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: "cannot unmarshal DNS message" when using netdns=go under Windows/WSL2 running ubuntu 20.04 #44135

Open
ncw opened this issue Feb 6, 2021 · 3 comments

Comments

@ncw
Copy link
Contributor

@ncw ncw commented Feb 6, 2021

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 rclone/rclone#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 #37362 and #36718 but the adddress in question doesn't have any SRV records and we aren't doing an SRV query, just HostLookup

@seankhliao
Copy link
Contributor

@seankhliao seankhliao commented Feb 6, 2021

can this be run with GODEBUG=netdns=go+2 and GODEBUG=netdns=cgo+2, also what if the DNS servers are changed (eg. to 8.8.8.8)?

@dmitshur dmitshur added this to the Backlog milestone Feb 6, 2021
@hstaugaard
Copy link

@hstaugaard hstaugaard commented Feb 8, 2021

can this be run with GODEBUG=netdns=go+2 and GODEBUG=netdns=cgo+2, also what if the DNS servers are changed (eg. to 8.8.8.8)?

$ GODEBUG=netdns=go+2 ./host prevasonline.sharepoint.com
Looking up "prevasonline.sharepoint.com"
go package net: GODEBUG setting forcing use of Go's resolver
go package net: hostLookupOrder(prevasonline.sharepoint.com) = files,dns
- Failed with error: lookup prevasonline.sharepoint.com on 172.29.128.1:53: cannot unmarshal DNS message

$ GODEBUG=netdns=cgo+2 ./host prevasonline.sharepoint.com
Looking up "prevasonline.sharepoint.com"
go package net: using cgo DNS resolver
go package net: hostLookupOrder(prevasonline.sharepoint.com) = cgo
- Addr: 13.107.136.9

Can't test Googles DNS, no public DNS on work network.

@jryan128
Copy link

@jryan128 jryan128 commented Feb 10, 2021

Same issues with a different go program. When I run with +2. I am using a VPN and WSL2. The server is on the VPN.

go package net: built with netgo build tag; using Go's DNS resolver
go package net: hostLookupOrder(****) = files,dns
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
5 participants