From 8a7f1758da4cba81d65ba4b9b06bbf4b750a6f87 Mon Sep 17 00:00:00 2001 From: Gris Ge Date: Thu, 22 Oct 2020 14:09:27 +0800 Subject: [PATCH 1/2] nm bond: Ignore ad_actor_system=00:00:00:00:00:00 The ad_actor_system=00:00:00:00:00:00 is invalid in kernel as that's the default value of ad_actor_system. NM plugin should not set that value. Test case included. Signed-off-by: Gris Ge Signed-off-by: Fernando Fernandez Mancera --- libnmstate/nm/bond.py | 9 +++++++++ tests/integration/nm/bond_test.py | 12 ++++++++++++ 2 files changed, 21 insertions(+) diff --git a/libnmstate/nm/bond.py b/libnmstate/nm/bond.py index 9ea3648..d196965 100644 --- a/libnmstate/nm/bond.py +++ b/libnmstate/nm/bond.py @@ -38,6 +38,8 @@ NM_SUPPORTED_BOND_OPTIONS = NM.SettingBond.get_valid_options( SYSFS_BOND_OPTION_FOLDER_FMT = "/sys/class/net/{ifname}/bonding" +BOND_AD_ACTOR_SYSTEM_USE_BOND_MAC = "00:00:00:00:00:00" + def create_setting(options, wired_setting): bond_setting = NM.SettingBond.new() @@ -48,6 +50,13 @@ def create_setting(options, wired_setting): ): # When in MAC restricted mode, MAC address should be unset. wired_setting.props.cloned_mac_address = None + if ( + option_name == "ad_actor_system" + and option_value == BOND_AD_ACTOR_SYSTEM_USE_BOND_MAC + ): + # The all zero ad_actor_system is the kernel default value + # And it is invalid to set as all zero + continue if option_value != SYSFS_EMPTY_VALUE: success = bond_setting.add_option(option_name, str(option_value)) if not success: -- 2.25.4