From 5e2d48708bb2d28a344d2c027fea637a32df0621 Mon Sep 17 00:00:00 2001 From: KJ Tsanaktsidis Date: Fri, 24 Nov 2023 15:06:20 +1100 Subject: [PATCH] Catch EPROTONOSUPPORT as a sign of no IPv6 as well (#41) If IPv6 is disabled inside a freebsd jail, it seems this returns EPROTONOSUPPORT and not EAFNOSUPPORT. In both cases, we should simply try some other listed DNS servers. Fixes [Bug #19928] https://bugs.ruby-lang.org/issues/19928 --- lib/resolv.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/resolv.rb b/lib/resolv.rb index 9e83353..0c96ee8 100644 --- a/lib/resolv.rb +++ b/lib/resolv.rb @@ -750,7 +750,7 @@ def lazy_initialize next if @socks_hash[bind_host] begin sock = UDPSocket.new(af) - rescue Errno::EAFNOSUPPORT + rescue Errno::EAFNOSUPPORT, Errno::EPROTONOSUPPORT next # The kernel doesn't support the address family. end @socks << sock