-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
speed/isup
returned by net_if_stats are incorrect on OSX
#805
Comments
speed/isup
returned by net_if_stats are incorrect on OSX
We may have a better chance to figure out what's wrong with this when we get around #898. |
This issue also exists on Linux. |
"isup" reflects the value of the flag IFF_UP. In OSX the flag IFF_UP is set even if the airport is disabled (using OSX tools, such as 'networksetup'), but the flag IFF_RUNNING reflects the airport state. Also, there is no way to set an ethernet interface to down (IFF_UP not set) and IFF_RUNNING remains set even if the cable is disconnected. (It is however possible to manually set the IFF_UP flag through 'ifconfig') In linux the flags are set as one would expect, i.e. IFF_UP is set if the interface is enabled/configured and IFF_RUNNING if it is connected. Here is a description of the two (from Stack Overflow): From Linux Device Drivers 3: IFF_UP This flag is read-only for the driver. The kernel turns it on when the interface is active and ready to transfer packets. Digging a bit deeper, it seems that there is one significant difference: IFF_RUNNING is supposed to reflect the operational status on a network interface, rather than its administrative one. To provide an example, an Ethernet interface may be brought UP by the administrator (e.g. ifconfig eth0 up), but it will not be considered operational (i.e. RUNNING as per RFC2863) if the cable is not plugged in. I think there are two options, either to add 'is_running' to the interface dict, or to consider checking IFF_RUNNING instead of IFF_UP for 'isup'. Both the above solutions would solve the problem with WiFi status in OSX, but not the Ethernet status, since it appears to always be both "UP" and "RUNNING". However, the speed will be 0 on a disconnected Ethernet interface. |
For wireless interface, the link speed is always 0.
The link status isup is always True even the wireless is turn off or the ethernet cable is disconnected.
The text was updated successfully, but these errors were encountered: