Skip to content
Snippets Groups Projects
Commit 1a559136 authored by Vladimír Čunát's avatar Vladimír Čunát
Browse files

policy: add policy.FLAGS, (un)setting query flags

parent a6c47db2
Branches
Tags
2 merge requests!254Knot Resolver 1.2.5,!184workarounds module
......@@ -97,9 +97,20 @@ local function reroute(tbl, names)
return ren.rule(prefixes)
end
-- Set and clear some query flags (TODO: documentation).
local function flags(opts_set, opts_clear)
return function(state, req)
req = kres.request_t(req)
local qry = req:current()
qry.flags = bit.band(bit.bor(qry.flags, opts_set or 0), bit.bnot(opts_clear or 0))
return nil -- chain rule
end
end
local policy = {
-- Policies
PASS = 1, DENY = 2, DROP = 3, TC = 4, QTRACE = 5, FORWARD = forward, REROUTE = reroute, MIRROR = mirror,
PASS = 1, DENY = 2, DROP = 3, TC = 4, QTRACE = 5,
FORWARD = forward, REROUTE = reroute, MIRROR = mirror, FLAGS = flags,
-- Special values
ANY = 0,
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment