summaryrefslogtreecommitdiff
path: root/src/conf_mode/host_name.py
diff options
context:
space:
mode:
authorJernej Jakob <jernej.jakob@gmail.com>2020-06-11 08:59:04 +0200
committerJernej Jakob <jernej.jakob@gmail.com>2020-06-11 22:10:47 +0200
commit77081a6585fb64c1dba32c97eaaa54cf6a8741d9 (patch)
tree25ad0395fa935494542934ddb4d21027a8b809fe /src/conf_mode/host_name.py
parent7343e0e184a15eb56dc0ae1ee9bbc8ef60871704 (diff)
downloadvyos-1x-77081a6585fb64c1dba32c97eaaa54cf6a8741d9.tar.gz
vyos-1x-77081a6585fb64c1dba32c97eaaa54cf6a8741d9.zip
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 <interface>, which allows us to enable just the interfaces we want to use for system DNS, identical in syntax to 'service dns forwarding dhcp <interface>'. 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.
Diffstat (limited to 'src/conf_mode/host_name.py')
-rwxr-xr-xsrc/conf_mode/host_name.py5
1 files changed, 2 insertions, 3 deletions
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'):