Skip to content

Commit 4f39b24

Browse files
author
Jiang Jiang Jian
committed
Merge branch 'bugfix/wps_reconnect_failure_v5.4' into 'release/v5.4'
fix(wpa_suppplicant): Fix for issue in wps reconnection (Backport v5.4) See merge request espressif/esp-idf!37641
2 parents f884315 + f86473e commit 4f39b24

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

components/wpa_supplicant/esp_supplicant/src/esp_wps.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2019-2024 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2019-2025 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -877,9 +877,11 @@ int wps_finish(void)
877877
return ret;
878878
}
879879

880+
/* This will get executed in the wifi task's context */
880881
static void wps_sm_notify_deauth(void)
881882
{
882-
if (gWpsSm && gWpsSm->wps->state != WPS_FINISHED) {
883+
if (gWpsSm && gWpsSm->wps->state != WPS_FINISHED &&
884+
!gWpsSm->intermediate_disconnect) {
883885
wps_stop_process(WPS_FAIL_REASON_RECV_DEAUTH);
884886
}
885887
}
@@ -1593,6 +1595,7 @@ wifi_station_wps_deinit(void)
15931595
sm->wps = NULL;
15941596
}
15951597
if (s_wps_sm_cb) {
1598+
s_wps_sm_cb->wps_sm_notify_deauth = NULL;
15961599
os_free(s_wps_sm_cb);
15971600
s_wps_sm_cb = NULL;
15981601
}
@@ -1643,7 +1646,9 @@ wifi_wps_scan_done(void *arg, ETS_STATUS status)
16431646
sm->discover_ssid_cnt = 0;
16441647

16451648
if (wps_get_status() == WPS_STATUS_PENDING) {
1649+
sm->intermediate_disconnect = true;
16461650
esp_wifi_disconnect();
1651+
sm->intermediate_disconnect = false;
16471652

16481653
os_memcpy(wifi_config.sta.bssid, sm->bssid, ETH_ALEN);
16491654
os_memcpy(wifi_config.sta.ssid, (char *)sm->creds[0].ssid, sm->creds[0].ssid_len);

components/wpa_supplicant/esp_supplicant/src/esp_wps_i.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ struct wps_sm {
8484
bool wps_pbc_overlap;
8585
struct discard_ap_list_t dis_ap_list[WPS_MAX_DIS_AP_NUM];
8686
u8 discard_ap_cnt;
87+
bool intermediate_disconnect;
8788
};
8889

8990
#define API_MUTEX_TAKE() do {\

0 commit comments

Comments
 (0)