fix(esp_wifi): Deinit WPS registrar during hostapd deinit

This commit is contained in:
Kapil Gupta 2024-09-19 23:07:36 +05:30
parent 13d4235d73
commit 28f12bfb47
3 changed files with 9 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#include "esp_wifi_types.h" #include "esp_wifi_types.h"
#include "esp_wpa3_i.h" #include "esp_wpa3_i.h"
#include "esp_wps.h" #include "esp_wps.h"
#include "esp_wps_i.h"
#define WIFI_PASSWORD_LEN_MAX 65 #define WIFI_PASSWORD_LEN_MAX 65
@ -236,6 +237,9 @@ bool hostap_deinit(void *data)
esp_wifi_unset_appie_internal(WIFI_APPIE_WPA); esp_wifi_unset_appie_internal(WIFI_APPIE_WPA);
esp_wifi_unset_appie_internal(WIFI_APPIE_ASSOC_RESP); esp_wifi_unset_appie_internal(WIFI_APPIE_ASSOC_RESP);
#ifdef CONFIG_WPS_REGISTRAR
wifi_ap_wps_disable_internal();
#endif
#ifdef CONFIG_SAE #ifdef CONFIG_SAE
wpa3_hostap_auth_deinit(); wpa3_hostap_auth_deinit();
/* Wait till lock is released by wpa3 task */ /* Wait till lock is released by wpa3 task */

View File

@ -367,16 +367,19 @@ int wpa3_hostap_post_evt(uint32_t evt_id, uint32_t data)
if (g_wpa3_hostap_evt_queue == NULL) { if (g_wpa3_hostap_evt_queue == NULL) {
WPA3_HOSTAP_AUTH_API_UNLOCK(); WPA3_HOSTAP_AUTH_API_UNLOCK();
os_free(evt); os_free(evt);
wpa_printf(MSG_DEBUG, "hostap evt queue NULL");
return ESP_FAIL; return ESP_FAIL;
} }
} else { } else {
os_free(evt); os_free(evt);
wpa_printf(MSG_DEBUG, "g_wpa3_hostap_auth_api_lock not found");
return ESP_FAIL; return ESP_FAIL;
} }
if (evt->id == SIG_WPA3_RX_CONFIRM || evt->id == SIG_TASK_DEL) { if (evt->id == SIG_WPA3_RX_CONFIRM || evt->id == SIG_TASK_DEL) {
/* prioritising confirm for completing handshake for committed sta */ /* prioritising confirm for completing handshake for committed sta */
if (os_queue_send_to_front(g_wpa3_hostap_evt_queue, &evt, 0) != pdPASS) { if (os_queue_send_to_front(g_wpa3_hostap_evt_queue, &evt, 0) != pdPASS) {
WPA3_HOSTAP_AUTH_API_UNLOCK(); WPA3_HOSTAP_AUTH_API_UNLOCK();
wpa_printf(MSG_DEBUG, "failed to add msg to queue front");
os_free(evt); os_free(evt);
return ESP_FAIL; return ESP_FAIL;
} }
@ -384,6 +387,7 @@ int wpa3_hostap_post_evt(uint32_t evt_id, uint32_t data)
if (os_queue_send(g_wpa3_hostap_evt_queue, &evt, 0) != pdPASS) { if (os_queue_send(g_wpa3_hostap_evt_queue, &evt, 0) != pdPASS) {
WPA3_HOSTAP_AUTH_API_UNLOCK(); WPA3_HOSTAP_AUTH_API_UNLOCK();
os_free(evt); os_free(evt);
wpa_printf(MSG_DEBUG, "failed to send msg to queue");
return ESP_FAIL; return ESP_FAIL;
} }
} }

View File

@ -148,3 +148,4 @@ static inline int wps_set_status(uint32_t status)
bool is_wps_enabled(void); bool is_wps_enabled(void);
int wps_init_cfg_pin(struct wps_config *cfg); int wps_init_cfg_pin(struct wps_config *cfg);
void wifi_station_wps_eapol_start_handle(void *data, void *user_ctx); void wifi_station_wps_eapol_start_handle(void *data, void *user_ctx);
int wifi_ap_wps_disable_internal(void);