diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-06-17 22:45:13 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-06-17 22:45:16 +0200 |
commit | 740ace13f36b78583434eabfbd324cf3d29e909d (patch) | |
tree | 22ebbd4e967e834f8a9790d6d11e52b26535d64e /src/conf_mode | |
parent | 197043f52f037e43d993c77d2e1947e649a34d72 (diff) | |
download | vyos-1x-740ace13f36b78583434eabfbd324cf3d29e909d.tar.gz vyos-1x-740ace13f36b78583434eabfbd324cf3d29e909d.zip |
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.
Diffstat (limited to 'src/conf_mode')
-rwxr-xr-x | src/conf_mode/service_router-advert.py | 15 |
1 files changed, 11 insertions, 4 deletions
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): |