Hostresolver: Treat AAAA queries as A queries when IPv6 is disabled #738
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A "correct" answer would be to set
handled = true
and return a NODATA response.Unfortunately some older resolvers use a slow random source to set the transaction id.
This creates a problem on M1 computers, which are too fast for that implementation:
Both the A and AAAA queries might end up with the same id. Returning NODATA for AAAA is faster, so would arrive first, and be treated as the response to the A query.
To avoid this, we will treat an AAAA query as an A query when IPv6 has been disabled.
This way it is either a valid response for an A query, or the A records will be discarded by a genuine AAAA query, resulting in the desired NODATA response.
Packet capture with the old implementation:
You can see both queries use the same transaction id
0x0edd
, so the NODATA response in frame 3 is treated as the answer to the query in frame 1. Getting a second answer in frame 4 with different content is then considered an error:With the changes in the PR the packet capture looks like this:
So the A and AAAA queries still use the same transaction id, but since both responses contain the same requested data, the query succeeds and no error is reported.
Fixes rancher-sandbox/rancher-desktop#1788 (and probably a couple of other DNS issues on M1 machines)
Shoutout to fellow packet log connoisseurs @chancez, @jsoref, and @Nino-K for their help and the 570 message discussion on Slack! 😄