summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/conf_mode/interfaces-vxlan.py34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/conf_mode/interfaces-vxlan.py b/src/conf_mode/interfaces-vxlan.py
index c035557f0..ee8f26d21 100755
--- a/src/conf_mode/interfaces-vxlan.py
+++ b/src/conf_mode/interfaces-vxlan.py
@@ -44,6 +44,13 @@ def get_config(config=None):
base = ['interfaces', 'vxlan']
vxlan = get_interface_dict(conf, base)
+ # leave first remote in dict and put the other ones (if they exists) to "other_remotes"
+ remotes = vxlan.get('remote')
+ if remotes:
+ vxlan['remote'] = remotes[0]
+ if len(remotes) > 1:
+ del remotes[0]
+ vxlan['other_remotes'] = remotes
return vxlan
def verify(vxlan):
@@ -81,6 +88,33 @@ def verify(vxlan):
raise ConfigError(f'Underlaying device MTU is to small ({lower_mtu} '\
f'bytes) for VXLAN overhead ({vxlan_overhead} bytes!)')
+ # Check for mixed IPv4 and IPv6 addresses
+ protocol = None
+ if 'source_address' in vxlan:
+ if is_ipv6(vxlan['source_address']):
+ protocol = 'ipv6'
+ else:
+ protocol = 'ipv4'
+ if 'remote' in vxlan:
+ if is_ipv6(vxlan['remote']):
+ if protocol == 'ipv4':
+ raise ConfigError('IPv4 and IPV6 cannot be mixed')
+ protocol = 'ipv6'
+ else:
+ if protocol == 'ipv6':
+ raise ConfigError('IPv4 and IPV6 cannot be mixed')
+ protocol = 'ipv4'
+ if 'other_remotes' in vxlan:
+ for rem in vxlan['other_remotes']:
+ if is_ipv6(rem):
+ if protocol == 'ipv4':
+ raise ConfigError('IPv4 and IPV6 cannot be mixed')
+ protocol = 'ipv6'
+ else:
+ if protocol == 'ipv6':
+ raise ConfigError('IPv4 and IPV6 cannot be mixed')
+ protocol = 'ipv4'
+
verify_mtu_ipv6(vxlan)
verify_address(vxlan)
return None