nets[#nets+1] = net
- if #nets > 0 then
- self:set("network", table.concat(nets, " "))
- else
- self:set("network", " ")
- end
+ _M:del_network(net)
+ self:set("network", table.concat(nets, " "))
end
end
return nets
end
+function zone.clear_networks(self)
+ self:set("network", " ")
+end
+
function zone.get_forwardings_by(self, what)
local name = self:name()
local forwards = { }
end
end
- if not exist and dest ~= self:name() then
+ if not exist and dest ~= self:name() and _valid_id(dest) then
local s = uci_r:section("firewall", "forwarding", nil, {
src = self:name(),
dest = dest
end
end
- if not exist and src ~= self:name() then
+ if not exist and src ~= self:name() and _valid_id(src) then
local s = uci_r:section("firewall", "forwarding", nil, {
src = src,
dest = self:name()
function zone.del_forwardings_by(self, what)
local name = self:name()
- uci_r:foreach("firewall", "forwarding",
+ uci_r:delete_all("firewall", "forwarding",
function(s)
- if s.src and s.dest and s[what] == name then
- uci_r:delete("firewall", s['.name'])
- end
+ return (s.src and s.dest and s[what] == name)
end)
end