summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-08-04 10:12:21 +0200
committerChristian Poessinger <christian@poessinger.com>2020-08-04 10:12:21 +0200
commit3658058c6299a107dd5ce5973a9ec5e4be7064b0 (patch)
tree0c1b5a3fe4c29b0d611206458f6d7593c1e6d149
parent4526ceadf4a9a81b51ec394970188daccd69539b (diff)
downloadvyos-1x-3658058c6299a107dd5ce5973a9ec5e4be7064b0.tar.gz
vyos-1x-3658058c6299a107dd5ce5973a9ec5e4be7064b0.zip
router-advert: T2758: bugfix 'infinity' is not a valid integer number
Problem was introduced in commit 740ace13 ("router-advert: T2609: add missing verify() for prefix lifetime"). The 'infinity' literal was not converted to its corresponding integer 0xffffffff (4294967295) for the check.
-rwxr-xr-xsrc/conf_mode/service_router-advert.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/conf_mode/service_router-advert.py b/src/conf_mode/service_router-advert.py
index 1b333e1a5..4e1c432ab 100755
--- a/src/conf_mode/service_router-advert.py
+++ b/src/conf_mode/service_router-advert.py
@@ -73,7 +73,15 @@ def verify(rtradv):
if 'prefix' in interface:
for prefix in interface['prefix']:
prefix = interface['prefix'][prefix]
- if not (int(prefix['valid_lifetime']) > int(prefix['preferred_lifetime'])):
+ valid_lifetime = prefix['valid_lifetime']
+ if valid_lifetime == 'infinity':
+ valid_lifetime = 4294967295
+
+ preferred_lifetime = prefix['preferred_lifetime']
+ if preferred_lifetime == 'infinity':
+ preferred_lifetime = 4294967295
+
+ if not (int(valid_lifetime) > int(preferred_lifetime)):
raise ConfigError('Prefix valid-lifetime must be greater then preferred-lifetime')
return None