mirror of
https://github.com/espressif/esp-idf.git
synced 2025-09-03 23:11:34 +00:00
fix(esp_wifi): Backport some wifi fixes
1. Fix memory leak caused by assoc IE and retry timer
2. Discard commit frame received at confirmed state in SAE
3. Ignore immediate assoc req received from the station while we are
processing the older one. Fix regression caused by 4cb4faa9
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD
|
||||
* SPDX-FileCopyrightText: 2019-2023 Espressif Systems (Shanghai) CO LTD
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
@@ -304,18 +304,31 @@ static bool hostap_sta_join(void **sta, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len,u8
|
||||
}
|
||||
|
||||
if (*sta && !esp_wifi_ap_is_sta_sae_reauth_node(bssid)) {
|
||||
ap_free_sta(hapd, *sta);
|
||||
ap_free_sta(hapd, *sta);
|
||||
}
|
||||
|
||||
sta_info = ap_sta_add(hapd, bssid);
|
||||
if (!sta_info) {
|
||||
wpa_printf(MSG_ERROR, "failed to add station " MACSTR, MAC2STR(bssid));
|
||||
goto fail;
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_SAE
|
||||
if (sta_info->lock && os_semphr_take(sta_info->lock, 0) != TRUE) {
|
||||
wpa_printf(MSG_INFO, "Ignore assoc request as softap is busy with sae calculation for station "MACSTR, MAC2STR(bssid));
|
||||
return false;
|
||||
}
|
||||
#endif /* CONFIG_SAE */
|
||||
|
||||
#ifdef CONFIG_WPS_REGISTRAR
|
||||
if (check_n_add_wps_sta(hapd, sta_info, wpa_ie, wpa_ie_len, pmf_enable, subtype) == 0) {
|
||||
if (sta_info->eapol_sm) {
|
||||
*sta = sta_info;
|
||||
#ifdef CONFIG_SAE
|
||||
if (sta_info->lock) {
|
||||
os_semphr_give(sta_info->lock);
|
||||
}
|
||||
#endif /* CONFIG_SAE */
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
@@ -324,6 +337,11 @@ static bool hostap_sta_join(void **sta, u8 *bssid, u8 *wpa_ie, u8 wpa_ie_len,u8
|
||||
#endif
|
||||
if (wpa_ap_join(sta_info, bssid, wpa_ie, wpa_ie_len, rsnxe, rsnxe_len, pmf_enable, subtype)) {
|
||||
*sta = sta_info;
|
||||
#ifdef CONFIG_SAE
|
||||
if (sta_info->lock) {
|
||||
os_semphr_give(sta_info->lock);
|
||||
}
|
||||
#endif /* CONFIG_SAE */
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -398,6 +416,7 @@ int esp_supplicant_init(void)
|
||||
int esp_supplicant_deinit(void)
|
||||
{
|
||||
esp_supplicant_common_deinit();
|
||||
esp_supplicant_unset_all_appie();
|
||||
eloop_destroy();
|
||||
wpa_cb = NULL;
|
||||
return esp_wifi_unregister_wpa_cb_internal();
|
||||
|
Reference in New Issue
Block a user