summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2011-10-26 22:29:57 +0000
committerJo-Philipp Wich <jow@openwrt.org>2011-10-26 22:29:57 +0000
commitf3973132f2f7332894d1e5c92898d20db0d5953f (patch)
tree9a96f0eb8b50006dba1ed4fc9874ef99b42a6a56
parentc3e8976605175dc873653d9fd3d1ab5705593f00 (diff)
modules/admin-full: commit uci and restart corresponding radio when removing wifi networks
-rw-r--r--modules/admin-full/luasrc/controller/admin/network.lua12
1 files changed, 10 insertions, 2 deletions
diff --git a/modules/admin-full/luasrc/controller/admin/network.lua b/modules/admin-full/luasrc/controller/admin/network.lua
index 954ba12f5..87cc040ea 100644
--- a/modules/admin-full/luasrc/controller/admin/network.lua
+++ b/modules/admin-full/luasrc/controller/admin/network.lua
@@ -198,9 +198,17 @@ end
function wifi_delete(network)
local ntm = require "luci.model.network".init()
+ local net = ntm:get_wifinet(network)
- ntm:del_wifinet(network)
- ntm:save("wireless")
+ if net then
+ local dev = net:get_device()
+ if dev then
+ luci.sys.call("env -i /sbin/wifi down %q" % dev:name())
+ ntm:del_wifinet(network)
+ ntm:commit("wireless")
+ luci.sys.call("env -i /sbin/wifi up %q" % dev:name())
+ end
+ end
luci.http.redirect(luci.dispatcher.build_url("admin/network/wireless"))
end