[PR #3310] [MERGED] Use Message in Lookup instead of [Record] to preserve section information #3730

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

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/3310
Author: @bryanlarsen
Created: 10/13/2025
Status: Merged
Merged: 12/15/2025
Merged by: @djc

Base: mainHead: feature/dns-section-preservation


📝 Commits (10+)

  • 99c143b resolver: move LookupRecordIter next to LookupIter
  • a38e84c use Message in Lookup instead of [Record]
  • ced3997 server: remove AuthLookupIter::Resolved
  • 342c780 util: print all sections in resolve util
  • 82aeeda resolver: rework caching client record filtering
  • 158067f resolver: centralize DNSSEC record stripping
  • 2c8426d server: catalog resp as Message, comprehensive DNSSEC strip
  • 9a44553 resolver: use edns_set_dnssec_ok from context opts
  • 557c845 resolver: as a forwarder, strip RRSIGs appropriately
  • 8355ef3 server: preserve message sections when forwarding

📊 Changes

15 files changed (+1767 additions, -648 deletions)

View changed files

📝 conformance/conformance-tests/src/forwarder/dnssec/scenarios.rs (+62 -1)
📝 crates/proto/src/dnssec/mod.rs (+38 -1)
📝 crates/proto/src/op/message.rs (+43 -1)
📝 crates/resolver/examples/flush_cache.rs (+16 -5)
📝 crates/resolver/src/caching_client.rs (+928 -116)
📝 crates/resolver/src/hosts.rs (+117 -89)
📝 crates/resolver/src/lookup.rs (+225 -246)
📝 crates/resolver/src/lookup_ip.rs (+38 -22)
📝 crates/resolver/src/recursor/handle.rs (+2 -10)
📝 crates/resolver/src/recursor/mod.rs (+4 -34)
📝 crates/resolver/src/resolver.rs (+40 -23)
📝 crates/server/src/zone_handler/auth_lookup.rs (+2 -7)
📝 crates/server/src/zone_handler/catalog.rs (+215 -78)
📝 tests/integration-tests/tests/integration/lookup_tests.rs (+12 -12)
📝 util/src/bin/resolve.rs (+25 -3)

📄 Description

Fixes #2781

  • In Lookup, replace the records: Arc<[Record]> field with message: Message. This allows users of the Lookup, such as the resolve util to print section information. It also ensures that section information is not lost when using hickory as a forwarder

  • update the resolve util to print section information

  • handle_noerror in caching_client.rs, which does cname and SRV chasing changed considerably as a consequence. I assumed that some of the filtering previously done in this code was there because all records were being put into the answers section. Now that we preserve sections, I don't think this filtering is necessary. Changes to this function should be carefully reviewed.

  • many of the previous functions on Lookup became ambiguous. For example, should iter() iterate over answers or all_sections? In the discussion it was decided that these functions should be removed. Users now have better options. They can use message() to access the Message and use it's accessors. Or they can use the LookupIp wrapper which has less ambiguous iterators. These removals have been split into multiple commits so it's easy to undo some of the removals while keeping others.

  • one dnssec conformance test broke with the initial changes. Stripping of RRSIG records was happening accidentally and unconditionally. This PR makes the stripping conditional on dnssec_ok, puts it in an appropriately named function, and adds a conformance test for both dnssec_ok true and false.

  • moved DnssecIter into the proto crate. Lookup had a method dnssec_iter() which didn't have an equivalent in Message. So rather than leaving dnssec_iter() on Lookup, DnssecIter was moved to the Proto crate and dnssec_answers() added to the Message struct.


🔄 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/3310 **Author:** [@bryanlarsen](https://github.com/bryanlarsen) **Created:** 10/13/2025 **Status:** ✅ Merged **Merged:** 12/15/2025 **Merged by:** [@djc](https://github.com/djc) **Base:** `main` ← **Head:** `feature/dns-section-preservation` --- ### 📝 Commits (10+) - [`99c143b`](https://github.com/hickory-dns/hickory-dns/commit/99c143b2e2d0fa213a5ad800be4b7d39a7cce571) resolver: move LookupRecordIter next to LookupIter - [`a38e84c`](https://github.com/hickory-dns/hickory-dns/commit/a38e84cd128e7a0b1ed8f4fef4fa41ed633afa03) use Message in Lookup instead of [Record] - [`ced3997`](https://github.com/hickory-dns/hickory-dns/commit/ced3997479083c9ce2f8594fc7a615b5e01dabf1) server: remove AuthLookupIter::Resolved - [`342c780`](https://github.com/hickory-dns/hickory-dns/commit/342c7800080394b6816a997cf182bfff44c682bc) util: print all sections in resolve util - [`82aeeda`](https://github.com/hickory-dns/hickory-dns/commit/82aeeda36cb278ee8dd803eadf5cfd25ca3df0a3) resolver: rework caching client record filtering - [`158067f`](https://github.com/hickory-dns/hickory-dns/commit/158067fd3f8da24d5f27936606a2115641e46e50) resolver: centralize DNSSEC record stripping - [`2c8426d`](https://github.com/hickory-dns/hickory-dns/commit/2c8426da6c7bcc9b720b2746d758984035ca962a) server: catalog resp as Message, comprehensive DNSSEC strip - [`9a44553`](https://github.com/hickory-dns/hickory-dns/commit/9a445536771d11fc227583e02d0f6252f42bfe5a) resolver: use edns_set_dnssec_ok from context opts - [`557c845`](https://github.com/hickory-dns/hickory-dns/commit/557c8450714d7ca027a64ee3695308dbdec23d37) resolver: as a forwarder, strip RRSIGs appropriately - [`8355ef3`](https://github.com/hickory-dns/hickory-dns/commit/8355ef3a639bbe9be58113fe2ee8de78b7df54c5) server: preserve message sections when forwarding ### 📊 Changes **15 files changed** (+1767 additions, -648 deletions) <details> <summary>View changed files</summary> 📝 `conformance/conformance-tests/src/forwarder/dnssec/scenarios.rs` (+62 -1) 📝 `crates/proto/src/dnssec/mod.rs` (+38 -1) 📝 `crates/proto/src/op/message.rs` (+43 -1) 📝 `crates/resolver/examples/flush_cache.rs` (+16 -5) 📝 `crates/resolver/src/caching_client.rs` (+928 -116) 📝 `crates/resolver/src/hosts.rs` (+117 -89) 📝 `crates/resolver/src/lookup.rs` (+225 -246) 📝 `crates/resolver/src/lookup_ip.rs` (+38 -22) 📝 `crates/resolver/src/recursor/handle.rs` (+2 -10) 📝 `crates/resolver/src/recursor/mod.rs` (+4 -34) 📝 `crates/resolver/src/resolver.rs` (+40 -23) 📝 `crates/server/src/zone_handler/auth_lookup.rs` (+2 -7) 📝 `crates/server/src/zone_handler/catalog.rs` (+215 -78) 📝 `tests/integration-tests/tests/integration/lookup_tests.rs` (+12 -12) 📝 `util/src/bin/resolve.rs` (+25 -3) </details> ### 📄 Description Fixes #2781 - In Lookup, replace the `records: Arc<[Record]>` field with `message: Message`. This allows users of the Lookup, such as the `resolve` util to print section information. It also ensures that section information is not lost when using hickory as a forwarder - update the `resolve` util to print section information - handle_noerror in caching_client.rs, which does cname and SRV chasing changed considerably as a consequence. I assumed that some of the filtering previously done in this code was there because all records were being put into the answers section. Now that we preserve sections, I don't think this filtering is necessary. Changes to this function should be carefully reviewed. - many of the previous functions on Lookup became ambiguous. For example, should iter() iterate over answers or all_sections? In the discussion it was decided that these functions should be removed. Users now have better options. They can use message() to access the Message and use it's accessors. Or they can use the LookupIp wrapper which has less ambiguous iterators. These removals have been split into multiple commits so it's easy to undo some of the removals while keeping others. - one dnssec conformance test broke with the initial changes. Stripping of RRSIG records was happening accidentally and unconditionally. This PR makes the stripping conditional on dnssec_ok, puts it in an appropriately named function, and adds a conformance test for both dnssec_ok true and false. - moved DnssecIter into the proto crate. Lookup had a method dnssec_iter() which didn't have an equivalent in Message. So rather than leaving dnssec_iter() on Lookup, DnssecIter was moved to the Proto crate and dnssec_answers() added to the Message struct. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 11:59:40 +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#3730
No description provided.