<div dir="ltr"><div>network-manager's MAC randomization causes issues even on Intel's very popular Dual Band Wireless-AC 8265. I have a Lenovo Thinkpad X1 Carbon 5th gen with this adapter and I wasted a few hours tracking down an issue caused by randomization. On my machine, when network-manager is already connected to wifi, re-opening the list of wifi networks and reclicking on my network's SSID forces a reconnection which takes ~30 seconds during which wpa_supplicant cycles through my 4 BSSIDs advertising the same SSID:</div><div><br></div><div>"wpa_supplicant -t" output:</div><div>1522285915.798062: wlp4s0: CTRL-EVENT-DISCONNECTED bssid=f2:9f:c2:22:24:4d reason=3 locally_generated=1  <========== attempt to reconnect</div><div>1522285917.494361: wlp4s0: SME: Trying to authenticate with f2:9f:c2:22:24:4d (SSID='Bevand Guest' freq=5180 MHz)</div><div>1522285922.857478: wlp4s0: SME: Trying to authenticate with f0:9f:c2:21:24:4d (SSID='Bevand Guest' freq=2412 MHz)</div><div>1522285928.113198: wlp4s0: SME: Trying to authenticate with 82:2a:a8:4b:da:e2 (SSID='Bevand Guest' freq=5745 MHz)</div><div>1522285928.538433: wlp4s0: SME: Trying to authenticate with 80:2a:a8:4a:da:e2 (SSID='Bevand Guest' freq=2437 MHz)</div><div>1522285933.552821: wlp4s0: SME: Deauth request to the driver failed</div><div>1522285936.749782: wlp4s0: SME: Trying to authenticate with f2:9f:c2:22:24:4d (SSID='Bevand Guest' freq=5180 MHz)</div><div>1522285940.695917: wlp4s0: CTRL-EVENT-DISCONNECTED bssid=f2:9f:c2:22:24:4d reason=3 locally_generated=1</div><div>1522285942.719984: wlp4s0: SME: Trying to authenticate with f2:9f:c2:22:24:4d (SSID='Bevand Guest' freq=5180 MHz)</div><div>1522285942.729991: wlp4s0: Trying to associate with f2:9f:c2:22:24:4d (SSID='Bevand Guest' freq=5180 MHz)</div><div>1522285942.736596: wlp4s0: Associated with f2:9f:c2:22:24:4d</div><div>1522285942.744274: wlp4s0: WPA: Key negotiation completed with f2:9f:c2:22:24:4d [PTK=CCMP GTK=CCMP]</div><div>1522285942.744320: wlp4s0: CTRL-EVENT-CONNECTED - Connection to f2:9f:c2:22:24:4d completed [id=0 id_str=]</div><div>(total time: 26.9 seconds)</div><div><br></div><div>However with randomization disabled (wifi.scan-rand-mac-address=no), the long reconnection issue disappears, reconnecting takes only 2 seconds:</div><div><br></div><div>"wpa_supplicant -t" output:</div><div>1522286014.158020: wlp4s0: CTRL-EVENT-DISCONNECTED bssid=f2:9f:c2:22:24:4d reason=3 locally_generated=1  <========== attempt to reconnect</div><div>1522286015.839514: wlp4s0: SME: Trying to authenticate with f2:9f:c2:22:24:4d (SSID='Bevand Guest' freq=5180 MHz)</div><div>1522286015.853940: wlp4s0: Trying to associate with f2:9f:c2:22:24:4d (SSID='Bevand Guest' freq=5180 MHz)</div><div>1522286015.862127: wlp4s0: Associated with f2:9f:c2:22:24:4d</div><div>1522286015.869183: wlp4s0: WPA: Key negotiation completed with f2:9f:c2:22:24:4d [PTK=CCMP GTK=CCMP]</div><div>1522286015.869621: wlp4s0: CTRL-EVENT-CONNECTED - Connection to f2:9f:c2:22:24:4d completed [id=0 id_str=]</div><div>(total time: 1.7 seconds)</div><div><br></div><div>When doing the reconnection like this, network-manager calls a series of D-Bus methods into wpa_supplicant (Disconnect, RemoveNetwork, Scan, AddNetwork, SelectNetwork...) When I attempt to simulate this series of actions through wpa_cli[1], I am unable to reproduce the issue. Also, when I strace network-manager or wpa_supplicant the problem tends to disappear. This suggests the issue is timing-related.</div><div><br></div><div>Looking at verbose logs ("wpa_supplicant -tdd"), I noticed that MAC randomization causes many "SME: Authentication timeout" errors. See attached logs:</div><div>- log.wpa_sup-dd.full.failure is the wpa_supplicant log when network-manager's MAC randomization is enabled (wifi.scan-rand-mac-address=yes)</div><div>- log.wpa_sup-dd.full.success is the wpa_supplicant log when network-manager's MAC randomization is disabled (wifi.scan-rand-mac-address=no)</div><div><br></div><div>System info:</div><div>Debian 9.3 (stretch)</div><div>network-manager 1.6.2-3</div><div>wpasupplicant 2:2.4-1+deb9u1</div><div><br></div><div>Adapter info:</div><div>$ ethtool -i wlp4s0</div><div>driver: iwlwifi</div><div>version: 4.9.0-6-amd64</div><div>firmware-version: 22.361476.0</div><div><br></div><div>[1] I tried:</div><div>   $ for cmd in 'disconnect' 'remove_network 0' 'scan' 'add_network' 'set_network 0 ssid "my_ssid"' 'set_network 0 psk "my_passphrase"' 'enable_network 0' 'reconnect'; do wpa_cli -i wlp4s0 $cmd; done</div><div><br></div><div>-Marc</div></div>