summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-16 15:07:30 +0100
committerGitHub <noreply@github.com>2021-01-16 15:07:30 +0100
commit0ee4ed4ab400474e29a9f0e4e608a68050255f38 (patch)
tree96b164361c47c7de0b618782f8eb51df8da246dc /python
parent29e8af4dd8396ce8d3427a9a8f7e81a95a550d20 (diff)
parentaef8f45290ee156e600fb647cf02e911787404d9 (diff)
downloadvyos-1x-0ee4ed4ab400474e29a9f0e4e608a68050255f38.tar.gz
vyos-1x-0ee4ed4ab400474e29a9f0e4e608a68050255f38.zip
Merge pull request #686 from jack9603301/T3137
bridge: T3137: Support disable native VLAN
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/bridge.py9
-rw-r--r--python/vyos/ifconfig/interface.py9
2 files changed, 6 insertions, 12 deletions
diff --git a/python/vyos/ifconfig/bridge.py b/python/vyos/ifconfig/bridge.py
index 85b5335de..a565d37a6 100644
--- a/python/vyos/ifconfig/bridge.py
+++ b/python/vyos/ifconfig/bridge.py
@@ -342,10 +342,6 @@ class BridgeIf(Interface):
vlan_id = interface_config['native_vlan']
add_vlan.append(vlan_id)
native_vlan_id = vlan_id
- else:
- # VLAN 1 is the default VLAN for all unlabeled packets
- add_vlan.append(1)
- native_vlan_id = 1
if 'allowed_vlan' in interface_config:
for vlan in interface_config['allowed_vlan']:
@@ -367,8 +363,9 @@ class BridgeIf(Interface):
cmd = f'bridge vlan add dev {interface} vid {vlan} master'
self._cmd(cmd)
# Setting native VLAN to system
- cmd = f'bridge vlan add dev {interface} vid {native_vlan_id} pvid untagged master'
- self._cmd(cmd)
+ if native_vlan_id:
+ cmd = f'bridge vlan add dev {interface} vid {native_vlan_id} pvid untagged master'
+ self._cmd(cmd)
# Enable/Disable of an interface must always be done at the end of the
# derived class to make use of the ref-counting set_admin_state()
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index f7578fe2d..3b92ce463 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -912,10 +912,6 @@ class Interface(Control):
vlan_id = bridge_config['native_vlan']
add_vlan.append(vlan_id)
native_vlan_id = vlan_id
- else:
- # VLAN 1 is the default VLAN for all unlabeled packets
- add_vlan.append(1)
- native_vlan_id = 1
if 'allowed_vlan' in bridge_config:
for vlan in bridge_config['allowed_vlan']:
@@ -937,8 +933,9 @@ class Interface(Control):
cmd = f'bridge vlan add dev {ifname} vid {vlan} master'
self._cmd(cmd)
# Setting native VLAN to system
- cmd = f'bridge vlan add dev {ifname} vid {native_vlan_id} pvid untagged master'
- self._cmd(cmd)
+ if native_vlan_id:
+ cmd = f'bridge vlan add dev {ifname} vid {native_vlan_id} pvid untagged master'
+ self._cmd(cmd)
def set_dhcp(self, enable):
"""