From: michael Date: Thu, 25 Jun 2015 15:55:11 +0000 (+0000) Subject: - Added options::dns_timeout configuration option which allows to specify the amount... X-Git-Tag: 1.0.8~6 X-Git-Url: http://git.serene-ircd.net/?a=commitdiff_plain;h=42254dcf6780b1b4e73bda5fc6401a37098e7f41;p=hopm.git - 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/branches/1.0.x@6199 82007160-df01-0410-b94d-b575c5fd34c7 --- diff --git a/NEWS b/NEWS index ea86aff..387e6c3 100644 --- a/NEWS +++ b/NEWS @@ -1,10 +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) 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 */