summaryrefslogtreecommitdiff
path: root/src/conf_mode
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2021-01-15 19:25:04 +0100
committerChristian Poessinger <christian@poessinger.com>2021-01-15 19:50:54 +0100
commit94f886ab0f98207fee57c11e78b94240b1ffff8e (patch)
tree95440de47980bf2520b342b99062891382cd16a3 /src/conf_mode
parent2ae13c35257f73a9870ec655d55427ad30d6efdb (diff)
downloadvyos-1x-94f886ab0f98207fee57c11e78b94240b1ffff8e.tar.gz
vyos-1x-94f886ab0f98207fee57c11e78b94240b1ffff8e.zip
tunnel: T3173: path MTU discovery option should be valueless
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-xsrc/conf_mode/interfaces-tunnel.py23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/conf_mode/interfaces-tunnel.py b/src/conf_mode/interfaces-tunnel.py
index f79405388..d2fcf3121 100755
--- a/src/conf_mode/interfaces-tunnel.py
+++ b/src/conf_mode/interfaces-tunnel.py
@@ -126,10 +126,14 @@ def verify(tunnel):
if 'source_interface' in tunnel:
verify_interface_exists(tunnel['source_interface'])
- # ttl != 0 and nopmtudisc are incompatible
- if 'pmtu_discovery' in tunnel['parameters']['ip']:
- if 'disable' in tunnel['parameters']['ip']['pmtu_discovery'] and "0" not in tunnel['parameters']['ip']['ttl']:
- raise ConfigError('ip ttl should be set to "0" with option "pmtu-discovery disable"')
+ # TTL != 0 and nopmtudisc are incompatible, parameters and ip use default
+ # values, thus the keys are always present.
+ if dict_search('parameters.ip.no_pmtu_discovery', tunnel) != None:
+ if dict_search('parameters.ip.ttl', tunnel) != '0':
+ raise ConfigError('Disabled PMTU requires TTL set to "0"!')
+ if tunnel['encapsulation'] in ['ipip6', 'ip6ip6', 'ip6gre']:
+ raise ConfigError('Can not disable PMTU discovery for given encapsulation')
+
def generate(tunnel):
return None
@@ -169,7 +173,6 @@ def apply(tunnel):
'local_ip' : 'local',
'remote_ip' : 'remote',
'source_interface' : 'dev',
- 'parameters.ip.pmtu_discovery' : 'pmtud',
'parameters.ip.ttl' : 'ttl',
'parameters.ip.tos' : 'tos',
'parameters.ip.key' : 'key',
@@ -180,7 +183,10 @@ def apply(tunnel):
if tunnel['encapsulation'] in ['ipip6', 'ip6ip6', 'ip6gre']:
mappingv6 = {
# this : get_config()
- 'parameters.ipv6.encaplimit' : 'encaplimit'
+ 'parameters.ipv6.encaplimit' : 'encaplimit',
+ 'parameters.ipv6.flowlabel' : 'flowlabel',
+ 'parameters.ipv6.hoplimit' : 'hoplimit',
+ 'parameters.ipv6.tclass' : 'flowlabel'
}
mapping.update(mappingv6)
@@ -188,6 +194,11 @@ def apply(tunnel):
if dict_search(our_key, tunnel) and their_key in conf:
conf[their_key] = dict_search(our_key, tunnel)
+ if dict_search('parameters.ip.no_pmtu_discovery', tunnel) != None:
+ if 'pmtudisc' in conf['raw']:
+ conf['raw'].remove('pmtudisc')
+ conf['raw'].append('nopmtudisc')
+
tun = klass(tunnel['ifname'], **conf)
tun.change_options()
tun.update(tunnel)