]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
Move dns64 processing before postresolve processing
authorOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 12 Aug 2022 07:18:04 +0000 (09:18 +0200)
committerOtto Moerbeek <otto.moerbeek@open-xchange.com>
Fri, 12 Aug 2022 07:18:04 +0000 (09:18 +0200)
pdns/pdns_recursor.cc

index 76b2aa329f7cbcb0e2bcb0da7f6e54171793f56b..0d36ee09e5037bccd6048377f4441ce5aa794f18 100644 (file)
@@ -1178,26 +1178,31 @@ void startDoResolve(void* p)
 
       if (dc->d_luaContext) {
         PolicyResult policyResult = PolicyResult::NoAction;
-        if (res == RCode::NoError) {
-          if (answerIsNOData(dc->d_mdp.d_qtype, res, ret)) {
-            if (dc->d_luaContext->nodata(dq, res, sr.d_eventTrace)) {
-              shouldNotValidate = true;
-              policyResult = handlePolicyHit(appliedPolicy, dc, sr, res, ret, pw, tcpGuard);
-            }
+        if (answerIsNOData(dc->d_mdp.d_qtype, res, ret)) {
+          if (dc->d_luaContext->nodata(dq, res, sr.d_eventTrace)) {
+            shouldNotValidate = true;
+            policyResult = handlePolicyHit(appliedPolicy, dc, sr, res, ret, pw, tcpGuard);
           }
         }
         else if (res == RCode::NXDomain && dc->d_luaContext->nxdomain(dq, res, sr.d_eventTrace)) {
           shouldNotValidate = true;
           policyResult = handlePolicyHit(appliedPolicy, dc, sr, res, ret, pw, tcpGuard);
         }
-
         if (policyResult == PolicyResult::HaveAnswer) {
           goto haveAnswer;
         }
         else if (policyResult == PolicyResult::Drop) {
           return;
         }
+      } // dc->d_luaContext
+
+      if (g_dns64Prefix && dc->d_mdp.d_qtype == QType::AAAA && !vStateIsBogus(dq.validationState) && dns64Candidate(dc->d_mdp.d_qtype, res, ret)) {
+        res = getFakeAAAARecords(dq.qname, *g_dns64Prefix, ret);
+        shouldNotValidate = true;
+      }
 
+      if (dc->d_luaContext) {
+        PolicyResult policyResult = PolicyResult::NoAction;
         if (dc->d_luaContext->d_postresolve_ffi) {
           RecursorLua4::PostResolveFFIHandle handle(dq);
           sr.d_eventTrace.add(RecEventTrace::LuaPostResolveFFI);
@@ -1219,11 +1224,6 @@ void startDoResolve(void* p)
           return;
         }
       } // dc->d_luaContext
-
-      if (g_dns64Prefix && dc->d_mdp.d_qtype == QType::AAAA && !vStateIsBogus(dq.validationState) && dns64Candidate(dc->d_mdp.d_qtype, res, ret)) {
-        res = getFakeAAAARecords(dq.qname, *g_dns64Prefix, ret);
-        shouldNotValidate = true;
-      }
     }
     else if (dc->d_luaContext) {
       // preresolve returned true