linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: Protect Deauthentication frame when using MFP
@ 2010-06-11  2:44 Jouni Malinen
  2010-06-14 18:55 ` [PATCH v2] " Jouni Malinen
  0 siblings, 1 reply; 2+ messages in thread
From: Jouni Malinen @ 2010-06-11  2:44 UTC (permalink / raw)
  To: John W. Linville, Johannes Berg; +Cc: linux-wireless

When management frame protection (IEEE 802.11w) is used,
Deauthentication frame needs to be protected when the pairwise key is
configured. mac80211 was removing the station entry (and its keys)
before actually sending out the Deauthentication frame. Fix this by
reordering the code to send the frame before the station entry gets
removed. This matches an earlier change that handled the Disassociation
frame processing, but missed Deauthentication frames.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>

---
 net/mac80211/mlme.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

--- wireless-testing.orig/net/mac80211/mlme.c	2010-06-10 18:09:38.000000000 -0700
+++ wireless-testing/net/mac80211/mlme.c	2010-06-10 18:35:20.000000000 -0700
@@ -2292,13 +2292,13 @@ int ieee80211_mgd_deauth(struct ieee8021
 	struct ieee80211_local *local = sdata->local;
 	struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
 	struct ieee80211_work *wk;
-	const u8 *bssid = req->bss->bssid;
+	u8 bssid[ETH_ALEN];
 
 	mutex_lock(&ifmgd->mtx);
 
+	memcpy(bssid, req->bss->bssid, ETH_ALEN);
 	if (ifmgd->associated == req->bss) {
-		bssid = req->bss->bssid;
-		ieee80211_set_disassoc(sdata, true);
+		ieee80211_set_disassoc(sdata, false);
 		mutex_unlock(&ifmgd->mtx);
 	} else {
 		bool not_auth_yet = false;
@@ -2345,6 +2345,8 @@ int ieee80211_mgd_deauth(struct ieee8021
 	ieee80211_send_deauth_disassoc(sdata, bssid, IEEE80211_STYPE_DEAUTH,
 				       req->reason_code, cookie,
 				       !req->local_state_change);
+	if (ifmgd->associated == req->bss)
+		sta_info_destroy_addr(sdata, bssid);
 
 	ieee80211_recalc_idle(sdata->local);
 

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [PATCH v2] mac80211: Protect Deauthentication frame when using MFP
  2010-06-11  2:44 [PATCH] mac80211: Protect Deauthentication frame when using MFP Jouni Malinen
@ 2010-06-14 18:55 ` Jouni Malinen
  0 siblings, 0 replies; 2+ messages in thread
From: Jouni Malinen @ 2010-06-14 18:55 UTC (permalink / raw)
  To: John W. Linville, Johannes Berg; +Cc: linux-wireless

When management frame protection (IEEE 802.11w) is used,
Deauthentication frame needs to be protected when the pairwise key is
configured. mac80211 was removing the station entry (and its keys)
before actually sending out the Deauthentication frame. Fix this by
reordering the code to send the frame before the station entry gets
removed. This matches an earlier change that handled the Disassociation
frame processing, but missed Deauthentication frames.

Signed-off-by: Jouni Malinen <jouni.malinen@atheros.com>

---
 net/mac80211/mlme.c |   10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

v2: Fix a bug that left STA entries behind and broke some reassociation
    cases.

--- wireless-testing.orig/net/mac80211/mlme.c	2010-06-14 11:40:07.000000000 -0700
+++ wireless-testing/net/mac80211/mlme.c	2010-06-14 11:41:03.000000000 -0700
@@ -2292,14 +2292,16 @@ int ieee80211_mgd_deauth(struct ieee8021
 	struct ieee80211_local *local = sdata->local;
 	struct ieee80211_if_managed *ifmgd = &sdata->u.mgd;
 	struct ieee80211_work *wk;
-	const u8 *bssid = req->bss->bssid;
+	u8 bssid[ETH_ALEN];
+	bool assoc_bss = false;
 
 	mutex_lock(&ifmgd->mtx);
 
+	memcpy(bssid, req->bss->bssid, ETH_ALEN);
 	if (ifmgd->associated == req->bss) {
-		bssid = req->bss->bssid;
-		ieee80211_set_disassoc(sdata, true);
+		ieee80211_set_disassoc(sdata, false);
 		mutex_unlock(&ifmgd->mtx);
+		assoc_bss = true;
 	} else {
 		bool not_auth_yet = false;
 
@@ -2345,6 +2347,8 @@ int ieee80211_mgd_deauth(struct ieee8021
 	ieee80211_send_deauth_disassoc(sdata, bssid, IEEE80211_STYPE_DEAUTH,
 				       req->reason_code, cookie,
 				       !req->local_state_change);
+	if (assoc_bss)
+		sta_info_destroy_addr(sdata, bssid);
 
 	ieee80211_recalc_idle(sdata->local);
 

-- 
Jouni Malinen                                            PGP id EFC895FA

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2010-06-14 18:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-11  2:44 [PATCH] mac80211: Protect Deauthentication frame when using MFP Jouni Malinen
2010-06-14 18:55 ` [PATCH v2] " Jouni Malinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).