diff mbox

wpa_supplicant: restore permanent mac on reassoc

Message ID bc6deb4f-97aa-96c7-663f-c9a212295f21@waldteufel.eu
State Accepted
Headers show

Commit Message

Benjamin Richter Oct. 15, 2016, 7:41 p.m. UTC
On 2016-10-15 21:07, Jouni Malinen wrote:
> Wouldn't that break this for mac_addr == 1 and 2 cases by clearing
> the random MAC address for reassociation to the same ESS cases when
> the previously selected random MAC address should be maintained
> instead?

Yes. The revised patch below should fix both the error in the code and
in the commit message.

Comments

Jouni Malinen Oct. 16, 2016, 1:38 p.m. UTC | #1
On Sat, Oct 15, 2016 at 09:41:28PM +0200, Benjamin Richter wrote:
> Yes. The revised patch below should fix both the error in the code and
> in the commit message.

Thanks, applied.
diff mbox

Patch

From f983d34ee161d4531c83e7613eeee5515fa04666 Mon Sep 17 00:00:00 2001
From: Benjamin Richter <br@waldteufel.eu>
Date: Tue, 11 Oct 2016 05:57:38 +0200
Subject: [PATCH] wpa_supplicant: restore permanent mac on reassoc

With mac_addr=0 and preassoc_mac_addr=1, the permanent MAC address
should be restored for association. Previously this did not happen when
reassociating to the same ESS.

Signed-off-by: Benjamin Richter <br@waldteufel.eu>
---
 wpa_supplicant/wpa_supplicant.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index c939321..7fa58c6 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1691,11 +1691,13 @@  void wpa_supplicant_associate(struct wpa_supplicant *wpa_s,
 			wmm_ac_save_tspecs(wpa_s);
 			wpa_s->reassoc_same_bss = 1;
 		}
-	} else if (rand_style > 0) {
+	}
+
+	if (rand_style > 0 && !wpa_s->reassoc_same_ess) {
 		if (wpas_update_random_addr(wpa_s, rand_style) < 0)
 			return;
 		wpa_sm_pmksa_cache_flush(wpa_s->wpa, ssid);
-	} else if (wpa_s->mac_addr_changed) {
+	} else if (rand_style == 0 && wpa_s->mac_addr_changed) {
 		if (wpa_drv_set_mac_addr(wpa_s, NULL) < 0) {
 			wpa_msg(wpa_s, MSG_INFO,
 				"Could not restore permanent MAC address");
-- 
2.10.0