]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
Avoid sending DEAUTH or DISASSOC packet when using flag tx=0
authorGal Savion <gsavion@maxlinear.com>
Wed, 1 May 2024 11:11:39 +0000 (14:11 +0300)
committerJouni Malinen <j@w1.fi>
Sat, 3 Aug 2024 17:25:20 +0000 (20:25 +0300)
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@maxlinear.com>
src/ap/ctrl_iface_ap.c

index d4d73de19d192938d9e65be214e25649102f4f5e..27792c87e0fb0e7b9d5030178ef49177f323b107 100644 (file)
@@ -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;
 }