ruby/ext/socket
KJ Tsanaktsidis d2ba8ea54a
Set AI_ADDRCONFIG when making getaddrinfo(3) calls for outgoing conns (#7295)
When making an outgoing TCP or UDP connection, set AI_ADDRCONFIG in the
hints we send to getaddrinfo(3) (if supported). This will prompt the
resolver to _NOT_ issue A or AAAA queries if the system does not
actually have an IPv4 or IPv6 address (respectively).

This makes outgoing connections marginally more efficient on
non-dual-stack systems, since we don't have to try connecting to an
address which can't possibly work.

More importantly, however, this works around a race condition present
in some older versions of glibc on aarch64 where it could accidently
send the two outgoing DNS queries with the same DNS txnid, and get
confused when receiving the responses. This manifests as outgoing
connections sometimes taking 5 seconds (the DNS timeout before retry) to
be made.

Fixes #19144
2023-12-07 17:55:15 +09:00
..
lib Remove require 'io/wait' where it's no longer necessary. (#6932) 2022-12-15 11:37:01 +13:00
.document
addrinfo.h Expand tabs [ci skip] 2022-07-21 09:42:04 -07:00
ancdata.c BasicSocket#recv* return nil rather than an empty packet 2023-08-30 10:07:18 +02:00
basicsocket.c Try nil as default for 'default timeout'. (#6509) 2022-10-08 14:02:34 +13:00
constants.c Expand tabs [ci skip] 2022-07-21 09:42:04 -07:00
depend [Feature #19719] Universal Parser 2023-06-12 18:23:48 +09:00
extconf.rb Set AI_ADDRCONFIG when making getaddrinfo(3) calls for outgoing conns (#7295) 2023-12-07 17:55:15 +09:00
getaddrinfo.c Don't check for null pointer in calls to free 2023-06-30 09:13:31 -04:00
getnameinfo.c Expand tabs [ci skip] 2022-07-21 09:42:04 -07:00
ifaddr.c Expand tabs [ci skip] 2022-07-21 09:42:04 -07:00
init.c Adjust indent [ci skip] 2023-11-30 13:32:53 +09:00
ipsocket.c Set AI_ADDRCONFIG when making getaddrinfo(3) calls for outgoing conns (#7295) 2023-12-07 17:55:15 +09:00
mkconstants.rb sockopt adding Linux constants, SO_INCOMING_CPU/SO_INCOMING_NAPI_ID. 2022-09-21 17:15:54 +09:00
option.c Add support for sockaddr_un on Windows. (#6513) 2022-11-17 14:50:25 -08:00
raddrinfo.c Rename rsock_raise_socket_error to rsock_raise_resolution_error 2023-11-30 13:27:19 +09:00
rubysocket.h Rename rsock_raise_socket_error to rsock_raise_resolution_error 2023-11-30 13:27:19 +09:00
socket.c Rename rsock_raise_socket_error to rsock_raise_resolution_error 2023-11-30 13:27:19 +09:00
sockport.h
sockssocket.c Expand tabs [ci skip] 2022-07-21 09:42:04 -07:00
tcpserver.c Expand tabs [ci skip] 2022-07-21 09:42:04 -07:00
tcpsocket.c Expand tabs [ci skip] 2022-07-21 09:42:04 -07:00
udpsocket.c Set AI_ADDRCONFIG when making getaddrinfo(3) calls for outgoing conns (#7295) 2023-12-07 17:55:15 +09:00
unixserver.c Add support for sockaddr_un on Windows. (#6513) 2022-11-17 14:50:25 -08:00
unixsocket.c fix typo in comments / autodoc 2023-01-16 08:00:03 +09:00