[ntp:hackers] Correctly detecting interfaces

Danny Mayer mayer at ntp.org
Fri Jul 12 04:02:08 UTC 2013

On 7/11/2013 11:00 PM, Philip Prindeville wrote:
> 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?

I need to object here. Not that you are not apparently right but because
I seem to recall that there are issues with the UP flag and I don't even
recall seeing the RUNNING flag. This can be very tricky with different
Operating Systems/Compilers so you need to look carefully whether or not
all of them can support this change. These routines come from BIND9 and
you should look at the versions of them in the latest release of BIND9
first. These routines are very well maintained by ISC so looking there
first will be beneficial. Since I was the one who migrated these
routines into NTP I don't think we have had any issues with them. Is
there a problem that will be solved by this change?

It's not that you are wrong, but why you think that they should be changed?


> -Philip
> _______________________________________________
> hackers mailing list
> hackers at lists.ntp.org
> http://lists.ntp.org/listinfo/hackers

More information about the hackers mailing list