]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Do *not* use QName Minimization for DS retrievals in QM fallback mode.
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 2 Jan 2023 14:49:38 +0000 (15:49 +0100)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 20 Jan 2023 12:27:54 +0000 (13:27 +0100)
pdns/recursordist/syncres.cc
pdns/recursordist/syncres.hh

index 2b46e54af072dafb73cf3d8a260cacf83a26a258..103d428077f844eb4b9832695933dabe3310ccfc 100644 (file)
@@ -1773,6 +1773,8 @@ int SyncRes::doResolve(const DNSName& qname, const QType qtype, vector<DNSRecord
         // Case 5: unexpected answer
         QLOG("Step5: other rcode, last effort final resolve");
         setQNameMinimization(false);
+        setQMFallbackMode(true);
+
         // We might have hit a depth level check, but we still want to allow some recursion levels in the fallback
         // no-qname-minimization case. This has the effect that a qname minimization fallback case might reach 150% of
         // maxdepth.
@@ -3600,7 +3602,7 @@ vState SyncRes::getDSRecords(const DNSName& zone, dsmap_t& ds, bool taOnly, unsi
   Context context;
 
   const bool oldCacheOnly = setCacheOnly(false);
-  const bool oldQM = setQNameMinimization(true);
+  const bool oldQM = setQNameMinimization(!getQMFallbackMode());
   int rcode = doResolve(zone, QType::DS, dsrecords, depth + 1, beenthere, context);
   setCacheOnly(oldCacheOnly);
   setQNameMinimization(oldQM);
index 1fa9ff63e04f71729712ef58e97d659ce171ac61..24cda260845d02f20086fc90eedeb06059198377 100644 (file)
@@ -348,6 +348,18 @@ public:
     return old;
   }
 
+  bool setQMFallbackMode(bool state = true)
+  {
+    auto old = d_qNameMinimizationFalbackMode;
+    d_qNameMinimizationFalbackMode = state;
+    return old;
+  }
+
+  bool getQMFallbackMode() const
+  {
+    return d_qNameMinimizationFalbackMode;
+  }
+  
   void setDoEDNS0(bool state = true)
   {
     d_doEDNS0 = state;
@@ -678,6 +690,7 @@ private:
   bool d_wasOutOfBand{false};
   bool d_wasVariable{false};
   bool d_qNameMinimization{false};
+  bool d_qNameMinimizationFalbackMode{false};
   bool d_queryReceivedOverTCP{false};
   bool d_followCNAME{true};
   bool d_refresh{false};