-
Notifications
You must be signed in to change notification settings - Fork 18k
net: go DNS resolver fails to connect to local DNS server #67925
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
Comments
Similar Issues
(Emoji vote if this was helpful or unhelpful; more detailed feedback welcome in this discussion.) |
If you edit /etc/resolv.conf so that 192.168.0.1 is the only nameserver, does your program consistently fail? Does it have anything to do with "gchr.io", or does it fail for any host name? We may need to see a tcpdump showing the packets for a failed DNS lookup. |
No, it still alternates between success and failure.
Testing out:
It may have something to do with ghcr.io - but I'm not sure what. Maybe ipv6 vs ipv4?
I'm happy to provide one if you provide commands/steps on how to get one. |
Should work to run |
Thanks. When using tcpdump, the pattern changes slightly to success, success, failure, <repeats alternating success/failure>. The output from the first three runs (line breaks mine):
|
Thanks. The presence of Thanks. The success case replies to the A address query with
The single failure case replies with
I don't know why these would be different. I don't know why the second case is only listing the additional record and is not listing the actual answer. This seems like a problem with your DNS server, but I am not an expert. It might be interesting to try temporarily reverting https://go.dev/cl/386016 to see if that makes any difference. I don't know why it would, but I also don't know what is going on here. |
Reverting that change does make it succeed! I don't get any failures for any of the previously failing domains. |
I'm running this with no problem, you can try
|
@danvolchek Can you run |
@gopherbot Please open backport issues. The Go DNS resolver doesn't work with at least one DNS server that apparently does not handle EDNS0 additional headers correctly. The fix is to add a new GODEBUG setting. Requesting a backport to add the GODEBUG setting to earlier releases. |
Change https://go.dev/cl/591995 mentions this issue: |
Backport issue(s) opened: #67933 (for 1.21), #67934 (for 1.22). Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases. |
I'm sending a change that adds a new |
@ianlancetaylor Maybe we should support the |
We do recognize and ignore the |
@ianlancetaylor the cgo resolver (glibc) does not send the EDNS0 header when |
If we go with the GODEBUG approach then to disable EDNS0 properly you need to make sure that edns0 is removed from the resolv.conf and also that the GODEBUG is set for the go resolver. |
My feeling is that EDNS0 is always better. We want to use it by default. And in fact this issue is the first problem reported with it. The GODEBUG setting only needs to affect the Go resolver. Yes, the very few people who have this problem will need to make sure that they don't add |
|
Oh, sorry can you replace the
|
I can confirm that when I add |
I see two different outputs:
and
|
More context on my modem: it's running the latest firmware version, which is from 2020 as far as I can tell. |
Obviously his DNS servers are contaminated. You can't help him. |
Change https://go.dev/cl/592235 mentions this issue: |
Change https://go.dev/cl/592217 mentions this issue: |
…g EDNS0 header It reportedly breaks the DNS server on some modems. For #6464 For #21160 For #44135 For #51127 For #51153 For #67925 Fixes #67933 Change-Id: I54a11906159f00246d08a54cc8be7327e9ebfd2c Reviewed-on: https://go-review.googlesource.com/c/go/+/591995 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> (cherry picked from commit ee4a42b) Reviewed-on: https://go-review.googlesource.com/c/go/+/592235 Commit-Queue: Ian Lance Taylor <iant@google.com>
…g EDNS0 header It reportedly breaks the DNS server on some modems. For #6464 For #21160 For #44135 For #51127 For #51153 For #67925 Fixes #67934 Change-Id: I54a11906159f00246d08a54cc8be7327e9ebfd2c Reviewed-on: https://go-review.googlesource.com/c/go/+/591995 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Auto-Submit: Ian Lance Taylor <iant@google.com> Reviewed-by: Damien Neil <dneil@google.com> Reviewed-by: Ian Lance Taylor <iant@google.com> (cherry picked from commit ee4a42b) Reviewed-on: https://go-review.googlesource.com/c/go/+/592217 TryBot-Bypass: Ian Lance Taylor <iant@golang.org> Commit-Queue: Ian Lance Taylor <iant@google.com>
This isn't the modem. It's the upstream DNS servers. One of them is EDNS aware and understands DNS COOKIES. The second does not implement RFC 1034. It assumes that the incoming request only contains a DNS question and appends the response to the incoming request incrementing the answer count. This results in the OPT record appearing in the answer section and the answer in the additional section. I haven't seen a server doing this for 25 years back when EDNS was first introduced. |
Go version
go version go1.22.4 linux/arm64
Output of
go env
in your module/workspace:What did you do?
Using a local nameserver (
192.168.0.1
, provided by my router) and the go DNS resolver, callnet.LookupHost
./etc/resolv.conf:
main.go:
What did you see happen?
LookupHost
alternates between failing and then succeeding, over and over:The pattern is always like this - it never fails or succeeds twice in a row. It happens without setting GODEBUG as well.
What did you expect to see?
I expect
LookupHost
to always succeed.More context:
192.168.0.1
- so I don't think it's a connectivity issue.nameserver 192.168.0.1
in my/etc/resolv.conf
makes the go DNS resolver always succeed - so I think it is specific to that server.CenturyLink Zyxel C3000Z
in case it matters.go1.19.8 linux/arm64
andgo1.21.11 linux/arm64
(both on the same machine as above), andgo1.22.4 linux/amd64
(on a different machine in my network).go1.18.7 linux/arm
(on an older machine, RPI 3B+ with Raspbian 10) - the go resolver always succeeds.Let me know if any more info is needed/what I can do to debug further. Thanks!
The text was updated successfully, but these errors were encountered: