Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ping using specific interface (SO_BINDTODEVICE error) #3440

Closed
Skywalker-11 opened this issue Aug 5, 2018 · 1 comment
Closed

Ping using specific interface (SO_BINDTODEVICE error) #3440

Skywalker-11 opened this issue Aug 5, 2018 · 1 comment

Comments

@Skywalker-11
Copy link

  • Your Windows build number: (Type ver at a Windows Command Prompt)
    Microsoft Windows [Version 10.0.17134.165]

  • What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots)

  1. install WSL feature
  2. install Debian GNU/Linux from MS store
  3. open the app (opens bash command line)
  4. sudo su (optional, result same with and without)
  5. ping -I eth3 google.com or ping -I eth3 -4 google.com or ping -I eth3 -6 google.com
  • What's wrong / what should be happening instead:
    It should execute a ping using a specific network device (here eth3 - hosts lan connection)
    What actually happens for ipv4 destination (-4 argument or ipv4-only host)
ping -I eth3 -4 google.com
ping: SO_BINDTODEVICE: Invalid argument

For ipv6 enabled destination

ping -6 -I eth3 google.com
setsockopt(SO_BINDTODEVICE): Protocol not available

Ping without -I argument for using a specific interface is working correctly

@therealkenc
Copy link
Collaborator

therealkenc commented Aug 6, 2018

Fair enough given #69 (MESSAGE) but really this is spiritually dupe #1349. nmap does the same thing here.

[ed] FWIW I worked around it here by doing (...wait for it...) nothing. Which at least mitigates this bug (or lack of feature) from a "ping -I results in Protocol not available error" hard fail, to a somewhat softer "ping -I goes out the wrong interface if you pick the wrong one".

socket(AF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
capget({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, NULL) = -1 EFAULT (Bad address)
capget({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, {effective=0, permitted=1<<CAP_NET_ADMIN|1<<CAP_NET_RAW, inheritable=0}) = 0
capset({version=_LINUX_CAPABILITY_VERSION_3, pid=0}, {effective=1<<CAP_NET_RAW, permitted=1<<CAP_NET_ADMIN|1<<CAP_NET_RAW, inheritable=0}) = 0
setsockopt(4, SOL_SOCKET, SO_BINDTODEVICE, "eth3\0", 5) = -1 ENOPROTOOPT (Protocol not available)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants