Skip to content

Commit

Permalink
Merge pull request #12442 from omoerbeek/rec-48-backport-qm-ds-fallback
Browse files Browse the repository at this point in the history
rec: Backport to 4.8.x: Do *not* use QName Minimization for DS retrievals in QM fallback mode.
  • Loading branch information
omoerbeek committed Jan 20, 2023
2 parents 84bc894 + ff15378 commit 90ae17e
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pdns/recursordist/rec-main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2583,7 +2583,7 @@ int main(int argc, char** argv)
try {
#if HAVE_FIBER_SANITIZER
// Asan needs more stack
::arg().set("stack-size", "stack size per mthread") = "400000";
::arg().set("stack-size", "stack size per mthread") = "600000";
#else
::arg().set("stack-size", "stack size per mthread") = "200000";
#endif
Expand Down
4 changes: 3 additions & 1 deletion pdns/syncres.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1753,6 +1753,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.
Expand Down Expand Up @@ -3589,7 +3591,7 @@ vState SyncRes::getDSRecords(const DNSName& zone, dsmap_t& ds, bool taOnly, unsi

vState state = vState::Indeterminate;
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, state);
setCacheOnly(oldCacheOnly);
setQNameMinimization(oldQM);
Expand Down
13 changes: 13 additions & 0 deletions pdns/syncres.hh
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,18 @@ public:
return old;
}

bool setQMFallbackMode(bool state = true)
{
auto old = d_qNameMinimizationFallbackMode;
d_qNameMinimizationFallbackMode = state;
return old;
}

bool getQMFallbackMode() const
{
return d_qNameMinimizationFallbackMode;
}

void setDoEDNS0(bool state=true)
{
d_doEDNS0=state;
Expand Down Expand Up @@ -664,6 +676,7 @@ private:
bool d_wasOutOfBand{false};
bool d_wasVariable{false};
bool d_qNameMinimization{false};
bool d_qNameMinimizationFallbackMode{false};
bool d_queryReceivedOverTCP{false};
bool d_followCNAME{true};
bool d_refresh{false};
Expand Down

0 comments on commit 90ae17e

Please sign in to comment.