-
Notifications
You must be signed in to change notification settings - Fork 854
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
ioctl SIOCGIFCONF Returns Details of disconnected adapters (and shouldn't) #3904
Comments
Ref #3368 (message) which is related. As many details about your actual Windows 10 setup (hardware and 3rd party software) will help a lot here, because (like the #3368 post) the devs in Redmond won't be able to repro your case exactly. Also The VM and bare metal Linux analogies are problematic because with WSL, if Windows thinks those interfaces exist -- then they exist. But granted entirely: one can quibble over whether a given interface is I suspect WSL could be improved at least a little to fudge the fact we don't have |
I can post ipconfig /all on Monday when I'm back in the office, but I think you may be misunderstanding the issue I'm raising here, so just to clarify a couple of points now:
Note: Thinking about it I suspect the adapter may have to be configured for DHCP for this to happen. Will be interesting to see what the behaviour is in the case of a disconnected adapter that was previously configured with a static IPv4 address. Will try and test this Monday. Hope that helps. |
No you were quite clear in your description. Verbose. But clear.
Yes. That is why I said quoth: "It doesn't make sense to have a not-UP interface with an assigned IP address."
A wired ethernet interface can (and classically does) have an IP address even with the cable pulled. The Real Linux™ kernel does not care whether the wire is connected (on your adapter, or on some adapter halfway to Japan). The interface is brought down by
DHCP is tangentially related, but only affects how an IP address is assigned. You can have a static IP and the ping will still time out, unless some daemon goes out of its way to take the interface down. Or you take it down manually. |
The first part I understand and agree with, the last sentence is not my experience. On "real linux" if an IP is assigned, the address is valid, will route traffic for that address to the local machine, and will respond to pings. (Firewall permitting.) This is true regardless of the physical connection state of the adapter. Same for a disconnected Wifi adapter if you manually force an address. If wifi is disabled though (rfkill) it is not possible to assign an address.
Agreed, DHCP seemed related in the fact is is generally what falls back to the APIPA range 169.254.x.x addresses seen in this case. Finally, as requested ipconfig /all vs ifconfig -a on the same machine, with a 'disconnected' bluetooth adapter and 2 inactive wifi-direct adapters showing (along with one active wifi adapter):
|
Your Windows build number:
What you're doing and what's happening:
Using software that gets a list of local IPs using SIOCGIFCONF ioctl
On WSL, this includes disconnected adapters, like bluetooth adapter and (3!) wifi adapters, showing 169.x.x.x address for each. Running ifconfig -a also lists these as configured addresses:
What's wrong / what should be happening instead:
This information is false. The addresses are not bound locally and not in the routing table. Any attempt to connect to these will result in trying to use the default route and an eventual timeout. This affects the behavior of software that relies on this method.
ipconfig in Windows correctly lists them as disconnected:
On a real Linux system ifconfig -a will show disconnected interfaces with no IP address, and SIOCGIFCONF will not list them:
Strace of the failing command, if applicable:
WSL:
(All interfaces showing with 169.x.x.x addresses are not actually connected, as shown above in windows ipconfig output).
Linux VM, disconnected adapter:
Only lo shown, as enp0s3 has no IP.
The text was updated successfully, but these errors were encountered: