From 01f27c67893b64b425aa58b4ac0854d1245d4491 Mon Sep 17 00:00:00 2001 From: Julien Fortin Date: Tue, 16 Feb 2021 18:42:47 +0100 Subject: [PATCH] addons: bridge: skip bridge-bridgeprio if mstpctl-treeprio is configured on the bridge Signed-off-by: Julien Fortin --- ifupdown2/addons/bridge.py | 25 ++++++++++++++++++++++++- 1 file changed, 24 insertions(+), 1 deletion(-) diff --git a/ifupdown2/addons/bridge.py b/ifupdown2/addons/bridge.py index db61241..2ed0433 100644 --- a/ifupdown2/addons/bridge.py +++ b/ifupdown2/addons/bridge.py @@ -464,7 +464,7 @@ class bridge(Bridge, moduleBase): 'bridge-maxage': Link.IFLA_BR_MAX_AGE, 'bridge-ageing': Link.IFLA_BR_AGEING_TIME, 'bridge-stp': Link.IFLA_BR_STP_STATE, - 'bridge-bridgeprio': Link.IFLA_BR_PRIORITY, + # 'bridge-bridgeprio': Link.IFLA_BR_PRIORITY, 'bridge-vlan-aware': Link.IFLA_BR_VLAN_FILTERING, 'bridge-vlan-protocol': Link.IFLA_BR_VLAN_PROTOCOL, # Link.IFLA_BR_GROUP_FWD_MASK, @@ -1487,6 +1487,29 @@ class bridge(Bridge, moduleBase): cached_value=cached_ifla_info_data.get(nl_attr) ) + # special cases ######################################################## + + # bridge-bridgeprio + # if mstpctl-treeprio is configured on the bridge + # do not reset the bridge-bridgeprio to the default value + # NOTE: this is the case for every bridge/mstpctl attribute pairs. + # TODO: more code should be added to handle this in the future. + mstpctl_treeprio = ifaceobj.get_attr_value_first("mstpctl-treeprio") + bridge_bridgeprio = ifaceobj.get_attr_value_first("bridge-bridgeprio") + + if mstpctl_treeprio: + self.logger.info("%s: mstpctl-treeprio attribute is set - ignorning bridge-bridgeprio" % ifname) + else: + self.fill_ifla_info_data_with_ifla_br_attribute( + ifla_info_data=ifla_info_data, + link_just_created=link_just_created, + ifname=ifname, + nl_attr=Link.IFLA_BR_PRIORITY, + attr_name='bridge-bridgeprio', + user_config=bridge_bridgeprio, + cached_value=cached_ifla_info_data.get(Link.IFLA_BR_PRIORITY) + ) + # bridge-mcsnoop self.fill_ifla_info_data_with_ifla_br_attribute( ifla_info_data=ifla_info_data,