ruby/ext
KJ Tsanaktsidis 25711e7063 Partially revert "Set AI_ADDRCONFIG when making getaddrinfo(3) calls"
This _partially_ reverts commit
d2ba8ea54a, but for UDP sockets only.

With TCP sockets (and other things which use `rsock_init_inetsock`), the
order of operations is to call `getaddrinfo(3)` with AF_UNSPEC, look at
the returned addresses, pick one, and then call `socket(2)` with the
family for that address (i.e. AF_INET or AF_INET6).

With UDP sockets, however, this is reversed; `UDPSocket.new` takes an
address family as an argument, and then calls `socket(2)` with that
family. A subsequent call to UDPSocket#connect will then call
`getaddrinfo(3)` with that family.

The problem here is that...

* If you are in a networking situation that _only_ has loopback addrs,
* And you want to look up a name like "localhost" (or NULL)
* And you pass AF_INET or AF_INET6 as the ai_family argument to
  getaddrinfo(3),
* And you pass AI_ADDRCONFIG to the hints argument as well,

then glibc on Linux will not return an address. This is because
AI_ADDRCONFIG is supposed to return addresses for families we actually
have an address for and could conceivably connect to, but also is
documented to explicitly ignore localhost in that situation.

It honestly doesn't make a ton of sense to pass AI_ADDRCONFIG if you're
explicitly passing the address family anyway, because you're not looking
for "an address for this name we can connect to"; you're looking for "an
IPv(4|6) address for this name". And the original glibc bug that
d2ba8ea5 was supposed to work around was related to parallel issuance of
A and AAAA queries, which of course won't happen if an address family is
explicitly specified.

So, we fix this by not passing AI_ADDRCONFIG for calls to
`rsock_addrinfo` that we also pass an explicit family to (i.e. for
UDPsocket).

[Bug #20048]
2023-12-12 20:05:21 +11:00
..
-test- add `flags` to `rb_postponed_job_preregister` 2023-12-10 15:39:06 +09:00
bigdecimal [ruby/bigdecimal] Clarify that JSON methods come from the JSON gem 2023-12-06 16:14:54 +00:00
cgi/escape [ruby/cgi] Fix unescapeHTML 2023-11-30 08:19:28 +00:00
continuation Update the depend files 2023-02-28 09:09:00 -08:00
coverage [Feature #19719] Universal Parser 2023-06-12 18:23:48 +09:00
date [ruby/date] Bump up 3.3.4 2023-11-07 04:16:02 +00:00
digest [ruby/digest] Suppress implicit cast down warnings 2023-11-09 07:20:00 +00:00
erb/escape [ruby/erb] Skip using the extension for truffleruby as well 2022-11-27 06:30:48 +00:00
etc [ruby/etc] Fix inconsistent dll linkage warning 2023-11-05 11:50:07 +00:00
fcntl [ruby/fcntl] Bump up 1.1.0 2023-11-07 06:55:45 +00:00
fiddle [ruby/fiddle] Remove garbage 2023-11-08 09:25:45 +09:00
io [ruby/io-console] [DOC] Add documentation for IO#cursor 2023-12-07 10:50:00 +00:00
json [flori/json] Bump up 2.7.1 2023-12-05 15:09:56 +09:00
monitor `rb_bug` prints a newline after the message 2023-05-20 21:43:30 +09:00
nkf [ruby/nkf] Bump up nkf-0.1.3 2023-05-25 09:11:36 +00:00
objspace objspace_dump.c: dump call cache ids with dump_append_id 2023-11-22 10:24:35 +01:00
openssl [ruby/openssl] History.md: Escape Markdown syntax Italic "*". [ci skip] 2023-11-25 10:05:24 +00:00
pathname [ruby/pathname] Bump up 0.3.0 2023-11-07 07:55:13 +00:00
psych [ruby/psych] Prefer each_char in Psych::Visitors::Visitor::ToRuby#deserialize 2023-11-27 01:35:08 +00:00
pty Hide the usage of `rb_io_t` where possible. (#7880) 2023-06-01 14:23:30 +09:00
rbconfig/sizeof Update the depend files 2023-02-28 09:09:00 -08:00
ripper Change the semantics of rb_postponed_job_register 2023-12-10 15:00:37 +09:00
rubyvm Added depend files 2019-07-14 01:31:29 +09:00
socket Partially revert "Set AI_ADDRCONFIG when making getaddrinfo(3) calls" 2023-12-12 20:05:21 +11:00
stringio [ruby/stringio] Development of 3.1.1 started. 2023-11-28 01:38:41 +00:00
strscan [ruby/strscan] Bump version 2023-11-08 09:26:58 +09:00
syslog [ruby/syslog] Improve the version extraction 2023-04-25 01:51:26 +00:00
win32 Expand tabs [ci skip] 2022-07-21 09:42:04 -07:00
win32ole [ruby/win32ole] Bump up 1.8.10 2023-11-07 05:52:50 +00:00
zlib [ruby/zlib] Bump up 3.1.0 2023-11-07 08:50:40 +00:00
.document [ruby/io-console] [DOC] Split .document files to sync with ruby/ruby 2023-10-22 11:09:06 +09:00
Setup Clean up removed directories in ext/Setup* [ci skip] 2023-01-18 12:02:27 +09:00
Setup.atheos racc/cparse is extracted from ruby/ruby repository 2023-06-08 18:05:07 +09:00
Setup.nt racc/cparse is extracted from ruby/ruby repository 2023-06-08 18:05:07 +09:00
extmk.rb Use `File::NULL` instead of hard coded null device names 2023-07-10 19:21:47 +09:00