summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2023-07-14 06:57:11 +0200
committerChristian Breunig <christian@breunig.cc>2023-07-14 06:57:11 +0200
commitb2089e76aed939b4b923ef00291f11dd1570b2d3 (patch)
treebc01314aadbdc6e9fbc285a045ea78b9eafd905a /src
parentac60fe7d1840b8768542ee4b3f28f46544c290f2 (diff)
downloadvyos-1x-b2089e76aed939b4b923ef00291f11dd1570b2d3.tar.gz
vyos-1x-b2089e76aed939b4b923ef00291f11dd1570b2d3.zip
bgp: T5338: bugfix MPLS VRF error handling
Commit 6e621e42f ("bgp: T5338: simplify XML and code handling") hat a wrong if branch when handling the check if an interface belongs to the proper VRF when MPLS forwarding is used. This has been fixed.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/protocols_bgp.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py
index 79d97860b..6a33a2794 100755
--- a/src/conf_mode/protocols_bgp.py
+++ b/src/conf_mode/protocols_bgp.py
@@ -242,9 +242,14 @@ def verify(bgp):
# Verify vrf on interface and bgp section
if 'interface' in bgp:
for interface in bgp['interface']:
+ error_msg = f'Interface "{interface}" belongs to different VRF instance'
tmp = get_interface_vrf(interface)
- if ('vrf' in bgp and bgp['vrf'] != tmp) or tmp != 'default':
- raise ConfigError(f'Interface "{interface}" belongs to different VRF instance!')
+ if 'vrf' in bgp:
+ if bgp['vrf'] != tmp:
+ vrf = bgp['vrf']
+ raise ConfigError(f'{error_msg} "{vrf}"!')
+ elif tmp != 'default':
+ raise ConfigError(f'{error_msg} "{tmp}"!')
# Common verification for both peer-group and neighbor statements
for neighbor in ['neighbor', 'peer_group']: