net.unbound: Disable use of hosts file by default (fixes #1737) 0.12
authorKim Alvefur <zash@zash.se>
Mon, 16 May 2022 12:45:51 +0200
branch0.12
changeset 12513 a92e1de62c9e
parent 12511 e242a6e74424
child 12514 cd3b5912c9a3
net.unbound: Disable use of hosts file by default (fixes #1737) This mirrors the behaviour with net.dns and avoids the initialization issue in #1737
net/unbound.lua
--- a/net/unbound.lua	Mon May 16 11:39:17 2022 +0200
+++ b/net/unbound.lua	Mon May 16 12:45:51 2022 +0200
@@ -25,13 +25,22 @@
 local classes, types, errors = dns_utils.classes, dns_utils.types, dns_utils.errors;
 local parsers = dns_utils.parsers;
 
+local builtin_defaults = { hoststxt = false }
+
 local function add_defaults(conf)
 	if conf then
+		for option, default in pairs(builtin_defaults) do
+			if conf[option] == nil then
+				conf[option] = default;
+			end
+		end
 		for option, default in pairs(libunbound.config) do
 			if conf[option] == nil then
 				conf[option] = default;
 			end
 		end
+	else
+		return builtin_defaults;
 	end
 	return conf;
 end