Skip to content
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

Test 1083 fails when configured with --enable-ares #10759

Closed
Kangie opened this issue Mar 14, 2023 · 3 comments
Closed

Test 1083 fails when configured with --enable-ares #10759

Kangie opened this issue Mar 14, 2023 · 3 comments
Labels
name lookup DNS and related tech tests

Comments

@Kangie
Copy link
Contributor

Kangie commented Mar 14, 2023

I did this

$ ./configure --prefix=/usr --build=x86_64-pc-linux-gnu --host=x86_64-pc-linux-gnu --mandir=/usr/share/man --infodir=/usr/share/info --datadir=/usr/share --sysconfdir=/etc --localstatedir=/var/lib --datarootdir=/usr/share --disable-dependency-tracking --disable-silent-rules --disable-static --docdir=/usr/share/doc/curl-7.88.1-r2 --htmldir=/usr/share/doc/curl-7.88.1-r2/html --with-sysroot=/ --libdir=/usr/lib64 --without-ca-fallback --with-ca-bundle=/etc/ssl/certs/ca-certificates.crt --without-gnutls --without-mbedtls --without-nss --without-rustls --with-ssl --with-ca-path=/etc/ssl/certs --with-default-ssl-backend=openssl --disable-alt-svc --enable-crypto-auth --enable-dict --disable-ech --enable-file --enable-ftp --disable-gopher --disable-hsts --enable-http --enable-imap --disable-ldap --disable-ldaps --enable-ntlm --disable-ntlm-wb --enable-pop3 --enable-rt --enable-rtsp --disable-smb --without-libssh2 --enable-smtp --disable-telnet --enable-tftp --enable-tls-srp --enable-ares --enable-cookies --enable-dateparse --enable-dnsshuffle --enable-doh --enable-symbol-hiding --enable-http-auth --enable-ipv6 --enable-largefile --enable-manual --enable-mime --enable-netrc --enable-progress-meter --enable-proxy --enable-socketpair --disable-sspi --disable-static --enable-pthreads --enable-threaded-resolver --disable-versioned-symbols --without-amissl --without-bearssl --without-brotli --without-fish-functions-dir --with-nghttp2 --without-hyper --without-libidn2 --without-gssapi --without-libgsasl --without-libpsl --without-msh3 --without-nghttp3 --without-ngtcp2 --without-quiche --without-librtmp --without-schannel --without-secure-transport --without-test-caddy --without-test-httpd --without-test-nghttpx --disable-websockets --without-winidn --without-wolfssl --with-zlib --with-zstd --with-test-nghttpx=/usr/bin/nghttpx
$  make -j16 && make test -j16 TFLAGS="-n -v -a -k -am -p -d 1083"

I expected the following

Test 1083 should pass. When configured without ares the test passes successfully.

curl/libcurl version

curl 7.88.1 (x86_64-pc-linux-gnu) libcurl/7.88.1 OpenSSL/3.0.8 zlib/1.2.13 c-ares/1.19.0 nghttp2/1.52.0
Release-Date: 2023-02-20

c-ares version

1.19.0

operating system

Linux obsidian 6.2.0-gentoo #3 SMP PREEMPT_DYNAMIC Fri Feb 24 23:33:12 AEDT 2023 x86_64 AMD Ryzen 7 3700X 8-Core Processor AuthenticAMD GNU/Linux

@bagder bagder added the name lookup DNS and related tech label Mar 14, 2023
@jay
Copy link
Member

jay commented Mar 14, 2023

Please include the test output.

@jay jay added the tests label Mar 14, 2023
@bagder
Copy link
Member

bagder commented Mar 14, 2023

Even when there is an entry for ip6-localhost in /etc/hosts, this source code line surprisingly returns an error:

rc = Curl_resolv(data, dev, 0, FALSE, &h);

@Kangie
Copy link
Contributor Author

Kangie commented Mar 14, 2023

As requested: build.log.txt

What I see with ares enabled:

kangie@obsidian /data/development/temp/curl (ip6-localhost*) $ src/curl -g 'http://[::1]/'                                 
curl: (7) Failed to connect to ::1 port 80 after 0 ms: Couldn't connect to server
kangie@obsidian /data/development/temp/curl (ip6-localhost*) $ src/curl -g 'http://[::1]/' --interface localhost           
RC = 0
curl: (7) Failed to connect to ::1 port 80 after 0 ms: Couldn't connect to server
kangie@obsidian /data/development/temp/curl (ip6-localhost*) $ src/curl -g 'http://[::1]/' --interface ip6-localhost       
RC = -1
curl: (45) Couldn't bind to 'ip6-localhost'
kangie@obsidian /data/development/temp/curl (ip6-localhost*) $ doas src/curl -g 'http://[2607:f8b0:4002:81a::2003]/' --interface localhost    
RC = 0
curl: (7) Failed to connect to 2607:f8b0:4002:81a::2003 port 80 after 0 ms: Couldn't connect to server
kangie@obsidian /data/development/temp/curl (ip6-localhost*) $ doas src/curl -g 'http://[2607:f8b0:4002:81a::2003]/' --interface ip6-localhost
RC = -1
curl: (45) Couldn't bind to 'ip6-localhost'
kangie@obsidian /data/development/temp/curl (ip6-localhost*) $ doas src/curl -g 'http://[2607:f8b0:4002:81a::2003]/' --interface localhost --ipv6
RC = 0
curl: (7) Failed to connect to 2607:f8b0:4002:81a::2003 port 80 after 0 ms: Couldn't connect to server
kangie@obsidian /data/development/temp/curl (ip6-localhost*) $ doas src/curl -g 'http://[2607:f8b0:4002:81a::2003]/'                             
<!DOCTYPE html>
     ...
kangie@obsidian /data/development/temp/curl (ip6-localhost*) $ doas src/curl -g 'http://[::1]/' --interface "::1"
RC = 0
curl: (7) Failed to connect to ::1 port 80 after 0 ms: Couldn't connect to server

So we're failing to resolve ip6-localhost and can't work out which interface we're supposed to bind to.

Through judicious printf debugging, It looks like we're erroring on interface resolution here:

curl/lib/hostip.c

Lines 785 to 788 in 06f65f7

/* First, check that we haven't received the info by now */
result = Curl_resolv_check(data, &dns);
if(result) /* error detected */
return CURLRESOLV_ERROR;

I don't have much to add here, will have to leave my troubleshooting at that, gotta get back to work and moving for a while so I'll leave this with you!

bagder added a commit that referenced this issue Mar 17, 2023
It turns out c-ares returns an error when asked to resolve a host name with
ares_getaddrinfo using port number 0.

Reported as a c-ares bug here: c-ares/c-ares#517

The work-around is to simply use port 80 instead, as the number typically does
not make a difference and a non-zero number works for c-ares.

Fixes #10759
Reported-by: Matt Jolly
@bagder bagder closed this as completed in 1388605 Mar 17, 2023
bch pushed a commit to bch/curl that referenced this issue Jul 19, 2023
It turns out c-ares returns an error when asked to resolve a host name with
ares_getaddrinfo using port number 0.

Reported as a c-ares bug here: c-ares/c-ares#517

The work-around is to simply use port 80 instead, as the number typically does
not make a difference and a non-zero number works for c-ares.

Fixes curl#10759
Reported-by: Matt Jolly
Closes curl#10789
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
name lookup DNS and related tech tests
Development

Successfully merging a pull request may close this issue.

3 participants