From: Martin Burnicki Date: Fri, 8 May 2015 10:25:43 +0000 (+0200) Subject: [Bug 2792] If the IFF_RUNNING interface flag is supported then an interface is ignored X-Git-Tag: NTP_4_3_32~3^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=446fc8b2decb388bc166cb94e412fb5060350c8e;p=thirdparty%2Fntp.git [Bug 2792] If the IFF_RUNNING interface flag is supported then an interface is ignored as long as this flag is not set since the interface is not usable (e.g., no link). bk: 554c8f27omN7jQQR-gNskWbahvfroA --- diff --git a/ChangeLog b/ChangeLog index 88bf769a7..3bdc0b0df 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,8 @@ --- +* [Bug 2792] If the IFF_RUNNING interface flag is supported then an interface + is ignored as long as this flag is not set since the interface is not usable + (e.g., no link). * CID 739725: Fix a rare resource leak in libevent/listener.c. * CID 1295478: Quiet a pedantic potential error from the fix for Bug 2776. * CID 1296235: Fix refclock_jjy.c and correcting type of the driver40-ja.html diff --git a/lib/isc/unix/ifiter_getifaddrs.c b/lib/isc/unix/ifiter_getifaddrs.c index 425b9b4c3..b5b48618f 100644 --- a/lib/isc/unix/ifiter_getifaddrs.c +++ b/lib/isc/unix/ifiter_getifaddrs.c @@ -147,6 +147,13 @@ internal_current(isc_interfaceiter_t *iter) { ifa = iter->pos; #ifdef __linux + /* + * burnicki: iter->pos is usually never NULL here (anymore?), + * so linux_if_inet6_current(iter) is never called here. + * However, that routine would check (under Linux), if the + * interface is in a tentative state, e.g. if there's no link + * yet but an IPv6 address has already be assigned. + */ if (iter->pos == NULL) return (linux_if_inet6_current(iter)); #endif @@ -154,6 +161,16 @@ internal_current(isc_interfaceiter_t *iter) { INSIST(ifa != NULL); INSIST(ifa->ifa_name != NULL); + +#ifdef IFF_RUNNING + /* + * burnicki: if the interface is not running then + * it may be in a tentative state. See above. + */ + if ((ifa->ifa_flags & IFF_RUNNING) == 0) + return (ISC_R_IGNORE); +#endif + if (ifa->ifa_addr == NULL) return (ISC_R_IGNORE);