device: split nm_device_update_permanent_hw_address() out of nm_device_update_initial_hw_address()

Either, the function is called different to reflect that it does
not only update the initial_hw_addres, or it is split.

Split it.
This commit is contained in:
Thomas Haller 2016-05-20 13:33:28 +02:00
parent 6947aedb6e
commit 89d6dfdb96
3 changed files with 11 additions and 0 deletions

View file

@ -1593,6 +1593,7 @@ link_changed (NMDevice *device, NMPlatformLink *info)
_LOGD (LOGD_DEVICE, "device got a valid hw address");
nm_device_update_hw_address (self);
nm_device_update_initial_hw_address (self);
nm_device_update_permanent_hw_address (self);
if (nm_device_get_state (device) == NM_DEVICE_STATE_UNAVAILABLE) {
/*
* If the device is UNAVAILABLE, any previous try to

View file

@ -2140,6 +2140,7 @@ realize_start_setup (NMDevice *self, const NMPlatformLink *plink)
nm_device_update_hw_address (self);
nm_device_update_initial_hw_address (self);
nm_device_update_permanent_hw_address (self);
/* Note: initial hardware address must be read before calling get_ignore_carrier() */
config = nm_config_get ();
@ -11394,7 +11395,15 @@ nm_device_update_initial_hw_address (NMDevice *self)
g_free (priv->initial_hw_addr);
priv->initial_hw_addr = g_strdup (priv->hw_addr);
_LOGD (LOGD_DEVICE | LOGD_HW, "read initial MAC address %s", priv->initial_hw_addr);
}
}
void
nm_device_update_permanent_hw_address (NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
if (priv->hw_addr_len) {
if (priv->ifindex > 0) {
guint8 buf[NM_UTILS_HWADDR_LEN_MAX];
size_t len = 0;

View file

@ -578,6 +578,7 @@ void nm_device_reactivate_ip6_config (NMDevice *device,
void nm_device_update_hw_address (NMDevice *self);
void nm_device_update_initial_hw_address (NMDevice *self);
void nm_device_update_permanent_hw_address (NMDevice *self);
void nm_device_update_dynamic_ip_setup (NMDevice *self);
G_END_DECLS