mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 03:05:51 +03:00
[PR #2682] [MERGED] resolver: never use truncated UDP response #3231
Labels
No labels
blocked
breaking-change
bug
bug:critical
bug:tests
cleanup
compliance
compliance
compliance
crate:all
crate:client
crate:native-tls
crate:proto
crate:recursor
crate:resolver
crate:resolver
crate:rustls
crate:server
crate:util
dependencies
docs
duplicate
easy
easy
enhance
enhance
enhance
feature:dns-over-https
feature:dns-over-quic
feature:dns-over-tls
feature:dnsssec
feature:global_lb
feature:mdns
feature:tsig
features:edns
has workaround
ops
perf
platform:WASM
platform:android
platform:fuchsia
platform:linux
platform:macos
platform:windows
pull-request
question
test
tools
tools
trust
unclear
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/hickory-dns#3231
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/hickory-dns/hickory-dns/pull/2682
Author: @divergentdave
Created: 12/16/2024
Status: ✅ Merged
Merged: 12/18/2024
Merged by: @marcus0x62
Base:
main← Head:david/resolver-truncation-fix📝 Commits (1)
0002736resolver: never use truncated UDP response📊 Changes
3 files changed (+5 additions, -20 deletions)
View changed files
📝
conformance/packages/conformance-tests/src/resolver/dns/rfc1035/truncation.rs(+0 -1)📝
crates/resolver/src/name_server/name_server_pool.rs(+2 -18)📝
crates/resolver/src/resolver.rs(+3 -1)📄 Description
This changes
NameServerPoolto only return data from a TCP response if the UDP response was truncated. This fixes #2608, and fixes NSEC/NSEC3 validation in some cases. I think we should not return truncated responses in this context, even if that's the only response available, because it is presently the cause of multiple correctness issues, and because this PR's behavior aligns with other implementations, like BIND and Unbound's recursive resolvers. There are some cases where it would be possible to implement optimizations making use of truncated responses, such as eagerly connecting to nameservers during iterative recursion before receiving complete referral responses, but I think we'd need to pierce existing encapsulation, and make more of the codebase truncation-aware. Plus,ProtoErrormakes reasoning about this behavior harder.When handling a truncated UDP response for a query of an empty RRset,
ProtoError::from_response()returnsOk(response), because of a check for the truncation bit.NameServerPoolalso checks the truncation bit on the response, and sends a TCP query. Subsequently,ProtoError::from_response()turns the TCP response intoErr(ProtoErrorKind::NoRecordsFound { .. }.into()). Between these two choices, the existing code will return theOk(...)containing a truncated response over the completeNoRecordsFounderror, which leads to later validation reporting that the NSEC/NSEC3/RRSIG records are bogus, since it is working from an incomplete RRset.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.