]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
make '50' limit for max queries per queries configurable
authorbert hubert <bert.hubert@netherlabs.nl>
Tue, 16 Dec 2014 12:09:20 +0000 (13:09 +0100)
committerbert hubert <bert.hubert@netherlabs.nl>
Tue, 16 Dec 2014 12:09:20 +0000 (13:09 +0100)
pdns/pdns_recursor.cc
pdns/syncres.cc
pdns/syncres.hh

index 7a26faf7906bf4dcd9a1721ceaff08da13ba1703..6b10100c20bb9bb373d5f543f21b339f1e399ff0 100644 (file)
@@ -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.";
index d605573731594bf10bd354a4f6e282ae87ff5f2a..ae70f4edc7903b66f3634515691df293cef0ef93 100644 (file)
@@ -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);
index 74a26cf120a1c6b996a9ff869bc8f445f57a366e..d456821c8477bf3beee8d80eb136d4b27b0850ae 100644 (file)
@@ -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;