summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJernej Jakob <jernej.jakob@gmail.com>2020-05-01 18:11:13 +0200
committerJernej Jakob <jernej.jakob@gmail.com>2020-05-04 22:59:39 +0200
commit2b002b2b2309942f3ee137e5c2e8427c44038935 (patch)
tree337192914adbc61558637ac6b29b550419272b48 /src
parentbe55968dfbe66477bbef4492abc0875c5da5b797 (diff)
downloadvyos-1x-2b002b2b2309942f3ee137e5c2e8427c44038935.tar.gz
vyos-1x-2b002b2b2309942f3ee137e5c2e8427c44038935.zip
ethernet: T2241: make VRF and bond/bridge membership mutually exclusive
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/interfaces-ethernet.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/conf_mode/interfaces-ethernet.py b/src/conf_mode/interfaces-ethernet.py
index cc6a824dc..468a9040a 100755
--- a/src/conf_mode/interfaces-ethernet.py
+++ b/src/conf_mode/interfaces-ethernet.py
@@ -167,9 +167,7 @@ def verify(eth):
if eth['dhcpv6_prm_only'] and eth['dhcpv6_temporary']:
raise ConfigError('DHCPv6 temporary and parameters-only options are mutually exclusive!')
- vrf_name = eth['vrf']
- if vrf_name and vrf_name not in interfaces():
- raise ConfigError(f'VRF "{vrf_name}" does not exist')
+ memberof = eth['is_bridge_member'] if eth['is_bridge_member'] else eth['is_bond_member']
conf = Config()
# some options can not be changed when interface is enslaved to a bond
@@ -180,6 +178,15 @@ def verify(eth):
if eth['address']:
raise ConfigError(f"Can not assign address to interface {eth['intf']} which is a member of {bond}")
+ if eth['vrf']:
+ if eth['vrf'] not in interfaces():
+ raise ConfigError(f'VRF "{eth["vrf"]}" does not exist')
+
+ if memberof:
+ raise ConfigError((
+ f'Interface "{eth["intf"]}" cannot be member of VRF "{eth["vrf"]}" '
+ f'and "{memberof}" at the same time!'))
+
# use common function to verify VLAN configuration
verify_vlan_config(eth)
return None