From b87fa496cedb3fba86c71d886e001c52b7179908 Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Fri, 10 Feb 2023 17:33:23 +0100 Subject: [PATCH] device: update address in nm_device_update_from_platform_link() When a software device is deactivated, normally we schedule a idle task to unrealize the device (delete_on_deactivate). However, if a new activation is enqueued on the same device (and that implies that the new profile is compatible with the device), then the idle task is not scheduled and the device will normally transition to the different states (disconnected, prepare, config, etc.). For ovs-interfaces, we remove the db entry on disconnect and that makes the link go away; however, we don't clear the hw_addr* fields of the device struct. When the new link appears, we try to set the new cloned MAC but the stale hw_addr field indicates that it's already set. Avoid this problem by updating the address as soon as the link appears. https://bugzilla.redhat.com/show_bug.cgi?id=2168477 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1532 (cherry picked from commit d403ac3d40264876c75298e7b4d475a8b49c0921) --- src/core/devices/nm-device.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index e278a702f9..cf9e6baba6 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -7168,6 +7168,9 @@ nm_device_update_from_platform_link(NMDevice *self, const NMPlatformLink *plink) ifindex_changed = _set_ifindex(self, plink ? plink->ifindex : 0, FALSE); + nm_device_update_hw_address(self); + nm_device_update_permanent_hw_address(self, FALSE); + if (ifindex_changed) NM_DEVICE_GET_CLASS(self)->link_changed(self, plink);