mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-04-22 10:30:43 +02:00
bond: avoid logging warning to set "ad_actor_system=00:00:00:00:00:00"
The bond option ad_actor_system only matters (and is available) with mode=802.3ad. When you create a new bond, the sysctl value will be set to "00:00:00:00:00:00". So this seems to be a valid value, and in fact the default value for this option. However, kernel will fail with EINVAL to set the sysctl to "00:00:00:00:00:00". Kernel fails both if the value is already "00:00:00:00:00:00" (i.e. setting the same value results in an error) and it also fails otherwise (i.e. we cannot ever reset the value to "00:00:00:00:00:00", at least not via sysfs). Avoid the warning in the common case, where the value is already as expected. Otherwise, we still get the warning and won't be able to set the right value. But this is really a limitation of the kernel API where we cannot do anything about it (in NetworkManager). https://bugzilla.redhat.com/show_bug.cgi?id=1923999
This commit is contained in:
parent
09c943b9a7
commit
9e7af31454
3 changed files with 21 additions and 1 deletions
|
|
@ -109,6 +109,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, value);
|
||||
if (!ret)
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ _bond_get_option_normalized(NMSettingBond *self, const char *option, gboolean ge
|
|||
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 "";
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -586,6 +586,8 @@ 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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue