+stp = s:taboption("physical", Flag, "stp", translate("Enable <abbr title=\"Spanning Tree Protocol\">STP</abbr>"),
+ translate("Enables the Spanning Tree Protocol on this bridge"))
+stp:depends("type", "1")
+stp.rmempty = true
+
+ifname_single = s:taboption("physical", Value, "ifname_single", translate("Interface"))
+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", "")
+
+function ifname_single.cfgvalue(self, s)
+ return self.map.uci:get("network", s, "ifname")
+end
+
+function ifname_single.write(self, s, val)
+ local n = nw:get_network(s)
+ 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())
+ 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)
+ end
+ end
+
+ if zone then
+ fw:del_network(section)
+ zone:add_network(section)