<ul style="margin:0; list-style-type:none">
<% for _, iface in ipairs(ifaces) do
local link = iface:adminlink()
- if (not self.nobridges or not iface:is_bridge()) and iface:name() ~= self.exclude then %>
+ if (not self.nobridges or not iface:is_bridge()) and
+ (not self.noinactive or iface:is_up()) and
+ iface:name() ~= self.exclude
+ then %>
<li>
<input class="cbi-input-<%=self.widget or "radio"%>" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)"<%=
attr("type", self.widget or "radio") ..
attr("id", cbid .. "." .. iface:name()) ..
attr("name", cbid) .. attr("value", iface:name()) ..
- ifattr(checked[iface:name()], "checked", "checked") ..
- ifattr(iface:type() == "wifi" and not iface:is_up(), "disabled", "disabled")
+ ifattr(checked[iface:name()], "checked", "checked")
%> />  
<label<%=attr("for", cbid .. "." .. iface:name())%>>
<% if link then -%><a href="<%=link%>"><% end -%>
<input class="cbi-input-<%=self.widget or "radio"%>" onclick="cbi_d_update(this.id)" onchange="cbi_d_update(this.id)"<%=
attr("type", self.widget or "radio") ..
attr("id", cbid .. "_custom") ..
- attr("name", cbid)
+ attr("name", cbid) ..
+ attr("value", " ")
%> />  
<label<%=attr("for", cbid .. "_custom")%>>
<img title="<%:Custom Interface%>" style="width:16px; height:16px; vertical-align:middle" src="<%=resource%>/icons/ethernet_disabled.png" />
return
end
-local ifc = net:get_interfaces()[1]
+local ifc = net:get_interface()
s = m:section(NamedSection, arg[1], "interface", translate("Common Configuration"))
s.addremove = false
p.description = translate("You need to install \"comgt\" for UMTS/GPRS, \"ppp-mod-pppoe\" for PPPoE, \"ppp-mod-pppoa\" for PPPoA or \"pptp\" for PPtP support")
end
-auto = s:taboption("physical", Flag, "auto", translate("Bring up on boot"))
+auto = s:taboption("physical", Flag, "auto", translate("Bring up on boot"))
auto.default = (m.uci:get("network", arg[1], "proto") == "none") and auto.disabled or auto.enabled
br = s:taboption("physical", Flag, "type", translate("Bridge interfaces"), translate("creates a bridge over specified interface(s)"))
ifname_single.template = "cbi/network_ifacelist"
ifname_single.widget = "radio"
ifname_single.nobridges = true
+ifname_single.rmempty = false
ifname_single.network = arg[1]
ifname_single:depends({ type = "", proto = "static" })
ifname_single:depends({ type = "", proto = "dhcp" })
local n = nw:get_network(s)
if n then
local i
+ local new_ifs = { }
+ local old_ifs = { }
+
for _, i in ipairs(n:get_interfaces()) do
- n:del_interface(i)
+ old_ifs[#old_ifs+1] = i:name()
end
for i in ut.imatch(val) do
- n:add_interface(i)
+ new_ifs[#new_ifs+1] = i
-- if this is not a bridge, only assign first interface
if self.option == "ifname_single" then
break
end
end
- end
-end
-function ifname_single.remove(self, s)
- self:write(s, "")
+ table.sort(old_ifs)
+ table.sort(new_ifs)
+
+ for i = 1, math.max(#old_ifs, #new_ifs) do
+ if old_ifs[i] ~= new_ifs[i] then
+ for i = 1, #old_ifs do
+ n:del_interface(old_ifs[i])
+ end
+ for i = 1, #new_ifs do
+ n:add_interface(new_ifs[i])
+ end
+ break
+ end
+ end
+ end
end
ifname_multi = s:taboption("physical", Value, "ifname_multi", translate("Interface"))
ifname_multi.template = "cbi/network_ifacelist"
ifname_multi.nobridges = true
+ifname_multi.rmempty = false
ifname_multi.network = arg[1]
ifname_multi.widget = "checkbox"
ifname_multi:depends("type", "bridge")
ifname_multi.cfgvalue = ifname_single.cfgvalue
ifname_multi.write = ifname_single.write
-ifname_multi.remove = ifname_single.remove
if has_firewall then
gw.optional = true
gw.datatype = "ip4addr"
gw:depends("proto", "static")
+gw:depends("proto", "dhcp")
bcast = s:taboption("general", Value, "broadcast", translate("<abbr title=\"Internet Protocol Version 4\">IPv4</abbr>-Broadcast"))
bcast.optional = true