summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-07-30 19:14:10 +0200
committerChristian Poessinger <christian@poessinger.com>2022-07-31 19:42:57 +0200
commita782eb0711af53a0565589d67056c9706ec328fc (patch)
treec7d8acffe1e65c674743b94d275ad432d4945eef /python
parent03e6b4e9cda0d9573afbd99bc356f7ff584d7809 (diff)
downloadvyos-1x-a782eb0711af53a0565589d67056c9706ec328fc.tar.gz
vyos-1x-a782eb0711af53a0565589d67056c9706ec328fc.zip
bridge: T4579: remove duplicate code path already handled by base class
Interface() base class already takes care about VLAN creation/removal of newly added or no longer required interfaces. No need to code this logic again. (cherry picked from commit 41477cc85208507be55f8db4e412ad78eae764eb)
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/bridge.py29
1 files changed, 5 insertions, 24 deletions
diff --git a/python/vyos/ifconfig/bridge.py b/python/vyos/ifconfig/bridge.py
index ffd9c590f..d5dbaeb99 100644
--- a/python/vyos/ifconfig/bridge.py
+++ b/python/vyos/ifconfig/bridge.py
@@ -183,6 +183,11 @@ class BridgeIf(Interface):
"""
self.set_interface('vlan_filter', state)
+ # VLAN of bridge parent interface is always 1
+ # VLAN 1 is the default VLAN for all unlabeled packets
+ cmd = f'bridge vlan add dev {self.ifname} vid 1 pvid untagged self'
+ self._cmd(cmd)
+
def set_multicast_querier(self, enable):
"""
Sets whether the bridge actively runs a multicast querier or not. When a
@@ -272,30 +277,6 @@ class BridgeIf(Interface):
vlan_filter = '1' if 'enable_vlan' in config else '0'
self.set_vlan_filter(vlan_filter)
- ifname = config['ifname']
- if int(vlan_filter):
- add_vlan = []
- cur_vlan_ids = get_vlan_ids(ifname)
-
- tmp = dict_search('vif', config)
- if tmp:
- for vif, vif_config in tmp.items():
- add_vlan.append(vif)
-
- # Remove redundant VLANs from the system
- for vlan in list_diff(cur_vlan_ids, add_vlan):
- cmd = f'bridge vlan del dev {ifname} vid {vlan} self'
- self._cmd(cmd)
-
- for vlan in add_vlan:
- cmd = f'bridge vlan add dev {ifname} vid {vlan} self'
- self._cmd(cmd)
-
- # VLAN of bridge parent interface is always 1
- # VLAN 1 is the default VLAN for all unlabeled packets
- cmd = f'bridge vlan add dev {ifname} vid 1 pvid untagged self'
- self._cmd(cmd)
-
tmp = dict_search('member.interface', config)
if tmp:
for interface, interface_config in tmp.items():