about summary refs log tree commit diff
path: root/debian/patches/git-mac-change.patch
blob: efa01d6d41bc10696b86722dd9abad707b097328 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
From 0624814af17fb66826fda0e901c3d73a292ff37e Mon Sep 17 00:00:00 2001
From: Beniamino Galvani <bgalvani@redhat.com>
Date: Thu, 6 Dec 2018 16:56:47 +0100
Subject: 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)
---
 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 76c80bd..3df5b28 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);
-- 
cgit v1.1