Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Commit 836a110

Browse files
committed
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.
1 parent fb81ce5 commit 836a110

File tree

2 files changed

+37
-8
lines changed

2 files changed

+37
-8
lines changed

src/conf_mode/vpp.py

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -335,6 +335,43 @@ def verify(config):
335335
if iface_config['xdp_options']['num_rx_queues'] != 'all':
336336
Warning(f'Not all RX queues will be connected to VPP for {iface}!')
337337

338+
# check GRE tunnels as part of the bridge, only tunnel-type teb is allowed
339+
# set vpp interfaces bridge br1 member interface gre1
340+
# set vpp interfaces gre gre1 tunnel-type teb
341+
if 'interfaces' in config:
342+
if 'bridge' in config['interfaces']:
343+
for iface, iface_config in config['interfaces']['bridge'].items():
344+
if 'member' in iface_config:
345+
for member in iface_config['member'].get('interface', []):
346+
if member.startswith('gre'):
347+
if (
348+
'gre' in config['interfaces']
349+
and config['interfaces']['gre'].get(member, {}).get('tunnel_type') != 'teb'
350+
):
351+
raise ConfigError(
352+
f'Only tunnel-type teb is allowed for GRE interfaces in bridge {iface}'
353+
)
354+
355+
# Only one multipoint GRE tunnel is allowed from the same source address
356+
# set vpp interfaces gre gre0 mode 'point-to-multipoint'
357+
# set vpp interfaces gre gre0 remote '0.0.0.0'
358+
# set vpp interfaces gre gre0 source-address '192.0.2.1'
359+
# set vpp interfaces gre gre1 mode 'point-to-multipoint'
360+
# set vpp interfaces gre gre1 remote '0.0.0.0'
361+
# set vpp interfaces gre gre1 source-address '192.0.2.1'
362+
if 'gre' in config['interfaces']:
363+
for iface, iface_config in config['interfaces']['gre'].items():
364+
if iface_config['mode'] == 'point-to-multipoint':
365+
for other_iface, other_iface_config in config['interfaces']['gre'].items():
366+
if (
367+
other_iface_config['mode'] == 'point-to-multipoint'
368+
and other_iface_config['source_address'] == iface_config['source_address']
369+
and iface != other_iface
370+
):
371+
raise ConfigError(
372+
'Only one multipoint GRE tunnel is allowed from the same source address'
373+
)
374+
338375
if 'cpu' in config['settings']:
339376
if (
340377
'corelist_workers' in config['settings']['cpu']

src/conf_mode/vpp_interfaces_gre.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,6 @@ def verify(config):
136136
# For multipoint mode, remote IP must be 0.0.0.0
137137
if config.get('remote') != '0.0.0.0':
138138
raise ConfigError('For point-to-multipoint mode, remote must be 0.0.0.0')
139-
# Only one multipoint GRE tunnel is allowed from the same source address
140-
for ifname, iface in config.get('vpp_interfaces', {}).items():
141-
if iface.get('mode') == 'point-to-multipoint' and iface.get(
142-
'source_address'
143-
) == config.get('source_address'):
144-
raise ConfigError(
145-
'Only one multipoint GRE tunnel is allowed from the same source address'
146-
)
147139

148140
# Change 'vpp interfaces gre greX kernel-interface vpp-tunX'
149141
# => 'vpp interfaces gre greX kernel-interface vpp-tunY'

0 commit comments

Comments
 (0)