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: AAAA DNS queries are made despite ip4 on LookupIP #44809

Closed
melardev opened this issue Mar 5, 2021 · 4 comments
Closed

net: AAAA DNS queries are made despite ip4 on LookupIP #44809

melardev opened this issue Mar 5, 2021 · 4 comments
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@melardev
Copy link

melardev commented Mar 5, 2021

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

$ go version
go version go1.15.8 linux/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="/home/laro/.cache/go-build"
GOENV="/home/laro/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/laro/Desktop/SSDStorage/workspace/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/laro/Desktop/SSDStorage/workspace/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build927622048=/tmp/go-build -gno-record-gcc-switches"

What did you do?

The following snippets may not run on golang playground, maybe they restrict network connections?

I prepared the following snippet(https://play.golang.org/p/CTmnriuHXcU), run it with a network sniffer turned on, I used Wireshark with the filter "udp port 53" so I only capture DNS traffic.
There are two DNS queries being made, A, and AAA, this should not happen. I thought this may be reproducible on the default resolver too, so I prepared this other snipped(https://play.golang.org/p/6wIdTxjI4dd), it does not make the AAA DNS query, this shows it is a bug, because if it was by design then I would have expected both snippets to behave the same.

What did you expect to see?

If I ask for an A DNS record, why am I making a query for AAA (ip6)?

What did you see instead?

Two DNS queries, one for IP4(A) and other for IP6 (AAA).

@melardev melardev changed the title Bug - AAA DNS queries are made despite ip4 Bug - AAA DNS queries are made despite ip4 on LookupIP() Mar 5, 2021
@melardev
Copy link
Author

melardev commented Mar 5, 2021

Maybe it would help you track this down, this is only reproducible if PreferGo is set to true, I don't see why this flag should determine what DNS requests should be sent. So the issue must be on cgLookupIp I guess? (https://golang.org/src/net/lookup_unix.go)

@dmitshur dmitshur changed the title Bug - AAA DNS queries are made despite ip4 on LookupIP() net: AAA DNS queries are made despite ip4 on LookupIP Mar 6, 2021
@dmitshur dmitshur added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Mar 6, 2021
@dmitshur dmitshur added this to the Backlog milestone Mar 6, 2021
@dmitshur
Copy link
Contributor

dmitshur commented Mar 6, 2021

CC @bradfitz, @ianlancetaylor via owners.

@seankhliao seankhliao changed the title net: AAA DNS queries are made despite ip4 on LookupIP net: AAAA DNS queries are made despite ip4 on LookupIP Mar 9, 2021
@antong
Copy link
Contributor

antong commented Aug 25, 2021

I believe this is the same as #45024 (filed some days later), so fixed in Go 1.17.

@seankhliao
Copy link
Member

Duplicate of #45024

@seankhliao seankhliao marked this as a duplicate of #45024 Aug 25, 2021
@golang golang locked and limited conversation to collaborators Aug 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

No branches or pull requests

5 participants