device: cleanup _hw_addr_set()
No change in behavior, just reorganize.
Fixes: 32f7c1d4b9
This commit is contained in:
@@ -11793,7 +11793,6 @@ _hw_addr_set (NMDevice *self,
|
|||||||
{
|
{
|
||||||
NMDevicePrivate *priv;
|
NMDevicePrivate *priv;
|
||||||
gboolean success = FALSE;
|
gboolean success = FALSE;
|
||||||
gboolean needs_refresh = FALSE;
|
|
||||||
NMPlatformError plerr;
|
NMPlatformError plerr;
|
||||||
guint8 addr_bytes[NM_UTILS_HWADDR_LEN_MAX];
|
guint8 addr_bytes[NM_UTILS_HWADDR_LEN_MAX];
|
||||||
guint hw_addr_len;
|
guint hw_addr_len;
|
||||||
@@ -11835,24 +11834,11 @@ _hw_addr_set (NMDevice *self,
|
|||||||
_LOGI (LOGD_DEVICE, "set-hw-addr: %s MAC address to %s (%s)",
|
_LOGI (LOGD_DEVICE, "set-hw-addr: %s MAC address to %s (%s)",
|
||||||
operation, addr, detail);
|
operation, addr, detail);
|
||||||
} else {
|
} else {
|
||||||
|
gint64 poll_end, now;
|
||||||
|
|
||||||
_LOGD (LOGD_DEVICE,
|
_LOGD (LOGD_DEVICE,
|
||||||
"set-hw-addr: new MAC address %s not successfully %s (%s) (refresh link)",
|
"set-hw-addr: new MAC address %s not successfully %s (%s) (refresh link)",
|
||||||
addr, operation, detail);
|
addr, operation, detail);
|
||||||
needs_refresh = TRUE;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
_NMLOG (plerr == NM_PLATFORM_ERROR_NOT_FOUND ? LOGL_DEBUG : LOGL_WARN,
|
|
||||||
LOGD_DEVICE, "set-hw-addr: failed to %s MAC address to %s (%s) (%s)",
|
|
||||||
operation, addr, detail,
|
|
||||||
nm_platform_error_to_string (plerr));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (needs_refresh) {
|
|
||||||
success = TRUE;
|
|
||||||
if (_hw_addr_matches (self, addr)) {
|
|
||||||
/* the MAC address already changed during nm_device_bring_up() above. */
|
|
||||||
} else {
|
|
||||||
gint64 poll_end, now;
|
|
||||||
|
|
||||||
/* The platform call indicated success, however the address is not
|
/* The platform call indicated success, however the address is not
|
||||||
* as expected. That is either due to a driver issue (brcmfmac, bgo#770456,
|
* as expected. That is either due to a driver issue (brcmfmac, bgo#770456,
|
||||||
@@ -11888,7 +11874,6 @@ handle_fail:
|
|||||||
success = FALSE;
|
success = FALSE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (success) {
|
if (success) {
|
||||||
_LOGI (LOGD_DEVICE, "set-hw-addr: %s MAC address to %s (%s)",
|
_LOGI (LOGD_DEVICE, "set-hw-addr: %s MAC address to %s (%s)",
|
||||||
@@ -11899,6 +11884,12 @@ handle_fail:
|
|||||||
addr, operation, detail);
|
addr, operation, detail);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
_NMLOG (plerr == NM_PLATFORM_ERROR_NOT_FOUND ? LOGL_DEBUG : LOGL_WARN,
|
||||||
|
LOGD_DEVICE, "set-hw-addr: failed to %s MAC address to %s (%s) (%s)",
|
||||||
|
operation, addr, detail,
|
||||||
|
nm_platform_error_to_string (plerr));
|
||||||
|
}
|
||||||
|
|
||||||
if (was_up) {
|
if (was_up) {
|
||||||
if (!nm_device_bring_up (self, TRUE, NULL))
|
if (!nm_device_bring_up (self, TRUE, NULL))
|
||||||
|
Reference in New Issue
Block a user