pythonping icon indicating copy to clipboard operation
pythonping copied to clipboard

feat: specify device to bind ICMP socket to

Open akomelj opened this issue 6 months ago • 0 comments

This pull request adds new parameter device to method ping. The parameter allows to explicitly specify the name of the device to bind outgoing ICMP socket to.

Setting a socket source address (parameter source) does not always select the correct network interface as the interface is selected based on (destination) routing rules which may not favour the intended interface for a given destination IP. It is technically possible to define a source based routing policy to select the interface based on the socket source address but this requires much more effort than simply specifying the device name and setting socket option SOL_SOCKET, SO_BINDTODEVICE.

Additionally, the pull request adds a missing pydoc parameter description and updates the pydoc parameter name to match the actual code parameter name.

akomelj avatar Jul 12 '25 11:07 akomelj