changeset 2113:d75145297bf9

mod_firewall: Support for defining extra chains in the config file
author Matthew Wild <mwild1@gmail.com>
date Thu, 17 Mar 2016 12:09:20 +0000
parents 4e434abaf8fc
children ce3dd93f30d9
files mod_firewall/mod_firewall.lua
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_firewall/mod_firewall.lua	Thu Mar 17 11:51:05 2016 +0000
+++ b/mod_firewall/mod_firewall.lua	Thu Mar 17 12:09:20 2016 +0000
@@ -6,7 +6,7 @@
 local definitions = module:shared("definitions");
 local active_definitions = {};
 
-local chains = {
+local default_chains = {
 	preroute = {
 		type = "event";
 		priority = 0.1;
@@ -27,6 +27,16 @@
 	};
 };
 
+local extra_chains = module:get_option("firewall_extra_chains", {});
+
+local chains = {};
+for k,v in pairs(default_chains) do
+	chains[k] = v;
+end
+for k,v in pairs(extra_chains) do
+	chains[k] = v;
+end
+
 function idsafe(name)
 	return name:match("^%a[%w_]*$")
 end