go: net: "cannot unmarshal DNS message" when using netdns=go under Windows/WSL2 running ubuntu 20.04
What version of Go are you using (go version)?
$ go version go version go1.15.7 linux/amd64
Does this issue reproduce with the latest release?
Haven’t tried go1.16-rc1 or tip
What operating system and processor architecture are you using (go env)?
The problem has been reproduced with Microsoft Windows [Version 10.0.19042.746], WSL2 with Ubuntu 20.04
What did you do?
Run this program on WSL2 with Ubuntu 20.04. It is a very simple program, essentially just calling net.LookupHost
fmt.Printf("Looking up %q\n", host)
addrs, err := net.LookupHost(host)
if err != nil {
fmt.Printf("- Failed with error: %v\n", err)
} else {
for _, addr := range addrs {
fmt.Printf("- Addr: %v\n", addr)
}
}
What did you expect to see?
I expected it to resolve names correctly
What did you see instead?
$ ./host prevasonline.sharepoint.com
Looking up "prevasonline.sharepoint.com"
- Failed with error: lookup prevasonline.sharepoint.com on 172.29.224.1:53: cannot unmarshal DNS message
$ GODEBUG=netdns=go ./host prevasonline.sharepoint.com
Looking up "prevasonline.sharepoint.com"
- Failed with error: lookup prevasonline.sharepoint.com on 172.29.224.1:53: cannot unmarshal DNS message
$ GODEBUG=netdns=cgo ./host prevasonline.sharepoint.com
Looking up "prevasonline.sharepoint.com"
- Addr: 13.107.136.9
This issue was originally from https://github.com/rclone/rclone/issues/4984 and @hstaugaard and @black-snow have reported it. I (@ncw) haven’t verified it personally since I don’t have Windows with WSL2.
This issue is superficially similar to https://github.com/golang/go/issues/37362 and https://github.com/golang/go/issues/36718 but the adddress in question doesn’t have any SRV records and we aren’t doing an SRV query, just HostLookup
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 1
- Comments: 18 (3 by maintainers)
Commits related to this issue
- net: send EDNS(0) packet length in DNS query We used to only accept up to 512 bytes in a DNS packet, per RFC 1035. Increase the size we accept to 1232 bytes, per https://dnsflagday.net/2020/, and adv... — committed to golang/go by ianlancetaylor 2 years ago
- Revert "net: send EDNS(0) packet length in DNS query" This reverts https://go.dev/cl/385035. For 1.18 we will use a simple change to increase the accepted DNS packet size, to handle what appear to be... — committed to golang/go by ianlancetaylor 2 years ago
- net: increase maximum accepted DNS packet to 1232 bytes The existing value of 512 bytes as is specified by RFC 1035. However, the WSL resolver reportedly sends larger packets without setting the trun... — committed to golang/go by ianlancetaylor 2 years ago
- [release-branch.go1.17] net: increase maximum accepted DNS packet to 1232 bytes The existing value of 512 bytes as is specified by RFC 1035. However, the WSL resolver reportedly sends larger packets ... — committed to golang/go by ianlancetaylor 2 years ago
- [release-branch.go1.16] net: increase maximum accepted DNS packet to 1232 bytes The existing value of 512 bytes as is specified by RFC 1035. However, the WSL resolver reportedly sends larger packets ... — committed to golang/go by ianlancetaylor 2 years ago
- net: send EDNS(0) packet length in DNS query Advertise to DNS resolvers that we are willing and able to accept up to 1232 bytes in a DNS packet. The value 1232 was chosen based on https://dnsflagday.... — committed to golang/go by ianlancetaylor 2 years ago
Can’t test Googles DNS, no public DNS on work network.
I guess this didn’t get reopened, but #51127 has more information about this problem.