util.prosodyctl.check: Silence IP protocol mismatches when disabled
authorKim Alvefur <zash@zash.se>
Sun, 04 Jul 2021 01:23:35 +0200
changeset 11655 c9f46d28ed7e
parent 11654 a227bc35771e
child 11656 887d7b15e21b
util.prosodyctl.check: Silence IP protocol mismatches when disabled If you set 'use_ipv4 = false' then you probably don't care much for the host not resolving to the IPv4 address, and same with 'use_ipv6'.
util/prosodyctl/check.lua
--- a/util/prosodyctl/check.lua	Sat Jul 03 17:28:07 2021 +0200
+++ b/util/prosodyctl/check.lua	Sun Jul 04 01:23:35 2021 +0200
@@ -471,6 +471,8 @@
 				end
 			end
 
+			local use_ipv4 = configmanager.get("*", "use_ipv4") ~= false;
+			local use_ipv6 = configmanager.get("*", "use_ipv6") ~= false;
 			for target_host in target_hosts do
 				local host_ok_v4, host_ok_v6;
 				do
@@ -511,10 +513,10 @@
 				end
 
 				local bad_protos = {}
-				if not host_ok_v4 then
+				if use_ipv4 and not host_ok_v4 then
 					table.insert(bad_protos, "IPv4");
 				end
-				if not host_ok_v6 then
+				if use_ipv6 and not host_ok_v6 then
 					table.insert(bad_protos, "IPv6");
 				end
 				if #bad_protos > 0 then