Revert adding AI_ADDRCONFIG flag to getaddrinfo(3) calls.
It is causing problems when network is in certain, valid, configuration. The point of it is to workaround a glibc bug that is not present for us. https://bugs.ruby-lang.org/issues/20208 To reproduce, have IPv6 enabled localhost but only IPv4 interfaces (such as eth0, name and count of them may vary based on system) to disable public interfaces via sysctl: `$ sysctl "net.ipv6.conf.<interface>.disable_ipv6=1"` Where <interface> is NOT lo but can be eth0 or other. Confirm with command `$ ip addr` command that only `lo` interface has IPv6 address. and run the following with Ruby 3.3: ~~~ $ ruby -rnet/http -e 'http = Net::HTTP.new("localhost", 8080); http.local_host = Addrinfo.tcp("localhost", 8080).ip_address; p http.get("/")' ~~~ The error is then related to EAFNOSUPPORT: ``` Errno::EAFNOSUPPORT: Failed to open TCP connection to localhost:37337 (Address family not supported by protocol - bind(2) for "::1" port 45395) ``` running above Ruby command with `strace` suggest that there is an attempt to bind with AF_INET6 using an AF_INET socket, however, only if the reproducer above attempts to set the `http.local_host` with Addrinfo. From upstream issue #20208: "This is calling getaddrinfo to resolve "localhost" for us to use it as the local side of the connection. Because Ruby does not know what you intend to do with this IP address, it does not make the request with AI_ADDRCONFIG. Thus, you get an IPv6 result returned, since there is an IPv6 addres for localhost!"
This commit is contained in:
parent
066e0a3d6d
commit
aa7e8debee
2 changed files with 258 additions and 1 deletions
18
ruby.spec
18
ruby.spec
|
|
@ -167,7 +167,7 @@
|
|||
Summary: An interpreter of object-oriented scripting language
|
||||
Name: ruby
|
||||
Version: %{ruby_version}%{?development_release}
|
||||
Release: 3%{?dist}
|
||||
Release: 4%{?dist}
|
||||
# BSD-3-Clause: missing/{crypt,mt19937,setproctitle}.c
|
||||
# ISC: missing/strl{cat,cpy}.c
|
||||
# Public Domain for example for: include/ruby/st.h, strftime.c, missing/*, ...
|
||||
|
|
@ -243,6 +243,18 @@ Patch11: ruby-3.4.0-ruby-net-http-Renew-test-certificates.patch
|
|||
# See related upstream report: https://bugs.ruby-lang.org/issues/20085
|
||||
# https://bugs.ruby-lang.org/issues/20154
|
||||
Patch12: ruby-3.4.0-fix-branch-protection-compilation-for-arm.patch
|
||||
# Revert adding AI_ADDRCONFIG flag to getaddrinfo(3) calls.
|
||||
# It is causing problems when network is in certain, valid, configuration.
|
||||
# When loopback interface is IPv6 capable, but no regular network interface
|
||||
# is IPv6 capable, in some situations (such as in TestNetHTTPLocalBind)
|
||||
# this might result in creating IPv4 socket and then binding it
|
||||
# to IPv6 family connection.
|
||||
# That is incorrect behavior and such operation will result in
|
||||
# Errno::EAFNOSUPPORT exception.
|
||||
# The point of the upstream change is to workaround a glibc bug
|
||||
# that is not present for us. Therefore we can safely revert the change.
|
||||
# https://bugs.ruby-lang.org/issues/20208
|
||||
Patch13: ruby-3.4.0-Revert-Set-AI_ADDRCONFIG-when-making-getaddrinfo.patch
|
||||
|
||||
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
|
||||
%{?with_rubypick:Suggests: rubypick}
|
||||
|
|
@ -715,6 +727,7 @@ analysis result in RBS format, a standard type description format for Ruby
|
|||
%patch 10 -p1
|
||||
%patch 11 -p1
|
||||
%patch 12 -p1
|
||||
%patch 13 -p1
|
||||
|
||||
# Provide an example of usage of the tapset:
|
||||
cp -a %{SOURCE3} .
|
||||
|
|
@ -1650,6 +1663,9 @@ make -C %{_vpath_builddir} runruby TESTRUN_SCRIPT=" \
|
|||
|
||||
|
||||
%changelog
|
||||
* Fri Jan 26 2024 Jarek Prokop <jprokop@redhat.com> - 3.3.0-4
|
||||
- Do not set AI_ADDRCONFIG by default when calling getaddrinfo(3).
|
||||
|
||||
* Mon Jan 22 2024 Fedora Release Engineering <releng@fedoraproject.org>
|
||||
- Rebuilt for https://fedoraproject.org/wiki/Fedora_40_Mass_Rebuild
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue