X-Git-Url: http://git.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=libs%2Fcore%2Fluasrc%2Fmodel%2Ffirewall.lua;h=a1daf5a7019e4266eb9ba8691176a281827f46ee;hp=a6158c20523125f8d0e77f63f6a5c14b241de9c2;hb=99d425aeedf5801a0ca8c6f741e591456bd1ab0e;hpb=7bf9452985c79f3efdc98c720f29753cdb160edc diff --git a/libs/core/luasrc/model/firewall.lua b/libs/core/luasrc/model/firewall.lua index a6158c2052..a1daf5a701 100644 --- a/libs/core/luasrc/model/firewall.lua +++ b/libs/core/luasrc/model/firewall.lua @@ -234,7 +234,7 @@ function zone.add_forwarding_to(self, dest, with_mtu_fix) local s = ub.uci:section("firewall", "forwarding", nil, { src = self:name(), dest = dest, - mtu_fix = with_mtu_fix and true or false + mtu_fix = with_mtu_fix and "1" or "0" }) return s and forwarding(s) end @@ -252,12 +252,22 @@ function zone.add_forwarding_from(self, src, with_mtu_fix) local s = ub.uci:section("firewall", "forwarding", nil, { src = src, dest = self:name(), - mtu_fix = with_mtu_fix and true or false + mtu_fix = with_mtu_fix and "1" or "0" }) return s and forwarding(s) end end +function zone.del_forwardings_by(self, what) + local name = self:name() + ub.uci:foreach("firewall", "forwarding", + function(s) + if s.src and s.dest and s[what] == name then + ub.uci:delete("firewall", s['.name']) + end + end) +end + function zone.add_redirect(self, options) options = options or { } options.src = self:name()