Blame SOURCES/0016-device-mac-addr-wait-rh1371623.patch

a85faa
From 702e8eec9e543b2c26b5d07d83b4f12db768b7b6 Mon Sep 17 00:00:00 2001
a85faa
From: Thomas Haller <thaller@redhat.com>
a85faa
Date: Sun, 11 Sep 2016 09:48:56 +0200
a85faa
Subject: [PATCH 1/1] device: wait for MAC address change to complete before
a85faa
 setting interface up
a85faa
a85faa
Some drivers (brcmfmac) don't change the MAC address right away.
a85faa
NetworkManager works around that by waiting synchronously until
a85faa
the address changes (commit 1a85103765d4eaa0acab6b03658a4f9cfe684a64).
a85faa
a85faa
wpa_supplicant on the other hand, only re-reads the MAC address
a85faa
when changing state from DISABLED to ENABLED, which happens when
a85faa
the interface comes up.
a85faa
a85faa
That is a bug in wpa_supplicant and the driver, but we can work-around by
a85faa
waiting until the MAC address actually changed before setting the interface
a85faa
IFF_UP. Also note, that there is still a race in wpa_supplicant which might
a85faa
miss a change to DISABLED state altogether.
a85faa
a85faa
https://bugzilla.gnome.org/show_bug.cgi?id=770504
a85faa
https://bugzilla.redhat.com/show_bug.cgi?id=1374023
a85faa
(cherry picked from commit 32f7c1d4b9aba597a99128631f07c2985149f303)
a85faa
(cherry picked from commit cd8f2ecc617a896d8007e6fe825c676a626a3b8d)
a85faa
---
a85faa
 src/devices/nm-device.c | 27 ++++++++++++++++-----------
a85faa
 1 file changed, 16 insertions(+), 11 deletions(-)
a85faa
a85faa
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
a85faa
index 240e590..d5e1f95 100644
a85faa
--- a/src/devices/nm-device.c
a85faa
+++ b/src/devices/nm-device.c
a85faa
@@ -11834,12 +11834,8 @@ _hw_addr_set (NMDevice *self,
a85faa
 		        nm_platform_error_to_string (plerr));
a85faa
 	}
a85faa
 
a85faa
-	if (was_up) {
a85faa
-		if (!nm_device_bring_up (self, TRUE, NULL))
a85faa
-			return FALSE;
a85faa
-	}
a85faa
-
a85faa
 	if (needs_refresh) {
a85faa
+		success = TRUE;
a85faa
 		if (_hw_addr_matches (self, addr)) {
a85faa
 			/* the MAC address already changed during nm_device_bring_up() above. */
a85faa
 		} else {
a85faa
@@ -11876,15 +11872,24 @@ handle_wait:
a85faa
 					continue;
a85faa
 				}
a85faa
 handle_fail:
a85faa
-				_LOGW (LOGD_DEVICE,
a85faa
-				       "set-hw-addr: new MAC address %s not successfully %s (%s)",
a85faa
-				       addr, operation, detail);
a85faa
-				return FALSE;
a85faa
+				success = FALSE;
a85faa
+				break;
a85faa
 			}
a85faa
 		}
a85faa
 
a85faa
-		_LOGI (LOGD_DEVICE, "set-hw-addr: %s MAC address to %s (%s)",
a85faa
-		       operation, addr, detail);
a85faa
+		if (success) {
a85faa
+			_LOGI (LOGD_DEVICE, "set-hw-addr: %s MAC address to %s (%s)",
a85faa
+			       operation, addr, detail);
a85faa
+		} else {
a85faa
+			_LOGW (LOGD_DEVICE,
a85faa
+			       "set-hw-addr: new MAC address %s not successfully %s (%s)",
a85faa
+			       addr, operation, detail);
a85faa
+		}
a85faa
+	}
a85faa
+
a85faa
+	if (was_up) {
a85faa
+		if (!nm_device_bring_up (self, TRUE, NULL))
a85faa
+			return FALSE;
a85faa
 	}
a85faa
 
a85faa
 	return success;
a85faa
-- 
a85faa
2.7.4
a85faa