Mercurial > prosody-modules
diff mod_firewall/actions.lib.lua @ 2558:2b533a7b5236
mod_firewall: Make PASS bubble up through all chains, and add DEFAULT and RETURN
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 24 Feb 2017 09:38:20 +0000 |
parents | 9392f45b0364 |
children | fda47e2135e5 |
line wrap: on
line diff
--- a/mod_firewall/actions.lib.lua Thu Feb 23 14:26:19 2017 +0000 +++ b/mod_firewall/actions.lib.lua Fri Feb 24 09:38:20 2017 +0000 @@ -50,13 +50,21 @@ end function action_handlers.PASS() - return "do return end" + return "do return pass_return end" end function action_handlers.DROP() return "do return true end"; end +function action_handlers.DEFAULT() + return "do return false end"; +end + +function action_handlers.RETURN() + return "do return end" +end + function action_handlers.STRIP(tag_desc) local code = {}; local name, xmlns = tag_desc:match("^(%S+) (.+)$"); @@ -185,7 +193,16 @@ end function action_handlers.JUMP_CHAIN(name) - return ("if fire_event(%q, event) then return true; end"):format("firewall/chains/"..name); + return ([[do + local ret = fire_event(%q, event); + log('debug', 'chain \"%%s\" returned %%s', %q, tostring(ret)); + if ret ~= nil then + if ret == false then + return pass_return; + end + return ret; + end + end]]):format("firewall/chains/"..name, name); end function action_handlers.MARK_ORIGIN(name)