]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
ntp_io.c:
authorFrank Kardel <kardel@ntp.org>
Sun, 18 Jun 2006 22:18:50 +0000 (22:18 +0000)
committerFrank Kardel <kardel@ntp.org>
Sun, 18 Jun 2006 22:18:50 +0000 (22:18 +0000)
  import fix for bug 637

bk: 4495d14apfmYIZt-f776t_UtVwYPOw

ntpd/ntp_io.c

index a41310623096fbeb113dd4b36bfb6d17aa63b5d9..78428d01807c3905e92dd282176e4b901b0bfe9d 100644 (file)
@@ -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