mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2025-12-10 08:44:39 +01:00
hostapd: add ubus support to disasoc/deauth all wireless STAs
Similar to the hostapd control interface, treat ff:ff:ff:ff:ff:ff as a stand in for "all clients". Signed-off-by: Rany Hany <rany_hany@riseup.net> Link: https://github.com/openwrt/openwrt/pull/18670 Signed-off-by: Robert Marko <robimarko@gmail.com>
This commit is contained in:
parent
cc20942931
commit
5d7107ef63
1 changed files with 10 additions and 5 deletions
|
|
@ -476,6 +476,7 @@ hostapd_bss_del_client(struct ubus_context *ctx, struct ubus_object *obj,
|
||||||
struct blob_attr *msg)
|
struct blob_attr *msg)
|
||||||
{
|
{
|
||||||
struct blob_attr *tb[__DEL_CLIENT_MAX];
|
struct blob_attr *tb[__DEL_CLIENT_MAX];
|
||||||
|
const u8 bcast[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
|
||||||
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
|
struct hostapd_data *hapd = container_of(obj, struct hostapd_data, ubus.obj);
|
||||||
struct sta_info *sta;
|
struct sta_info *sta;
|
||||||
bool deauth = false;
|
bool deauth = false;
|
||||||
|
|
@ -496,15 +497,19 @@ hostapd_bss_del_client(struct ubus_context *ctx, struct ubus_object *obj,
|
||||||
if (tb[DEL_CLIENT_DEAUTH])
|
if (tb[DEL_CLIENT_DEAUTH])
|
||||||
deauth = blobmsg_get_bool(tb[DEL_CLIENT_DEAUTH]);
|
deauth = blobmsg_get_bool(tb[DEL_CLIENT_DEAUTH]);
|
||||||
|
|
||||||
|
if (deauth)
|
||||||
|
hostapd_drv_sta_deauth(hapd, addr, reason);
|
||||||
|
else
|
||||||
|
hostapd_drv_sta_disassoc(hapd, addr, reason);
|
||||||
|
|
||||||
sta = ap_get_sta(hapd, addr);
|
sta = ap_get_sta(hapd, addr);
|
||||||
if (sta) {
|
if (sta) {
|
||||||
if (deauth) {
|
if (deauth)
|
||||||
hostapd_drv_sta_deauth(hapd, addr, reason);
|
|
||||||
ap_sta_deauthenticate(hapd, sta, reason);
|
ap_sta_deauthenticate(hapd, sta, reason);
|
||||||
} else {
|
else
|
||||||
hostapd_drv_sta_disassoc(hapd, addr, reason);
|
|
||||||
ap_sta_disassociate(hapd, sta, reason);
|
ap_sta_disassociate(hapd, sta, reason);
|
||||||
}
|
} else if (memcmp(addr, bcast, ETH_ALEN) == 0) {
|
||||||
|
hostapd_free_stas(hapd);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tb[DEL_CLIENT_BAN_TIME])
|
if (tb[DEL_CLIENT_BAN_TIME])
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue