summaryrefslogtreecommitdiff
path: root/python/vyos
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-07-30 19:14:10 +0200
committerChristian Poessinger <christian@poessinger.com>2022-07-30 19:27:31 +0200
commit41477cc85208507be55f8db4e412ad78eae764eb (patch)
tree01e8def9faacaa35c693518e6cf97755cd0a22ad /python/vyos
parent99ff0ac7d29a65466a0fe4a12ef1a42cce90ece0 (diff)
downloadvyos-1x-41477cc85208507be55f8db4e412ad78eae764eb.tar.gz
vyos-1x-41477cc85208507be55f8db4e412ad78eae764eb.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.
Diffstat (limited to 'python/vyos')
-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 e4db69c1f..7f0abf4ef 100644
--- a/python/vyos/ifconfig/bridge.py
+++ b/python/vyos/ifconfig/bridge.py
@@ -187,6 +187,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
@@ -293,30 +298,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():