diff --git a/include/config.h b/include/config.h index 58598cdf1..43f8f9462 100644 --- a/include/config.h +++ b/include/config.h @@ -384,14 +384,6 @@ */ #define WRITEWAITDELAY 15 /* Recommended value: 15 */ -/* - * Number of seconds to wait for a connect(2) call to complete. - * NOTE: this must be at *LEAST* 10. When a client connects, it has - * CONNECTTIMEOUT - 10 seconds for its host to respond to an ident lookup - * query and for a DNS answer to be retrieved. - */ -#define CONNECTTIMEOUT 30 /* Recommended value: 60 */ - /* * Max time from the nickname change that still causes KILL * automaticly to switch for the current nick of that user. (seconds) diff --git a/include/dynconf.h b/include/dynconf.h index 003a971a4..e33744c39 100644 --- a/include/dynconf.h +++ b/include/dynconf.h @@ -143,6 +143,7 @@ struct zConfiguration { int nicklen; int hide_list; int max_unknown_connections_per_ip; + long handshake_timeout; }; #ifndef DYNCONF_C diff --git a/src/ircd.c b/src/ircd.c index a3c5cd5ec..43fb97f14 100644 --- a/src/ircd.c +++ b/src/ircd.c @@ -542,7 +542,7 @@ EVENT(check_unknowns) list_for_each_entry_safe(cptr, cptr2, &unknown_list, lclient_node) { - if (cptr->local->firsttime && ((TStime() - cptr->local->firsttime) > CONNECTTIMEOUT)) + if (cptr->local->firsttime && ((TStime() - cptr->local->firsttime) > iConf.handshake_timeout)) { (void)exit_client(cptr, cptr, &me, "Registration Timeout"); continue; @@ -558,7 +558,7 @@ int check_ping(aClient *cptr) char scratch[64]; int ping = 0; - ping = cptr->local->class ? cptr->local->class->pingfreq : CONNECTTIMEOUT; + ping = cptr->local->class ? cptr->local->class->pingfreq : iConf.handshake_timeout; Debug((DEBUG_DEBUG, "c(%s)=%d p %d a %d", cptr->name, cptr->status, ping, TStime() - cptr->local->lasttime)); diff --git a/src/s_conf.c b/src/s_conf.c index b7aa7d8a3..8f5edc6a2 100644 --- a/src/s_conf.c +++ b/src/s_conf.c @@ -1502,6 +1502,7 @@ void config_setdefaultsettings(aConfiguration *i) DISABLE_IPV6 = 1; i->network.x_prefix_quit = strdup("Quit"); i->max_unknown_connections_per_ip = 3; + i->handshake_timeout = 30; /* SSL/TLS options */ i->ssl_options = MyMallocEx(sizeof(SSLOptions)); @@ -7865,6 +7866,10 @@ int _conf_set(ConfigFile *conf, ConfigEntry *ce) { tempiConf.max_unknown_connections_per_ip = atoi(cep->ce_vardata); } + else if (!strcmp(cep->ce_varname, "handshake-timeout")) + { + tempiConf.handshake_timeout = config_checkval(cep->ce_vardata, CFG_TIME); + } else { int value; @@ -8774,13 +8779,24 @@ int _test_set(ConfigFile *conf, ConfigEntry *ce) int v; CheckNull(cep); v = atoi(cep->ce_vardata); - if (v <= 1) + if (v < 1) { config_error("%s:%i: set::max-unknown-connections-per-ip: value should be at least 1.", cep->ce_fileptr->cf_filename, cep->ce_varlinenum); errors++; } } + else if (!strcmp(cep->ce_varname, "handshake-timeout")) { + int v; + CheckNull(cep); + v = config_checkval(cep->ce_vardata, CFG_TIME); + if (v < 5) + { + config_error("%s:%i: set::handshake-timeout: value should be at least 5 seconds.", + cep->ce_fileptr->cf_filename, cep->ce_varlinenum); + errors++; + } + } else { int used = 0;