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

net: Happ{y,yish,ier} Eyeballs should give the preferred family a head start #8455

Closed
pmarks-net opened this issue Jul 31, 2014 · 7 comments
Closed
Milestone

Comments

@pmarks-net
Copy link
Contributor

Forked from issue #8453.

The Happy Eyeballs implementation used by net.Dialer{DualStack: true} sends IPv4 and
IPv6 SYNs simultaneously, and the resulting address family is unpredictable.

This is harmful for two reasons:
- It increases server load in the common case, by always sending two SYNs.
- Dual-stack clients cannot reliably use IPv6 to route around NATs.  The primary
incentive for a network operator to deploy IPv6 is to reduce NAT load (and therefore
save money), but this sort of client behavior invalidates that incentive.


http://tools.ietf.org/html/rfc6555#section-4.1 says:

"""
   Thus, to avoid harming IPv4-only hosts, implementations MUST prefer
   the first IP address family returned by the host's address preference
   policy, unless implementing a stateful algorithm described in
   Section 4.2.  This usually means giving preference to IPv6 over IPv4,
   although that preference can be overridden by user configuration or
   by network configuration [ADDR-SELECT].  If the host's policy is
   unknown or not attainable, implementations MUST prefer IPv6 over
   IPv4.
"""


When the DualStack flag is true, clients should follow this algorithm:

  Call getaddrinfo()
  Note the family of address[0], and start a routine which connects to each address of that family, in order.
  After ~300ms, start a second routine which connects to addresses *not* of that family, in order.
  Meanwhile:
  - If the first routine terminates before 300ms, start the second routine immediately.
  - When one routine succeeds, cancel the other.


There's room for flexibility in the details, but the important point is that under
normal network conditions, a client should send exactly one SYN to the first address
reported by getaddrinfo().
@mikioh
Copy link
Contributor

mikioh commented Jul 31, 2014

Comment 1:

off topic:
> The primary incentive for a network operator to deploy IPv6 is to reduce NAT load (and
therefore save money)
really? (from APNIC region ;)  but pretty interesting, is that common in ARIN/RIPE
regions recently?

@mikioh
Copy link
Contributor

mikioh commented Jul 31, 2014

Comment 2:

Labels changed: added repo-main.

@pmarks-net
Copy link
Contributor Author

Comment 3:

>> The primary incentive for a network operator to deploy IPv6 is to reduce NAT load
(and therefore save money)
> really? (from APNIC region ;)  but pretty interesting, is that common in ARIN/RIPE
regions recently?
Well, the primary incentive *should* be to preserve the Internet as a platform of
freedom and innovation, but for a hypothetical ISP who only cares about cost, IPv6 makes
more sense if you know that you won't have to keep scaling up your IPv4 NAT
infrastructure forever.
That said, I don't personally know what the operators are thinking.

@mikioh
Copy link
Contributor

mikioh commented Jul 31, 2014

Comment 4:

> There's room for flexibility in the details....
For the record: as discussed other issue, current implementation is happi{sh,er}
eyeballs" as described in
http://www.potaroo.net/presentations/2012-04-17-dual-stack-quality.pdf.

@gopherbot
Copy link

Comment 5 by google@barrera.io:

By ignoring the address ordering a more important issue arises:
Since they always prefer IPv4 unconditionally, all golang applications fail to establish
any network connections on IPv6-only hosts. I've seen this behavious consistenly across
several golang applications: they can never connect to any host. (And I don't have any
native IPv4 connectivity most of the time).

@bradfitz bradfitz removed the new label Dec 18, 2014
@mikioh mikioh changed the title net: Happy Eyeballs should give the preferred family a head start net: Happ{y,yish,ier} Eyeballs should give the preferred family a head start Mar 25, 2015
@mikioh
Copy link
Contributor

mikioh commented Mar 25, 2015

@pmarks-net is working on this issue.

@mikioh mikioh added this to the Go1.5 milestone Mar 25, 2015
mikioh pushed a commit that referenced this issue Apr 10, 2015
Remove the "netaddr" type, which ambiguously represented either one
address, or a list of addresses. Instead, use "addrList" wherever
multiple addresses are supported.

The "first" method returns the first address matching some condition
(e.g. "is it IPv4?"), primarily to support legacy code that can't handle
multiple addresses.

The "partition" method splits an addrList into two categories, as
defined by some strategy function. This is useful for implementing
Happy Eyeballs, and similar two-channel algorithms.

Finally, internetAddrList (formerly resolveInternetAddr) no longer
mangles the ordering defined by getaddrinfo. In the future, this may
be used by a sequential Dial implementation.

Updates #8453, #8455.

Change-Id: I7375f4c34481580ab40e31d33002a4073a0474f3
Reviewed-on: https://go-review.googlesource.com/8360
Reviewed-by: Mikio Hara <mikioh.mikioh@gmail.com>
Run-TryBot: Mikio Hara <mikioh.mikioh@gmail.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
@rsc rsc removed the repo-main label Apr 14, 2015
@gopherbot
Copy link

CL https://golang.org/cl/8768 mentions this issue.

@golang golang locked and limited conversation to collaborators Jun 25, 2016
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

5 participants