mirror of
https://github.com/hickory-dns/hickory-dns.git
synced 2026-04-25 03:05:51 +03:00
[PR #2325] [MERGED] Improve recursor logic by eliminating redundant NS requests and adding recursor support for NS referrals. #2953
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#2953
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/2325
Author: @marcus0x62
Created: 7/25/2024
Status: ✅ Merged
Merged: 7/28/2024
Merged by: @bluejekyll
Base:
main← Head:recursor_logic📝 Commits (4)
78d5776Improve recursor logic by eliminating redundant NS requests and adding recursor support for NS referrals.88d4fbbReintroduce changeset; see comment in previous commit.8b63f77Change the zone name handling logic to account for NS queries with the DO bit set - in that case we67077c9Merge branch 'main' into recursor_logic📊 Changes
6 files changed (+328 additions, -29 deletions)
View changed files
📝
crates/proto/src/error.rs(+46 -0)📝
crates/recursor/src/error.rs(+17 -5)📝
crates/recursor/src/recursor_dns_handle.rs(+253 -23)📝
crates/resolver/src/caching_client.rs(+5 -0)📝
crates/resolver/src/dns_lru.rs(+4 -0)📝
crates/resolver/src/name_server/name_server_pool.rs(+3 -1)📄 Description
Improve recursor logic by:
The current resolver logic will send an NS query for every element of a queried name, which for most cases, results in an extra NS query being sent for the hostname portion of the domain. For instance, assuming a cold start/empty cache, host.example.com results in the following queries:
By changing the logic to start the ns_pool_for_zone search on the parent zone name, the superfluous NS request is eliminated, and the queries sent for the example above now look like this:
In the case where a query is made for a second-level domain, an A query will be sent to the top-level domain name servers, but there still will not be any redundant queries due to the second change in this PR, which is to create a new recursor error variant (ForwardNS) to reflect when a referral to a different set of nameservers is encountered.
To continue the previous example, a request sent for A example.com will result in the following queries (again, cold-start, no cache assumed:)
After the first query, ns_pool_for_zone is done - it uses the zone 'com.' to try to resolve
'example.com.'. The root servers for com. do not contain the zone data for example.com., but are authoritative for the example.com NS delegation records, and return those. Since the response contains no answer but does include NS records, the Error::ForwardNS condition is the result of the second lookup, which triggers a call to build_pool_for_referral and a new query for A example.com via the correct servers.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.