Obsoleted RFC

This has been obsoleted by RFC 8305 Happy Eyeballs Version 2 Better Connectivity Using Concurrency, which refines the algorithm

In the transition to IPv6, we are in a state where devices have dual stack support. They want to prefer IPv6 addresses to ease the load off IPv4 network. However, some hosts will only support IPv4 even though the DNS has a AAAA record. The IPv6 might be temporarily down or might have been removed.

We don’t want devices with IPv6 to suffer delays in connection when the IPv6 address of the host is down. This would be a delay of a few seconds if we allowed IPv6 to timeout and then connected to IPv4.

Happy Eyeballs algorithm suggests that we try to connect to both the addresses together. For TCP, we’ll send SYN packets to both v4 and v6 addresses. If the IPv6 connection succeeds, we send RST to v4 connection, otherwise the v4 connection can be used. This information can be cached by the device in the order of 10 minutes, to reduce load on the server.

Example Algorithm

This is one that is used in Mozilla Firefox and Google Chrome:

  • Call getaddrinfo() which returns a list of addresses in the order of preference. Try making connection to the first one.
  • If the connection doesn’t succeed in a short interval (these browsers use 300ms), then attempt connection with the address of the other address family (e.g. IPv4)
  • Choose the first connection that is established and then discard the other

The last steps result can be cached.