From: bert hubert Date: Tue, 16 Dec 2014 12:09:20 +0000 (+0100) Subject: make '50' limit for max queries per queries configurable X-Git-Tag: rec-3.7.0-rc1~109^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=173d790ead08f67733010ca4c6fc404a040fe699;p=thirdparty%2Fpdns.git make '50' limit for max queries per queries configurable --- diff --git a/pdns/pdns_recursor.cc b/pdns/pdns_recursor.cc index 7a26faf790..6b10100c20 100644 --- a/pdns/pdns_recursor.cc +++ b/pdns/pdns_recursor.cc @@ -1870,6 +1870,7 @@ int serviceMain(int argc, char*argv[]) SyncRes::s_serverdownmaxfails=::arg().asNum("server-down-max-fails"); SyncRes::s_serverdownthrottletime=::arg().asNum("server-down-throttle-time"); SyncRes::s_serverID=::arg()["server-id"]; + SyncRes::s_maxqperq=::arg().asNum("max-qperq"); if(SyncRes::s_serverID.empty()) { char tmp[128]; gethostname(tmp, sizeof(tmp)-1); @@ -2187,6 +2188,7 @@ int main(int argc, char **argv) ::arg().setSwitch( "any-to-tcp","Answer ANY queries with tc=1, shunting to TCP" )="no"; ::arg().set("udp-truncation-threshold", "Maximum UDP response size before we truncate")="1680"; ::arg().set("minimum-ttl-override", "Set under adverse conditions, a minimum TTL")="0"; + ::arg().set("max-qperq", "Maximum outgoing queries per query")="50"; ::arg().set("include-dir","Include *.conf files from this directory")=""; ::arg().set("security-poll-suffix","Domain name from which to query security update notifications")="secpoll.powerdns.com."; diff --git a/pdns/syncres.cc b/pdns/syncres.cc index d605573731..ae70f4edc7 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -62,7 +62,7 @@ uint64_t SyncRes::s_unreachables; unsigned int SyncRes::s_minimumTTL; bool SyncRes::s_doIPv6; bool SyncRes::s_nopacketcache; - +unsigned int SyncRes::s_maxqperq; string SyncRes::s_serverID; SyncRes::LogMode SyncRes::s_lm; @@ -923,7 +923,7 @@ int SyncRes::doResolveAt(set nameservers, string auth, } else { s_outqueries++; d_outqueries++; - if(d_outqueries > 50) throw ImmediateServFailException("more than 50 queries sent while resolving "+qname); + if(d_outqueries > s_maxqperq) throw ImmediateServFailException("more than "+lexical_cast(s_maxqperq)+" (max-qperq) queries sent while resolving "+qname); TryTCP: if(doTCP) { LOG(prefix<toStringWithPort() <