modules/admin-full: introduce a new tab for firewall related stuff in iface config page
This commit is contained in:
parent
2e8d0a9b6b
commit
0698926009
1 changed files with 17 additions and 2 deletions
|
@ -28,6 +28,7 @@ local has_ipv6 = fs.access("/proc/net/ipv6_route")
|
|||
|
||||
m = Map("network", translate("interfaces"), translate("a_n_ifaces1"))
|
||||
m:chain("firewall")
|
||||
m:chain("wireless")
|
||||
|
||||
nw.init(m.uci)
|
||||
fw.init(m.uci)
|
||||
|
@ -39,6 +40,7 @@ s:tab("general", translate("a_n_general", "General Setup"))
|
|||
if has_ipv6 then s:tab("ipv6", translate("a_n_ipv6", "IPv6 Setup")) end
|
||||
if has_pppd then s:tab("ppp", translate("a_n_ppp", "PPP Settings")) end
|
||||
s:tab("physical", translate("a_n_physical", "Physical Settings"))
|
||||
s:tab("firewall", translate("a_n_firewall", "Firewall Settings"))
|
||||
|
||||
--[[
|
||||
back = s:taboption("general", DummyValue, "_overview", translate("overview"))
|
||||
|
@ -75,6 +77,7 @@ ifname_single = s:taboption("physical", Value, "ifname_single", translate("inter
|
|||
ifname_single.template = "cbi/network_ifacelist"
|
||||
ifname_single.widget = "radio"
|
||||
ifname_single.nobridges = true
|
||||
ifname_single.network = arg[1]
|
||||
ifname_single.rmempty = true
|
||||
ifname_single:depends("type", "")
|
||||
|
||||
|
@ -84,18 +87,26 @@ end
|
|||
|
||||
function ifname_single.write(self, s, val)
|
||||
local n = nw:get_network(s)
|
||||
if n then n:ifname(val) end
|
||||
if n then
|
||||
local i
|
||||
for _, i in ipairs(n:get_interfaces()) do
|
||||
n:del_interface(i)
|
||||
end
|
||||
n:add_interface(val)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
ifname_multi = s:taboption("physical", MultiValue, "ifname_multi", translate("interface"))
|
||||
ifname_multi.template = "cbi/network_ifacelist"
|
||||
ifname_multi.nobridges = true
|
||||
ifname_multi.network = arg[1]
|
||||
ifname_multi.widget = "checkbox"
|
||||
ifname_multi:depends("type", "1")
|
||||
ifname_multi.cfgvalue = ifname_single.cfgvalue
|
||||
ifname_multi.write = ifname_single.write
|
||||
|
||||
|
||||
for _, d in ipairs(nw:get_interfaces()) do
|
||||
if not d:is_bridge() then
|
||||
ifname_single:value(d:name())
|
||||
|
@ -104,11 +115,14 @@ for _, d in ipairs(nw:get_interfaces()) do
|
|||
end
|
||||
|
||||
|
||||
fwzone = s:taboption("general", Value, "_fwzone",
|
||||
local fwd_to, fwd_from
|
||||
|
||||
fwzone = s:taboption("firewall", Value, "_fwzone",
|
||||
translate("network_interface_fwzone"),
|
||||
translate("network_interface_fwzone_desc"))
|
||||
|
||||
fwzone.template = "cbi/firewall_zonelist"
|
||||
fwzone.network = arg[1]
|
||||
fwzone.rmempty = false
|
||||
|
||||
function fwzone.cfgvalue(self, section)
|
||||
|
@ -135,6 +149,7 @@ function fwzone.write(self, section, value)
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
ipaddr = s:taboption("general", Value, "ipaddr", translate("ipaddress"))
|
||||
ipaddr.rmempty = true
|
||||
ipaddr:depends("proto", "static")
|
||||
|
|
Loading…
Reference in a new issue