luci-mod-admin-full: fix changing alias interface ifnames
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
This commit is contained in:
parent
ffff1e7c0a
commit
4f0b755241
1 changed files with 11 additions and 3 deletions
|
@ -285,6 +285,7 @@ if not net:is_floating() then
|
||||||
ifname_single.template = "cbi/network_ifacelist"
|
ifname_single.template = "cbi/network_ifacelist"
|
||||||
ifname_single.widget = "radio"
|
ifname_single.widget = "radio"
|
||||||
ifname_single.nobridges = true
|
ifname_single.nobridges = true
|
||||||
|
ifname_single.noaliases = false
|
||||||
ifname_single.rmempty = false
|
ifname_single.rmempty = false
|
||||||
ifname_single.network = arg[1]
|
ifname_single.network = arg[1]
|
||||||
ifname_single:depends("type", "")
|
ifname_single:depends("type", "")
|
||||||
|
@ -295,13 +296,19 @@ if not net:is_floating() then
|
||||||
end
|
end
|
||||||
|
|
||||||
function ifname_single.write(self, s, val)
|
function ifname_single.write(self, s, val)
|
||||||
local i
|
local _, i
|
||||||
local new_ifs = { }
|
local new_ifs = { }
|
||||||
local old_ifs = { }
|
local old_ifs = { }
|
||||||
|
|
||||||
|
local alias = net:is_alias()
|
||||||
|
|
||||||
|
if alias then
|
||||||
|
old_ifs[1] = '@' .. alias
|
||||||
|
else
|
||||||
for _, i in ipairs(net:get_interfaces() or { net:get_interface() }) do
|
for _, i in ipairs(net:get_interfaces() or { net:get_interface() }) do
|
||||||
old_ifs[#old_ifs+1] = i:name()
|
old_ifs[#old_ifs+1] = i:name()
|
||||||
end
|
end
|
||||||
|
end
|
||||||
|
|
||||||
for i in ut.imatch(val) do
|
for i in ut.imatch(val) do
|
||||||
new_ifs[#new_ifs+1] = i
|
new_ifs[#new_ifs+1] = i
|
||||||
|
@ -335,6 +342,7 @@ if not net:is_virtual() then
|
||||||
ifname_multi = s:taboption("physical", Value, "ifname_multi", translate("Interface"))
|
ifname_multi = s:taboption("physical", Value, "ifname_multi", translate("Interface"))
|
||||||
ifname_multi.template = "cbi/network_ifacelist"
|
ifname_multi.template = "cbi/network_ifacelist"
|
||||||
ifname_multi.nobridges = true
|
ifname_multi.nobridges = true
|
||||||
|
ifname_multi.noaliases = true
|
||||||
ifname_multi.rmempty = false
|
ifname_multi.rmempty = false
|
||||||
ifname_multi.network = arg[1]
|
ifname_multi.network = arg[1]
|
||||||
ifname_multi.widget = "checkbox"
|
ifname_multi.widget = "checkbox"
|
||||||
|
|
Loading…
Reference in a new issue