Menu

#1424 happy eyeballs problem with host unaccessible over ipv6

closed-works-for-me
5
2015-03-19
2014-09-19
No

Running curl https://sublime.wbond.net/channel.json in the console tell me, its unreachable:

$ curl https://sublime.wbond.net/channel.json
curl: (7) Failed to connect to sublime.wbond.net port 443: Network is unreachable

But I can download that json from any browser instance.

Weird. How come?

Here more info. I am on Ubuntu 14.04:

$ curl -V
curl 7.37.1 (x86_64-pc-linux-gnu) libcurl/7.37.1 OpenSSL/1.0.1f zlib/1.2.8 libidn/1.28 librtmp/2.3
Protocols: dict file ftp ftps gopher http https imap imaps ldap ldaps pop3 pop3s rtmp rtsp smtp smtps telnet tftp
Features: AsynchDNS GSS-Negotiate IDN IPv6 Largefile NTLM NTLM_WB SSL libz TLS-SRP

Discussion

  • Daniel Stenberg

    Daniel Stenberg - 2014-09-19

    It works perfectly fine for me. Does it fail consistently for you? If you add -v you can see which IP address curl gets and tries. I take it you can get other HTTPS pages fine with curl from that computer?

     
  • Daniel Stenberg

    Daniel Stenberg - 2014-09-19
    • assigned_to: Daniel Stenberg
     
  • Michael Heuberger

    Hmmmm, thanks for the -v hint. I found out that, when I add "-ip4", then it works. Hmmmm ...

     
  • Daniel Stenberg

    Daniel Stenberg - 2014-09-19
    • summary: Unreachable or not? --> happy eyeballs problem with host unaccessible over ipv6
     
  • Daniel Stenberg

    Daniel Stenberg - 2014-09-19

    That sounds like a potential happy eyeballs bug. It is supposed to try both ipv4 and upv6 and use the one that works first...

     
  • Michael Heuberger

    is there a way to configure default curl settings? like forcing the linux machine to use ipv4 instead?

     
  • Michael Heuberger

    well, i do not have an ipv6 connnection between my router and my isp

     
  • Daniel Stenberg

    Daniel Stenberg - 2014-09-20

    If curl tries to connect over ipv6, it is because it got an IPv6 address for the given host and IPv6 works on your system. It is then supposed to try both IPv4 and IPv6 (which is what is called "happy eyeballs") and use the one that connects first. You can force ipv4-only with the dedicated option and you can of course put that in your .curlrc file etc or rebuild curl from source with IPv6 knowledge removed.

    Those are still just work-arounds, curl should work out these details by itself. For me it is a bit hard to debug though since I've not been able to repeat this problem in my end.

     
  • Daniel Stenberg

    Daniel Stenberg - 2014-11-03
    • status: open --> pending
     
  • Daniel Stenberg

    Daniel Stenberg - 2014-11-03

    Since I've failed to repeat this and nobody else seems to either, I will close this report again soonish.

     
  • dominikh

    dominikh - 2014-12-01

    I can reproduce this issue. Trying with the URL from the bug report:

    dominikh-pc 130? ~ $ curl -v https://sublime.wbond.net/channel.json 
    * Hostname was NOT found in DNS cache
    *   Trying 50.116.34.243...
    *   Trying 2600:3c02:e000:42::1...
    * connect to 2600:3c02:e000:42::1 port 443 failed: Network is unreachable
    * Failed to connect to sublime.wbond.net port 443: Network is unreachable
    * Closing connection 0
    curl: (7) Failed to connect to sublime.wbond.net port 443: Network is unreachable
    

    Works fine if passing -4

    Using sprunge.us instead, where the server sometimes responds fast enough:

    dominikh-pc 7? ~ $ curl -sv sprunge.us > /dev/null                
    * Rebuilt URL to: sprunge.us/
    * Hostname was NOT found in DNS cache
    *   Trying 216.239.34.21...
    * Connected to sprunge.us (216.239.34.21) port 80 (#0)
    > GET / HTTP/1.1
    > User-Agent: curl/7.39.0
    > Host: sprunge.us
    > Accept: */*
    > 
    < HTTP/1.1 200 OK
    < Content-Type: text/html; charset=utf-8
    < Cache-Control: no-cache
    < Vary: Accept-Encoding
    < Date: Mon, 01 Dec 2014 20:34:06 GMT
    < Server: Google Frontend
    < Alternate-Protocol: 80:quic,p=0.02,80:quic,p=0.02
    < Transfer-Encoding: chunked
    < 
    { [data not shown]
    * Connection #0 to host sprunge.us left intact
    
    dominikh-pc ~ $ curl -sv sprunge.us > /dev/null
    * Rebuilt URL to: sprunge.us/
    * Hostname was NOT found in DNS cache
    *   Trying 216.239.36.21...
    *   Trying 2001:4860:4802:32::15...
    * connect to 2001:4860:4802:32::15 port 80 failed: Network is unreachable
    *   Trying 2001:4860:4802:34::15...
    * connect to 2001:4860:4802:34::15 port 80 failed: Network is unreachable
    *   Trying 2001:4860:4802:36::15...
    * connect to 2001:4860:4802:36::15 port 80 failed: Network is unreachable
    *   Trying 2001:4860:4802:38::15...
    * connect to 2001:4860:4802:38::15 port 80 failed: Network is unreachable
    * Failed to connect to sprunge.us port 80: Network is unreachable
    * Closing connection 0
    

    Essentially, if curl manages to test and fail all v6 addresses before a v4 address succeeds, it gives up entirely, not waiting for v4 to finish.

    dominikh-pc ~ $ curl --version
    curl 7.39.0 (x86_64-unknown-linux-gnu) libcurl/7.39.0 LibreSSL/2.0.0 zlib/1.2.8 libidn/1.29
    Protocols: dict file ftp ftps gopher http https imap imaps pop3 pop3s rtsp smtp smtps telnet tftp 
    Features: AsynchDNS IDN IPv6 Largefile NTLM NTLM_WB SSL libz
    

    Curl was built with --enable-threaded-resolver --enable-ipv6.

     
  • Daniel Stenberg

    Daniel Stenberg - 2014-12-08
    • status: pending --> open-confirmed
     
  • dominikh

    dominikh - 2015-01-13

    I can't really tell. I can't reproduce the original problem anymore, but the verbose output doesn't list any v6 attempts anymore, either, so it might work by chance now, or something else changed. I'll defer to Michael Heuberger.

     
  • Michael Heuberger

    can i install the latest version simply with apt-get? do not want to compile all that ...

     
  • Patrick Monnerat

    @dominikh: thanks for having tried.
    @michael: Since the latest release is very recent, I don't think Ubuntu provides it already (i'm not working with this distro). You have to watch the repos by yourself, find a third-party binary package for your distro... or compile.
    Also watch http://curl.haxx.se/download.html (nothing for you currently, i'm afraid).

     
  • Daniel Stenberg

    Daniel Stenberg - 2015-03-15

    Can you please try if 7.41.0 has this fixed? We merged at least two happy eyeballs-related fixes there that I suspect may have fixed this problem!

     
  • Daniel Stenberg

    Daniel Stenberg - 2015-03-15
    • labels: --> connections
    • status: open-confirmed --> pending-needsinfo
     
  • Daniel Stenberg

    Daniel Stenberg - 2015-03-19
    • labels: connections --> connections, happy eyeballs
    • status: pending-needsinfo --> closed-works-for-me
     
  • Daniel Stenberg

    Daniel Stenberg - 2015-03-19

    Closing this. We've done numerous happy-eyeballs fixes since this was reported and I believe it is fixed now.

    If not, please open a new bug with a recipe on how to repeat it!