From: Vladimír Čunát Date: Tue, 21 Feb 2023 14:35:14 +0000 (+0100) Subject: view: fix destination-based matching X-Git-Tag: v5.7.0~12^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=01810935857d7c039d527e0f1ca31200c8643cdb;p=thirdparty%2Fknot-resolver.git view: fix destination-based matching Apparently it's never worked since its introduction. .addr is non-nil exactly when .dst_addr is non-nil (which hapens iff the query originated externally). Now we have semantics which was probably intended by the original code (982162956a from 2016) but that semantics is still problematic if you need both kinds of matching in a single request from client. This matching by destination has never made it to docs, so let's just add this simple fixup for now, and later we'll steer users to new policy configuration anyway. --- diff --git a/modules/view/view.lua b/modules/view/view.lua index f5e186261..d704384d5 100644 --- a/modules/view/view.lua +++ b/modules/view/view.lua @@ -69,8 +69,9 @@ local function evaluate(state, req) if execute(state, req, match_cb) then return end end end + end -- Finally try :addr by the destination. - elseif req.qsource.dst_addr ~= nil then + if req.qsource.dst_addr ~= nil then for i = 1, #view.dst do local pair = view.dst[i] if match_subnet(pair[1], pair[2], pair[3], req.qsource.dst_addr) then