summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2009-10-10 04:48:57 +0000
committerJo-Philipp Wich <jow@openwrt.org>2009-10-10 04:48:57 +0000
commit0533309ef29e3ff3239d3fa2a8c561178137856e (patch)
tree16ca7e2a2a9475037607b7460d9c85e6d4011211
parent03a6d3fcd440ffc7ccac8314602f923ac565476b (diff)
libs/core: fix firewall model
-rw-r--r--libs/core/luasrc/model/firewall.lua12
1 files 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)