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: resolver error messages indicate wrong dns server when using custom resolver #43703

Open
harshathulasi opened this issue Jan 14, 2021 · 3 comments
Labels
NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@harshathulasi
Copy link

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

go1.14.13

Does this issue reproduce with the latest release?

Yes. At least the latest on go playgound

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

go env Output
louper$ go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/hthulasi/Library/Caches/go-build"
GOENV="/Users/hthulasi/Library/Application Support/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GONOPROXY="git.soma.salesforce.com"
GONOSUMDB="git.soma.salesforce.com"
GOOS="darwin"
GOPATH="/Users/hthulasi/go"
GOPRIVATE="git.soma.salesforce.com"
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD="/Users/hthulasi/go/src/git.soma.salesforce.com/GovCloud-SecDev/louper/go.mod"
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 -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/17/vmjmghsj28d4lzrx7mqshr9r0000gp/T/go-build117441851=/tmp/go-build -gno-record-gcc-switches -fno-common"
louper$ 

What did you do?

If I update/set a the DNS resolver to a custom address the error when host can't connect or couldn't resolve is using the incorrect DNS server address in the response. Example: play.golang.org link: https://play.golang.org/p/LmTM-eOy3q-

What did you expect to see?

I see the error message indicating that it failed with the provisioned DNS server. I am assuming this is just invalid error message but not an issue with golang not using the correct DNS server.

What did you see instead?

It is using the default DNS server (likely configured through DSCP) in the error message instead of 8.8.8.8.

from default resolver
from default resolver
from default resolver
from default resolver
from default resolver
from default resolver
from default resolver
from default resolver
from default resolver
from default resolver
from default resolver
from default resolver
addr: []
err: lookup google.com on 169.254.169.254:53: dial udp 8.8.8.8:53: connect: no route to host
from default resolver
from default resolver
from default resolver
from default resolver
from default resolver
from default resolver
from default resolver
from default resolver
from default resolver
from default resolver
from default resolver
from default resolver
addr: []
err: lookup gafwefjawioefjoawjfoaewif.com on 169.254.169.254:53: dial udp 8.8.8.8:53: connect: no route to host

from custom resolver
from custom resolver
from custom resolver
from custom resolver
from custom resolver
from custom resolver
from custom resolver
from custom resolver
from custom resolver
from custom resolver
from custom resolver
from custom resolver
addr: []
err: lookup google.com on 169.254.169.254:53: dial udp 8.8.8.8:53: connect: no route to host
from custom resolver
from custom resolver
from custom resolver
from custom resolver
from custom resolver
from custom resolver
from custom resolver
from custom resolver
from custom resolver
from custom resolver
from custom resolver
from custom resolver
addr: []
err: lookup gafwefjawioefjoawjfoaewif.com on 169.254.169.254:53: dial udp 8.8.8.8:53: connect: no route to host
@seankhliao seankhliao changed the title Golang net resolver error messages indicate wrong dns server when using custom resolver net: resolver error messages indicate wrong dns server when using custom resolver Jan 14, 2021
@seankhliao
Copy link
Member

I guess the calling code could check the returned conn and try to extract the actual remote destination if it's valid?

@harshathulasi
Copy link
Author

harshathulasi commented Jan 14, 2021

Not sure about the implementation. Its very misleading on which IP the net resolver is using. The above example is in go playground where it can't connect externally but on my local machine its showing the incorrect server. Little troubling when I have to share application logs to others and they question why the application is using the wrong server.

@dmitshur
Copy link
Contributor

CC @bradfitz, @ianlancetaylor per owners.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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

3 participants