Skip to content

net: ipv4 chosen first when both ipv4 and ipv6 are available #54928

Closed
@edevil

Description

@edevil

What version of Go are you using (go version)?

$ go version
go version go1.19 darwin/amd64

Does this issue reproduce with the latest release?

Yes.

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/acruz/Library/Caches/go-build"
GOENV="/Users/acruz/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/acruz/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/acruz/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/Cellar/go/1.19/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.19/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/dev/null"
GOWORK=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/50/p3qbm6c112v0sdym26_t_bq80000gn/T/go-build466847973=/tmp/go-build -gno-record-gcc-switches -fno-common"

What did you do?

Connect to a host that resolves both to ipv4 and ipv6 addresses.

What did you expect to see?

According to https://github.com/golang/go/blob/master/src/net/dial.go#L71, with the default FallbackDelay of 300ms, ipv6 should be tried first and only after the configured delay ipv4 should be attempted.

What did you see instead?

ipv4 was chosen first.

The partition function uses the label of the first result, which is the DNS result that resolved first (A vs AAAA). If the A response was received first, then the primary address(es) will be ipv4, which contradicts the purpose of the Happy Eyeballs RFC.

Metadata

Metadata

Assignees

No one assigned

    Labels

    FrozenDueToAgeNeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions