[PR #2339] [MERGED] CNAME resolution support for the recursor. #2965

Closed
opened 2026-03-16 11:17:57 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/2339
Author: @marcus0x62
Created: 8/4/2024
Status: Merged
Merged: 9/14/2024
Merged by: @marcus0x62

Base: mainHead: recursor_cname


📝 Commits (4)

  • 47ddecb Add extend_records method to Lookup implementation to allow the recursor CNAME mechanism
  • 0353ba8 Preserve original query type in cache lookup
  • 89d2083 CNAME lookup logic for the recursor
  • ee85315 Tests for the recursor CNAME implementation

📊 Changes

11 files changed (+492 additions, -18 deletions)

View changed files

📝 crates/recursor/src/recursor.rs (+19 -2)
📝 crates/recursor/src/recursor_dns_handle.rs (+118 -7)
📝 crates/resolver/src/dns_lru.rs (+12 -9)
📝 crates/resolver/src/lookup.rs (+8 -0)
📝 crates/server/src/store/recursor/authority.rs (+1 -0)
📝 crates/server/src/store/recursor/config.rs (+8 -0)
📝 tests/e2e-tests/src/lib.rs (+1 -0)
tests/e2e-tests/src/recursor.rs (+1 -0)
tests/e2e-tests/src/recursor/cname.rs (+1 -0)
tests/e2e-tests/src/recursor/cname/scenarios.rs (+322 -0)
📝 tests/test-data/test_configs/example_recursor.toml (+1 -0)

📄 Description

This PR adds support for CNAME resolution to the recursor, along with a set of related changes:

  1. A new extend_records method in crates/resolver/src/lookup.rs to facilitate appending the resolved CNAMES to the original Lookup result.
  2. A change to the DNS LRU insert_records function to use the original query type when inserting a CNAME record, to facilitate later retrieval of the record.
  3. Core CNAME lookup logic for the recursor and a configurable recursion depth limit (default: 12 nested lookups) to prevent lookup loops
  4. CNAME-related tests for single CNAME queries, CNAME chain queries, and the recursion depth limit.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/hickory-dns/hickory-dns/pull/2339 **Author:** [@marcus0x62](https://github.com/marcus0x62) **Created:** 8/4/2024 **Status:** ✅ Merged **Merged:** 9/14/2024 **Merged by:** [@marcus0x62](https://github.com/marcus0x62) **Base:** `main` ← **Head:** `recursor_cname` --- ### 📝 Commits (4) - [`47ddecb`](https://github.com/hickory-dns/hickory-dns/commit/47ddecbebdd2eac9b9d0dfeae5183febf2f0e57b) Add extend_records method to Lookup implementation to allow the recursor CNAME mechanism - [`0353ba8`](https://github.com/hickory-dns/hickory-dns/commit/0353ba843dbe839c1c252d198f6abdf0b1ce6643) Preserve original query type in cache lookup - [`89d2083`](https://github.com/hickory-dns/hickory-dns/commit/89d2083aee6e27d257eefb09e8716d14678dfa44) CNAME lookup logic for the recursor - [`ee85315`](https://github.com/hickory-dns/hickory-dns/commit/ee85315f854112aeb31f6932863c54f6b57a8793) Tests for the recursor CNAME implementation ### 📊 Changes **11 files changed** (+492 additions, -18 deletions) <details> <summary>View changed files</summary> 📝 `crates/recursor/src/recursor.rs` (+19 -2) 📝 `crates/recursor/src/recursor_dns_handle.rs` (+118 -7) 📝 `crates/resolver/src/dns_lru.rs` (+12 -9) 📝 `crates/resolver/src/lookup.rs` (+8 -0) 📝 `crates/server/src/store/recursor/authority.rs` (+1 -0) 📝 `crates/server/src/store/recursor/config.rs` (+8 -0) 📝 `tests/e2e-tests/src/lib.rs` (+1 -0) ➕ `tests/e2e-tests/src/recursor.rs` (+1 -0) ➕ `tests/e2e-tests/src/recursor/cname.rs` (+1 -0) ➕ `tests/e2e-tests/src/recursor/cname/scenarios.rs` (+322 -0) 📝 `tests/test-data/test_configs/example_recursor.toml` (+1 -0) </details> ### 📄 Description This PR adds support for CNAME resolution to the recursor, along with a set of related changes: 1. A new extend_records method in [crates/resolver/src/lookup.rs](https://github.com/hickory-dns/hickory-dns/blob/f7ef5cdf08730ecb04ba0947d9bbc309400c9b4b/crates/resolver/src/lookup.rs#L144) to facilitate appending the resolved CNAMES to the original Lookup result. 2. A [change](https://github.com/marcus0x62/hickory-dns/blob/77bdf979cceba089d04fe718abe7db73ff49c074/crates/resolver/src/dns_lru.rs#L279) to the DNS LRU insert_records function to use the original query type when inserting a CNAME record, to facilitate later retrieval of the record. 3. Core CNAME lookup logic for the recursor and a configurable recursion depth limit (default: 12 nested lookups) to prevent lookup loops 4. CNAME-related tests for single CNAME queries, CNAME chain queries, and the recursion depth limit. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 11:17:57 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#2965
No description provided.