From: Vladimír Čunát Date: Thu, 23 Jan 2020 14:25:16 +0000 (+0100) Subject: modules/policy: make postrules useful X-Git-Tag: v5.0.0~2^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=0a57436b5aa4e772ba2b551bdd161b1812421b87;p=thirdparty%2Fknot-resolver.git modules/policy: make postrules useful In finish() phase DONE is (almost?) always set, so it didn't make sense. The mistake came from c16728f5 !678. --- diff --git a/NEWS b/NEWS index 7e5cc9406..8845942a6 100644 --- a/NEWS +++ b/NEWS @@ -20,7 +20,7 @@ Improvements Bugfixes -------- - correctly use EDNS(0) padding in failed answers (!921) -- policy and daf modules: fix reroute rules (!901) +- policy and daf modules: fix postrules and reroute rules (!901) - renumber module: don't accidentally zero-out request's .state (!901) diff --git a/modules/policy/policy.lua b/modules/policy/policy.lua index d9da4d800..2c1886810 100644 --- a/modules/policy/policy.lua +++ b/modules/policy/policy.lua @@ -789,7 +789,7 @@ end -- as a dependency chain, e.g. r1,r2,r3 -> r3(r2(r1(state))) policy.layer = { begin = function(state, req) - -- Don't act on "resolved" cases. + -- Don't act on "finished" cases. if bit.band(state, bit.bor(kres.FAIL, kres.DONE)) ~= 0 then return state end local qry = req:current() return policy.evaluate(policy.rules, req, qry, state) @@ -800,8 +800,8 @@ policy.layer = { finish = function(state, req) -- Optimization for the typical case if #policy.postrules == 0 then return state end - -- Don't act on "resolved" cases. - if bit.band(state, bit.bor(kres.FAIL, kres.DONE)) ~= 0 then return state end + -- Don't act on failed cases. + if bit.band(state, kres.FAIL) ~= 0 then return state end return policy.evaluate(policy.postrules, req, req:current(), state) or state end } diff --git a/modules/view/view.lua b/modules/view/view.lua index 28b7d26b2..dcc7117ff 100644 --- a/modules/view/view.lua +++ b/modules/view/view.lua @@ -106,7 +106,7 @@ end -- @function Module layers view.layer = { begin = function(state, req) - -- Don't act on "resolved" cases. + -- Don't act on "finished" cases. if bit.band(state, bit.bor(kres.FAIL, kres.DONE)) ~= 0 then return state end evaluate(state, req)