# HG changeset patch # User Matthew Wild # Date 1487584078 0 # Node ID 9d2bfff515b872b12669d0f4e50c0e8070518f3d # Parent 84e103fd8039d8aba4792fdd54cfe2db7bb53e30 mod_firewall: Add 'ADD TO' action for adding to lists diff -r 84e103fd8039 -r 9d2bfff515b8 mod_firewall/actions.lib.lua --- a/mod_firewall/actions.lib.lua Mon Feb 20 09:47:40 2017 +0000 +++ b/mod_firewall/actions.lib.lua Mon Feb 20 09:47:58 2017 +0000 @@ -187,4 +187,11 @@ return [[session.firewall_marked_]]..idsafe(name)..[[ = nil;]] end +function action_handlers.ADD_TO(spec) + local list_name, value = spec:match("(%S+) (.+)"); + local meta_deps = {}; + value = meta(("%q"):format(value), meta_deps); + return ("list_%s:add(%s);"):format(list_name, value), { "list:"..list_name, unpack(meta_deps) }; +end + return action_handlers;