Skip to content

Commit

Permalink
Apply suggestion from review by @rgacogne, thanks!
Browse files Browse the repository at this point in the history
  • Loading branch information
omoerbeek committed Oct 9, 2023
1 parent 103bdf7 commit 44f34df
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion pdns/recursordist/rec-main.cc
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions pdns/recursordist/settings/table.py
Expand Up @@ -1980,6 +1980,7 @@
'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'
},
Expand Down
9 changes: 4 additions & 5 deletions pdns/recursordist/syncres.cc
Expand Up @@ -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) {
Expand Down Expand Up @@ -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;
Expand All @@ -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);
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion pdns/recursordist/syncres.hh
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion pdns/recursordist/test-syncres_cc.cc
Expand Up @@ -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();
Expand Down

0 comments on commit 44f34df

Please sign in to comment.