From 8a7f7bc4e0af6ca6b2f9cdf7e8668688d6d34e71 Mon Sep 17 00:00:00 2001 From: Remi Gacogne Date: Wed, 2 Jun 2021 16:29:40 +0200 Subject: [PATCH] rec: Cleaner way of handling a referral to a child zone for DS queries (cherry picked from commit 18dc3b3d9be3f8d7095b8f9eb2a8fb8d2b79bcba) --- pdns/syncres.cc | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 95643ac6fe..78efdd2b3a 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -3401,6 +3401,7 @@ bool SyncRes::processRecords(const std::string& prefix, const DNSName& qname, co bool done = false; DNSName dnameTarget, dnameOwner; uint32_t dnameTTL = 0; + bool referralOnDS = false; for (auto& rec : lwr.d_records) { if (rec.d_type != QType::OPT && rec.d_class != QClass::IN) { @@ -3595,21 +3596,20 @@ bool SyncRes::processRecords(const std::string& prefix, const DNSName& qname, co newauth = rec.d_name; LOG(prefix< '"<getZoneRepresentation()<<"'"<(rec)) { + nsset.insert(content->getNS()); + } } } else { LOG(prefix< '"<getZoneRepresentation()<<"', had '"<(rec)) { nsset.insert(content->getNS()); } @@ -3716,6 +3716,23 @@ bool SyncRes::processRecords(const std::string& prefix, const DNSName& qname, co cnamerec.d_content = std::make_shared(CNAMERecordContent(newtarget)); ret.push_back(std::move(cnamerec)); } + + /* If we have seen a proper denial, let's forget that we also had a referral for a DS query. + Otherwise we need to deal with it. */ + if (referralOnDS && !negindic) { + LOG(prefix<