diff --git a/dhcpy6d/config.py b/dhcpy6d/config.py index 9881e65..b5ce0ef 100644 --- a/dhcpy6d/config.py +++ b/dhcpy6d/config.py @@ -121,7 +121,11 @@ def __init__(self): # INFORMATION REFRESH TIME option 32 for option 11 (INFORMATION REQUEST) # see RFC http://tools.ietf.org/html/rfc4242 - self.INFORMATION_REFRESH_TIME = '6000' + self.INFORMATION_REFRESH_TIME = '600' + + # SOL_MAX_RT Option 82 + # see https://www.rfc-editor.org/rfc/rfc8415.html#page-127 + self.MAX_SOLICITATION_REFRESH_TIME = '1200' # config type # one of file, mysql, sqlite or none @@ -727,6 +731,13 @@ def read_config(self, configfile): error_exit(f"{msg_prefix} Information refresh time preference " f"'{self.INFORMATION_REFRESH_TIME}' is pretty short.") + # check max solicitation refresh time + if not self.MAX_SOLICITATION_REFRESH_TIME.isdigit(): + error_exit(f"{msg_prefix} Max solicitation refresh time '{self.MAX_SOLICITATION_REFRESH_TIME}' is invalid.") + elif not 60 <= int(self.MAX_SOLICITATION_REFRESH_TIME) <= 86400: + error_exit(f"{msg_prefix} Max solicitation refresh time preference " + f"'{self.MAX_SOLICITATION_REFRESH_TIME}' is not greater or equal to 60 and neither smaller or equal to 86400.") + # check validity of configuration source if self.STORE_CONFIG not in ['mysql', 'postgresql', 'sqlite', 'file', False]: error_exit(f"{msg_prefix} Unknown config storage type '{self.STORAGE}' is invalid.") diff --git a/dhcpy6d/options/option_82.py b/dhcpy6d/options/option_82.py index 5b02635..c5ce0c1 100644 --- a/dhcpy6d/options/option_82.py +++ b/dhcpy6d/options/option_82.py @@ -25,6 +25,6 @@ class Option(OptionTemplate): Option 32 Information Refresh Time """ def build(self, **kwargs): - response_string_part = self.convert_to_string(self.number, f'{int(cfg.INFORMATION_REFRESH_TIME):08x}') + response_string_part = self.convert_to_string(self.number, f'{int(cfg.MAX_SOLICITATION_REFRESH_TIME):08x}') # options in answer to be logged return response_string_part, self.number