diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-10-05 19:31:17 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-10-05 19:35:05 +0200 |
commit | b66b886e840fa86638ab4836ea18749ade85ad6f (patch) | |
tree | 6dd83163f6d03fba4994341f7b0f4926550f0529 | |
parent | bda4784c4831980d06d6ded08268cd590a6bfa0e (diff) | |
download | vyos-1x-b66b886e840fa86638ab4836ea18749ade85ad6f.tar.gz vyos-1x-b66b886e840fa86638ab4836ea18749ade85ad6f.zip |
validate: ipv6: mtu: T2427: wireless interface MTU is not configurable
Commit 5db3d631 ("ifconfig: mtu: disallow MTU < 1280 bytes when IPv6 is enabled
on the interface") checked the "mtu" key for it's value and the test only passed
if mtu was larger then the required 1280 bytes when IPv6 address have
been configured on the link.
wireless (WiFi) interfaces have no MTU node - thus this always resulted in a
Python KeyError.
-rw-r--r-- | python/vyos/configverify.py | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py index f970ca6de..422483663 100644 --- a/python/vyos/configverify.py +++ b/python/vyos/configverify.py @@ -52,26 +52,26 @@ def verify_mtu_ipv6(config): configured on the interface. IPv6 requires a 1280 bytes MTU. """ from vyos.validate import is_ipv6 - # IPv6 minimum required link mtu - min_mtu = 1280 + if 'mtu' in config: + # IPv6 minimum required link mtu + min_mtu = 1280 + if int(config['mtu']) < min_mtu: + interface = config['ifname'] + error_msg = f'IPv6 address will be configured on interface "{interface}" ' \ + f'thus the minimum MTU requirement is {min_mtu}!' - if int(config['mtu']) < min_mtu: - interface = config['ifname'] - error_msg = f'IPv6 address will be configured on interface "{interface}" ' \ - f'thus the minimum MTU requirement is {min_mtu}!' + if not vyos_dict_search('ipv6.address.no_default_link_local', config): + raise ConfigError('link-local ' + error_msg) - if not vyos_dict_search('ipv6.address.no_default_link_local', config): - raise ConfigError('link-local ' + error_msg) + for address in (vyos_dict_search('address', config) or []): + if address in ['dhcpv6'] or is_ipv6(address): + raise ConfigError(error_msg) - for address in (vyos_dict_search('address', config) or []): - if address in ['dhcpv6'] or is_ipv6(address): + if vyos_dict_search('ipv6.address.autoconf', config): raise ConfigError(error_msg) - if vyos_dict_search('ipv6.address.autoconf', config): - raise ConfigError(error_msg) - - if vyos_dict_search('ipv6.address.eui64', config): - raise ConfigError(error_msg) + if vyos_dict_search('ipv6.address.eui64', config): + raise ConfigError(error_msg) def verify_vrf(config): |