summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-full
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2012-06-26 21:49:27 +0000
committerJo-Philipp Wich <jow@openwrt.org>2012-06-26 21:49:27 +0000
commit254ad2dfd1bd5bcf42e7b53c3b1db13e46465933 (patch)
treea689ccf76a4057238e2ab347e50d4692ae906a9d /modules/admin-full
parent61883f2c3fdad559dd1362ca76c258793cd32c82 (diff)
modules/admin-full: when deleting wifi-ifaces, remove all empty leftover networks, not only the first one
Diffstat (limited to 'modules/admin-full')
-rw-r--r--modules/admin-full/luasrc/controller/admin/network.lua15
1 files changed, 9 insertions, 6 deletions
diff --git a/modules/admin-full/luasrc/controller/admin/network.lua b/modules/admin-full/luasrc/controller/admin/network.lua
index 759ad68a28..85d7b18dd5 100644
--- a/modules/admin-full/luasrc/controller/admin/network.lua
+++ b/modules/admin-full/luasrc/controller/admin/network.lua
@@ -43,13 +43,13 @@ function index()
local has_wifi = false
-
+
uci:foreach("wireless", "wifi-device",
function(s)
has_wifi = true
return false
end)
-
+
if has_wifi then
page = entry({"admin", "network", "wireless_join"}, call("wifi_join"), nil)
page.leaf = true
@@ -214,14 +214,17 @@ 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
- ntm:del_network(net:name())
- ntm:commit("network")
+ 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