summaryrefslogtreecommitdiff
path: root/src/conf_mode/interfaces-bonding.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2022-07-14 20:13:53 +0200
committerChristian Poessinger <christian@poessinger.com>2022-07-18 08:14:33 +0200
commit752ddaff0a806527ab6cc787b4ab2a60fec01886 (patch)
treef46357a84c0cf39c43e70bd1cab9ee36627c2ec8 /src/conf_mode/interfaces-bonding.py
parent3a1c690e22e397bbdecf47364c3f885df7a8e8ef (diff)
downloadvyos-1x-752ddaff0a806527ab6cc787b4ab2a60fec01886.tar.gz
vyos-1x-752ddaff0a806527ab6cc787b4ab2a60fec01886.zip
bond: bridge: T4534: error out if member interface is assigned to a VRF instance
It makes no sense to enslave an interface to a bond or a bridge device if it is bound to a given VRF. If VRFs should be used - the encapuslating/master interface should be part of the VRF. Error out if the member interface is part of a VRF. (cherry picked from commit 87d2dff241d9ab4de9f3a2c7fbf9852934557aef)
Diffstat (limited to 'src/conf_mode/interfaces-bonding.py')
-rwxr-xr-xsrc/conf_mode/interfaces-bonding.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/conf_mode/interfaces-bonding.py b/src/conf_mode/interfaces-bonding.py
index 55ffb184d..06e6f059a 100755
--- a/src/conf_mode/interfaces-bonding.py
+++ b/src/conf_mode/interfaces-bonding.py
@@ -35,6 +35,7 @@ from vyos.ifconfig import BondIf
from vyos.ifconfig import Section
from vyos.util import dict_search
from vyos.validate import has_address_configured
+from vyos.validate import has_vrf_configured
from vyos import ConfigError
from vyos import airbag
airbag.enable()
@@ -125,6 +126,10 @@ def get_config(config=None):
tmp = has_address_configured(conf, interface)
if tmp: bond['member']['interface'][interface].update({'has_address' : {}})
+ # bond members must not have a VRF attached
+ tmp = has_vrf_configured(conf, interface)
+ if tmp: bond['member']['interface'][interface].update({'has_vrf' : {}})
+
return bond
@@ -181,6 +186,8 @@ def verify(bond):
if 'has_address' in interface_config:
raise ConfigError(error_msg + 'it has an address assigned!')
+ if 'has_vrf' in interface_config:
+ raise ConfigError(error_msg + 'it has a VRF assigned!')
if 'primary' in bond:
if bond['primary'] not in bond['member']['interface']: