[PATCH] SME: Fix processing of Authentication timeout and failure

Eyal Shapira eyal
Tue Jan 10 07:56:58 PST 2012

current_bss and pending_bssid weren't cleaned up so BSS
kept appearing in the scan results even when it was actually gone.
Use wpa_supplicant_mark_disassoc() to cleanup the wpa_s context
instead of just dropping wpa_state back to DISCONNECTED.

Reported-by: Vishal Mahaveer <vishalm at ti.com>
Signed-hostap: Eyal Shapira <eyal at wizery.com>

The problematic flow encountered is as follows:
1. Associated AP is turned off
2. WPAS is notified and attempts to reconnect
by starting a normal scan almost immediately
3. Sometimes the remote AP is still returned in the results
4. WPAS tries to authenticate with the AP
5. This times out because the AP is down
6. However wpa_s->current_bss and pending_bssid were set
at the beginning of the authentication and aren't cleared up
7. This prevents later on the bss from being cleared
from the scan results

 wpa_supplicant/sme.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/sme.c b/wpa_supplicant/sme.c
index c5e47d1..fc28347 100644
--- a/wpa_supplicant/sme.c
+++ b/wpa_supplicant/sme.c
@@ -265,8 +265,8 @@ void sme_authenticate(struct wpa_supplicant *wpa_s,
 	if (wpa_drv_authenticate(wpa_s, &params) < 0) {
 		wpa_msg(wpa_s, MSG_INFO, "SME: Authentication request to the "
 			"driver failed");
-		wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
 		wpas_connection_failed(wpa_s, bss->bssid);
+		wpa_supplicant_mark_disassoc(wpa_s);
@@ -503,8 +503,8 @@ void sme_event_auth_timed_out(struct wpa_supplicant *wpa_s,
 			      union wpa_event_data *data)
 	wpa_dbg(wpa_s, MSG_DEBUG, "SME: Authentication timed out");
-	wpa_supplicant_set_state(wpa_s, WPA_DISCONNECTED);
 	wpas_connection_failed(wpa_s, wpa_s->pending_bssid);
+	wpa_supplicant_mark_disassoc(wpa_s);

More information about the Hostap mailing list