|
| 1 | +diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wps.c b/components/wpa_supplicant/esp_supplicant/src/esp_wps.c |
| 2 | +index 1ac9258f94..1d3a80d5bd 100644 |
| 3 | +--- a/components/wpa_supplicant/esp_supplicant/src/esp_wps.c |
| 4 | ++++ b/components/wpa_supplicant/esp_supplicant/src/esp_wps.c |
| 5 | +@@ -1,5 +1,5 @@ |
| 6 | + /* |
| 7 | +- * SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD |
| 8 | ++ * SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD |
| 9 | + * |
| 10 | + * SPDX-License-Identifier: Apache-2.0 |
| 11 | + */ |
| 12 | +@@ -887,9 +887,11 @@ int wps_finish(void) |
| 13 | + return ret; |
| 14 | + } |
| 15 | + |
| 16 | ++/* This will get executed in the wifi task's context */ |
| 17 | + static void wps_sm_notify_deauth(void) |
| 18 | + { |
| 19 | +- if (gWpsSm && gWpsSm->wps->state != WPS_FINISHED) { |
| 20 | ++ if (gWpsSm && gWpsSm->wps->state != WPS_FINISHED && |
| 21 | ++ !gWpsSm->intermediate_disconnect) { |
| 22 | + wps_stop_process(WPS_FAIL_REASON_RECV_DEAUTH); |
| 23 | + } |
| 24 | + } |
| 25 | +@@ -1603,6 +1605,7 @@ wifi_station_wps_deinit(void) |
| 26 | + sm->wps = NULL; |
| 27 | + } |
| 28 | + if (s_wps_sm_cb) { |
| 29 | ++ s_wps_sm_cb->wps_sm_notify_deauth = NULL; |
| 30 | + os_free(s_wps_sm_cb); |
| 31 | + s_wps_sm_cb = NULL; |
| 32 | + } |
| 33 | +@@ -1653,7 +1656,9 @@ wifi_wps_scan_done(void *arg, ETS_STATUS status) |
| 34 | + sm->discover_ssid_cnt = 0; |
| 35 | + |
| 36 | + if (wps_get_status() == WPS_STATUS_PENDING) { |
| 37 | ++ sm->intermediate_disconnect = true; |
| 38 | + esp_wifi_disconnect(); |
| 39 | ++ sm->intermediate_disconnect = false; |
| 40 | + |
| 41 | + os_memcpy(wifi_config.sta.bssid, sm->bssid, ETH_ALEN); |
| 42 | + os_memcpy(wifi_config.sta.ssid, (char *)sm->creds[0].ssid, sm->creds[0].ssid_len); |
| 43 | +diff --git a/components/wpa_supplicant/esp_supplicant/src/esp_wps_i.h b/components/wpa_supplicant/esp_supplicant/src/esp_wps_i.h |
| 44 | +index ce17d9047a..4f64b289f1 100644 |
| 45 | +--- a/components/wpa_supplicant/esp_supplicant/src/esp_wps_i.h |
| 46 | ++++ b/components/wpa_supplicant/esp_supplicant/src/esp_wps_i.h |
| 47 | +@@ -84,6 +84,7 @@ struct wps_sm { |
| 48 | + bool wps_pbc_overlap; |
| 49 | + struct discard_ap_list_t dis_ap_list[WPS_MAX_DIS_AP_NUM]; |
| 50 | + u8 discard_ap_cnt; |
| 51 | ++ bool intermediate_disconnect; |
| 52 | + }; |
| 53 | + |
| 54 | + #define API_MUTEX_TAKE() do {\ |
0 commit comments