diff mod_firewall/conditions.lib.lua @ 2928:b0d92332b87f

mod_firewall: Add special case for $local zone (fixes #1090)
author Kim Alvefur <zash@zash.se>
date Mon, 12 Mar 2018 12:26:15 +0100
parents b1cdcbcd1c90
children df6227e288e5
line wrap: on
line diff
--- a/mod_firewall/conditions.lib.lua	Sat Mar 10 05:01:15 2018 +0100
+++ b/mod_firewall/conditions.lib.lua	Mon Mar 12 12:26:15 2018 +0100
@@ -87,12 +87,14 @@
 end
 
 local function zone_check(zone, which)
+	local zone_var = zone;
+	if zone == "$local" then zone_var = "_local" end
 	local which_not = which == "from" and "to" or "from";
 	return ("(zone_%s[%s_host] or zone_%s[%s] or zone_%s[bare_%s]) "
 		.."and not(zone_%s[%s_host] or zone_%s[%s] or zone_%s[bare_%s])"
 		)
-		:format(zone, which, zone, which, zone, which,
-		zone, which_not, zone, which_not, zone, which_not), {
+		:format(zone_var, which, zone_var, which, zone_var, which,
+		zone_var, which_not, zone_var, which_not, zone_var, which_not), {
 			"split_to", "split_from", "bare_to", "bare_from", "zone:"..zone
 		};
 end