esp_wifi: Move wpa_supplicant WIFI_EVENT_STA_CONNECTED and WIFI_EVENT_STA_DISCONNECTED event handlers into callbacks

Executing supplicant WIFI_EVENT_STA_CONNECTED and WIFI_EVENT_STA_DISCONNECTED handlers in event-handler context can lead to concurrency issues.
Moving the functionality into 'wpa_sta_connected_cb' and 'wpa_sta_disconnected_cb' callbacks and execute in ppTask context.
This commit is contained in:
Sarvesh Bodakhe
2023-03-31 12:32:01 +05:30
parent 7fb6f3b9e3
commit b89a851645
5 changed files with 49 additions and 54 deletions

View File

@@ -228,6 +228,11 @@ int wpa_parse_wpa_ie_wrapper(const u8 *wpa_ie, size_t wpa_ie_len, wifi_wpa_ie_t
return ret;
}
static void wpa_sta_connected_cb(uint8_t *bssid)
{
supplicant_sta_conn_handler(bssid);
}
static void wpa_sta_disconnected_cb(uint8_t reason_code)
{
switch (reason_code) {
@@ -250,6 +255,8 @@ static void wpa_sta_disconnected_cb(uint8_t reason_code)
#ifdef CONFIG_OWE_STA
owe_deinit();
#endif /* CONFIG_OWE_STA */
supplicant_sta_disconn_handler();
}
#ifdef CONFIG_ESP_WIFI_SOFTAP_SUPPORT
@@ -326,6 +333,7 @@ int esp_supplicant_init(void)
wpa_cb->wpa_sta_deinit = wpa_deattach;
wpa_cb->wpa_sta_rx_eapol = wpa_sm_rx_eapol;
wpa_cb->wpa_sta_connect = wpa_sta_connect;
wpa_cb->wpa_sta_connected_cb = wpa_sta_connected_cb;
wpa_cb->wpa_sta_disconnected_cb = wpa_sta_disconnected_cb;
wpa_cb->wpa_sta_in_4way_handshake = wpa_sta_in_4way_handshake;