From ab287bc42c23af446b913954e1fc9da129ae471c Mon Sep 17 00:00:00 2001 From: Julien Fortin Date: Fri, 20 Aug 2021 17:45:51 +0200 Subject: [PATCH] addons: bridge: fix sync between bridge-learning and vxlan-learning if not specified by the user vxlan brport learning is controlled by the bridge_vxlan_port_learning policy (on by default). 4.4 introduced vxlan-learning off via policy. The syncing code between bridge-learning and vxlan-learning was incomplete and was written at the time when we didn't have a default vxlan-learning policy. This patch fixes the sync-ing gap and makes sure vxlan-learning is sync'd with bridge-learning which wasn't always the case before. for every vxlan brport BRPORT_LEARNING is turned on Signed-off-by: Julien Fortin --- ifupdown2/addons/bridge.py | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/ifupdown2/addons/bridge.py b/ifupdown2/addons/bridge.py index 3ae70e5..43fde69 100644 --- a/ifupdown2/addons/bridge.py +++ b/ifupdown2/addons/bridge.py @@ -2081,6 +2081,7 @@ class bridge(Bridge, moduleBase): """ kind = None + synced = False ifla_info_data = {} if user_config_brport_learning_nl is None: @@ -2093,6 +2094,8 @@ class bridge(Bridge, moduleBase): = cached_brport_learning \ = user_config_brport_learning_nl + synced = True + self.logger.info( "%s: %s: set bridge-learning %s" % (bridge_name, brport_name, "on" if user_config_brport_learning_nl else "off") @@ -2109,19 +2112,27 @@ class bridge(Bridge, moduleBase): # # vxlan-learning sync: # + brport_vxlan_learning_config_synced = False brport_vxlan_learning_config = brport_ifaceobj.get_attr_value_first("vxlan-learning") # if vxlan-learning is defined by the user or via policy file we need # to honor his config and not sync vxlan-learning with bridge-learning + if not brport_vxlan_learning_config and synced: + # vxlan-learning is not defined by the user but bridge-learning was set using bridge-vxlan-port-learning + # vxlan-learning needs to be synced as well + brport_vxlan_learning_config_nl = user_config_brport_learning_nl + brport_vxlan_learning_config_synced = True + if not brport_vxlan_learning_config: # check policy file brport_vxlan_learning_config = policymanager.policymanager_api.get_attr_default("vxlan", "vxlan-learning") - # convert vxlan-learning string to netlink value (if None use brport-learning value instead) - brport_vxlan_learning_config_nl = utils.get_boolean_from_string(brport_vxlan_learning_config) \ - if brport_vxlan_learning_config \ - else cached_brport_learning + if not brport_vxlan_learning_config_synced: + # convert vxlan-learning string to netlink value (if None use brport-learning value instead) + brport_vxlan_learning_config_nl = utils.get_boolean_from_string(brport_vxlan_learning_config) \ + if brport_vxlan_learning_config \ + else cached_brport_learning if brport_vxlan_learning_config_nl != self.cache.get_link_info_data_attribute(brport_name, Link.IFLA_VXLAN_LEARNING): self.logger.info(