diff options
author | Christian Poessinger <christian@poessinger.com> | 2021-05-15 17:03:23 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2021-05-15 17:10:08 +0200 |
commit | edcdea890b2eeb03d24b06fdd8ac38133e631c05 (patch) | |
tree | 6f628d56f73baacf12b7d58bb601b3e0dd3b5cea /python/vyos/ifconfig/interface.py | |
parent | 388413429335a64083d6850de452934f46c68fb1 (diff) | |
download | vyos-1x-edcdea890b2eeb03d24b06fdd8ac38133e631c05.tar.gz vyos-1x-edcdea890b2eeb03d24b06fdd8ac38133e631c05.zip |
vyos.ifconfig: T3532: re-create Q-in-Q interface on protocol change
It is not possible to change the VLAN encapsulation protocol "on-the-fly". For
this "quirk" we need to actively delete and re-create the VIF-S interface.
(cherry picked from commit cd504035015dca62149b57bc07d8e002bd8723b1)
Diffstat (limited to 'python/vyos/ifconfig/interface.py')
-rw-r--r-- | python/vyos/ifconfig/interface.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index 251d3fa88..40bff7c3d 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -36,6 +36,7 @@ from vyos.template import render from vyos.util import mac2eui64 from vyos.util import dict_search from vyos.util import read_file +from vyos.util import get_interface_config from vyos.template import is_ipv4 from vyos.validate import is_intf_addr_assigned from vyos.validate import is_ipv6_link_local @@ -1251,6 +1252,16 @@ class Interface(Control): vif_s_ifname = f'{ifname}.{vif_s_id}' vif_s_config['ifname'] = vif_s_ifname + + # It is not possible to change the VLAN encapsulation protocol + # "on-the-fly". For this "quirk" we need to actively delete and + # re-create the VIF-S interface. + if self.exists(vif_s_ifname): + cur_cfg = get_interface_config(vif_s_ifname) + protocol = dict_search('linkinfo.info_data.protocol', cur_cfg).lower() + if protocol != vif_s_config['protocol']: + VLANIf(vif_s_ifname).remove() + s_vlan = VLANIf(vif_s_ifname, **tmp) s_vlan.update(vif_s_config) |