From: Gal Savion Date: Wed, 1 May 2024 11:11:39 +0000 (+0300) Subject: Avoid sending DEAUTH or DISASSOC packet when using flag tx=0 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=23456e480e09a5a8a35f2d618fc335c3b4d85bed;p=thirdparty%2Fhostap.git Avoid sending DEAUTH or DISASSOC packet when using flag tx=0 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 --- diff --git a/src/ap/ctrl_iface_ap.c b/src/ap/ctrl_iface_ap.c index d4d73de19..27792c87e 100644 --- a/src/ap/ctrl_iface_ap.c +++ b/src/ap/ctrl_iface_ap.c @@ -661,15 +661,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; } @@ -723,15 +726,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; }