From d6d72d37606849607979d410db75d1803f18f159 Mon Sep 17 00:00:00 2001 From: Jernej Jakob Date: Thu, 11 Jun 2020 08:37:15 +0200 Subject: dns forwarding: T2486: add warning for no dhcp, system or static nameservers Add warning that forwarding will operate as a recursor in case there are no nameservers configured. --- src/conf_mode/dns_forwarding.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/conf_mode') diff --git a/src/conf_mode/dns_forwarding.py b/src/conf_mode/dns_forwarding.py index 556947733..06bdab12b 100755 --- a/src/conf_mode/dns_forwarding.py +++ b/src/conf_mode/dns_forwarding.py @@ -124,6 +124,19 @@ def verify(conf, dns): raise ConfigError(( f'Error: No server configured for domain {domain}')) + no_system_nameservers = False + if dns['system'] and not ( + conf.exists(['system', 'name-server']) or + conf.exists(['system', 'name-servers-dhcp']) ): + no_system_nameservers = True + print(("DNS forwarding warning: No 'system name-server' or " + "'system name-servers-dhcp' set\n")) + + if (no_system_nameservers or not dns['system']) and not ( + dns['name_servers'] or dns['dhcp_interfaces']): + print(("DNS forwarding warning: No 'dhcp', 'name-server' or 'system' " + "nameservers set. Forwarding will operate as a recursor.\n")) + return None def generate(dns): -- cgit v1.2.3