1
0
mirror of https://github.com/CumulusNetworks/ifupdown2.git synced 2024-05-06 15:54:50 +00:00

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 <jfortin@nvidia.com>
This commit is contained in:
Julien Fortin
2021-08-20 17:45:51 +02:00
parent 1ac64c41d7
commit ab287bc42c

View File

@ -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(