diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-09-22 02:43:38 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-09-22 02:43:38 +0000 |
commit | 659a8bdf014a617cd8f254e90d73bed07b4d1e15 (patch) | |
tree | 05d96ef88b231f907c7aef61d6fe81912f4113c9 /modules/admin-full/luasrc/controller/admin | |
parent | 0252fb9da783b8e831108dd7248ed747d8b33229 (diff) |
modules/admin-full: implement per-wifi-iface disable option
Diffstat (limited to 'modules/admin-full/luasrc/controller/admin')
-rw-r--r-- | modules/admin-full/luasrc/controller/admin/network.lua | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/modules/admin-full/luasrc/controller/admin/network.lua b/modules/admin-full/luasrc/controller/admin/network.lua index 85456483a3..d2f17a4fa1 100644 --- a/modules/admin-full/luasrc/controller/admin/network.lua +++ b/modules/admin-full/luasrc/controller/admin/network.lua @@ -343,6 +343,26 @@ function wifi_status() luci.http.status(404, "No such device") end +function wifi_reconnect() + local path = luci.dispatcher.context.requestpath + local mode = path[#path-1] + local wnet = path[#path] + local netmd = require "luci.model.network".init() + + local net = netmd:get_wifinet(wnet) + if net then + net:set("disabled", (mode == "wireless_shutdown") and 1 or nil) + netmd:commit("wireless") + + luci.sys.call("(env -i /sbin/wifi down; env -i /sbin/wifi up) >/dev/null 2>/dev/null") + luci.http.status(200, (mode == "wireless_shutdown") and "Shutdown" or "Reconnected") + + return + end + + luci.http.status(404, "No such radio") +end + function lease_status() local s = require "luci.tools.status" |