From 77081a6585fb64c1dba32c97eaaa54cf6a8741d9 Mon Sep 17 00:00:00 2001 From: Jernej Jakob Date: Thu, 11 Jun 2020 08:59:04 +0200 Subject: host_name: T2486: replace disable-dhcp-nameservers with name-servers-dhcp The previous implementation only supported disabling DHCP nameservers for all interfaces, and was implemented improperly so it didn't work anyway. It's safe to remove it completely. This adds support for a new config node name-servers-dhcp , which allows us to enable just the interfaces we want to use for system DNS, identical in syntax to 'service dns forwarding dhcp '. The new option works by adding tags to vyos-hostsd that we want to use to add nameservers to resolv.conf, same as adding tags for dns forwarding but for a different destination file. A config migrator will be added in a separate commit. --- src/conf_mode/host_name.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'src/conf_mode') diff --git a/src/conf_mode/host_name.py b/src/conf_mode/host_name.py index 4fe7b4cbd..a71f9f88f 100755 --- a/src/conf_mode/host_name.py +++ b/src/conf_mode/host_name.py @@ -41,7 +41,7 @@ default_config_data = { 'domain_name': '', 'domain_search': [], 'nameserver': [], - 'no_dhcp_ns': False + 'nameservers_dhcp_interfaces': [], 'static_host_mapping': {} } @@ -66,8 +66,7 @@ def get_config(): if conf.exists("system name-server"): hosts['nameserver'] = conf.return_values("system name-server") - if conf.exists("system disable-dhcp-nameservers"): - hosts['no_dhcp_ns'] = True + hosts['nameservers_dhcp_interfaces'] = conf.return_values("system name-servers-dhcp") # system static-host-mapping for hn in conf.list_nodes('system static-host-mapping host-name'): -- cgit v1.2.3