bond: avoid logging warning to set "ad_actor_system=00:00:00:00:00:00"

This commit is contained in:
roy 2024-08-27 16:40:06 +08:00
parent 35dc1157e3
commit 25ae8dfb88
2 changed files with 79 additions and 1 deletions

View File

@ -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 <yupeng@kylinos.cn> - 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

View File

@ -0,0 +1,71 @@
From 76113feedb3ad1a9cf5e997c82f2af722ec1e8cc Mon Sep 17 00:00:00 2001
From: YuPeng <yupeng@kylinos.cn>
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 <yupeng@kylinos.cn>
---
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