From patchwork Tue Jan 10 15:56:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eyal Shapira X-Patchwork-Id: 135256 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 4C3ABB6FC4 for ; Wed, 11 Jan 2012 02:57:24 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 441B117C00A; Tue, 10 Jan 2012 10:57:21 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ea2m13biyeHG; Tue, 10 Jan 2012 10:57:21 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 3D21B9C114; Tue, 10 Jan 2012 10:57:17 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id F127A9C113 for ; Tue, 10 Jan 2012 10:57:15 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ZEqcqGe5Dnfa for ; Tue, 10 Jan 2012 10:57:11 -0500 (EST) Received: from mail-wi0-f172.google.com (mail-wi0-f172.google.com [209.85.212.172]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id E597417C008 for ; Tue, 10 Jan 2012 10:57:06 -0500 (EST) Received: by wibhj6 with SMTP id hj6so5828481wib.17 for ; Tue, 10 Jan 2012 07:57:05 -0800 (PST) Received: by 10.180.101.3 with SMTP id fc3mr12934720wib.22.1326211025525; Tue, 10 Jan 2012 07:57:05 -0800 (PST) Received: from localhost.localdomain ([77.125.85.134]) by mx.google.com with ESMTPS id fi6sm166000722wib.2.2012.01.10.07.57.03 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 10 Jan 2012 07:57:04 -0800 (PST) From: Eyal Shapira To: Subject: [PATCH] SME: Fix processing of Authentication timeout and failure Date: Tue, 10 Jan 2012 17:56:58 +0200 Message-Id: <1326211018-29318-1-git-send-email-eyal@wizery.com> X-Mailer: git-send-email 1.7.4.1 X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com 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 Signed-hostap: Eyal Shapira --- 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, ¶ms) < 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); return; } @@ -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); }