]> git.ipfire.org Git - thirdparty/knot-resolver.git/commitdiff
policy.DEBUG_IF: don't trigger .REQTRACE unconditionally
authorVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 5 Dec 2022 13:38:45 +0000 (14:38 +0100)
committerVladimír Čunát <vladimir.cunat@nic.cz>
Mon, 5 Dec 2022 13:45:02 +0000 (14:45 +0100)
I broke this in 54ab3f78 or closely around, so this never worked well
since 5.4.1, and maybe structured logging (5.4.0) had related issues.

NEWS
modules/policy/policy.lua

diff --git a/NEWS b/NEWS
index 99e5f49f502db9213b7f5972c81d45a280f48242..59526db78b42ba6cb35747bde50ad5455bf51501 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,10 @@ Improvements
 ------------
 - depend on jemalloc, preferably, to improve memory usage (!1353)
 
+Bugfixes
+--------
+- policy.DEBUG_IF: don't print client's packet unconditionally (!1366)
+
 
 Knot Resolver 5.5.3 (2022-09-21)
 ================================
index 4eba7494e4ed5d3d98ed127fbd643f1cd9b942c2..47e436f027616100d62ec6c1515cdb09beebaa94 100644 (file)
@@ -781,6 +781,7 @@ function policy.DEBUG_IF(test)
        local debug_finish_cb = ffi.cast('trace_callback_f', function (cbreq)
                jit.off(true, true) -- JIT for (C -> lua)^2 nesting isn't allowed
                if test(cbreq) then
+                       policy.REQTRACE(nil, cbreq)
                        debug_logfinish_cb(cbreq)  -- unconditional version
 
                        local stash = cbreq:vars()['policy_debug_stash']
@@ -797,7 +798,6 @@ function policy.DEBUG_IF(test)
                req:vars()['policy_debug_stash'] = {}
                policy.QTRACE(state, req)
                req:trace_chain_callbacks(debug_stashlog_cb, debug_finish_cb)
-               policy.REQTRACE(state, req)
                return
        end
 end