-
-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IPv4 prioritized over IPv6 for local server with custom DNS server #14761
Comments
Could you give us the log output when running with |
Sure:
For comparison, the IPv6 connection is established just fine when I add the
|
There seems to be a bug where curl does not try the ipv6 address as it should. Investigating... Update: ah, now I see it. @bagder: you are more familiar with the history and intention of this address family approach. Is this what we want or would we always prefer to start with ipv6, if present, no matter the order in the list? |
Thanks for looking into this! According to the log, IPv6 is resolved first:
Am I missing something? Because the DNS lookup tool in Firefox (about:networking#dnslookuptool) does indeed return the "wrong" order (IPv4, then IPv6) for the local client, but the correct one for all other machines in my LAN. |
That output always shows IPv6 before IPv4. The order returned to curl is determined by getaddrinfo() (and |
Ok, I see the difference at the happy eyeballs stage now. |
I believe maybe that is a trace of trying to respect getaddrinfo(), as that is supposed to return the addresses in a priority order. But thinking about it now, I think that is most likely the wrong thing and we should probably forcibly always go with IPv6 first. |
This change breaks systems with IPv6 disabled but ::1 present in hosts file for localhost(Default on RHEL). All PHPs cURL tests which use server bound to localhost are failing with a process timeout now:
|
@vityank can you provide a more detailed trace? curl's happy eyeballing should immediately continue to connect with the ipv4 address. (Hint a |
How is it disabled? curl should not try IPv6 if it is disabled
curl does not use the hosts file for |
@icing, @bagder I'm not 100% sure if is's caused by this change or there are some other regression. |
@vityank I recommend you create a new issue with all the details. This old issue is closed and fixed. You see something else. I don't think the IPv6 part is what causes your the problem but rather the "Connection #0 is not open enough, cannot reuse" part. Are you sure this exact commit broke the functionality for you? |
@bagder, |
I did this
In my dual-stack LAN, a bind server resolves local domains (
*.something.internal
) for both A and AAAA records, and all LAN webservers listen on IPv4 and IPv6. When accessing the servers, IPv6 gets prioritized (as expected) for all webservers except for my local client (which also acts as a webserver):Firefox and Safari behave exactly the same, while Chrome uses IPv6 addresses for all servers. I used the Network tab of the developer tools in all three browsers to compare and verify the behavior.
If I populate
/etc/hosts
on the local machine (using 127.0.0.1 and ::1 for its domains) instead of using my DNS server, all applications (including Firefox and Safari) prioritize IPv6:I expected the following
I would expect curl to always prioritize IPv6, especially since #11465 was solved in September 2023.
curl/libcurl version
curl 8.9.1 (aarch64-apple-darwin23.4.0) libcurl/8.9.1 OpenSSL/3.3.1 (SecureTransport) zlib/1.2.12 brotli/1.1.0 zstd/1.5.6 libidn2/2.3.7 libssh2/1.11.0 nghttp2/1.61.0 librtmp/2.3
Release-Date: 2024-07-31
Protocols: dict file ftp ftps gopher gophers http https imap imaps ipfs ipns ldap ldaps mqtt pop3 pop3s rtmp rtsp scp sftp smb smbs smtp smtps telnet tftp
Features: alt-svc AsynchDNS brotli GSS-API HSTS HTTP2 HTTPS-proxy IDN IPv6 Kerberos Largefile libz MultiSSL NTLM SPNEGO SSL threadsafe TLS-SRP UnixSockets zstd
operating system
macOS 14.6.1
The text was updated successfully, but these errors were encountered: