net: DNS lookups do not include host name suffix as a search domain #14897
Labels
Milestone
Comments
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
src/net/dnsconfig_unix.go has this comment:
// See resolv.conf(5) on a Linux machine.
// TODO(rsc): Supposed to call uname() and chop the beginning
// of the host name to get the default search domain.
...which succinctly describes the issue.
Here's an example: Given a server with uname -n "foo.x.y.z" where /etc/resolv.conf only has nameserver lines, and with another server with hostname "bar.x.y.z", net.LookupHost("bar") results in "no such host" when using the built-in DNS resolver, but succeeds when running with "GODEBUG=netdns=cgo".
go version: go version go1.6 linux/amd64
go env:
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOOS="linux"
GOPATH="/home/ben/go"
GORACE=""
GOROOT="/usr/lib/go"
GOTOOLDIR="/usr/lib/go/pkg/tool/linux_amd64"
GO15VENDOREXPERIMENT="1"
CC="x86_64-pc-linux-gnu-gcc"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0"
CXX="x86_64-pc-linux-gnu-g++"
CGO_ENABLED="1"
The text was updated successfully, but these errors were encountered: