diff mbox

wpa_supplicant: restore permanent mac on reassoc

Message ID 1987bcb2-77cc-b595-825b-4b0537171bc6@waldteufel.eu
State Superseded
Headers show

Commit Message

Benjamin Richter Oct. 11, 2016, 4:37 a.m. UTC
Hi everyone.

I noticed that with preassoc_mac_addr=1 sometimes the randomized MAC
address stays around, even though mac_addr=0 is set - it happens when
reassociating to the same network as before. Please find attached a
patch that ensures that the permanent MAC address is restored in this case.

Best regards,
Benjamin Richter

Comments

Jouni Malinen Oct. 11, 2016, 8:33 a.m. UTC | #1
On Tue, Oct 11, 2016 at 06:37:14AM +0200, Benjamin Richter wrote:
> I noticed that with preassoc_mac_addr=1 sometimes the randomized MAC
> address stays around, even though mac_addr=0 is set - it happens when
> reassociating to the same network as before. Please find attached a
> patch that ensures that the permanent MAC address is restored in this case.

Could you please read the top level CONTRIBUTIONS file (*) and provide a
Signed-off-by: line for the commit message so that I can apply this?

(*) http://w1.fi/cgit/hostap/plain/CONTRIBUTIONS
diff mbox

Patch

From 37f85de2d47d5ce09b5e069d256ded4fcecb4a9a 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 after association. Previously this did not happen
when reassociating to the same ESS.
---
 wpa_supplicant/wpa_supplicant.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index c939321..2a82ee4 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -1691,7 +1691,9 @@  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);
-- 
2.10.0