mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 19:25:56 +03:00
[GH-ISSUE #2602] Consider removing DnsLru::insert_records() #1023
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#1023
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?
Originally created by @divergentdave on GitHub (Nov 21, 2024).
Original GitHub issue: https://github.com/hickory-dns/hickory-dns/issues/2602
Currently, the resolver and recursor use disjoint APIs for inserting into the record cache. The recursor uses
DnsLru::insert_records(), which takes a list of records, groups them by name and record type (with some exceptions) and stores the groups in the cache under synthesized query keys. The two exceptions for record types areCNAMErecords, which get stored under the original query, andRRSIGrecords, which get stored with the record set they are a signature over.These exceptions are incomplete, because they result in DS records getting stored separate from NS records when present in a response. They also result in storing NSEC and NSEC3 records under the name of the record, not the query name, which means they won't be found when performing the same query again. This affects #2595. Additionally, glue records may get stored in the cache if they are in-bailiwick, which means the recursor may nondeterministically reuse glue records when handling subsequent recursive requests, rather than requesting A/AAAA records from the relevant authoritative server.
Rather than extend the exceptions in
insert_records()'s grouping algorithm, I think it might make more sense to eliminate its use. Instead, we would store the records from an authoritative response together, keyed by their original query. This would ensure we always have the necessary DNSSEC records sent in the original response, and prevent parent and child nodes from fighting over cache entries in case they have a disagreement about a record set. However, the recursor as it is written today is reliant on the behavior ofinsert_records(), so we would need to change its operation in tandem. For example, we would have to pull out glue A/AAAA records directly from a response, rather than relying oninsert_records()to populate cache entries with them, and loading IP addresses from the cache inRecursorDnsHandle::ns_pool_for_zone().@divergentdave commented on GitHub (Dec 6, 2024):
RFC 4035 section 4.5 has a related recommendation:
The recommendation here is more focused on not synthesizing positive responses from wildcard RRSIGs, or performing aggressive NSEC caching, but I think the point about consistency still applies.
@divergentdave commented on GitHub (Mar 28, 2025):
I tried looking up
ideleg.net. IN Awith the validating recursive resolver, and got back a SERVFAIL response due to this issue. This zone is unusual because one of its nameservers isideleg.net.itself. Thus, one of the glue records from the referral fromnet.gets stored in the cache under the same query as the recursive query. The glue does not come with anRRSIG, which should be fine because the glue is not authoritative data anyway, but then this stored RRset is also used as the response to the recursive query. DNSSEC validation then fails because there is no RRSIG in theLookupreturned by the recursor.