From: Dave Hart Date: Sat, 9 May 2009 09:00:06 +0000 (+0000) Subject: add --disable-listen-read-drop configure option for machines with more X-Git-Tag: NTP_4_2_5P175~7^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1586e528a28a9b1303cccf200ea66f33fa582b66;p=thirdparty%2Fntp.git add --disable-listen-read-drop configure option for machines with more interfaces than FD_SETSIZE [Bug 1180] bk: 4a054616CNDM39n4AbynYe0oDqZyZA --- diff --git a/ChangeLog b/ChangeLog index 1122aa406..5f8e3948c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* [Bug 1180] ntpd won't start with more than ~1000 interfaces * Stale leapsecond file fixes from Dave Mills. (4.2.5p173) 2009/05/08 Released by Harlan Stenn * Include (4.2.4p7-RC6) diff --git a/configure.ac b/configure.ac index b76317c87..1ef497449 100644 --- a/configure.ac +++ b/configure.ac @@ -3102,6 +3102,24 @@ case "$ntp_libparse" in esac AC_MSG_RESULT([$ans]) + +AC_ARG_ENABLE( + [listen-read-drop], + AS_HELP_STRING( + [--enable-listen-read-drop], + [+ read and drop from unused interfaces] + ), + [ans=$enableval], + [ans=yes] +) + +case "$ans" in + no) + AC_DEFINE([NO_LISTEN_READ_DROP], 1, + [[do not listen on unused interfaces]]) +esac + + # AC_SUBST(RSAOBJS) # AC_SUBST(RSASRCS) # AC_SUBST(RSADIR) diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c index 77bd8c7fe..133af6154 100644 --- a/ntpd/ntp_io.c +++ b/ntpd/ntp_io.c @@ -1075,9 +1075,10 @@ address_okay(isc_interface_t *isc_if) { return (ISC_TRUE); } /* - * Check if the address is limit + * Check if the IP address matches one given to -I, which if given + * limits interfaces/addresses to be used to those listed with -I. */ - if (ISC_LIST_HEAD(limit_address_list)!= NULL) { + { const limit_address_t *laddr; for (laddr = ISC_LIST_HEAD(limit_address_list); laddr != NULL; laddr = ISC_LIST_NEXT(laddr, link)) if (isc_netaddr_equal(&(isc_if->address), laddr->addr)) { @@ -1086,9 +1087,9 @@ address_okay(isc_interface_t *isc_if) { } } /* - * Check if the interface is specific + * Check if the interface name was specified with an -I option. */ - 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) { @@ -1096,11 +1097,19 @@ address_okay(isc_interface_t *isc_if) { return (ISC_TRUE); } } + /* + * Check if we are excluding virtual IPs/aliases, and if so, is + * this interface such? + */ 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 any -I options were given, only listed interfaces and + * addresses are used. + */ if (interface_optioncount > 0) { DPRINTF(4, ("address_okay: FAIL\n")); return (ISC_FALSE); @@ -1404,11 +1413,22 @@ update_interfaces( /* * Check to see if we are going to use the interface + * If we don't use it we mark it to drop any packet + * received but we still must create the socket and + * bind to it. This prevents other apps binding to it + * and potentially causing problems with more than one + * process fiddling with the clock */ - if (!address_okay(&isc_if)) + if (address_okay(&isc_if) == ISC_TRUE) { + interface.ignore_packets = ISC_FALSE; + } + else { +#ifndef NO_LISTEN_READ_DROP + interface.ignore_packets = ISC_TRUE; +#else continue; - - interface.ignore_packets = ISC_FALSE; +#endif + } DPRINT_INTERFACE(4, (&interface, "examining ", "\n")); diff --git a/ports/winnt/ntpd/ntpd.vcproj b/ports/winnt/ntpd/ntpd.vcproj index a737569e2..671c00c19 100644 --- a/ports/winnt/ntpd/ntpd.vcproj +++ b/ports/winnt/ntpd/ntpd.vcproj @@ -232,6 +232,10 @@ Name="Source Files" Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" > + + @@ -731,28 +735,6 @@ RelativePath="..\include\clockstuff.h" > - - - - - - - -