Permalink
Browse files

make '50' limit for max queries per queries configurable

  • Loading branch information...
1 parent 4eb26e0 commit 173d790ead08f67733010ca4c6fc404a040fe699 @ahupowerdns ahupowerdns committed Dec 16, 2014
Showing with 5 additions and 2 deletions.
  1. +2 −0 pdns/pdns_recursor.cc
  2. +2 −2 pdns/syncres.cc
  3. +1 −0 pdns/syncres.hh
@@ -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.";
View
@@ -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<string, CIStringCompare> 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<string>(s_maxqperq)+" (max-qperq) queries sent while resolving "+qname);
TryTCP:
if(doTCP) {
LOG(prefix<<qname<<": using TCP with "<< remoteIP->toStringWithPort() <<endl);
View
@@ -291,6 +291,7 @@ public:
static uint64_t s_unreachables;
static unsigned int s_minimumTTL;
static bool s_doIPv6;
+ static unsigned int s_maxqperq;
unsigned int d_outqueries;
unsigned int d_tcpoutqueries;
unsigned int d_throttledqueries;

0 comments on commit 173d790

Please sign in to comment.