From 0983a45de1dfaaed283d2b095698867642110ac5 Mon Sep 17 00:00:00 2001 From: Fernando Fernandez Mancera Date: Mon, 4 Dec 2023 12:11:57 +0100 Subject: [PATCH] device: do not set MAC address on iface with index <=0 Resolves: RHEL-16008 Signed-off-by: Fernando Fernandez Mancera --- ...ess-on-iface-with-index-0-rhel-16008.patch | 51 +++++++++++++++++++ NetworkManager.spec | 6 ++- 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 1012-device-do-not-set-MAC-address-on-iface-with-index-0-rhel-16008.patch diff --git a/1012-device-do-not-set-MAC-address-on-iface-with-index-0-rhel-16008.patch b/1012-device-do-not-set-MAC-address-on-iface-with-index-0-rhel-16008.patch new file mode 100644 index 0000000..9ea7525 --- /dev/null +++ b/1012-device-do-not-set-MAC-address-on-iface-with-index-0-rhel-16008.patch @@ -0,0 +1,51 @@ +From c62f49f07ed84b266427feb53469109d8878c496 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Wed, 12 Jul 2023 16:22:03 +0800 +Subject: [PATCH] device: do not set MAC address on iface with index <=0 + +The `nm_device_hw_addr_reset()` should only set MAC address on NIC +with valid(>0) interface index. + +The failure was found by `ovs_mtu` test of NMCI, failed to reproduce +the original problem (`ovs_mtu` test of NMCI) with 100 times retry. +And no trace log found for original test failure, hence cannot tell why +`nm_device_hw_addr_reset()` been invoked with iface index 0. + +Signed-off-by: Gris Ge +(cherry picked from commit 215bc1525501b22325c2a17090a5f911e01f06a9) +(cherry picked from commit 21f1e5cdc7d72376cdaa63112d8a134b714b2002) +(cherry picked from commit 37bd70034f7f43becf2cc64468143c5ea2666762) +--- + src/core/devices/nm-device.c | 9 ++++++++- + 1 file changed, 8 insertions(+), 1 deletion(-) + +diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c +index 2ac55fa83c..5748d80393 100644 +--- a/src/core/devices/nm-device.c ++++ b/src/core/devices/nm-device.c +@@ -16859,6 +16859,7 @@ nm_device_hw_addr_reset(NMDevice *self, const char *detail) + { + NMDevicePrivate *priv; + const char *addr; ++ int ifindex; + + g_return_val_if_fail(NM_IS_DEVICE(self), FALSE); + +@@ -16868,7 +16869,13 @@ nm_device_hw_addr_reset(NMDevice *self, const char *detail) + return TRUE; + + priv->hw_addr_type = HW_ADDR_TYPE_UNSET; +- addr = nm_device_get_initial_hw_address(self); ++ ++ ifindex = nm_device_get_ip_ifindex(self); ++ if (ifindex <= 0) { ++ return TRUE; ++ } ++ ++ addr = nm_device_get_initial_hw_address(self); + if (!addr) { + /* as hw_addr_type is not UNSET, we expect that we can get an + * initial address to which to reset. */ +-- +2.41.0 + diff --git a/NetworkManager.spec b/NetworkManager.spec index 4505c0f..320199c 100644 --- a/NetworkManager.spec +++ b/NetworkManager.spec @@ -6,7 +6,7 @@ %global epoch_version 1 %global real_version 1.40.16 %global rpm_version %{real_version} -%global release_version 12 +%global release_version 13 %global snapshot %{nil} %global git_sha %{nil} %global bcond_default_debug 0 @@ -207,6 +207,7 @@ Patch1008: 1008-cloud-setup-fix-terminating-in-reconfig-rh2221903.patch Patch1009: 1009-manager-allow-controller-activation-if-device-is-dea-rhel-5119.patch Patch1010: 1010-fix-l3cd-comparison-rhel-8423.patch Patch1011: 1011-dispatch-dns-change-event-rhel-10195.patch +Patch1012: 1012-device-do-not-set-MAC-address-on-iface-with-index-0-rhel-16008.patch Requires(post): systemd %if 0%{?fedora} || 0%{?rhel} >= 8 @@ -1242,6 +1243,9 @@ fi %changelog +* Mon Dec 04 2023 Fernando Fernandez - 1:1.40.16-13 +- device: do not set MAC address on iface with index <=0 (RHEL-16008) + * Thu Oct 19 2023 Íñigo Huguet - 1:1.40.16-12 - Dispatch "dns-changed" event (RHEL-10195)