summaryrefslogtreecommitdiffhomepage
path: root/modules/admin-full/luasrc/controller/admin/network.lua
diff options
context:
space:
mode:
Diffstat (limited to 'modules/admin-full/luasrc/controller/admin/network.lua')
-rw-r--r--modules/admin-full/luasrc/controller/admin/network.lua20
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"