core: persist the fake permanent hardware address to the device's statefile

System Internals / NetworkManager - Thomas Haller [redhat.com] - 28 October 2016 09:44 UTC

On devices that have no real permanent hardware address (as returned by ethtool), we take the current MAC address of the device.

Currently, NM is a bit flaky about whether to accept such fake permanent addresses for settings like keyfile.unmanaged-devices or the per-connection property ethernet.mac-address. Probably, we should allow using fake addresses there in general.

However, that leads to problems because NetworkManager itself changes the current MAC address of such devices. For example when configuing

keyfile.unmanaged-device=22:33:44:55:66:77

and later activating a connection with

ethernet.cloned-mac-address=22:33:44:55:66:77

we have a strange situation after restart and the device becomes unmanaged.

We are going to avoid that, by remembering the fake permanent address in the device state file.

This only matters:

- for devices that don't have a real permanent address (veth)

- if the user or NetworkManager itself changed the MAC address of the device

- after a restart of NetworkManager, without reboot. A reboot clears the device state for /var/run/NetworkManager.

5912b2f core: persist the fake permanent hardware address to the device's statefile
src/devices/nm-device.c | 57 ++++++++++++++++++++++++++++++++++++--------
src/devices/nm-device.h | 2 ++
src/nm-config.c | 60 +++++++++++++++++++++++++++++++++++++----------
src/nm-config.h | 3 +++
src/nm-manager.c | 7 ++++++
5 files changed, 107 insertions(+), 22 deletions(-)

Upstream: cgit.freedesktop.org


  • Share