diff options
author | Steven Barth <steven@midlink.org> | 2008-08-14 14:54:37 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2008-08-14 14:54:37 +0000 |
commit | 09145378c87cc1b8bad52d211b77f836a6130a9f (patch) | |
tree | 5fc387bb62c48215857cb3418cb6c4789675f071 | |
parent | 2c09564d762b692d970a531cca58eb52ba3807e7 (diff) |
modules/admin-full: Added a cross-references from network interface config to firewall zone config
-rw-r--r-- | modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua | 66 |
1 files changed, 36 insertions, 30 deletions
diff --git a/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua b/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua index 6d1fb4f39..1a41ed271 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_network/ifaces.lua @@ -39,40 +39,46 @@ for i,d in ipairs(luci.sys.net.devices()) do end local zones = luci.tools.webadmin.network_get_zones(arg[1]) -if zones and #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 zones then + if #zones == 0 then + m:chain("firewall") - 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 + 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 + ) - if stat then - self.render = function() end + function fwzone.write(self, section, value) + 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 + else + fwzone = s:option(DummyValue, "_fwzone", translate("zone")) + fwzone.value = table.concat(zones, ", ") end + fwzone.titleref = luci.dispatcher.build_url("admin", "network", "firewall", "zones") end ipaddr = s:option(Value, "ipaddr", translate("ipaddress")) |