summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorViacheslav Hletenko <v.gletenko@vyos.io>2025-01-24 17:19:54 +0000
committerViacheslav Hletenko <v.gletenko@vyos.io>2025-01-24 19:09:53 +0000
commit1c8e9d5c409ba6b0a7e63cacb8e886bada036b4b (patch)
treeadda65dbc3f51f8ac9bc5d67f57e97ecbf6be056 /src
parentfb81ce586f1077076b9d2588f4599c2dadcad482 (diff)
downloadvyos-1x-1c8e9d5c409ba6b0a7e63cacb8e886bada036b4b.tar.gz
vyos-1x-1c8e9d5c409ba6b0a7e63cacb8e886bada036b4b.zip
GRE: Fix verify options for GRE type teb and multipoint
- Only tunnel-type 'teb' (L2 Transparent Ethernet Bridge) is allowed to brdige with other itnerfaces. - Only one multipoint GRE tunnel is allowed from the same source address. Do this check from the main vpp file as it has the full vpp config dictionary.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/vpp.py43
-rw-r--r--src/conf_mode/vpp_interfaces_gre.py8
2 files changed, 43 insertions, 8 deletions
diff --git a/src/conf_mode/vpp.py b/src/conf_mode/vpp.py
index 32dd0d01a..923ac7f31 100755
--- a/src/conf_mode/vpp.py
+++ b/src/conf_mode/vpp.py
@@ -335,6 +335,49 @@ def verify(config):
if iface_config['xdp_options']['num_rx_queues'] != 'all':
Warning(f'Not all RX queues will be connected to VPP for {iface}!')
+ # check GRE tunnels as part of the bridge, only tunnel-type teb is allowed
+ # set vpp interfaces bridge br1 member interface gre1
+ # set vpp interfaces gre gre1 tunnel-type teb
+ if 'interfaces' in config:
+ if 'bridge' in config['interfaces']:
+ for iface, iface_config in config['interfaces']['bridge'].items():
+ if 'member' in iface_config:
+ for member in iface_config['member'].get('interface', []):
+ if member.startswith('gre'):
+ if (
+ 'gre' in config['interfaces']
+ and config['interfaces']['gre']
+ .get(member, {})
+ .get('tunnel_type')
+ != 'teb'
+ ):
+ raise ConfigError(
+ f'Only tunnel-type teb is allowed for GRE interfaces in bridge {iface}'
+ )
+
+ # Only one multipoint GRE tunnel is allowed from the same source address
+ # set vpp interfaces gre gre0 mode 'point-to-multipoint'
+ # set vpp interfaces gre gre0 remote '0.0.0.0'
+ # set vpp interfaces gre gre0 source-address '192.0.2.1'
+ # set vpp interfaces gre gre1 mode 'point-to-multipoint'
+ # set vpp interfaces gre gre1 remote '0.0.0.0'
+ # set vpp interfaces gre gre1 source-address '192.0.2.1'
+ if 'gre' in config['interfaces']:
+ for iface, iface_config in config['interfaces']['gre'].items():
+ if iface_config['mode'] == 'point-to-multipoint':
+ for other_iface, other_iface_config in config['interfaces'][
+ 'gre'
+ ].items():
+ if (
+ other_iface_config['mode'] == 'point-to-multipoint'
+ and other_iface_config['source_address']
+ == iface_config['source_address']
+ and iface != other_iface
+ ):
+ raise ConfigError(
+ 'Only one multipoint GRE tunnel is allowed from the same source address'
+ )
+
if 'cpu' in config['settings']:
if (
'corelist_workers' in config['settings']['cpu']
diff --git a/src/conf_mode/vpp_interfaces_gre.py b/src/conf_mode/vpp_interfaces_gre.py
index 334725994..817345135 100644
--- a/src/conf_mode/vpp_interfaces_gre.py
+++ b/src/conf_mode/vpp_interfaces_gre.py
@@ -136,14 +136,6 @@ def verify(config):
# For multipoint mode, remote IP must be 0.0.0.0
if config.get('remote') != '0.0.0.0':
raise ConfigError('For point-to-multipoint mode, remote must be 0.0.0.0')
- # Only one multipoint GRE tunnel is allowed from the same source address
- for ifname, iface in config.get('vpp_interfaces', {}).items():
- if iface.get('mode') == 'point-to-multipoint' and iface.get(
- 'source_address'
- ) == config.get('source_address'):
- raise ConfigError(
- 'Only one multipoint GRE tunnel is allowed from the same source address'
- )
# Change 'vpp interfaces gre greX kernel-interface vpp-tunX'
# => 'vpp interfaces gre greX kernel-interface vpp-tunY'