From cf11884a85fae8bc34f7c9b3dec7199983c2114a Mon Sep 17 00:00:00 2001 From: Beniamino Galvani Date: Thu, 15 Dec 2022 09:50:40 +0100 Subject: [PATCH] macsec: fix tracking of parent ifindex For MACsec interfaces, kernel announces the parent ifindex in the generic IFLA_LINK netlink attribute, which we save in NMPlatformLink.parent. There is no need to have a dedicate member in NMPlatformLnkMacsec. The dedicate member was never set and during a restart of NetworkManager the parent of the MACsec device could be unset leading to a failed assertion: act_stage2_config: assertion 'parent' failed Fixes: 85103656e97b ('platform: add support for macsec links') https://bugzilla.redhat.com/show_bug.cgi?id=2122564 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1481 --- src/core/devices/nm-device-macsec.c | 3 +-- src/libnm-platform/nm-platform.c | 2 -- src/libnm-platform/nm-platform.h | 1 - 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/src/core/devices/nm-device-macsec.c b/src/core/devices/nm-device-macsec.c index 615ebe6b27..99003a7660 100644 --- a/src/core/devices/nm-device-macsec.c +++ b/src/core/devices/nm-device-macsec.c @@ -153,8 +153,7 @@ update_properties(NMDevice *device) g_object_freeze_notify((GObject *) device); - if (priv->props.parent_ifindex != props->parent_ifindex) - nm_device_parent_set_ifindex(device, props->parent_ifindex); + nm_device_parent_set_ifindex(device, plink->parent); #define CHECK_PROPERTY_CHANGED(field, prop) \ G_STMT_START \ diff --git a/src/libnm-platform/nm-platform.c b/src/libnm-platform/nm-platform.c index 4688269d2c..bc60f19f89 100644 --- a/src/libnm-platform/nm-platform.c +++ b/src/libnm-platform/nm-platform.c @@ -8044,7 +8044,6 @@ void nm_platform_lnk_macsec_hash_update(const NMPlatformLnkMacsec *obj, NMHashState *h) { nm_hash_update_vals(h, - obj->parent_ifindex, obj->sci, obj->cipher_suite, obj->window, @@ -8064,7 +8063,6 @@ int nm_platform_lnk_macsec_cmp(const NMPlatformLnkMacsec *a, const NMPlatformLnkMacsec *b) { NM_CMP_SELF(a, b); - NM_CMP_FIELD(a, b, parent_ifindex); NM_CMP_FIELD(a, b, sci); NM_CMP_FIELD(a, b, icv_length); NM_CMP_FIELD(a, b, cipher_suite); diff --git a/src/libnm-platform/nm-platform.h b/src/libnm-platform/nm-platform.h index dceb3e6be5..c510c15017 100644 --- a/src/libnm-platform/nm-platform.h +++ b/src/libnm-platform/nm-platform.h @@ -814,7 +814,6 @@ typedef struct { } _nm_alignas(NMPlatformObject) NMPlatformLnkIpIp; typedef struct { - int parent_ifindex; guint64 sci; /* host byte order */ guint64 cipher_suite; guint32 window;