From c5aac0a6a1aba39b734a7b0f65ee4282fc72a605 Mon Sep 17 00:00:00 2001 From: Daniil Baturin Date: Fri, 3 Dec 2021 00:32:39 +0700 Subject: T4035: correct the interface basename extraction logic to avoid confusing 'v' in GENEVE interface prefix ('gnv') with a "vXXX" part of a VRRP interface --- python/vyos/ifconfig/section.py | 10 +++++----- 1 file 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 -- cgit v1.2.3