device: re-read initial hw-address before activating connection

Previously, we would only once read the initial hardware address during
device realization.

When a device activates, NetworkManager always sets the MAC address as configured
in the cloned-mac-address setting -- or, if unspecified -- it falls back
to use the permanent hardware-address instead.

Later, when deactivating the device, the MAC address is reset to the
"inital MAC address".

This patch changes, that the "initial MAC address" is re-read every time
before activating the device, contrary to reading it once in the
beginning.

This allows for a user to first start NetworkManager and later change the
MAC address of the device. When activating the device, NM will reset the
MAC address for the time the device is active. But when disconnecting,
it resets to the user-changed value, not the value when NM was started.

https://bugzilla.gnome.org/show_bug.cgi?id=708820
This commit is contained in:
Thomas Haller 2016-05-20 18:10:51 +02:00
parent 3704197d87
commit 2f05353d9e

View file

@ -11041,6 +11041,9 @@ _set_state_full (NMDevice *self,
}
}
break;
case NM_DEVICE_STATE_PREPARE:
nm_device_update_initial_hw_address (self);
break;
case NM_DEVICE_STATE_NEED_AUTH:
if (old_state > NM_DEVICE_STATE_NEED_AUTH) {
/* Clean up any half-done IP operations if the device's layer2