From: bert hubert Date: Mon, 15 Aug 2016 10:33:57 +0000 (+0200) Subject: speed up IPv6 additional processing (on by default) with an ANY query. Also saves... X-Git-Tag: rec-4.0.2~27^2~5 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0ece3f099b7140922f1e6b77b0aa128f30eb42f7;p=thirdparty%2Fpdns.git speed up IPv6 additional processing (on by default) with an ANY query. Also saves a bunch of mallocs. Especially important when running as a root-server. Thanks to Anand Buddhdev for helping us make aware of this issue. --- diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index b8c4a02376..e0f61d4651 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -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) { - vectorparts; - stringtok(parts, content); - if (parts.size() >= 3) { - B.lookup(qtypes[n], DNSName(parts[2]), p); - } - else - continue; + if (i->qtype.getCode()==QType::SRV) { + vectorparts; + 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<qname<<" ("<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<qname<<" ("<addRecord(rr); } } }