diff options
author | khramshinr <khramshinr@gmail.com> | 2024-07-29 15:31:37 +0600 |
---|---|---|
committer | khramshinr <khramshinr@gmail.com> | 2024-09-11 13:14:31 +0600 |
commit | 9e194ce895319683b877890ebb7d5da06b8e9b31 (patch) | |
tree | d122f1c034c026062b5612d35c617e48cfb7c863 /src/conf_mode/service_dns_forwarding.py | |
parent | 4bbd5c7c13f7ea72ba40813db0e6258ecf0a59f7 (diff) | |
download | vyos-1x-9e194ce895319683b877890ebb7d5da06b8e9b31.tar.gz vyos-1x-9e194ce895319683b877890ebb7d5da06b8e9b31.zip |
T6294: Service dns forwarding add the ability to configure ZonetoCache
Diffstat (limited to 'src/conf_mode/service_dns_forwarding.py')
-rwxr-xr-x | src/conf_mode/service_dns_forwarding.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/conf_mode/service_dns_forwarding.py b/src/conf_mode/service_dns_forwarding.py index 70686534f..e3bdbc9f8 100755 --- a/src/conf_mode/service_dns_forwarding.py +++ b/src/conf_mode/service_dns_forwarding.py @@ -224,6 +224,18 @@ def get_config(config=None): dns['authoritative_zones'].append(zone) + if 'zone_cache' in dns: + # convert refresh interval to sec: + for _, zone_conf in dns['zone_cache'].items(): + if 'options' in zone_conf \ + and 'refresh' in zone_conf['options']: + + if 'on_reload' in zone_conf['options']['refresh']: + interval = 0 + else: + interval = zone_conf['options']['refresh']['interval'] + zone_conf['options']['refresh']['interval'] = interval + return dns def verify(dns): @@ -259,8 +271,16 @@ def verify(dns): if not 'system_name_server' in dns: print('Warning: No "system name-server" configured') + if 'zone_cache' in dns: + for name, conf in dns['zone_cache'].items(): + if ('source' not in conf) \ + or ('url' in conf['source'] and 'axfr' in conf['source']): + raise ConfigError(f'Invalid configuration for zone "{name}": ' + f'Please select one source type "url" or "axfr".') + return None + def generate(dns): # bail out early - looks like removal from running config if not dns: |