# HG changeset patch # User Matthew Wild # Date 1365181696 -3600 # Node ID d773a51af9b164ff73e1d17a4dc9ef6d6bcacaca # Parent 6ef3345962762df7d68cfcaf14787bd7ad9274f6 mod_firewall: Add actions EVENT (fire an event), JUMP EVENT (transfer control to the handlers of an event), JUMP CHAIN (transfer control to another mod_firewall chain) diff -r 6ef334596276 -r d773a51af9b1 mod_firewall/actions.lib.lua --- a/mod_firewall/actions.lib.lua Fri Apr 05 18:06:32 2013 +0100 +++ b/mod_firewall/actions.lib.lua Fri Apr 05 18:08:16 2013 +0100 @@ -162,4 +162,16 @@ return "", { dep }; end +function action_handlers.EVENT(name) + return ("fire_event(%q, event)"):format(name); +end + +function action_handlers.JUMP_EVENT(name) + return ("do return fire_event(%q, event); end"):format(name); +end + +function action_handlers.JUMP_CHAIN(name) + return ("do return fire_event(%q, event); end"):format("firewall/chains/"..name); +end + return action_handlers; diff -r 6ef334596276 -r d773a51af9b1 mod_firewall/mod_firewall.lua --- a/mod_firewall/mod_firewall.lua Fri Apr 05 18:06:32 2013 +0100 +++ b/mod_firewall/mod_firewall.lua Fri Apr 05 18:08:16 2013 +0100 @@ -241,9 +241,7 @@ table.insert(code, rule_code); end - assert(chains[chain_name].type == "event", "Only event chains supported at the moment") - - local code_string = [[return function (zones, log) + local code_string = [[return function (zones, fire_event, log) ]]..table.concat(code.global_header, "\n")..[[ local db = require 'util.debug' return function (event)