From 0533309ef29e3ff3239d3fa2a8c561178137856e Mon Sep 17 00:00:00 2001 From: Jo-Philipp Wich Date: Sat, 10 Oct 2009 04:48:57 +0000 Subject: [PATCH] libs/core: fix firewall model --- libs/core/luasrc/model/firewall.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libs/core/luasrc/model/firewall.lua b/libs/core/luasrc/model/firewall.lua index 6fc207cac..a6158c205 100644 --- a/libs/core/luasrc/model/firewall.lua +++ b/libs/core/luasrc/model/firewall.lua @@ -74,21 +74,21 @@ function get_zones(self) return zones end -function get_zones_by_network(self, net) - local zones = { } +function get_zone_by_network(self, net) + local z ub.uci:foreach("firewall", "zone", function(s) - if s.name then + if s.name and net then local n for _, n in ipairs(ub:list(s.network or s.name)) do if n == net then - zones[#zones+1] = zone(s['.name']) - return true + z = s['.name'] + return false end end end end) - return zones + return z and zone(z) end function del_zone(self, n) -- 2.11.0