Diff

mod_firewall/mod_firewall.lua @ 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
parent 2101:41a0a9db89ef
child 2117:5aa3b93cd37a
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