]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Apply suggestion from review by @rgacogne, thanks! 13296/head
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Mon, 9 Oct 2023 10:02:24 +0000 (12:02 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Wed, 11 Oct 2023 13:41:50 +0000 (15:41 +0200)
pdns/recursordist/rec-main.cc
pdns/recursordist/settings/table.py
pdns/recursordist/syncres.cc
pdns/recursordist/syncres.hh
pdns/recursordist/test-syncres_cc.cc

index fd713a11fd1e16a3ee3f1661dcc0ffcb8025a3f8..aa964c82a3d24ab326071730cc92667b9a519b84 100644 (file)
@@ -1687,7 +1687,7 @@ static int initSyncRes(Logr::log_t log)
   SyncRes::s_ecscachelimitttl = ::arg().asNum("ecs-cache-limit-ttl");
 
   SyncRes::s_qnameminimization = ::arg().mustDo("qname-minimization");
-  SyncRes::s_minimize_one_lab = ::arg().asNum("qname-minimize-one-label");
+  SyncRes::s_minimize_one_label = ::arg().asNum("qname-minimize-one-label");
   SyncRes::s_max_minimize_count = ::arg().asNum("qname-max-minimize-count");
 
   SyncRes::s_hardenNXD = SyncRes::HardenNXD::DNSSEC;
index 826d843c7b6d6b93fddf0213df6a6b2069683bdc..31d24af82826f2af93395d4470a5b2abd815b760 100644 (file)
@@ -1980,6 +1980,7 @@ of the Query Name Minimization Algorithm.
         'doc' : '''
 ``Minimize one label`` parameter, described in :rfc:`9156`.
 The value for the number of iterations of the Query Name Minimization Algorithm that should only have one label appended.
+This value has precedence over :ref:`setting-qname-max-minimize-count`.
  ''',
     'versionadded': '5.0.0'
     },
index 2c779dddcffec34aab20bea1ec1c734dab2a6b58..53e6327fca1a3d3dc6e3224d8f46abe7312f17a0 100644 (file)
@@ -1599,13 +1599,13 @@ LWResult::Result SyncRes::asyncresolveWrapper(const ComboAddress& address, bool
 /* maximum number of QNAME minimization iterations */
 unsigned int SyncRes::s_max_minimize_count; // default is 10
 /* number of iterations that should only have one label appended */
-unsigned int SyncRes::s_minimize_one_lab; // default is 4
+unsigned int SyncRes::s_minimize_one_label; // default is 4
 
 static unsigned int qmStepLen(unsigned int labels, unsigned int qnamelen, unsigned int i)
 {
   unsigned int step;
 
-  if (i < SyncRes::s_minimize_one_lab) {
+  if (i < SyncRes::s_minimize_one_label) {
     step = 1;
   }
   else if (i < SyncRes::s_max_minimize_count) {
@@ -1695,7 +1695,7 @@ int SyncRes::doResolve(const DNSName& qname, const QType qtype, vector<DNSRecord
     LOG(prefix << qname << ": Step0 qname is in a forwarded domain " << fwdomain << endl);
   }
 
-  for (unsigned int i = 0; i <= qnamelen;) {
+  for (unsigned int i = 0; i <= qnamelen; i++) {
 
     // Step 1
     vector<DNSRecord> bestns;
@@ -1714,7 +1714,7 @@ int SyncRes::doResolve(const DNSName& qname, const QType qtype, vector<DNSRecord
       }
     }
 
-    if (bestns.size() == 0) {
+    if (bestns.empty()) {
       if (!forwarded) {
         // Something terrible is wrong
         LOG(prefix << qname << ": Step1 No ancestor found return ServFail" << endl);
@@ -1788,7 +1788,6 @@ int SyncRes::doResolve(const DNSName& qname, const QType qtype, vector<DNSRecord
       LOG(prefix << qname << ": Step4 Resolve " << child << "|A result is " << RCode::to_s(res) << "/" << retq.size() << "/" << stopAtDelegation << endl);
       if (stopAtDelegation == Stopped) {
         LOG(prefix << qname << ": Delegation seen, continue at step 1" << endl);
-        i++;
         break;
       }
 
index 44f41c5f3a5dc4a203e7147fe3015eea95b917d8..9fe98262ac767acb1bad60646552b7f5bd9b4e5a 100644 (file)
@@ -551,7 +551,7 @@ public:
   static unsigned int s_max_busy_dot_probes;
   static unsigned int s_max_CNAMES_followed;
   static unsigned int s_max_minimize_count;
-  static unsigned int s_minimize_one_lab;
+  static unsigned int s_minimize_one_label;
 
   static const int event_trace_to_pb = 1;
   static const int event_trace_to_log = 2;
index b544195ceb008b65368c0bf935861795ee1d3787..50e45a80f2e6e714ecc0c372779d1d3bd6a2f9ae 100644 (file)
@@ -183,7 +183,7 @@ void initSR(bool debug)
   SyncRes::s_save_parent_ns_set = true;
   SyncRes::s_maxnsperresolve = 13;
   SyncRes::s_locked_ttlperc = 0;
-  SyncRes::s_minimize_one_lab = 4;
+  SyncRes::s_minimize_one_label = 4;
   SyncRes::s_max_minimize_count = 10;
 
   SyncRes::clearNSSpeeds();