• Russ Cox's avatar
    undo CL 4557058 / b4c2ffae7034 · 16dbf218
    Russ Cox authored
    Using the getaddrinfo order is only okay if we
    are smart enough to try multiple addresses in Dial.
    Since the code does not do that, we must make
    the right first choice, regardless of what getaddrinfo
    does, and more often that not that means using the
    IPv4 address, even on IPv6 systems.  With the CL
    applied, gotest fails in package net on OS X.
    
    helix.cam=; gotest
    ...
    --- FAIL: net.TestDialGoogleIPv4 (1.05 seconds)
            -- 74.125.226.179:80 --
            -- www.google.com:80 --
            Dial("tcp", "", "www.google.com:80") = _, dial tcp [2001:4860:800f::69]:80: address family not supported by protocol family
            -- 74.125.226.179:http --
            -- www.google.com:http --
            Dial("tcp", "", "www.google.com:http") = _, dial tcp [2001:4860:800f::69]:80: address family not supported by protocol family
            -- 074.125.226.179:0080 --
            -- [::ffff:74.125.226.179]:80 --
            -- [::ffff:4a7d:e2b3]:80 --
            -- [0:0:0:0:0000:ffff:74.125.226.179]:80 --
            -- [0:0:0:0:000000:ffff:74.125.226.179]:80 --
            -- [0:0:0:0:0:ffff::74.125.226.179]:80 --
    FAIL
    gotest: "./6.out" failed: exit status 1
    
    ««« original CL description
    net: name-based destination address selection
    
    getaddrinfo() orders the addresses according to RFC 3484.
    
    This means when IPv6 is working on a host we get results like:
        []string = {"2001:4810::110", "66.117.47.214"}
    
    and when it's not working we get:
        []string = {"66.117.47.214", "2001:4810::110"}
    
    thus can drop firstFavoriteAddr.
    
    This also means /etc/gai.conf works on relevant systems.
    
    R=rsc, mikioh.mikioh
    CC=golang-dev
    https://golang.org/cl/4557058
    
    »»»
    
    R=golang-dev, bradfitz
    CC=golang-dev
    https://golang.org/cl/4532101
    16dbf218
Name
Last commit
Last update
..
dict Loading commit data...
textproto Loading commit data...
Makefile Loading commit data...
cgo_bsd.go Loading commit data...
cgo_linux.go Loading commit data...
cgo_stub.go Loading commit data...
cgo_unix.go Loading commit data...
dial.go Loading commit data...
dialgoogle_test.go Loading commit data...
dnsclient.go Loading commit data...
dnsconfig.go Loading commit data...
dnsmsg.go Loading commit data...
dnsmsg_test.go Loading commit data...
dnsname_test.go Loading commit data...
fd.go Loading commit data...
fd_darwin.go Loading commit data...
fd_freebsd.go Loading commit data...
fd_linux.go Loading commit data...
fd_windows.go Loading commit data...
file.go Loading commit data...
file_test.go Loading commit data...
file_windows.go Loading commit data...
hosts.go Loading commit data...
hosts_test.go Loading commit data...
hosts_testdata Loading commit data...
ip.go Loading commit data...
ip_test.go Loading commit data...
ipraw_test.go Loading commit data...
iprawsock.go Loading commit data...
ipsock.go Loading commit data...
lookup.go Loading commit data...
multicast_test.go Loading commit data...
net.go Loading commit data...
net_test.go Loading commit data...
newpollserver.go Loading commit data...
parse.go Loading commit data...
parse_test.go Loading commit data...
pipe.go Loading commit data...
pipe_test.go Loading commit data...
port.go Loading commit data...
port_test.go Loading commit data...
resolv_windows.go Loading commit data...
sendfile_linux.go Loading commit data...
sendfile_stub.go Loading commit data...
server_test.go Loading commit data...
sock.go Loading commit data...
sock_bsd.go Loading commit data...
sock_linux.go Loading commit data...
sock_windows.go Loading commit data...
srv_test.go Loading commit data...
tcpsock.go Loading commit data...
timeout_test.go Loading commit data...
udpsock.go Loading commit data...
unixsock.go Loading commit data...