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.
This commit is contained in:
Thomas Haller
2016-06-17 19:38:04 +02:00
parent 6db3c80aba
commit da3f608802

View File

@@ -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");
}
}
}