]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: when using ZTC, do not store non-auth data if the name is subject to recursive... 15907/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 10 Jun 2025 07:02:47 +0000 (09:02 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Thu, 24 Jul 2025 07:57:17 +0000 (09:57 +0200)
Fixes #15651

Signed-off-by: Otto Moerbeek <otto.moerbeek@open-xchange.com>
(cherry picked from commit 753ad2390bfbc90f6bc1b68f980ef4bcdc2cfddc)

pdns/recursordist/rec-zonetocache.cc
pdns/recursordist/syncres.cc
pdns/recursordist/syncres.hh

index f7fb5dc1c23b4771d4e7eb254ff026dea06a4c92..e1955a35994cf11c40e7fb75a6d224816b3cdb0b 100644 (file)
@@ -418,10 +418,12 @@ void ZoneData::ZoneToCache(const RecZoneToCache::Config& config)
         sigsrr = iter->second;
       }
       bool auth = isRRSetAuth(qname, qtype);
-      // Same decision as updateCacheFromRecords() (we do not test for NSEC since we skip those completely)
-      if (auth || (qtype == QType::NS || qtype == QType::A || qtype == QType::AAAA || qtype == QType::DS)) {
-        g_recCache->replace(d_now, qname, qtype, v, sigsrr,
-                            std::vector<std::shared_ptr<DNSRecord>>(), auth, d_zone);
+      // Same list as updateCacheFromRecords() (we do not test for NSEC since we skip those completely)
+      // Issue #15651
+      bool storeNonAuth = !SyncRes::isRecursiveForward(qname);
+      if (auth || (storeNonAuth && (qtype == QType::NS || qtype == QType::A || qtype == QType::AAAA || qtype == QType::DS))) {
+        g_recCache->replace(d_now, qname, qtype, v, sigsrr, {},
+                            auth, d_zone);
       }
       break;
     }
index 491e36b60bc82861381c807d8e8f212dfe9edb7c..8d7823faed127e2f3658339df5759d3ecf63da56 100644 (file)
@@ -1089,6 +1089,13 @@ bool SyncRes::isRecursiveForwardOrAuth(const DNSName& qname)
   return iter != t_sstorage.domainmap->end() && (iter->second.isAuth() || iter->second.shouldRecurse());
 }
 
+bool SyncRes::isRecursiveForward(const DNSName& qname)
+{
+  DNSName authname(qname);
+  const auto iter = getBestAuthZone(&authname);
+  return iter != t_sstorage.domainmap->end() && iter->second.shouldRecurse();
+}
+
 bool SyncRes::isForwardOrAuth(const DNSName& qname)
 {
   DNSName authname(qname);
index 0974743acb8206a733bef4181028949839a40840..b3f5445b151eff8ed2736e639e474002468c0404 100644 (file)
@@ -296,6 +296,7 @@ public:
   {
     return t_sstorage.domainmap;
   }
+  static bool isRecursiveForward(const DNSName& qname);
 
   static void setECSScopeZeroAddress(const Netmask& scopeZeroMask)
   {