-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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: DNS Resolution functions return truncated results when UDP responses are fragmented #69644
Comments
In the go resolver we advertise support up to 1232 Bytes for UDP packets as per DNS flag day 2020 through EDNS(0). Lines 37 to 39 in ca1123f
Quote from http://www.dnsflagday.net/2020/:
@LeeBrotherston can you post the entire output of:
For both of the links you were testing, so the 1280 MTU (VPN) and the normal one (1500)? On my side i get a TC reply in the UDP DNS query while using
|
@mateusz834 thankyou! I was just coming back to close this ticket as I just came across the comment about this exact thing in the source. I now see that my VPN connection changes the nameserver to one within the VPN network, and which sends larger sized responses. |
Go version
go version go1.23.1 darwin/arm64
Output of
go env
in your module/workspace:What did you do?
Select a DNS query which will return a response larger than the current MTU on your default interface. To illustrate I am using
nat.travisci.net
is it returns 79 A records, with a packet size of just over 1300.If you run the code snippet below, whilst connected via a standard ethernet connection (probably 1500 MTU), you should get 79 responses, which can be verified by comparing the output of the same query using
nslookup
,host
,dig
, etc.If you now use a connection with a lower MTU, for example using a VPN lowers my MTU to 1280, and run the same tests you will see that the code snippet below only returns 29 results, while
nslookup
,host
,dig
, etc still return the full set of results.If we use some sort of packetsniffer (e.g. wireshark, tcpdump, etc) to analyze the data on the wire, we can see that the response is fragmented due to being larger than the MTU, as we would expect. As far as I can tell the other tools successfully reconstruct the packet from the fragments, however go seems to truncate the response, presumably due to the fragmentation.
This seems to happen on Linux as well as macOS, with and without CGO.
Snippet for testing:
What did you see happen?
I saw the go lookup return truncated results whilst on a lower MTU connection, while nslookup, etc continued to return the full results.
What did you expect to see?
I expected to see the same results between the sample code and nslookup, etc no matter which connection I was using.
The text was updated successfully, but these errors were encountered: