]> git.ipfire.org Git - thirdparty/ntp.git/commitdiff
add --disable-listen-read-drop configure option for machines with more
authorDave Hart <hart@ntp.org>
Sat, 9 May 2009 09:00:06 +0000 (09:00 +0000)
committerDave Hart <hart@ntp.org>
Sat, 9 May 2009 09:00:06 +0000 (09:00 +0000)
interfaces than FD_SETSIZE [Bug 1180]

bk: 4a054616CNDM39n4AbynYe0oDqZyZA

ChangeLog
configure.ac
ntpd/ntp_io.c
ports/winnt/ntpd/ntpd.vcproj

index 1122aa40639eccb103137baebb9d4ef079204c3d..5f8e3948c8084af9e730f2e212679a2694ba1608 100644 (file)
--- 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 <stenn@ntp.org>
 * Include (4.2.4p7-RC6)
index b76317c870bbf066bbe4f339eb278a6e717d39b1..1ef4974490996aedcb26129e9c8e2bc9a419c1d6 100644 (file)
@@ -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)
index 77bd8c7fea08c2232df01ce290b82404fb051d71..133af61544f9cff2c6d54c3a371b0045d4125927 100644 (file)
@@ -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"));
 
index a737569e26b7cbe657c0187556f34fe1c6476f98..671c00c1975c55745403b2fd221c55d890d35567 100644 (file)
                        Name="Source Files"
                        Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
                        >
+                       <File
+                               RelativePath="..\..\..\ntpd\cmd_args.c"
+                               >
+                       </File>
                        <File
                                RelativePath="nt_clockstuff.c"
                                >
                                RelativePath="..\include\clockstuff.h"
                                >
                        </File>
-                       <File
-                               RelativePath="..\..\..\ntpd\cmd_args.c"
-                               >
-                               <FileConfiguration
-                                       Name="Release|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                               AdditionalIncludeDirectories=""
-                                               PreprocessorDefinitions=""
-                                       />
-                               </FileConfiguration>
-                               <FileConfiguration
-                                       Name="Debug|Win32"
-                                       >
-                                       <Tool
-                                               Name="VCCLCompilerTool"
-                                               AdditionalIncludeDirectories=""
-                                               PreprocessorDefinitions=""
-                                       />
-                               </FileConfiguration>
-                       </File>
                        <File
                                RelativePath="..\include\config.h"
                                >