Bug 301577 - Broken link state awareness on FreeBSD
Summary: Broken link state awareness on FreeBSD
Status: RESOLVED UNMAINTAINED
Alias: None
Product: knemo
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: FreeBSD Ports FreeBSD
: NOR major
Target Milestone: ---
Assignee: John Stamp
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-06-10 13:56 UTC by Alberto Villa
Modified: 2018-10-29 22:10 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Fix to the bug. (835 bytes, patch)
2012-06-10 13:58 UTC, Alberto Villa
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alberto Villa 2012-06-10 13:56:19 UTC
Connection state of interfaces is detected in two ways on FreeBSD.

AF_LINK interfaces:
stats->ifi_link_state == LINK_STATE_UP

AF_INET ones:
ifa->ifa_flags & IFF_RUNNING && addrVal.scope != RT_SCOPE_LINK && addrVal.scope != RT_SCOPE_NOWHERE

While the first one is correct (even if I don't think we should check for the link-layer connection, as we need the network one - anyway, it's being overwritten, so it's fine), the AF_INET interface uses IFF_RUNNING which on FreeBSD is a driver reserved value (and is mostly set when the driver is loaded).

The consequence of this is that the interface, if it has an IP set, is detected as connected. Instead, ioctl() should be used to get a reliable state.

Reproducible: Always
Comment 1 Alberto Villa 2012-06-10 13:58:29 UTC
Created attachment 71701 [details]
Fix to the bug.

I'm attaching a patch which fixes the issue checking for the IFM_ACTIVE flag (just like ifconfig and dhclient do).
Comment 2 John Stamp 2012-06-12 02:18:12 UTC
SVN commit 1299926 by jstamp:

Fix link state awareness on FreeBSD

Thanks to Alberto Villa for the report and patch.


 M  +6 -1      bsdbackend.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1299926
Comment 3 Andrew Crouthamel 2018-10-29 22:10:13 UTC
Hello! Sorry to be the bearer of bad news, but this project has been unmaintained for many years so I will be closing this bug.