#939294 network-manager: After upgrade to 1.20.0-1, mac address of wlan0 is randomized

Package:
network-manager
Source:
network-manager
Description:
network management framework (daemon and userspace tools)
Submitter:
Jörn Heissler
Date:
2019-09-24 00:09:03 UTC
Severity:
important
#939294#5
Date:
2019-09-02 22:03:12 UTC
From:
To:
Hello,
I upgraded several packages, including network-manager (1.18.0-3 -> 1.20.0-1).
During the upgrade, my wifi connection disconnected and wouldn't connect again.
Luckily I wasn't doing the upgrade from remote ;-)

It appears that the mac address of my wlan0 device is now changed and my
wifi router refused the new address because it got a whitelist.

There is no mention of this behaviour change in the docs and it's
unclear how to disable/control this feature.

I suggest that this change is reverted or at least users should be made
aware of it. And users should be pointed at relevant documentation.

In fact I'm not sure that network-manager is the culprit, but it's a
likely candidate.

Thanks
Jörn Heissler

#939294#10
Date:
2019-09-02 22:55:59 UTC
From:
To:
Am 03.09.19 um 00:03 schrieb Jörn Heissler:

network-manager did always randomize the mac, unless you have a package
explicitly overriding this behaviour.

That said, this sounds like a driver bug. You should raise that with the
kernel package.

#939294#15
Date:
2019-09-03 07:20:40 UTC
From:
To:
I had a closer looks at the logs: It appears like NM always changes mac address
before scanning:

device (wlan0): set-hw-addr: set MAC address to 7E:83:4F:92:E9:72 (scanning)

And changing it back when connecting:

device (wlan0): set-hw-addr: reset MAC address to <---redacted---> (preserve)

I wasn't even aware of the feature, but it makes sense. That happened
before the upgrade too.


During the upgrade, NM started a scan for some reason and changed the address.
Then the NM process was terminated. The new instance of NM assumed wrongly
that the current mac address is the real one.

Logs looked like:

device (wlan0): set-hw-addr: set MAC address to C6:E8:D3:FB:55:4B (scanning)
exiting (success)
---
NetworkManager (version 1.20.0) is starting... (after a restart)
device (wlan0): set-hw-addr: set MAC address to 52:8C:79:7C:65:5E (scanning)
device (wlan0): set-hw-addr: reset MAC address to C6:E8:D3:FB:55:4B (preserve)


The flaw can be triggered easily:

# systemctl restart wpa_supplicant.service; sleep 1.5; systemctl restart NetworkManager.service

Restart of wpa_supplicant.service causes a rescan which appears to take
about 3 seconds. During rescan, NM is restarted. Afterwards the MAC
address is wrong.

A workaround without reboot is to stop NM, change the mac adress
manually (ip link set dev wlan0 down; ip link set dev wlan0 address zz:yy:xx:ww:vv:uu),
then start NM again.


So, I believe this is really a bug in NetworkManager which should be
fixed. But might well be an upstream bug.

#939294#20
Date:
2019-09-03 09:20:21 UTC
From:
To:
Am 03.09.19 um 09:20 schrieb Jörn Heissler:

This works just fine here (using iwlwifi).

#939294#25
Date:
2019-09-23 23:55:37 UTC
From:
To:
Just to add a data point, I’ve experienced the same failure as Jörn. I’m
using ath9k, not iwlwifi, so this may indeed be an implementation
difference between the two drivers. In the meantime, I’ve worked around
the issue by putting

	[connection]
	wifi.cloned-mac-address=permanent

in /etc/NetworkManager/NetworkManager.conf. This undoes the change in
upstream commit fae5ecec5a4d9987a1915441602cb78275a9f490 [1] and makes
NetworkManager default to using the permanent MAC address when it’s done
scanning.


[1] https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=fae5ecec5a4d9987a1915441602cb78275a9f490