From 3658058c6299a107dd5ce5973a9ec5e4be7064b0 Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Tue, 4 Aug 2020 10:12:21 +0200 Subject: 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. --- src/conf_mode/service_router-advert.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'src/conf_mode/service_router-advert.py') 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 -- cgit v1.2.3