fix(wifi): Make sure auth is sent after sae process

This commit is contained in:
Shreyas Sheth
2024-09-10 13:44:16 +05:30
committed by BOT
parent d402b239d6
commit bdd9c2a0f1
4 changed files with 21 additions and 4 deletions

View File

@ -526,6 +526,11 @@ static void wpa3_process_rx_confirm(wpa3_hostap_auth_event_t *evt)
goto done; goto done;
} }
if (ret == WLAN_STATUS_SUCCESS) { if (ret == WLAN_STATUS_SUCCESS) {
if (sta->sae_data && esp_send_sae_auth_reply(hapd, sta->addr, frm->bssid, WLAN_AUTH_SAE, 2,
WLAN_STATUS_SUCCESS, wpabuf_head(sta->sae_data), wpabuf_len(sta->sae_data)) != ESP_OK) {
ap_free_sta(hapd, sta);
goto done;
}
if (esp_wifi_ap_notify_node_sae_auth_done(frm->bssid) != true) { if (esp_wifi_ap_notify_node_sae_auth_done(frm->bssid) != true) {
ap_free_sta(hapd, sta); ap_free_sta(hapd, sta);
goto done; goto done;
@ -541,6 +546,10 @@ static void wpa3_process_rx_confirm(wpa3_hostap_auth_event_t *evt)
} }
} }
done: done:
if (sta && sta->sae_data) {
wpabuf_free(sta->sae_data);
sta->sae_data = NULL;
}
os_free(frm); os_free(frm);
} }

View File

@ -180,13 +180,16 @@ static int auth_sae_send_confirm(struct hostapd_data *hapd,
if (sta->remove_pending) { if (sta->remove_pending) {
reply_res = -1; reply_res = -1;
} else { } else {
reply_res = esp_send_sae_auth_reply(hapd, sta->addr, bssid, WLAN_AUTH_SAE, 2, if (sta->sae_data)
WLAN_STATUS_SUCCESS, wpabuf_head(data), wpabuf_free(data);
wpabuf_len(data)); sta->sae_data = data;
reply_res = 0;
/* confirm is sent in later stage when all the required processing for a sta is done*/
} }
#else
wpabuf_free(data);
#endif /* ESP_SUPPLICANT */ #endif /* ESP_SUPPLICANT */
wpabuf_free(data);
return reply_res; return reply_res;
} }

View File

@ -113,6 +113,10 @@ void ap_free_sta(struct hostapd_data *hapd, struct sta_info *sta)
os_mutex_delete(sta->lock); os_mutex_delete(sta->lock);
sta->lock = NULL; sta->lock = NULL;
} }
if (sta->sae_data) {
wpabuf_free(sta->sae_data);
sta->sae_data = NULL;
}
#endif /* CONFIG_SAE */ #endif /* CONFIG_SAE */
wpa_auth_sta_deinit(sta->wpa_sm); wpa_auth_sta_deinit(sta->wpa_sm);
#ifdef CONFIG_WPS_REGISTRAR #ifdef CONFIG_WPS_REGISTRAR

View File

@ -66,6 +66,7 @@ struct sta_info {
* processing commit for that station */ * processing commit for that station */
bool remove_pending; /* Flag to indicate to free station when bool remove_pending; /* Flag to indicate to free station when
* whose mutex is taken by task */ * whose mutex is taken by task */
struct wpabuf *sae_data;
#endif /* CONFIG_SAE */ #endif /* CONFIG_SAE */
#endif /* ESP_SUPPLICANT */ #endif /* ESP_SUPPLICANT */