From bce078d41291c5c073ddd389a3ef9fd0f8e201db Mon Sep 17 00:00:00 2001 From: bert hubert Date: Wed, 22 Nov 2017 08:17:38 +0100 Subject: [PATCH] improve cache miss behaviour for LUA records --- pdns/packethandler.cc | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/pdns/packethandler.cc b/pdns/packethandler.cc index d0ab73c2d..0998e430d 100644 --- a/pdns/packethandler.cc +++ b/pdns/packethandler.cc @@ -1285,21 +1285,22 @@ DNSPacket *PacketHandler::doQuestion(DNSPacket *p) while(B.get(rr)) { if(rr.dr.d_type == QType::LUA) { auto rec=getRR(rr.dr); - if(rec->d_type != QType::CNAME && rec->d_type != p->qtype.getCode()) - continue; - - auto recvec=luaSynth(rec->getCode(), target, sd.qname, sd.domain_id, p->getRemote(), p->getRealRemote(), rec->d_type); - if(!recvec.empty()) { - for(const auto& r : recvec) { - rr.dr.d_type = rec->d_type; // might be CNAME - rr.dr.d_content = r; - rr.scopeMask = 32; - rrset.push_back(rr); + if(rec->d_type == QType::CNAME || rec->d_type == p->qtype.getCode()) { + noCache=true; + auto recvec=luaSynth(rec->getCode(), target, sd.qname, sd.domain_id, p->getRemote(), p->getRealRemote(), rec->d_type); + if(!recvec.empty()) { + + for(const auto& r : recvec) { + rr.dr.d_type = rec->d_type; // might be CNAME + rr.dr.d_content = r; + rr.scopeMask = 32; + rrset.push_back(rr); + } + if(rec->d_type == QType::CNAME && p->qtype.getCode() != QType::CNAME) + weRedirected = 1; + else + weDone = 1; } - if(rec->d_type == QType::CNAME && p->qtype.getCode() != QType::CNAME) - weRedirected = 1; - else - weDone = 1; } } //cerr<<"got content: ["<qtype.getCode() == QType::ANY || loopRR.dr.d_type == p->qtype.getCode()) && loopRR.dr.d_type && loopRR.dr.d_type != QType::ALIAS && loopRR.auth) { r->addRecord(loopRR); haveRecords = true; -- 2.40.0