From 5e95ed633acf7454ce9f5b668bd1069e1038b499 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Mon, 16 May 2022 12:45:51 +0200
Subject: 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 | 9 +++++++++
 1 file changed, 9 insertions(+)

(limited to 'net')

diff --git a/net/unbound.lua b/net/unbound.lua
index 4a6f0241..f11189fe 100644
--- a/net/unbound.lua
+++ b/net/unbound.lua
@@ -25,13 +25,22 @@ local dns_utils = require"util.dns";
 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
-- 
cgit v1.2.3


From 24288146ae05b47d74bd0d4403825048593623d9 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Mon, 16 May 2022 14:51:01 +0200
Subject: net.unbound: Adjust log level of error to error to error

This error is an error, therefore it should be at the error level
---
 net/unbound.lua | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'net')

diff --git a/net/unbound.lua b/net/unbound.lua
index f11189fe..4d8f9284 100644
--- a/net/unbound.lua
+++ b/net/unbound.lua
@@ -142,7 +142,7 @@ local function lookup(callback, qname, qtype, qclass)
 	if ret then
 		waiting_queries[ret] = callback;
 	else
-		log_query("warn", "Resolver error: %s", err);
+		log_query("error", "Resolver error: %s", err);
 	end
 	return ret, err;
 end
-- 
cgit v1.2.3