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
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()
end
function get_interface(self, i)
- return ifs[i] and interface(i)
+ if ifs[i] then
+ return interface(i)
+ else
+ local j
+ for j, _ in pairs(ifs) do
+ if ifs[j].sid == i then
+ return interface(j)
+ end
+ end
+ end
end
function get_interfaces(self)
local device = s.device or "wlan0"
local state = st:get_all("wireless", s['.name'])
- local name = state.ifname or device .. ".network" .. count
+ local name = device .. ".network" .. count
- ifs[state and state.ifname or name] = {
+ ifs[name] = {
idx = count,
- name = state and state.ifname or name,
+ name = name,
rawname = state and state.ifname or name,
flags = { },
ipaddrs = { },