1 --- a/src/ap/sta_info.c
2 +++ b/src/ap/sta_info.c
7 -static int ap_sta_in_other_bss(struct hostapd_data *hapd,
8 - struct sta_info *sta, u32 flags);
9 +static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
10 + struct sta_info *sta);
11 static void ap_handle_session_timer(void *eloop_ctx, void *timeout_ctx);
12 #ifdef CONFIG_IEEE80211W
13 static void ap_sa_query_timer(void *eloop_ctx, void *timeout_ctx);
14 @@ -123,8 +123,8 @@ void ap_free_sta(struct hostapd_data *ha
16 if (sta->flags & WLAN_STA_WDS)
17 hapd->drv.set_wds_sta(hapd, sta->addr, sta->aid, 0);
18 - if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC) &&
19 - !(sta->flags & WLAN_STA_PREAUTH))
21 + if (!(sta->flags & WLAN_STA_PREAUTH))
22 hapd->drv.sta_remove(hapd, sta->addr);
24 ap_sta_hash_del(hapd, sta);
25 @@ -451,6 +451,7 @@ struct sta_info * ap_sta_add(struct host
27 ap_sta_hash_add(hapd, sta);
28 sta->ssid = &hapd->conf->ssid;
29 + ap_sta_remove_in_other_bss(hapd, sta);
33 @@ -472,8 +473,8 @@ static int ap_sta_remove(struct hostapd_
37 -static int ap_sta_in_other_bss(struct hostapd_data *hapd,
38 - struct sta_info *sta, u32 flags)
39 +static void ap_sta_remove_in_other_bss(struct hostapd_data *hapd,
40 + struct sta_info *sta)
42 struct hostapd_iface *iface = hapd->iface;
44 @@ -488,11 +489,11 @@ static int ap_sta_in_other_bss(struct ho
45 if (bss == hapd || bss == NULL)
47 sta2 = ap_get_sta(bss, sta->addr);
48 - if (sta2 && ((sta2->flags & flags) == flags))
55 + ap_sta_disconnect(bss, sta2, sta2->addr, WLAN_REASON_DEAUTH_LEAVING);
60 @@ -502,8 +503,7 @@ void ap_sta_disassociate(struct hostapd_
61 wpa_printf(MSG_DEBUG, "%s: disassociate STA " MACSTR,
62 hapd->conf->iface, MAC2STR(sta->addr));
63 sta->flags &= ~WLAN_STA_ASSOC;
64 - if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC))
65 - ap_sta_remove(hapd, sta);
66 + ap_sta_remove(hapd, sta);
67 sta->timeout_next = STA_DEAUTH;
68 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
69 eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DISASSOC, 0,
70 @@ -521,8 +521,7 @@ void ap_sta_deauthenticate(struct hostap
71 wpa_printf(MSG_DEBUG, "%s: deauthenticate STA " MACSTR,
72 hapd->conf->iface, MAC2STR(sta->addr));
73 sta->flags &= ~(WLAN_STA_AUTH | WLAN_STA_ASSOC);
74 - if (!ap_sta_in_other_bss(hapd, sta, WLAN_STA_ASSOC))
75 - ap_sta_remove(hapd, sta);
76 + ap_sta_remove(hapd, sta);
77 sta->timeout_next = STA_REMOVE;
78 eloop_cancel_timeout(ap_handle_timer, hapd, sta);
79 eloop_register_timeout(AP_MAX_INACTIVITY_AFTER_DEAUTH, 0,