From c36c3920fca3768a2565eae9ed323c8d244aecd1 Mon Sep 17 00:00:00 2001 From: Sarvesh Bodakhe Date: Mon, 29 Apr 2024 12:59:21 +0530 Subject: [PATCH] fix(wpa_supplicant): Handle case when WPS registrar misses WSC_DONE sent by station When registrar somehow misses the WSC_DONE sent by station and station goes for next connection after sending deauth, make sure that softAP disables the registrar. --- .../wpa_supplicant/esp_supplicant/src/esp_hostpad_wps.c | 2 +- components/wpa_supplicant/src/eap_server/eap_server_wsc.c | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_hostpad_wps.c b/components/wpa_supplicant/esp_supplicant/src/esp_hostpad_wps.c index 869deccc6e..c96ca958e0 100644 --- a/components/wpa_supplicant/esp_supplicant/src/esp_hostpad_wps.c +++ b/components/wpa_supplicant/esp_supplicant/src/esp_hostpad_wps.c @@ -221,7 +221,7 @@ int esp_wifi_ap_wps_enable(const esp_wps_config_t *config) return ret; } -static int wifi_ap_wps_disable_internal(void) +int wifi_ap_wps_disable_internal(void) { struct wps_sm *sm = gWpsSm; diff --git a/components/wpa_supplicant/src/eap_server/eap_server_wsc.c b/components/wpa_supplicant/src/eap_server/eap_server_wsc.c index f3c4756257..653480efcc 100644 --- a/components/wpa_supplicant/src/eap_server/eap_server_wsc.c +++ b/components/wpa_supplicant/src/eap_server/eap_server_wsc.c @@ -103,6 +103,13 @@ static void eap_wsc_reset(struct eap_sm *sm, void *priv) wpabuf_free(data->out_buf); //wps_deinit(data->wps); os_free(data); +#ifdef ESP_SUPPLICANT + /* TODO: When wps-registrar is shifted in a separate task other than wifi task, + * call esp_wifi_ap_wps_disable() here instead of wifi_ap_wps_disable_internal() + * */ + extern int wifi_ap_wps_disable_internal(void); + wifi_ap_wps_disable_internal(); +#endif }