]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
rec: reset EDE in context when starting to resolve
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 28 Mar 2023 09:09:40 +0000 (11:09 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Tue, 28 Mar 2023 09:09:40 +0000 (11:09 +0200)
Fixes #12691

There is a slight complication here: If QM found an error, a retry
without QM is done, and that clears the EDE but might not find an
EDE itself (since it does not walk all labels).  So remember the
original EDE and put it back in place if the last effort attempt
failed but did not set an EDE.

pdns/recursordist/syncres.cc

index f7670f08c6f952a9176ac9721b58c4f4f66672ab..ba0741d1a3974e96d6a9f6711c84c519cf1ff162 100644 (file)
@@ -1768,11 +1768,18 @@ int SyncRes::doResolve(const DNSName& qname, const QType qtype, vector<DNSRecord
         setQNameMinimization(false);
         setQMFallbackMode(true);
 
+        auto oldEDE = context.extendedError;
         res = doResolveNoQNameMinimization(qname, qtype, ret, depth + 1, beenthere, context);
 
         if (res == RCode::NoError) {
           t_Counters.at(rec::Counter::qnameminfallbacksuccess)++;
         }
+        else {
+          // as doResolveNoQNameMinimization clears the EDE, we put it back here, it is relevant but might not be set by the last effort attempt
+          if (!context.extendedError) {
+            context.extendedError = oldEDE;
+          }
+        }
 
         LOG(prefix << qname << ": Step5 End resolve: " << RCode::to_s(res) << "/" << ret.size() << endl);
         return res;
@@ -1810,6 +1817,7 @@ unsigned int SyncRes::getAdjustedRecursionBound() const
  */
 int SyncRes::doResolveNoQNameMinimization(const DNSName& qname, const QType qtype, vector<DNSRecord>& ret, unsigned int depth, set<GetBestNSAnswer>& beenthere, Context& context, bool* fromCache, StopAtDelegation* stopAtDelegation)
 {
+  context.extendedError.reset();
   auto prefix = getPrefix(depth);
 
   LOG(prefix << qname << ": Wants " << (d_doDNSSEC ? "" : "NO ") << "DNSSEC processing, " << (d_requireAuthData ? "" : "NO ") << "auth data required by query for " << qtype << endl);