Skip to content

Commit

Permalink
Catch EPROTONOSUPPORT as a sign of no IPv6 as well (#41)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
KJTsanaktsidis committed Nov 24, 2023
1 parent da9c023 commit 5e2d487
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/resolv.rb
Expand Up @@ -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
Expand Down

0 comments on commit 5e2d487

Please sign in to comment.