diff options
author | Daniil Baturin <daniil@baturin.org> | 2021-12-03 00:32:39 +0700 |
---|---|---|
committer | create with ansible <dmbaturin@debian10-vyos-build.local> | 2021-12-04 00:00:18 -0500 |
commit | 071313e5180c76a7651150747530b41e06a9d7cb (patch) | |
tree | e0f9a7c8658aa723a7a5b73f74b58df9081bd08e | |
parent | 246536e73b5e5af5c350512a417b45b7fcbb7eec (diff) | |
download | vyos-1x-071313e5180c76a7651150747530b41e06a9d7cb.tar.gz vyos-1x-071313e5180c76a7651150747530b41e06a9d7cb.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
-rw-r--r-- | python/vyos/ifconfig/section.py | 10 |
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 |