From 740ace13f36b78583434eabfbd324cf3d29e909d Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Wed, 17 Jun 2020 22:45:13 +0200 Subject: router-advert: T2609: add missing verify() for prefix lifetime radvd[31898]: AdvValidLifeTime must be greater than AdvPreferredLifetime in radvd.conf, line 19 This happens with the following configuration: vyos@vyos# show service router-advert interface eth0.20 { name-server 2001:4860:4860::8888 prefix ::/64 { valid-lifetime 7200 } } A validator is added to solve this issue and radvd will run again. --- src/conf_mode/service_router-advert.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'src/conf_mode') diff --git a/src/conf_mode/service_router-advert.py b/src/conf_mode/service_router-advert.py index 594641975..89d4d5dd8 100755 --- a/src/conf_mode/service_router-advert.py +++ b/src/conf_mode/service_router-advert.py @@ -107,8 +107,8 @@ def get_config(): 'prefix' : prefix, 'autonomous_flag' : 'on', 'on_link' : 'on', - 'preferred_lifetime': '14400', - 'valid_lifetime' : '2592000' + 'preferred_lifetime': 14400, + 'valid_lifetime' : 2592000 } @@ -122,10 +122,10 @@ def get_config(): tmp['on_link'] = 'off' if conf.exists(['preferred-lifetime']): - tmp['preferred_lifetime'] = conf.return_value(['preferred-lifetime']) + tmp['preferred_lifetime'] = int(conf.return_value(['preferred-lifetime'])) if conf.exists(['valid-lifetime']): - tmp['valid_lifetime'] = conf.return_value(['valid-lifetime']) + tmp['valid_lifetime'] = int(conf.return_value(['valid-lifetime'])) intf['prefixes'].append(tmp) @@ -134,6 +134,13 @@ def get_config(): return rtradv def verify(rtradv): + for interface in rtradv['interfaces']: + for prefix in interface['prefixes']: + import pprint + pprint.pprint(prefix) + if not (prefix['valid_lifetime'] > prefix['preferred_lifetime']): + raise ConfigError('Prefix valid-lifetime must be greater then preferred-lifetime') + return None def generate(rtradv): -- cgit v1.2.3