[ntp:hackers] Correctly detecting interfaces
Philip Prindeville
philipp_subx at redfish-solutions.com
Fri Jul 12 03:00:04 UTC 2013
I was looking at lib/isc/unix/ifiter_ioctl.c (et al) works:
if ((ifa->ifa_flags & IFF_UP) != 0)
iter->current.flags |= INTERFACE_F_UP;
and thinking that the semantics aren't exactly right. This checks for the interface being configured, but not necessarily "up" (i.e. having carrier). I'm thinking a more precise semantic might be:
if ((ifa->ifa_flags & (IFF_UP | IFF_RUNNING)) != (IFF_UP | IFF_RUNNING))
iter->current.flags |= INTERFACE_F_UP;
which requires the interface to be both configured and be active at the physical layer.
Anyone have an argument against this proposal?
-Philip
More information about the hackers
mailing list