From c71a97fc13357fcc34b48aa254ad727939a24957 Mon Sep 17 00:00:00 2001 From: Christian Breunig <christian@breunig.cc> Date: Sat, 15 Apr 2023 15:29:53 +0200 Subject: vyos.ifconfig: T2104: support adding and removing VLANs in one call. VLANIf('eth0.10').remove() will create and remove the VLAN in one command. Thus one can ensure when calling remove() on a VLAN it will always succeed. (cherry picked from commit 7700da10b8d1d1b3d0db914ab48aebf8ff536da1) --- python/vyos/ifconfig/interface.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py index 7dbedea45..634060c4b 100644 --- a/python/vyos/ifconfig/interface.py +++ b/python/vyos/ifconfig/interface.py @@ -1549,6 +1549,14 @@ class VLANIf(Interface): if self.exists(f'{self.ifname}'): return + # If source_interface or vlan_id was not explicitly defined (e.g. when + # calling VLANIf('eth0.1').remove() we can define source_interface and + # vlan_id here, as it's quiet obvious that it would be eth0 in that case. + if 'source_interface' not in self.config: + self.config['source_interface'] = '.'.join(self.ifname.split('.')[:-1]) + if 'vlan_id' not in self.config: + self.config['vlan_id'] = self.ifname.split('.')[-1] + cmd = 'ip link add link {source_interface} name {ifname} type vlan id {vlan_id}' if 'protocol' in self.config: cmd += ' protocol {protocol}' -- cgit v1.2.3 From 3c98ddfa180a464683b841c4af97ec4c185e3e29 Mon Sep 17 00:00:00 2001 From: Christian Breunig <christian@breunig.cc> Date: Fri, 5 May 2023 22:10:06 +0200 Subject: container: T5082: future proof bridge network name Users might add the podman network interface to a zone based firewall. This could cuase breaking configs on upgrades to 1.4. As container support is not yet released for 1.3 LTS version (will be 1.3.3), we once rename the network interface to match the schema in VyOS 1.4. --- src/conf_mode/container.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/conf_mode/container.py b/src/conf_mode/container.py index 2d7f03e7f..667d08f8c 100755 --- a/src/conf_mode/container.py +++ b/src/conf_mode/container.py @@ -361,7 +361,7 @@ def generate(container): 'name' : network, 'plugins' : [{ 'type': 'bridge', - 'bridge': f'cni-{network}', + 'bridge': f'pod-{network}', 'isGateway': True, 'ipMasq': False, 'hairpinMode': False, -- cgit v1.2.3