summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-06-09 17:01:02 +0200
committerGitHub <noreply@github.com>2024-06-09 17:01:02 +0200
commit264037d4cc3d4b2222da4ebc51258d2919f76840 (patch)
tree0bed0d8b6ea9708ecf5497c3758c17da9c1fa5af /python
parentc4a3a55516cf03794f8baa45ebf9fb3014503106 (diff)
parent083e15c224be61ba51e1a29efdb24921a5278da5 (diff)
downloadvyos-1x-264037d4cc3d4b2222da4ebc51258d2919f76840.tar.gz
vyos-1x-264037d4cc3d4b2222da4ebc51258d2919f76840.zip
Merge pull request #3602 from vyos/mergify/bp/sagitta/pr-3573
vxlan: T6401: Avoid calling get_vxlan_vni_filter() unless we need it (backport #3573)
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/vxlan.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/python/vyos/ifconfig/vxlan.py b/python/vyos/ifconfig/vxlan.py
index bdb48e303..918aea202 100644
--- a/python/vyos/ifconfig/vxlan.py
+++ b/python/vyos/ifconfig/vxlan.py
@@ -138,10 +138,13 @@ class VXLANIf(Interface):
raise ValueError('Value out of range')
if 'vlan_to_vni_removed' in self.config:
- cur_vni_filter = get_vxlan_vni_filter(self.ifname)
+ cur_vni_filter = None
+ if dict_search('parameters.vni_filter', self.config) != None:
+ cur_vni_filter = get_vxlan_vni_filter(self.ifname)
+
for vlan, vlan_config in self.config['vlan_to_vni_removed'].items():
# If VNI filtering is enabled, remove matching VNI filter
- if dict_search('parameters.vni_filter', self.config) != None:
+ if cur_vni_filter != None:
vni = vlan_config['vni']
if vni in cur_vni_filter:
self._cmd(f'bridge vni delete dev {self.ifname} vni {vni}')