modules/admin-full: when deleting wifi-ifaces, remove all empty leftover networks, not only the first one
This commit is contained in:
parent
61883f2c3f
commit
254ad2dfd1
1 changed files with 9 additions and 6 deletions
|
@ -214,15 +214,18 @@ function wifi_delete(network)
|
|||
local wnet = ntm:get_wifinet(network)
|
||||
if wnet then
|
||||
local dev = wnet:get_device()
|
||||
local net = wnet:get_network()
|
||||
local nets = wnet:get_networks()
|
||||
if dev then
|
||||
luci.sys.call("env -i /sbin/wifi down %q >/dev/null" % dev:name())
|
||||
ntm:del_wifinet(network)
|
||||
ntm:commit("wireless")
|
||||
if net and net:is_empty() then
|
||||
local _, net
|
||||
for _, net in ipairs(nets) do
|
||||
if net:is_empty() then
|
||||
ntm:del_network(net:name())
|
||||
ntm:commit("network")
|
||||
end
|
||||
end
|
||||
luci.sys.call("env -i /sbin/wifi up %q >/dev/null" % dev:name())
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue