53 lines
1.8 KiB
Diff
53 lines
1.8 KiB
Diff
From 77c31234bcd84faad81d0e33c1662c834a4f616d Mon Sep 17 00:00:00 2001
|
|
From: Beniamino Galvani <bgalvani@redhat.com>
|
|
Date: Thu, 6 Dec 2018 16:56:47 +0100
|
|
Subject: [PATCH 3/3] 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: e206a3473249be4c92c5d71214a33e90db301127
|
|
|
|
https://bugzilla.redhat.com/show_bug.cgi?id=1656157
|
|
(cherry picked from commit 29e8f6d5a17c3dbfd11655338cd0ffc61e1fc91b)
|
|
(cherry picked from commit b2686110ef9cfcd87470d65872abf4adb9dab37c)
|
|
(cherry picked from commit 0624814af17fb66826fda0e901c3d73a292ff37e)
|
|
---
|
|
src/devices/nm-device.c | 11 +++++++++--
|
|
1 file changed, 9 insertions(+), 2 deletions(-)
|
|
|
|
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
|
|
index 76c80bd3d..3df5b28dc 100644
|
|
--- a/src/devices/nm-device.c
|
|
+++ b/src/devices/nm-device.c
|
|
@@ -14775,7 +14775,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));
|
|
@@ -14799,7 +14799,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);
|
|
--
|
|
2.17.1
|
|
|