Skip to content

affected/package: net #57506

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

Closed
alexchowle opened this issue Dec 29, 2022 · 9 comments
Closed

affected/package: net #57506

alexchowle opened this issue Dec 29, 2022 · 9 comments

Comments

@alexchowle
Copy link

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

$ go version
go version go1.19.3 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/me/.cache/go-build"
GOENV="/home/me/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/me/sourcecode/me/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/me/sourcecode/me/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/home/me/bin/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/home/me/bin/go/pkg/tool/linux_amd64"
GOVCS=""
GOVERSION="go1.19.3"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
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 -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build2805608787=/tmp/go-build -gno-record-gcc-switches"

What did you do?

Attempt to resolve a UDP hostname and port combination on a Centos7.9 VM. Works with go 1.17.6, but doesn't work with go 1.19.3.

https://go.dev/play/p/ZWWcqrwO0gv

What did you expect to see?

address my-lan-server:514 resolved successfully: <MY_LAN_SERVER_IP_ADDRESS>

What did you see instead?

failed to resolve my-lan-server:514: lookup my-lan-server on <MY_DNS_SERVER>:53: server misbehaving

@mateusz834
Copy link
Member

mateusz834 commented Dec 29, 2022

Can you show the file contents of /etc/nsswitch.conf and /etc/resolv.conf?
Also try running your program with GODEBUG=netdns=go+2 or GODEBUG=netdns=cgo+2 env vars.

@alexchowle
Copy link
Author

GODEBUG=netdns=go+2

go package net: confVal.netCgo = false  netGo = true
go package net: GODEBUG setting forcing use of Go's resolver
go package net: hostLookupOrder(my-lan-server) = files,dns
failed to resolve my-lan-server:514: lookup my-lan-server on <MY_DNS_SERVER>:53: server misbehaving

GODEBUG=netdns=cgo+2

go package net: confVal.netCgo = true  netGo = false
go package net: using cgo DNS resolver
go package net: hostLookupOrder(my-lan-server) = cgo
address my-lan-server:514 resolved successfully: <VALID_IP>:514

So, GODEBUG=netdns=cgo+2 has corrected the issue.

@mateusz834
Copy link
Member

mateusz834 commented Dec 29, 2022

Ok, so it seems that we are doing something differently that the glibc does.
What is the response code of the dns query to my-lan-server? Try running dig my-lan-server.
Do you have any search/domain directives in /etc/resolv.conf?

@seankhliao
Copy link
Member

how is the lan server address propagated? mdns? or some other way?

@alexchowle
Copy link
Author

I have a search directive: search localdomain

which looks odd. When I correct that to the correct domain, my software works, even with Go/s resolver (via GODEBUG=netdns=go+2)

@mateusz834
Copy link
Member

When I correct that to the correct domain, my software works, even with Go/s resolver (via GODEBUG=netdns=go+2)

What did you change the search domain to?

@alexchowle
Copy link
Author

The correct one for my enterprise - sorry for being coy but it's private information.

@alexchowle
Copy link
Author

So it looks like the cgo resolver copes with a dodgy search entry in resolv.conf, but the Go one doesn't. Unsure if this is a bug or not - I'll leave that to you guys.

@seankhliao
Copy link
Member

i don't think this is enough information for us to do anything about it.

@seankhliao seankhliao closed this as not planned Won't fix, can't repro, duplicate, stale Dec 29, 2022
@golang golang locked and limited conversation to collaborators Dec 29, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

4 participants