From: Frank Kardel Date: Sun, 18 Jun 2006 22:18:50 +0000 (+0000) Subject: ntp_io.c: X-Git-Tag: NTP_4_2_3P5~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4069214b565d5f45b6824181ba12a81c30f96ad;p=thirdparty%2Fntp.git ntp_io.c: import fix for bug 637 bk: 4495d14apfmYIZt-f776t_UtVwYPOw --- diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c index a41310623..78428d018 100644 --- a/ntpd/ntp_io.c +++ b/ntpd/ntp_io.c @@ -912,6 +912,27 @@ interface_update(interface_receiver_t receiver, void *data) UNBLOCKIO(); } +/* + * find out if a given interface structure contains + * a wildcard address + */ +static int +is_wildcard_ifaddr(struct interface *itf) +{ + if (itf->family == AF_INET && + ((struct sockaddr_in*)&itf->sin)->sin_addr.s_addr == htonl(INADDR_ANY)) + return 1; + +#ifdef INCLUDE_IPV6_SUPPORT + if (itf->family == AF_INET6 && + memcmp(&((struct sockaddr_in6*)&itf->sin)->sin6_addr, &in6addr_any, + sizeof(in6addr_any) == 0)) + return 1; +#endif + + return 0; +} + /* * update_interface strategy * @@ -1027,22 +1048,14 @@ update_interfaces( continue; } -#if 0 /* XXX: [BUG 637] FIXME */ /* * skip any interfaces UP and bound to a wildcard * address - some dhcp clients produce that in the * wild */ - if (family == AF_INET && - ((struct sockaddr_in*)&inter_list[idx].sin)->sin_addr.s_addr == htonl(INADDR_ANY)) + if (is_wildcard_ifaddr(&interface)) continue; - if (family == AF_INET6 && - memcmp(&((struct sockaddr_in6*)&inter_list[idx].sin)->sin6_addr, &in6addr_any, - sizeof(in6addr_any) == 0)) - continue; -#endif - /* * map to local *address* in order * to map all duplicate interfaces to an interface structure