net: don't keep reading from UDP resolver after truncated packet #23873
Labels
Milestone
Comments
This should be re-checked given the work done for #21160. |
See also #22857. |
With the new DNS client, the chances of truncated DNS messages causing problems is greatly reduced, not not eliminated. I believe that now in cases where not all answers are contained in the read UDP message we will either try another DNS server or error out. I agree that trying TCP would be better, but at least failing fast is better than waiting for a timeout. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When the
host
ordig
programs see a malformed packet from a resolver when using UDP, they fall back to using TCP. The net package resolver does not do this; it simply ignores the malformed packet (in(*dnsPacketConn).dnsRoundTrip
in net/dnsclient_unix.go). This was done for #13281. I suggest that we do the same.This is showing up right now for me when I run
go test -test.run=TestLookupLongTXT net
. I see this:If I run
dig -t txt golang.rsc.io
the output starts withI suggest that we keep the current behavior for the
!resp.IsResponseTo(query)
case but change the behavior for anUnpack
failure to drop right back to TCP.CC @mdempsky
The text was updated successfully, but these errors were encountered: