summaryrefslogtreecommitdiffstats
path: root/daemon/lua/kres.lua
diff options
context:
space:
mode:
authorVladimír Čunát <vladimir.cunat@nic.cz>2020-04-02 09:01:11 +0200
committerVladimír Čunát <vladimir.cunat@nic.cz>2020-04-02 14:35:43 +0200
commit55d3aa0a57f900ea1a9fe099505bc724cbaadcb4 (patch)
tree25ddb5d12f458980353f68360c89e8d1668eb78e /daemon/lua/kres.lua
parentmodules/policy: make actions usable in postrules (diff)
downloadknot-resolver-55d3aa0a57f900ea1a9fe099505bc724cbaadcb4.tar.xz
knot-resolver-55d3aa0a57f900ea1a9fe099505bc724cbaadcb4.zip
policy: fix qry parameter in postrules
Some rules need it and it was nil until now.
Diffstat (limited to 'daemon/lua/kres.lua')
-rw-r--r--daemon/lua/kres.lua7
1 files changed, 7 insertions, 0 deletions
diff --git a/daemon/lua/kres.lua b/daemon/lua/kres.lua
index bf9bde77..1bdc30a3 100644
--- a/daemon/lua/kres.lua
+++ b/daemon/lua/kres.lua
@@ -766,6 +766,13 @@ ffi.metatype( kr_request_t, {
if req.current_query == nil then return nil end
return req.current_query
end,
+ -- returns the initial query that started the request
+ initial = function(req)
+ assert(ffi.istype(kr_request_t, req))
+ local rplan = C.kr_resolve_plan(req)
+ if rplan.initial == nil then return nil end
+ return rplan.initial
+ end,
-- Return last query on the resolution plan
last = function(req)
assert(ffi.istype(kr_request_t, req))