[PATCH 1/2] Do not stall after a connection failure with multiple networks
Gustavo Bertoli
gubertoli at gmail.com
Wed Nov 11 11:07:06 PST 2026
Most callers of wpas_connection_failed() set WPA_DISCONNECTED only after
it returns. With more than one enabled network, the fast associate after
the first failure can select the same BSS again, and
wpa_supplicant_connect() skips it as an ongoing attempt. No retry or scan
is scheduled, so the other enabled networks are not tried and the
station stays disconnected. Set WPA_DISCONNECTED before the fast
associate.
Fixes: bbcc1adbc0de ("Try the next AP from scan results if connection attempt fails")
Signed-off-by: Gustavo Bertoli <gubertoli at gmail.com>
---
wpa_supplicant/wpa_supplicant.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 74fad8678..013451bb6 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -10067,8 +10067,14 @@ void wpas_connection_failed(struct wpa_supplicant *wpa_s, const u8 *bssid,
* next. Otherwise, we may as well try this one once more
* before allowing other, likely worse, ESSes to be considered.
*/
- if (count == 1 && wpa_supplicant_fast_associate(wpa_s) == 1)
- return;
+ if (count == 1) {
+ /* Do not let the retry be skipped as an ongoing attempt */
+ if (wpa_s->wpa_state == WPA_AUTHENTICATING ||
+ wpa_s->wpa_state == WPA_ASSOCIATING)
+ wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
+ if (wpa_supplicant_fast_associate(wpa_s) == 1)
+ return;
+ }
wpa_s->consecutive_conn_failures++;
--
2.43.0
More information about the Hostap
mailing list