device: always take device down when changing MAC for wifi devices

If the device is not taken down wpa_supplicant does not detect that
the MAC changed and the authentication can fail due to wrong key
derivation.

Fixes: e206a34732

https://bugzilla.redhat.com/show_bug.cgi?id=1656157
This commit is contained in:
Beniamino Galvani 2018-12-06 16:56:47 +01:00
parent 8c744b66cc
commit 29e8f6d5a1

View file

@ -15483,7 +15483,7 @@ _hw_addr_set (NMDevice *self,
NMPlatformError plerr;
guint8 addr_bytes[NM_UTILS_HWADDR_LEN_MAX];
gsize addr_len;
gboolean was_taken_down;
gboolean was_taken_down = FALSE;
gboolean retry_down;
nm_assert (NM_IS_DEVICE (self));
@ -15507,7 +15507,14 @@ _hw_addr_set (NMDevice *self,
_LOGT (LOGD_DEVICE, "set-hw-addr: setting MAC address to '%s' (%s, %s)...", addr, operation, detail);
was_taken_down = FALSE;
if (nm_device_get_device_type (self) == NM_DEVICE_TYPE_WIFI) {
/* Always take the device down for Wi-Fi because
* wpa_supplicant needs it to properly detect the MAC
* change. */
retry_down = FALSE;
was_taken_down = TRUE;
nm_device_take_down (self, FALSE);
}
again:
plerr = nm_platform_link_set_address (nm_device_get_platform (self), nm_device_get_ip_ifindex (self), addr_bytes, addr_len);