mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-07 04:20:23 +01:00
device: merge branch 'th/platform-set-address-enfile-bgo770456-v2'
https://bugzilla.gnome.org/show_bug.cgi?id=770456
This commit is contained in:
commit
e109f87067
1 changed files with 25 additions and 3 deletions
|
|
@ -11774,6 +11774,7 @@ _hw_addr_set (NMDevice *self,
|
|||
{
|
||||
NMDevicePrivate *priv;
|
||||
gboolean success = FALSE;
|
||||
gboolean needs_refresh = FALSE;
|
||||
NMPlatformError plerr;
|
||||
const char *cur_addr;
|
||||
guint8 addr_bytes[NM_UTILS_HWADDR_LEN_MAX];
|
||||
|
|
@ -11819,10 +11820,10 @@ _hw_addr_set (NMDevice *self,
|
|||
_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 set to %s (%s)",
|
||||
_LOGD (LOGD_DEVICE,
|
||||
"set-hw-addr: new MAC address %s not successfully %s (%s) (refresh link)",
|
||||
addr, operation, detail);
|
||||
success = FALSE;
|
||||
needs_refresh = TRUE;
|
||||
}
|
||||
} else {
|
||||
_NMLOG (plerr == NM_PLATFORM_ERROR_NOT_FOUND ? LOGL_DEBUG : LOGL_WARN,
|
||||
|
|
@ -11836,6 +11837,27 @@ _hw_addr_set (NMDevice *self,
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if (needs_refresh) {
|
||||
/* The platform call indicated success, however the address is not
|
||||
* as expected. May be a kernel issue and the MAC address takes
|
||||
* a moment to change (bgo#770456).
|
||||
*
|
||||
* Try to reload the link and check again. */
|
||||
nm_platform_link_refresh (NM_PLATFORM_GET, nm_device_get_ip_ifindex (self));
|
||||
|
||||
nm_device_update_hw_address (self);
|
||||
cur_addr = nm_device_get_hw_address (self);
|
||||
if (cur_addr && nm_utils_hwaddr_matches (cur_addr, -1, addr, -1)) {
|
||||
_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);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return success;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue