From da3f608802e9850c885e3ad96cec4fd97a75bbab Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Fri, 17 Jun 2016 19:38:04 +0200 Subject: [PATCH] device: don't clear the current MAC address When we were able to read a MAC address previously, we would not expect a failure the next time. Say a failure happens. Still, we should not clear the MAC address, because we also determine hw_addr_len based on that address. And hw_addr_perm and hw_addr_initial have the same length. When we allow hw_addr to be reset (and possibly reset to a different address length), we somehow have to re-fresh also the permanent and initial MAC address. Just don't allow for that complexity, when it's not even clear what such a scenario would mean and what do to in that case. --- src/devices/nm-device.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index d857288290..0b4432ecfd 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -11406,11 +11406,12 @@ nm_device_update_hw_address (NMDevice *self) } else { /* Invalid or no hardware address */ if (priv->hw_addr_len != 0) { - g_clear_pointer (&priv->hw_addr, g_free); - priv->hw_addr_len = 0; _LOGD (LOGD_HW | LOGD_DEVICE, - "hw-addr: previous hardware address is no longer valid"); - _notify (self, PROP_HW_ADDRESS); + "hw-addr: failed reading current MAC address (stay with %s)", + priv->hw_addr); + } else { + _LOGD (LOGD_HW | LOGD_DEVICE, + "hw-addr: failed reading current MAC address"); } } }