]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
speed up IPv6 additional processing (on by default) with an ANY query. Also saves...
authorbert hubert <bert.hubert@netherlabs.nl>
Mon, 15 Aug 2016 10:33:57 +0000 (12:33 +0200)
committerbert hubert <bert.hubert@powerdns.com>
Tue, 16 Aug 2016 08:39:08 +0000 (10:39 +0200)
pdns/packethandler.cc

index b8c4a023762ee7bc449ecb1312d7fc84f46f4b24..e0f61d465195625009244d8125f221abc22ed289 100644 (file)
@@ -405,31 +405,28 @@ int PacketHandler::doAdditionalProcessingAndDropAA(DNSPacket *p, DNSPacket *r, c
         trim_left(content);
       }
 
-      QType qtypes[2];
-      qtypes[0]="A"; qtypes[1]="AAAA";
-      for(int n=0 ; n < d_doIPv6AdditionalProcessing + 1; ++n) {
-        if (i->qtype.getCode()==QType::SRV) {
-          vector<string>parts;
-          stringtok(parts, content);
-          if (parts.size() >= 3) {
-            B.lookup(qtypes[n], DNSName(parts[2]), p);
-          }
-          else
-            continue;
+      if (i->qtype.getCode()==QType::SRV) {
+        vector<string>parts;
+        stringtok(parts, content);
+        if (parts.size() >= 3) {
+          B.lookup(QType(d_doIPv6AdditionalProcessing ? QType::ANY : QType::A), DNSName(parts[2]), p);
         }
-        else {
-          B.lookup(qtypes[n], DNSName(content), p);
-        }
-        while(B.get(rr)) {
-          if(rr.domain_id!=i->domain_id && ::arg()["out-of-zone-additional-processing"]=="no") {
-            DLOG(L<<Logger::Warning<<"Not including out-of-zone additional processing of "<<i->qname<<" ("<<rr.qname<<")"<<endl);
-            continue; // not adding out-of-zone additional data
-          }
-          if(rr.auth && !rr.qname.isPartOf(soadata.qname)) // don't sign out of zone data using the main key 
-            rr.auth=false;
-          rr.d_place=DNSResourceRecord::ADDITIONAL;
-          r->addRecord(rr);
+      }
+      else {
+        B.lookup(QType(d_doIPv6AdditionalProcessing ? QType::ANY : QType::A), DNSName(content), p);
+      }
+      while(B.get(rr)) {
+        if(rr.qtype.getCode() != QType::A && rr.qtype.getCode()!=QType::AAAA)
+          continue;
+        if(rr.domain_id!=i->domain_id && ::arg()["out-of-zone-additional-processing"]=="no") {
+          DLOG(L<<Logger::Warning<<"Not including out-of-zone additional processing of "<<i->qname<<" ("<<rr.qname<<")"<<endl);
+          continue; // not adding out-of-zone additional data
         }
+        
+        if(rr.auth && !rr.qname.isPartOf(soadata.qname)) // don't sign out of zone data using the main key 
+          rr.auth=false;
+        rr.d_place=DNSResourceRecord::ADDITIONAL;
+        r->addRecord(rr);
       }
     }
   }