From 33a496338010a14265382973e11a1c44b7988934 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 25 Jun 2015 15:56:16 +0000 Subject: [PATCH] - Added options::dns_timeout configuration option which allows to specify the amount of time the 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 | 14 +++++++++++--- doc/reference.conf | 6 ++++++ src/config-lexer.l | 1 + src/config-parser.y | 7 +++++++ src/config.c | 1 + src/config.h | 1 + src/firedns.c | 2 +- src/firedns.h | 2 -- 8 files changed, 28 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 83e68b3..387e6c3 100644 --- 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) diff --git a/doc/reference.conf b/doc/reference.conf index f3d79c1..f9dc6dd 100644 --- a/doc/reference.conf +++ b/doc/reference.conf @@ -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 diff --git a/src/config-lexer.l b/src/config-lexer.l index c98748d..82c173a 100644 --- a/src/config-lexer.l +++ b/src/config-lexer.l @@ -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; } diff --git a/src/config-parser.y b/src/config-parser.y index 181b2cd..18962d3 100644 --- a/src/config-parser.y +++ b/src/config-parser.y @@ -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); diff --git a/src/config.c b/src/config.c index d893f50..ab21c4c 100644 --- a/src/config.c +++ b/src/config.c @@ -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; } diff --git a/src/config.h b/src/config.h index 223b7b1..a06c0b0 100644 --- a/src/config.h +++ b/src/config.h @@ -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; }; diff --git a/src/firedns.c b/src/firedns.c index aa10126..729a2e1 100644 --- a/src/firedns.c +++ b/src/firedns.c @@ -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); diff --git a/src/firedns.h b/src/firedns.h index 5b4cc23..549f6e0 100644 --- a/src/firedns.h +++ b/src/firedns.h @@ -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 */ -- 2.30.2