- Added options::dns_timeout configuration option which allows to specify the amount...
authormichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Thu, 25 Jun 2015 15:56:16 +0000 (15:56 +0000)
committermichael <michael@82007160-df01-0410-b94d-b575c5fd34c7>
Thu, 25 Jun 2015 15:56:16 +0000 (15:56 +0000)
  resolver waits until a response is received from a name server

git-svn-id: svn://svn.ircd-hybrid.org/svnroot/hopm/trunk@6200 82007160-df01-0410-b94d-b575c5fd34c7

NEWS
doc/reference.conf
src/config-lexer.l
src/config-parser.y
src/config.c
src/config.h
src/firedns.c
src/firedns.h

diff --git a/NEWS b/NEWS
index 83e68b3390c93c2d8d30071b07f01c109fd316f0..387e6c3c17201e10bf45cf75beb975c6ffbae3cf 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,13 @@
 -- Noteworthy changes in version 1.0.8 (2015-??-??)
-o) Added options::reconnectinterval configuration option
+o) Added options::reconnectinterval configuration option. See doc/reference.conf
+   for more information.
+o) Further modernizations and cleanups to the build system
+o) HOPM now compiles with -fstack-protector-strong and -fstack-protector,
+   respectively, depending on what the compiler supports
+o) Added new --enable-assert switch to ./configure. assert() statements are now
+   disabled by default and can be enabled with ./configure --enable-assert
+o) Added options::dns_timeout configuration option. See doc/reference.conf
+   for more information.
 
 
 -- Noteworthy changes in version 1.0.7 (2015-06-06)
@@ -28,7 +36,7 @@ o) Code cleanups and performance improvements
 
 -- Noteworthy changes in version 1.0.3 (2015-01-28)
 o) Fixed bug where HOPM wouldn't try re-connecting to the server in
-   case the connection got lost.
+   case the connection got lost
 o) Added irc::notice configuration option
 
 
@@ -53,7 +61,7 @@ o) Added irc::readtimeout configuration option
 o) Many code cleanups and optimizations
 o) Worked towards IPv6 support
 o) Fixed reference.conf from causing syntax errors
-o) hopm now uses poll() for I/O event notification instead of select()
+o) HOPM now uses poll() for I/O event notification instead of select()
 
 
 -- Noteworthy changes in version 1.0.0beta1 (2014-12-25)
index f3d79c1075fa83c052c4d7db2d696c902d6b48ae..f9dc6ddf485c4b07cad16741f3e0e7936cacc10a 100644 (file)
@@ -56,6 +56,12 @@ options {
         */
        dns_fdlimit = 64;
 
+       /*
+        * Amount of time the resolver waits until a response is received
+        * from a name server.
+        */
+       dns_timeout = 5 seconds;
+
        /*
         * Put the full path and filename of a logfile here if you wish to log
         * every scan done. Normally HOPM only logs successfully detected
index c98748d95e819d4ae84e81d01f1519356f029033..82c173a285de8f55c4db00434a6c15c1891a48b6 100644 (file)
@@ -93,6 +93,7 @@ BLACKLIST               { return BLACKLIST;    }
 CHANNEL                 { return CHANNEL;      }
 CONNREGEX               { return CONNREGEX;    }
 DNS_FDLIMIT             { return DNS_FDLIMIT;  }
+DNS_TIMEOUT             { return DNS_TIMEOUT;  }
 DNSBL_FROM              { return DNSBL_FROM;   }
 DNSBL_TO                { return DNSBL_TO;     }
 EXEMPT                  { return EXEMPT;       }
index 181b2cd13bb46902bfdd4f68452bbebf916f67ea..18962d3d0b551b45a70bd17bd0d2ecb3a914562f 100644 (file)
@@ -38,6 +38,7 @@ static void *tmp;  /* Variable to temporarily hold nodes before insertion to lis
 %token CHANNEL
 %token CONNREGEX
 %token DNS_FDLIMIT
+%token DNS_TIMEOUT
 %token DNSBL_FROM
 %token DNSBL_TO
 %token EXEMPT
@@ -137,6 +138,7 @@ options_item: options_negcache         |
               options_negcache_rebuild |
               options_pidfile          |
               options_dns_fdlimit      |
+              options_dns_timeout      |
               options_scanlog          |
               error;
 
@@ -161,6 +163,11 @@ options_dns_fdlimit: DNS_FDLIMIT '=' NUMBER ';'
   OptionsItem->dns_fdlimit = $3;
 };
 
+options_dns_timeout: DNS_TIMEOUT '=' timespec ';'
+{
+  OptionsItem->dns_timeout = $3;
+};
+
 options_scanlog: SCANLOG '=' STRING ';'
 {
   xfree(OptionsItem->scanlog);
index d893f500f1e2740e6e5b15c9d9b9308fb497aff5..ab21c4c93230f551b11aa8d1fb3d27cfb3973ba8 100644 (file)
@@ -95,6 +95,7 @@ config_setup(void)
   OptionsItem->negcache_rebuild = 43200;
   OptionsItem->pidfile = xstrdup("hopm.pid");
   OptionsItem->dns_fdlimit = 50;
+  OptionsItem->dns_timeout = 5;
   OptionsItem->scanlog = NULL;
 }
 
index 223b7b1b1e44faf472147336ff2362d0d3a98ad1..a06c0b06b7374ef4dcfe554c7ffff7872c0c49eb 100644 (file)
@@ -63,6 +63,7 @@ struct OptionsConf
   time_t negcache;
   time_t negcache_rebuild;
   unsigned int dns_fdlimit;
+  time_t dns_timeout;
   char *pidfile;
   char *scanlog;
 };
index aa10126dcfb38a3dc410e2f94d2671d0d3dca886..729a2e174a128623829b681c58121edee5546e05 100644 (file)
@@ -785,7 +785,7 @@ firedns_cycle(void)
     if (p->fd < 0)
       continue;
 
-    if (p->fd > 0 && (p->start + FDNS_TIMEOUT) < timenow)
+    if (p->fd > 0 && (p->start + OptionsItem->dns_timeout) < timenow)
     {
       /* Timed out - remove from list */
       list_remove(CONNECTIONS, node);
index 5b4cc23003e928178739b3b62e1397da9f3a4302..549f6e064a9c18a20841f60856d55144bc70e8d9 100644 (file)
@@ -29,8 +29,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 #define FDNS_CONFIG_PREF     HOPM_ETCDIR "/firedns.conf"
 /* fallback config file */
 #define FDNS_CONFIG_FBCK     "/etc/resolv.conf"
-/* Number of seconds to wait for a reply */
-#define FDNS_TIMEOUT         5
 /* DNS well known port */
 #define FDNS_PORT            53
 /* name to IPv4 address */