diff options
author | Wang805447391 <805447391@qq.com> | 2018-11-12 15:03:31 +0800 |
---|---|---|
committer | Jo-Philipp Wich <jo@mein.io> | 2018-11-15 08:28:45 +0100 |
commit | 09ac96ede9f15119ee08c34ba05f885aeaa8e449 (patch) | |
tree | 1a7164224606a86654bcbbb75dd925b5d43077a1 /modules/luci-base/luasrc/controller/admin/index.lua | |
parent | 8aeb78d1c1893e1bcf0e3a8f8a2c17fa6ffbb6d2 (diff) |
luci-base: support disconnecting (deauthenticating) wireless clients
Add a button to each row in the wireless assoclist table to allow
disconnecting clients using the ubus del_client method if the underlying
radio interface supports it.
Ref: https://github.com/openwrt/luci/pull/2271
Submitted-by: Wang805447391 <805447391@qq.com>
[move deauth function to luci-base next to the existing assoclist function,
require post security, fix parameter check condition, hide button if not
supported by the radio, disable button after call, squash commits, fix
whitespace, reword subject, add commit message]
Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'modules/luci-base/luasrc/controller/admin/index.lua')
-rw-r--r-- | modules/luci-base/luasrc/controller/admin/index.lua | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/luci-base/luasrc/controller/admin/index.lua b/modules/luci-base/luasrc/controller/admin/index.lua index 39004c6760..1f7db0cb38 100644 --- a/modules/luci-base/luasrc/controller/admin/index.lua +++ b/modules/luci-base/luasrc/controller/admin/index.lua @@ -80,6 +80,9 @@ function index() if has_wifi then page = entry({"admin", "wireless_assoclist"}, call("wifi_assoclist"), nil) page.leaf = true + + page = entry({"admin", "wireless_deauth"}, post("wifi_deauth"), nil) + page.leaf = true end page = entry({"admin", "translations"}, call("action_translations"), nil) @@ -144,3 +147,18 @@ function wifi_assoclist() luci.http.prepare_content("application/json") luci.http.write_json(s.wifi_assoclist()) end + +function wifi_deauth() + local iface = luci.http.formvalue("iface") + local bssid = luci.http.formvalue("bssid") + + if iface and bssid then + luci.util.ubus("hostapd.%s" % iface, "del_client", { + addr = bssid, + deauth = true, + reason = 5, + ban_time = 60000 + }) + end + luci.http.status(200, "OK") +end |