modules/admin-full: Added a cross-references from network interface config to firewall zone config
This commit is contained in:
parent
2c09564d76
commit
09145378c8
1 changed files with 36 additions and 30 deletions
|
@ -39,40 +39,46 @@ for i,d in ipairs(luci.sys.net.devices()) do
|
||||||
end
|
end
|
||||||
|
|
||||||
local zones = luci.tools.webadmin.network_get_zones(arg[1])
|
local zones = luci.tools.webadmin.network_get_zones(arg[1])
|
||||||
if zones and #zones == 0 then
|
if zones then
|
||||||
m:chain("firewall")
|
if #zones == 0 then
|
||||||
|
m:chain("firewall")
|
||||||
fwzone = s:option(Value, "_fwzone",
|
|
||||||
translate("network_interface_fwzone"),
|
|
||||||
translate("network_interface_fwzone_desc"))
|
|
||||||
fwzone.rmempty = true
|
|
||||||
fwzone:value("", "- " .. translate("none") .. " -")
|
|
||||||
fwzone:value(arg[1])
|
|
||||||
luci.model.uci.foreach("firewall", "zone",
|
|
||||||
function (section)
|
|
||||||
fwzone:value(section.name)
|
|
||||||
end
|
|
||||||
)
|
|
||||||
|
|
||||||
function fwzone.write(self, section, value)
|
|
||||||
local zone = luci.tools.webadmin.firewall_find_zone(value)
|
|
||||||
local stat
|
|
||||||
|
|
||||||
if not zone then
|
fwzone = s:option(Value, "_fwzone",
|
||||||
stat = luci.model.uci.section("firewall", "zone", nil, {
|
translate("network_interface_fwzone"),
|
||||||
name = value,
|
translate("network_interface_fwzone_desc"))
|
||||||
network = section
|
fwzone.rmempty = true
|
||||||
})
|
fwzone:value("", "- " .. translate("none") .. " -")
|
||||||
else
|
fwzone:value(arg[1])
|
||||||
local net = luci.model.uci.get("firewall", zone, "network")
|
luci.model.uci.foreach("firewall", "zone",
|
||||||
net = (net or value) .. " " .. section
|
function (section)
|
||||||
stat = luci.model.uci.set("firewall", zone, "network", net)
|
fwzone:value(section.name)
|
||||||
end
|
end
|
||||||
|
)
|
||||||
|
|
||||||
if stat then
|
function fwzone.write(self, section, value)
|
||||||
self.render = function() end
|
local zone = luci.tools.webadmin.firewall_find_zone(value)
|
||||||
|
local stat
|
||||||
|
|
||||||
|
if not zone then
|
||||||
|
stat = luci.model.uci.section("firewall", "zone", nil, {
|
||||||
|
name = value,
|
||||||
|
network = section
|
||||||
|
})
|
||||||
|
else
|
||||||
|
local net = luci.model.uci.get("firewall", zone, "network")
|
||||||
|
net = (net or value) .. " " .. section
|
||||||
|
stat = luci.model.uci.set("firewall", zone, "network", net)
|
||||||
|
end
|
||||||
|
|
||||||
|
if stat then
|
||||||
|
self.render = function() end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
else
|
||||||
|
fwzone = s:option(DummyValue, "_fwzone", translate("zone"))
|
||||||
|
fwzone.value = table.concat(zones, ", ")
|
||||||
end
|
end
|
||||||
|
fwzone.titleref = luci.dispatcher.build_url("admin", "network", "firewall", "zones")
|
||||||
end
|
end
|
||||||
|
|
||||||
ipaddr = s:option(Value, "ipaddr", translate("ipaddress"))
|
ipaddr = s:option(Value, "ipaddr", translate("ipaddress"))
|
||||||
|
|
Loading…
Reference in a new issue