hostapd: adjust patches to work with git am
[openwrt/staging/xback.git] / package / network / services / hostapd / patches / 021-fix-sta-add-after-previous-connection.patch
1 From: Felix Fietkau <nbd@nbd.name>
2 Date: Tue, 25 May 2021 10:50:16 +0200
3 Subject: [PATCH] fix adding back stations after a missed deauth/disassoc
4
5 --- a/src/ap/ieee802_11.c
6 +++ b/src/ap/ieee802_11.c
7 @@ -4659,6 +4659,13 @@ static int add_associated_sta(struct hos
8 * drivers to accept the STA parameter configuration. Since this is
9 * after a new FT-over-DS exchange, a new TK has been derived, so key
10 * reinstallation is not a concern for this case.
11 + *
12 + * If the STA was associated and authorized earlier, but came for a new
13 + * connection (!added_unassoc + !reassoc), remove the existing STA entry
14 + * so that it can be re-added. This case is rarely seen when the AP could
15 + * not receive the deauth/disassoc frame from the STA. And the STA comes
16 + * back with new connection within a short period or before the inactive
17 + * STA entry is removed from the list.
18 */
19 wpa_printf(MSG_DEBUG, "Add associated STA " MACSTR
20 " (added_unassoc=%d auth_alg=%u ft_over_ds=%u reassoc=%d authorized=%d ft_tk=%d fils_tk=%d)",
21 @@ -4672,7 +4679,8 @@ static int add_associated_sta(struct hos
22 (!(sta->flags & WLAN_STA_AUTHORIZED) ||
23 (reassoc && sta->ft_over_ds && sta->auth_alg == WLAN_AUTH_FT) ||
24 (!wpa_auth_sta_ft_tk_already_set(sta->wpa_sm) &&
25 - !wpa_auth_sta_fils_tk_already_set(sta->wpa_sm)))) {
26 + !wpa_auth_sta_fils_tk_already_set(sta->wpa_sm)) ||
27 + (!reassoc && (sta->flags & WLAN_STA_AUTHORIZED)))) {
28 hostapd_drv_sta_remove(hapd, sta->addr);
29 wpa_auth_sm_event(sta->wpa_sm, WPA_DRV_STA_REMOVED);
30 set = 0;