[PATCH] Avoid sending DEAUTH or DISASSOC packet when using flag tx=0
Gal Savion
gsavion at maxlinear.com
Thu May 2 00:55:45 PDT 2024
From 1aea804f11200e8e4fe622221590250abda30581 Mon Sep 17 00:00:00 2001
From: Gal Savion <gsavion at maxlinear.com>
Date: Wed, 1 May 2024 14:11:39 +0300
Subject: [PATCH] Avoid sending DEAUTH or DISASSOC packet when using flag tx=0
To: hostap at lists.infradead.org
hostapd would send DISASSOC packet (after quiet DEAUTH) or DEAUTH packet (after
quiet DISASSOC) to the station after some inactivity timeout, even though the
command has tx=0 parameter. Fix this so that tx=0 cleans the STA info without
sending any DISASSOC or DEAUTH packets.
Signed-off-by: Gal Savion <gsavion at maxlinear.com>
---
src/ap/ctrl_iface_ap.c | 34 ++++++++++++++++++++--------------
1 file changed, 20 insertions(+), 14 deletions(-)
diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c
index 1acb97f9b..bcb7cc283 100644
--- a/src/ap/ctrl_iface_ap.c
+++ b/src/ap/ctrl_iface_ap.c
@@ -653,15 +653,18 @@ int hostapd_ctrl_iface_deauthenticate(struct hostapd_data *hapd,
}
#endif /* CONFIG_P2P_MANAGER */
- if (os_strstr(txtaddr, " tx=0"))
+ sta = ap_get_sta(hapd, addr);
+ if (os_strstr(txtaddr, " tx=0")) {
hostapd_drv_sta_remove(hapd, addr);
- else
+ if (sta)
+ ap_free_sta(hapd, sta);
+ } else {
hostapd_drv_sta_deauth(hapd, addr, reason);
- sta = ap_get_sta(hapd, addr);
- if (sta)
- ap_sta_deauthenticate(hapd, sta, reason);
- else if (addr[0] == 0xff)
- hostapd_free_stas(hapd);
+ if (sta)
+ ap_sta_deauthenticate(hapd, sta, reason);
+ else if (addr[0] == 0xff)
+ hostapd_free_stas(hapd);
+ }
return 0;
}
@@ -715,15 +718,18 @@ int hostapd_ctrl_iface_disassociate(struct hostapd_data *hapd,
}
#endif /* CONFIG_P2P_MANAGER */
- if (os_strstr(txtaddr, " tx=0"))
+ sta = ap_get_sta(hapd, addr);
+ if (os_strstr(txtaddr, " tx=0")) {
hostapd_drv_sta_remove(hapd, addr);
- else
+ if (sta)
+ ap_free_sta(hapd, sta);
+ } else {
hostapd_drv_sta_disassoc(hapd, addr, reason);
- sta = ap_get_sta(hapd, addr);
- if (sta)
- ap_sta_disassociate(hapd, sta, reason);
- else if (addr[0] == 0xff)
- hostapd_free_stas(hapd);
+ if (sta)
+ ap_sta_disassociate(hapd, sta, reason);
+ else if (addr[0] == 0xff)
+ hostapd_free_stas(hapd);
+ }
return 0;
}
--
2.17.1
More information about the Hostap
mailing list