From: Danny Mayer Date: Wed, 12 Dec 2007 21:57:34 +0000 (-0500) Subject: [Bug #830] Fix the checking order of the interface options X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3c404f5a7c4f075507a1d375375c7ed56a50f87b;p=thirdparty%2Fntp.git [Bug #830] Fix the checking order of the interface options bk: 4760594erDT5p02gJWEfHE7TaHQ8qQ --- diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c index 3f83652a34..a206b54a22 100644 --- a/ntpd/ntp_io.c +++ b/ntpd/ntp_io.c @@ -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); }