-local zones = luci.tools.webadmin.network_get_zones(arg[1])
-if zones then
- 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])
- m.uci:load("firewall")
- m.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
- stat = m.uci:section("firewall", "zone", nil, {
- name = value,
- network = section
- })
- else
- local net = m.uci:get("firewall", zone, "network")
- net = (net or value) .. " " .. section
- stat = m.uci:set("firewall", zone, "network", net)
- end
-
- if stat then
- self.render = function() 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())
+ ifname_multi:value(d:name())
+ end
+end
+
+
+local fwd_to, fwd_from
+
+fwzone = s:taboption("firewall", Value, "_fwzone",
+ translate("Create / Assign firewall-zone"),
+ translate("Choose the firewall zone you want to assign to this interface. Select <em>unspecified</em> to remove the interface from the associated zone or fill out the <em>create</em> field to define a new zone and attach the interface to it."))
+
+fwzone.template = "cbi/firewall_zonelist"
+fwzone.network = arg[1]
+fwzone.rmempty = false
+
+function fwzone.cfgvalue(self, section)
+ self.iface = section
+ local z = fw:get_zone_by_network(section)
+ return z and z:name()
+end
+
+function fwzone.write(self, section, value)
+ local zone = fw:get_zone(value)
+
+ if not zone and value == '-' then
+ value = m:formvalue(self:cbid(section) .. ".newzone")
+ if value and #value > 0 then
+ zone = fw:add_zone(value)
+ else
+ fw:del_network(section)