From 25ae8dfb88bf9c1537cb6e4ef068a6b1e146f02a Mon Sep 17 00:00:00 2001 From: roy Date: Tue, 27 Aug 2024 16:40:06 +0800 Subject: [PATCH] bond: avoid logging warning to set "ad_actor_system=00:00:00:00:00:00" --- NetworkManager.spec | 9 ++- ...gging-warning-to-set-ad_actor_system.patch | 71 +++++++++++++++++++ 2 files changed, 79 insertions(+), 1 deletion(-) create mode 100644 backport-avoid-logging-warning-to-set-ad_actor_system.patch diff --git a/NetworkManager.spec b/NetworkManager.spec index 7eedb02..85fa22f 100644 --- a/NetworkManager.spec +++ b/NetworkManager.spec @@ -48,7 +48,7 @@ Name: NetworkManager Version: 1.26.2 Epoch: 1 -Release: 13 +Release: 14 Summary: Network Link Manager and User Applications License: GPLv2+ URL: https://www.gnome.org/projects/NetworkManager/ @@ -65,6 +65,7 @@ Patch6: backport-core-fix-crash-in-nm_wildcard_match_check.patch Patch7: backport-core-ovs-fix-leak-of-NMOvsdbPrivate-db_uuid.patch Patch8: backport-libnm-fix-leak-and-return-failures-from-nm-client-load-connections.patch Patch9: bugfix-use-PartOf-replace-Requires-in-service.patch +Patch10: backport-avoid-logging-warning-to-set-ad_actor_system.patch BuildRequires: gcc libtool pkgconfig automake autoconf intltool gettext-devel ppp-devel gnutls-devel BuildRequires: dbus-devel dbus-glib-devel glib2-devel gobject-introspection-devel jansson-devel @@ -436,6 +437,12 @@ fi %{_datadir}/gtk-doc/html/NetworkManager/* %changelog +* Tue Aug 27 2024 Yu Peng - 1:1.26.2-14 +- Type:bugfix +- ID:NA +- SUG:NA +- DESC: bond:avoid logging warning to set "ad_actor_system=00:00:00:00:00:00". + * Mon Mar 7 2022 seuzw <930zhaowei@163.com> - 1.26.2-13 - Type:bugfix - ID:NA diff --git a/backport-avoid-logging-warning-to-set-ad_actor_system.patch b/backport-avoid-logging-warning-to-set-ad_actor_system.patch new file mode 100644 index 0000000..646171c --- /dev/null +++ b/backport-avoid-logging-warning-to-set-ad_actor_system.patch @@ -0,0 +1,71 @@ +From 76113feedb3ad1a9cf5e997c82f2af722ec1e8cc Mon Sep 17 00:00:00 2001 +From: YuPeng +Date: Tue, 12 Nov 2024 18:49:39 +0800 +Subject: [PATCH] backport-avoid-logging-warning-to-set-ad_actor_system +Confilct:NA +Reference:https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/commit/9e7af314546d7912ee23b3850230008902aca4d3 + +Signed-off-by: YuPeng +--- + libnm-core/nm-core-internal.h | 1 + + libnm-core/nm-setting-bond.c | 2 +- + src/devices/nm-device-bond.c | 18 ++++++++++++++++++ + 3 files changed, 20 insertions(+), 1 deletion(-) + +diff --git a/libnm-core/nm-core-internal.h b/libnm-core/nm-core-internal.h +index 3a15d2e..c5eb37d 100644 +--- a/libnm-core/nm-core-internal.h ++++ b/libnm-core/nm-core-internal.h +@@ -545,6 +545,7 @@ NMBondOptionType _nm_setting_bond_get_option_type (NMSettingBond *setting, const + + const char* nm_setting_bond_get_option_or_default (NMSettingBond *self, const char *option); + ++#define NM_BOND_AD_ACTOR_SYSTEM_DEFAULT "00:00:00:00:00:00" + /*****************************************************************************/ + + /* nm_connection_get_uuid() asserts against NULL, which is the right thing to +diff --git a/libnm-core/nm-setting-bond.c b/libnm-core/nm-setting-bond.c +index 6e0a5e5..e44ac24 100644 +--- a/libnm-core/nm-setting-bond.c ++++ b/libnm-core/nm-setting-bond.c +@@ -306,7 +306,7 @@ _bond_get_option_normalized (NMSettingBond* self, + if (nm_streq (option, NM_SETTING_BOND_OPTION_AD_ACTOR_SYSTEM)) { + /* The default value depends on the current mode */ + if (mode == NM_BOND_MODE_8023AD) +- return "00:00:00:00:00:00"; ++ return NM_BOND_AD_ACTOR_SYSTEM_DEFAULT; + return ""; + } + +diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c +index 71332ba..6b1da19 100644 +--- a/src/devices/nm-device-bond.c ++++ b/src/devices/nm-device-bond.c +@@ -77,6 +77,24 @@ _set_bond_attr (NMDevice *device, const char *attr, const char *value) + int ifindex = nm_device_get_ifindex (device); + gboolean ret; + ++ nm_assert(attr && attr[0]); ++ nm_assert(value); ++ ++ if (nm_streq(value, NM_BOND_AD_ACTOR_SYSTEM_DEFAULT) ++ && nm_streq(attr, NM_SETTING_BOND_OPTION_AD_ACTOR_SYSTEM)) { ++ gs_free char *cur_val = NULL; ++ ++ /* kernel does not allow setting ad_actor_system to "00:00:00:00:00:00". We would thus ++ * log an EINVAL error. Avoid that... at least, if the value is already "00:00:00:00:00:00". */ ++ cur_val = ++ nm_platform_sysctl_master_get_option(nm_device_get_platform(device), ifindex, attr); ++ if (nm_streq0(cur_val, NM_BOND_AD_ACTOR_SYSTEM_DEFAULT)) ++ return TRUE; ++ ++ /* OK, the current value is different, and we will proceed setting "00:00:00:00:00:00". ++ * That will fail, and we will log a warning. There is nothing else to do. */ ++ } ++ + ret = nm_platform_sysctl_master_set_option (nm_device_get_platform (device), + ifindex, + attr, +-- +2.33.0 +