summaryrefslogtreecommitdiff
path: root/src/conf_mode/dns_forwarding.py
diff options
context:
space:
mode:
authorJernej Jakob <jernej.jakob@gmail.com>2020-06-11 08:37:15 +0200
committerJernej Jakob <jernej.jakob@gmail.com>2020-06-11 22:10:47 +0200
commitd6d72d37606849607979d410db75d1803f18f159 (patch)
tree27fa11cdf469f6e9757aa578f83b10f8605cf08b /src/conf_mode/dns_forwarding.py
parentf02f9622307687282aeca2600953cf6394f09485 (diff)
downloadvyos-1x-d6d72d37606849607979d410db75d1803f18f159.tar.gz
vyos-1x-d6d72d37606849607979d410db75d1803f18f159.zip
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.
Diffstat (limited to 'src/conf_mode/dns_forwarding.py')
-rwxr-xr-xsrc/conf_mode/dns_forwarding.py13
1 files changed, 13 insertions, 0 deletions
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):