[openwrt/openwrt] hostapd: add ubus support to disasoc/deauth all wireless STAs

LEDE Commits lede-commits at lists.infradead.org
Mon Dec 8 08:26:11 PST 2025


robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/5d7107ef637b0249ba1d4fee1e15e81e7f95332c

commit 5d7107ef637b0249ba1d4fee1e15e81e7f95332c
Author: Rany Hany <rany_hany at riseup.net>
AuthorDate: Thu May 1 16:46:35 2025 +0000

    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 at riseup.net>
    Link: https://github.com/openwrt/openwrt/pull/18670
    Signed-off-by: Robert Marko <robimarko at gmail.com>
---
 package/network/services/hostapd/src/src/ap/ubus.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/package/network/services/hostapd/src/src/ap/ubus.c b/package/network/services/hostapd/src/src/ap/ubus.c
index a1420619a3..6c23078a69 100644
--- a/package/network/services/hostapd/src/src/ap/ubus.c
+++ b/package/network/services/hostapd/src/src/ap/ubus.c
@@ -476,6 +476,7 @@ hostapd_bss_del_client(struct ubus_context *ctx, struct ubus_object *obj,
 			struct blob_attr *msg)
 {
 	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 sta_info *sta;
 	bool deauth = false;
@@ -496,15 +497,19 @@ hostapd_bss_del_client(struct ubus_context *ctx, struct ubus_object *obj,
 	if (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);
 	if (sta) {
-		if (deauth) {
-			hostapd_drv_sta_deauth(hapd, addr, reason);
+		if (deauth)
 			ap_sta_deauthenticate(hapd, sta, reason);
-		} else {
-			hostapd_drv_sta_disassoc(hapd, addr, reason);
+		else
 			ap_sta_disassociate(hapd, sta, reason);
-		}
+	} else if (memcmp(addr, bcast, ETH_ALEN) == 0) {
+		hostapd_free_stas(hapd);
 	}
 
 	if (tb[DEL_CLIENT_BAN_TIME])




More information about the lede-commits mailing list