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

Open
melardev opened this issue Mar 5, 2021 · 2 comments
Open

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

melardev opened this issue Mar 5, 2021 · 2 comments
Milestone

Comments

@melardev
Copy link

@melardev 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 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 this to the Backlog milestone Mar 6, 2021
@dmitshur
Copy link
Member

@dmitshur dmitshur commented Mar 6, 2021

@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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants