]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
[Bug #830] Fix the checking order of the interface options
authorDanny Mayer <mayer@ntp.org>
Wed, 12 Dec 2007 21:57:34 +0000 (16:57 -0500)
committerDanny Mayer <mayer@ntp.org>
Wed, 12 Dec 2007 21:57:34 +0000 (16:57 -0500)
bk: 4760594erDT5p02gJWEfHE7TaHQ8qQ

ntpd/ntp_io.c

index 3f83652a34faa30ad80b06c5fd2ebdef3b44da7b..a206b54a227d8c12a59c0289b330ba19438fa246 100644 (file)
@@ -1034,7 +1034,6 @@ create_wildcards(u_short port) {
 #endif
 }
 
-
 static isc_boolean_t
 address_okay(isc_interface_t *isc_if) {
 
@@ -1048,17 +1047,6 @@ address_okay(isc_interface_t *isc_if) {
                DPRINTF(4, ("address_okay: loopback - OK\n"));
                return (ISC_TRUE);
        }
-       /*
-        * Check if the interface is specific
-        */
-       if (ISC_LIST_HEAD(specific_interface_list)!= NULL) {
-               specific_interface_t *iface;
-               for (iface = ISC_LIST_HEAD(specific_interface_list); iface != NULL; iface = ISC_LIST_NEXT(iface, link))
-                       if (strcasecmp(isc_if->name, iface->name) == 0) {
-                               DPRINTF(4, ("address_okay: specific interface name matched - OK\n"));
-                               return (ISC_TRUE);
-                       }
-       }
        /*
         * Check if the address is limit
         */
@@ -1068,40 +1056,28 @@ address_okay(isc_interface_t *isc_if) {
                        if (isc_netaddr_equal(&(isc_if->address), laddr->addr)) {
                                DPRINTF(4, ("address_okay: specific interface address matched - OK\n"));
                                return (ISC_TRUE);
-                       } else {
-                               DPRINTF(4, ("address_okay: specific interface name NOT matched - FAIL\n"));
-                               return (ISC_FALSE);
                        }
        }
-       else {
-               if (listen_to_virtual_ips == 0  && 
-                       (strchr(isc_if->name, (int)':') != NULL)) {
-                       DPRINTF(4, ("address_okay: virtual ip/alias - FAIL\n"));
-                       return (ISC_FALSE);
-               }
+       if (listen_to_virtual_ips == 0  && 
+               (strchr(isc_if->name, (int)':') != NULL)) {
+               DPRINTF(4, ("address_okay: virtual ip/alias - FAIL\n"));
+               return (ISC_FALSE);
        }
-
        /*
-        * Check if the interface is specified
+        * Check if the interface is specific
         */
-       /*
-       if (specific_interface != NULL) {
-               if (strcasecmp(isc_if->name, specific_interface) == 0) {
-                       DPRINTF(4, ("address_okay: specific interface name matched - OK\n"));
-                       return (ISC_TRUE);
-               } else {
-                       DPRINTF(4, ("address_okay: specific interface name NOT matched - FAIL\n"));
-                       return (ISC_FALSE);
-               }
+       if (ISC_LIST_HEAD(specific_interface_list)!= NULL) {
+               specific_interface_t *iface;
+               for (iface = ISC_LIST_HEAD(specific_interface_list); iface != NULL; iface = ISC_LIST_NEXT(iface, link))
+                       if (strcasecmp(isc_if->name, iface->name) == 0) {
+                               DPRINTF(4, ("address_okay: specific interface name matched - OK\n"));
+                               return (ISC_TRUE);
+                       }
        }
-       else {
-               if (listen_to_virtual_ips == 0  && 
-                   (strchr(isc_if->name, (int)':') != NULL)) {
-                       DPRINTF(4, ("address_okay: virtual ip/alias - FAIL\n"));
-                       return (ISC_FALSE);
-               }
+       if (interface_optioncount > 0) {
+               DPRINTF(4, ("address_okay: FAIL\n"));
+               return (ISC_FALSE);
        }
-*/
        DPRINTF(4, ("address_okay: OK\n"));
        return (ISC_TRUE);
 }