]> granicus.if.org Git - pdns/commitdiff
On testing with large numbers of unknown domains the send-root-referral
authorMark Zealey <mark@markandruth.co.uk>
Fri, 13 Dec 2013 20:39:47 +0000 (22:39 +0200)
committerMark Zealey <mark@markandruth.co.uk>
Fri, 13 Dec 2013 20:39:47 +0000 (22:39 +0200)
argument query amounted to quite a high proportion of CPU time. This will cache
it to reduce this overhead as is already done with a number of variables.

pdns/packethandler.cc
pdns/packethandler.hh

index e43802403d1a7977b3b8eccc8076fb871c72759a..22d6ff911048a62993657a34e856e5d72f1560cf 100644 (file)
 AtomicCounter PacketHandler::s_count;
 extern string s_programname;
 
+enum root_referral {
+    NO_ROOT_REFERRAL,
+    LEAN_ROOT_REFERRAL,
+    FULL_ROOT_REFERRAL
+};
+
 PacketHandler::PacketHandler():B(s_programname)
 {
   ++s_count;
@@ -59,6 +65,9 @@ PacketHandler::PacketHandler():B(s_programname)
   d_doRecursion= ::arg().mustDo("recursor");
   d_logDNSDetails= ::arg().mustDo("log-dns-details");
   d_doIPv6AdditionalProcessing = ::arg().mustDo("do-ipv6-additional-processing");
+  d_sendRootReferral = ::arg().mustDo("send-root-referral")
+                            ? ( pdns_iequals(::arg()["send-root-referral"], "lean") ? LEAN_ROOT_REFERRAL : FULL_ROOT_REFERRAL )
+                            : NO_ROOT_REFERRAL;
   string fname= ::arg()["lua-prequery-script"];
   if(fname.empty())
   {
@@ -102,7 +111,7 @@ void PacketHandler::addRootReferral(DNSPacket* r)
     r->addRecord(rr);
   }
 
-  if(pdns_iequals(::arg()["send-root-referral"], "lean"))
+  if( d_sendRootReferral == LEAN_ROOT_REFERRAL )
      return;
 
   // add the additional stuff
@@ -1242,7 +1251,7 @@ DNSPacket *PacketHandler::questionOrRecurse(DNSPacket *p, bool *shouldRecurse)
       
       if(!retargetcount)
         r->setA(false); // drop AA if we never had a SOA in the first place
-      if(::arg().mustDo("send-root-referral")) {
+      if( d_sendRootReferral != NO_ROOT_REFERRAL ) {
         DLOG(L<<Logger::Warning<<"Adding root-referral"<<endl);
         addRootReferral(r);
       }
index f6e50e2d436ec312ea7bd03d1ae377715be8c365..1a16b7132a111d445116eeade293890f910bc59f 100644 (file)
@@ -109,6 +109,7 @@ private:
   bool d_doRecursion;
   bool d_logDNSDetails;
   bool d_doIPv6AdditionalProcessing;
+  int d_sendRootReferral;
   AuthLua* d_pdl;
 
   UeberBackend B; // every thread an own instance