Bug 1415732 - MAC address randomization broken in latest update
Summary: MAC address randomization broken in latest update
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: wpa_supplicant
Version: 25
Hardware: x86_64
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Lubomir Rintel
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2017-01-23 15:07 UTC by Dominique Brazziel
Modified: 2017-12-12 10:47 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2017-12-12 10:47:34 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Dominique Brazziel 2017-01-23 15:07:12 UTC
Description of problem:
WiFi connection with Cloned MAC address fails.  wpa_supplicant fails scanning, NetworkManager says:

(wlan0): set-hw-addr: new MAC address XX:XX:XX:XX:XX:XX not successfully set (scanning)

Version-Release number of selected component (if applicable):
2.6-1

How reproducible:
Start networking (systemd network target)

Steps to Reproduce:
1.
2.
3.

Actual results:
Jan 23 09:10:06 X wpa_supplicant[1271]: Successfully initialized wpa_supplicant
Jan 23 09:10:09 X wpa_supplicant[1271]: wlan0: CTRL-EVENT-SCAN-FAILED ret=-100
Jan 23 09:10:20 X wpa_supplicant[1271]: wlan0: CTRL-EVENT-SCAN-FAILED ret=-100


Expected results:
Working Wifi network

Additional info:
Workaround was to disable MAC address randomization (preserve the MAC address)  with the following snippet in NM config directory (/usr/lib/NetworkManager/conf.d):

[device-mac-randomization]
# "yes" is already the default for scanning
wifi.scan-rand-mac-address=no

[connection-mac-randomization]
ethernet.cloned-mac-address=preserve
wifi.cloned-mac-address=preserve

Comment 1 Dominique Brazziel 2017-02-12 18:00:52 UTC
Debian has two similar bugs which have been report, confirmed, and fix is in the works.  

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=849875
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=849077#50

They have released version 2.6-3 to their unstable repo, with the following entry in the changelog:

wpa (2.6-3) unstable; urgency=medium
...
- wpa_supplicant: Restore permanent MAC address on reassociation

Comment 2 Thomas Haller 2017-05-16 10:42:12 UTC
maybe the same issue as https://bugzilla.redhat.com/show_bug.cgi?id=1441418#c8 .

But there isn't enough information here to confirm. Is it possible to test with the mentioned patch?

Comment 3 Dominique Brazziel 2017-05-19 12:12:12 UTC
It seems the patch mentioned is for hostapd, which I am not using.  I will see if I can find the patch to the Debian version and report later.

Comment 4 Beniamino Galvani 2017-05-19 12:32:11 UTC
(In reply to Dominique Brazziel from comment #3)
> It seems the patch mentioned is for hostapd, which I am not using.  I will
> see if I can find the patch to the Debian version and report later.

The patch is for wpa_supplicant, which is part of the hostap tree. Please try this:

https://w1.fi/cgit/hostap/commit/?id=290834df69556b903b49f2a45671cc62b44f13bb

Comment 5 Dominique Brazziel 2017-05-19 15:16:09 UTC
I'm sorry, I don't have time to try the patch.  I thought the code that Debian included in 2.6-3 might be in scan.c as I looked at the Debian patch and the current Fedora source and noticed the same clause present.  Here is the Debian patch:

From 5d30f927ea5a67bb6605af6c65eb52f900c0da4b Mon Sep 17 00:00:00 2001
From: Benjamin Richter <br>
Date: Tue, 11 Oct 2016 05:57:38 +0200
Subject: [PATCH] wpa_supplicant: Restore permanent MAC address on
 reassociation

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>
Signed-off-by: Andrew Shadura <andrew.shadura.uk>
---
 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 2479432..d9e2851 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.9.3

I took the NM config override out and restarted NM to test, but got the same CTRL-EVENT-SCAN-FAILED ret=-100.  I then plugged the MAC address into the cloned mac address field in nm-settings and was able to associate.

No MAC address randomization for me.

Comment 6 Fedora End Of Life 2017-11-16 19:45:01 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 7 Fedora End Of Life 2017-12-12 10:47:34 UTC
Fedora 25 changed to end-of-life (EOL) status on 2017-12-12. Fedora 25 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.