mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-04 12:57:58 +02:00
device: wait for MAC address change to complete before setting interface up
Some drivers (brcmfmac) don't change the MAC address right away.
NetworkManager works around that by waiting synchronously until
the address changes (commit 1a85103765).
wpa_supplicant on the other hand, only re-reads the MAC address
when changing state from DISABLED to ENABLED, which happens when
the interface comes up.
That is a bug in wpa_supplicant and the driver, but we can work-around by
waiting until the MAC address actually changed before setting the interface
IFF_UP. Also note, that there is still a race in wpa_supplicant which might
miss a change to DISABLED state altogether.
https://bugzilla.gnome.org/show_bug.cgi?id=770504
https://bugzilla.redhat.com/show_bug.cgi?id=1374023
This commit is contained in:
parent
c3b18ec6ee
commit
32f7c1d4b9
1 changed files with 16 additions and 11 deletions
|
|
@ -11847,12 +11847,8 @@ _hw_addr_set (NMDevice *self,
|
|||
nm_platform_error_to_string (plerr));
|
||||
}
|
||||
|
||||
if (was_up) {
|
||||
if (!nm_device_bring_up (self, TRUE, NULL))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (needs_refresh) {
|
||||
success = TRUE;
|
||||
if (_hw_addr_matches (self, addr)) {
|
||||
/* the MAC address already changed during nm_device_bring_up() above. */
|
||||
} else {
|
||||
|
|
@ -11889,15 +11885,24 @@ handle_wait:
|
|||
continue;
|
||||
}
|
||||
handle_fail:
|
||||
_LOGW (LOGD_DEVICE,
|
||||
"set-hw-addr: new MAC address %s not successfully %s (%s)",
|
||||
addr, operation, detail);
|
||||
return FALSE;
|
||||
success = FALSE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
_LOGI (LOGD_DEVICE, "set-hw-addr: %s MAC address to %s (%s)",
|
||||
operation, addr, detail);
|
||||
if (success) {
|
||||
_LOGI (LOGD_DEVICE, "set-hw-addr: %s MAC address to %s (%s)",
|
||||
operation, addr, detail);
|
||||
} else {
|
||||
_LOGW (LOGD_DEVICE,
|
||||
"set-hw-addr: new MAC address %s not successfully %s (%s)",
|
||||
addr, operation, detail);
|
||||
}
|
||||
}
|
||||
|
||||
if (was_up) {
|
||||
if (!nm_device_bring_up (self, TRUE, NULL))
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return success;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue