]> 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... 15911/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 10:21:34 +0000 (12:21 +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 c27219f06c9015851f15ccf4f986806e3900f990..e9aa2577af78ce5083720a722bc97629878d2f7e 100644 (file)
@@ -1057,6 +1057,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 cfa081f6235f7898818258c7f2aac2a4fdfe857f..55daa72ed71cf2053c57ffa13c2ceecc5c3cc94e 100644 (file)
@@ -282,6 +282,7 @@ public:
   {
     return t_sstorage.domainmap;
   }
+  static bool isRecursiveForward(const DNSName& qname);
 
   static void setECSScopeZeroAddress(const Netmask& scopeZeroMask)
   {