Patchwork wpa_supplicant: clear bssid state on deauth

login
register
mail settings
Submitter Arik Nemtsov
Date May 30, 2012, 6:32 a.m.
Message ID <1338359568-11869-1-git-send-email-arik@wizery.com>
Download mbox | patch
Permalink /patch/161869/
State Superseded
Headers show

Comments

Arik Nemtsov - May 30, 2012, 6:32 a.m.
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.

Reported-by: Yossi Wortzel <yossiw@ti.com>
Signed-hostap: Arik Nemtsov <arik@wizery.com>
---
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.

 wpa_supplicant/events.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
Arik Nemtsov - June 6, 2012, 5:46 a.m.
On Wed, May 30, 2012 at 9:32 AM, Arik Nemtsov <arik@wizery.com> 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.

Ping?

Regards,
Arik

Patch

diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index d09be6c..b8b25f6 100644
--- 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,
 					    data->deauth_info.ie,
 					    data->deauth_info.ie_len);
 			}
+
+#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) {