summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2021-12-03 00:32:39 +0700
committerDaniil Baturin <daniil@baturin.org>2021-12-03 00:32:39 +0700
commitc5aac0a6a1aba39b734a7b0f65ee4282fc72a605 (patch)
tree7470f5514c0fa669fd0a4495b6bf6d607a16bc5c /python
parent5a871f0dac024c7c0c59f1a1709543c4cc5e4f96 (diff)
downloadvyos-1x-c5aac0a6a1aba39b734a7b0f65ee4282fc72a605.tar.gz
vyos-1x-c5aac0a6a1aba39b734a7b0f65ee4282fc72a605.zip
T4035: correct the interface basename extraction logic
to avoid confusing 'v' in GENEVE interface prefix ('gnv') with a "vXXX" part of a VRRP interface
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/section.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/python/vyos/ifconfig/section.py b/python/vyos/ifconfig/section.py
index 0e4447b9e..91f667b65 100644
--- a/python/vyos/ifconfig/section.py
+++ b/python/vyos/ifconfig/section.py
@@ -52,12 +52,12 @@ class Section:
name: name of the interface
vlan: if vlan is True, do not stop at the vlan number
"""
- name = name.rstrip('0123456789')
- name = name.rstrip('.')
- if vlan:
- name = name.rstrip('0123456789.')
if vrrp:
- name = name.rstrip('0123456789v')
+ name = re.sub(r'\d(\d|v|\.)*$', '', name)
+ elif vlan:
+ name = re.sub(r'\d(\d|\.)*$', '', name)
+ else:
+ name = re.sub(r'\d+$', '', name)
return name
@classmethod