From patchwork Sat Jun 9 09:49:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jouni Malinen X-Patchwork-Id: 163906 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 97865B6F86 for ; Sat, 9 Jun 2012 19:49:33 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 9FAB09D33B; Sat, 9 Jun 2012 05:49:30 -0400 (EDT) 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 QUolvandMAU6; Sat, 9 Jun 2012 05:49:30 -0400 (EDT) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 4BA779D332; Sat, 9 Jun 2012 05:49:26 -0400 (EDT) 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 8955E9D332 for ; Sat, 9 Jun 2012 05:49:24 -0400 (EDT) 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 xvXRMlJdlp4Q for ; Sat, 9 Jun 2012 05:49:20 -0400 (EDT) Received: from jmaline2.user.openhosting.com (kvm.w1.fi [128.177.28.162]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id D0A5C9D331 for ; Sat, 9 Jun 2012 05:49:20 -0400 (EDT) Received: from jm (91-157-44-184.elisa-laajakaista.fi [91.157.44.184]) (authenticated bits=0) by jmaline2.user.openhosting.com (8.13.8/8.13.8) with ESMTP id q599ivn3006033 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Sat, 9 Jun 2012 05:44:58 -0400 Received: by jm (sSMTP sendmail emulation); Sat, 09 Jun 2012 12:49:17 +0300 Date: Sat, 9 Jun 2012 12:49:17 +0300 From: Jouni Malinen To: hostap@lists.shmoo.com Subject: Re: [PATCH] wpa_supplicant: clear bssid state on deauth Message-ID: <20120609094917.GE4128@w1.fi> Mail-Followup-To: hostap@lists.shmoo.com References: <1338359568-11869-1-git-send-email-arik@wizery.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1338359568-11869-1-git-send-email-arik@wizery.com> User-Agent: Mutt/1.5.21 (2010-09-15) 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: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com On Wed, May 30, 2012 at 09:32:48AM +0300, Arik Nemtsov wrote: > When de-authenticated by an AP, the state of wpa_s should be cleared, > especially the previous bssid. Otherwise, we will use re-assoc packets > when associating to the same AP. This is not according to spec, and some > APs refuse to association. Would you be able to identify such an AP that rejects the reassociation in this type of case? > I'm not 100% sure with this patch, I just tried to copy the relevant > parts from sme_deauth(). But it definitely fixed some real world issues > we encountered with a mac80211 based driver. With prev_bssid_set == 1, > re-assoc packets are used in mac80211 during association. sme_deauth() is used when the local end is forcing deauthentication, so this may not be the ideal place to copy from.. I would assume that setting wpa_s->sme.prev_bssid_set = 0 is the only part that is really needed here. > diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c > @@ -2246,6 +2246,18 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, > + > +#ifdef CONFIG_AP > + if (wpa_s->ap_iface == NULL) > +#endif /* CONFIG_AP */ > + { > +#ifdef CONFIG_SME > + wpa_s->sme.prev_bssid_set = 0; > +#endif /* CONFIG_SME */ > + wpa_supplicant_set_state(wpa_s, > + WPA_DISCONNECTED); > + os_memset(wpa_s->bssid, 0, ETH_ALEN); > + } > } > #ifdef CONFIG_AP > if (wpa_s->ap_iface && data && data->deauth_info.addr) { Those added lines are used only for deauthentication case. Why would this not be done for disassociation? What is the purpose of set_sta(DISCONNECTED) and clearing of wpa_s->bssid here? Something like this could be better way of achieving the main goal of not using reassociation: Could you please confirm that this resolves the issue you've seen? diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index d09be6c..e7dfa4e 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -121,6 +121,9 @@ void wpa_supplicant_mark_disassoc(struct wpa_supplicant *wpa_s) bssid_changed = !is_zero_ether_addr(wpa_s->bssid); os_memset(wpa_s->bssid, 0, ETH_ALEN); os_memset(wpa_s->pending_bssid, 0, ETH_ALEN); +#ifdef CONFIG_SME + wpa_s->sme.prev_bssid_set = 0; +#endif /* CONFIG_SME */ #ifdef CONFIG_P2P os_memset(wpa_s->go_dev_addr, 0, ETH_ALEN); #endif /* CONFIG_P2P */