From: Remi Gacogne Date: Tue, 23 Feb 2021 09:06:01 +0000 (+0100) Subject: rec: Test if the aggressive NSEC cache is enabled first X-Git-Tag: dnsdist-1.6.0-alpha2~12^2~8 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2190231d103b5f84113503bc77a998d1450cb32d;p=thirdparty%2Fpdns.git rec: Test if the aggressive NSEC cache is enabled first Making it easier to understand what the test is about. Also remove a comment about moving the aggressive NSEC cache lookup after the DNSSEC zone cut computation since it's going away. --- diff --git a/pdns/syncres.cc b/pdns/syncres.cc index 8e658c1d3d..122d71ff9b 100644 --- a/pdns/syncres.cc +++ b/pdns/syncres.cc @@ -1036,10 +1036,6 @@ int SyncRes::doResolveNoQNameMinimization(const DNSName &qname, const QType qtyp LOG(prefix<replace(d_now.tv_sec, i->first.name, i->first.type, i->second.records, i->second.signatures, authorityRecs, i->first.type == QType::DS ? true : isAA, auth, i->first.place == DNSResourceRecord::ANSWER ? ednsmask : boost::none, d_routingTag, recordState, remoteIP); - if (needWildcardProof && recordState == vState::Secure && i->first.place == DNSResourceRecord::ANSWER && g_aggressiveNSECCache && i->first.name == qname && !i->second.signatures.empty() && !d_routingTag && !ednsmask) { + if (g_aggressiveNSECCache && needWildcardProof && recordState == vState::Secure && i->first.place == DNSResourceRecord::ANSWER && i->first.name == qname && !i->second.signatures.empty() && !d_routingTag && !ednsmask) { /* we have an answer synthesized from a wildcard and aggressive NSEC is enabled, we need to store the wildcard in its non-expanded form in the cache to be able to synthesize wildcard answers later */ const auto& rrsig = i->second.signatures.at(0); @@ -3376,7 +3372,7 @@ RCode::rcodes_ SyncRes::updateCacheFromRecords(unsigned int depth, LWResult& lwr } } - if ((i->first.type == QType::NSEC || i->first.type == QType::NSEC3) && recordState == vState::Secure && !seenAuth.empty() && g_aggressiveNSECCache) { + if (g_aggressiveNSECCache && (i->first.type == QType::NSEC || i->first.type == QType::NSEC3) && recordState == vState::Secure && !seenAuth.empty()) { // Good candidate for NSEC{,3} caching g_aggressiveNSECCache->insertNSEC(seenAuth, i->first.name, i->second.records.at(0), i->second.signatures, i->first.type == QType::NSEC3); }