Diff

util/prosodyctl/check.lua @ 11645:3be346c5b940

util.prosodyctl.check: Reload unbound to ensure hosts.txt is ignored If unbound was initialized prior to this then the config change here wouldn't apply, and it will again think that 127.0.1.1 has been found in DNS.
author Kim Alvefur <zash@zash.se>
date Sat, 03 Jul 2021 03:24:26 +0200
parent 11635:1b17b967838e
child 11651:c9f46d28ed7e
line wrap: on
line diff
--- a/util/prosodyctl/check.lua	Tue Jun 29 16:18:31 2021 +0200
+++ b/util/prosodyctl/check.lua	Sat Jul 03 03:24:26 2021 +0200
@@ -299,10 +299,12 @@
 	if not what or what == "dns" then
 		local dns = require "net.dns";
 		pcall(function ()
+			local unbound = require"net.unbound";
 			local unbound_config = configmanager.get("*", "unbound") or {};
 			unbound_config.hoststxt = false; -- don't look at /etc/hosts
 			configmanager.set("*", "unbound", unbound_config);
-			dns = require"net.unbound".dns;
+			unbound.purge(); -- ensure the above config is used
+			dns = unbound.dns;
 		end)
 		local idna = require "util.encodings".idna;
 		local ip = require "util.ip";