summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-full
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-10-26 22:52:18 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-10-26 22:52:18 +0000
commitda527d2c4403ec414c871938e5470f23fc489e88 (patch)
tree0cabc3f14a9a063205260de1204824bee145e3f3 /modules/admin-full
parentf3973132f2f7332894d1e5c92898d20db0d5953f (diff)
modules/admin-full: remove associated network for the wifi-iface as well if it would be empty afterwards
Diffstat (limited to 'modules/admin-full')
-rw-r--r--modules/admin-full/luasrc/controller/admin/network.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/modules/admin-full/luasrc/controller/admin/network.lua b/modules/admin-full/luasrc/controller/admin/network.lua
index 87cc040ea..40856af2c 100644
--- a/modules/admin-full/luasrc/controller/admin/network.lua
+++ b/modules/admin-full/luasrc/controller/admin/network.lua
@@ -198,14 +198,18 @@ end
function wifi_delete(network)
local ntm = require "luci.model.network".init()
- local net = ntm:get_wifinet(network)
-
- if net then
- local dev = net:get_device()
+ local wnet = ntm:get_wifinet(network)
+ if wnet then
+ local dev = wnet:get_device()
+ local net = wnet:get_network()
if dev then
luci.sys.call("env -i /sbin/wifi down %q" % dev:name())
ntm:del_wifinet(network)
ntm:commit("wireless")
+ if net:is_empty() then
+ ntm:del_network(net:name())
+ ntm:commit("network")
+ end
luci.sys.call("env -i /sbin/wifi up %q" % dev:name())
end
end