[PR #2160] [MERGED] Trivariant LookupControlFlow type to allow authorities to decline to respond to a query #2849

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

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/2160
Author: @marcus0x62
Created: 2/29/2024
Status: Merged
Merged: 8/23/2024
Merged by: @marcus0x62

Base: mainHead: selective_authority


📝 Commits (10+)

  • 07f2117 Allow authorities to decline to respond to a query by returning None.
  • 1e959df LookupResult tri-variant enum and associated call site changes
  • fdd83bd Change Lookup::Bypass to Lookup::Skip, add map_dyn method to LookupResult, change map(|l| Box::new ... calls to use map_dyn()
  • 4ceeaca Merge branch 'main' into selective_authority
  • 92b0da8 Merge branch 'main' into selective_authority
  • c6fe59c resolve conflicts with upstream
  • e06b420 Merge branch 'main' into selective_authority
  • 2b33238 Merge remote-tracking branch 'upstream/main' into selective_authority
  • c6d3fc6 This commit reworks LookupResult into LookupControlFlow, as discussed in PR 2160
  • 332d338 Merge remote-tracking branch 'upstream/main' into selective_authority

📊 Changes

11 files changed (+412 additions, -134 deletions)

View changed files

📝 crates/server/src/authority/authority.rs (+174 -7)
📝 crates/server/src/authority/authority_object.rs (+15 -16)
📝 crates/server/src/authority/catalog.rs (+112 -35)
📝 crates/server/src/authority/error.rs (+0 -3)
📝 crates/server/src/authority/mod.rs (+2 -2)
📝 crates/server/src/server/request_handler.rs (+1 -1)
📝 crates/server/src/store/file/authority.rs (+9 -7)
📝 crates/server/src/store/forwarder/authority.rs (+12 -8)
📝 crates/server/src/store/in_memory/authority.rs (+59 -38)
📝 crates/server/src/store/recursor/authority.rs (+17 -11)
📝 crates/server/src/store/sqlite/authority.rs (+11 -6)

📄 Description

This PR contains changes to the lookup, search, and related authority functions that wrap the lookup in an Option. This is to allow authorities to use None to signal when a lookup was not found, but that searching should continue using other authorities configured in an authority chain.

The current use case is for the block list authority.

This also changes the lookup and build_response logic in catalog.rs to not call send_authoritative_response or send_forwarded_response if None is returned.

The use case for this is so that when an authority like the block list is consulted, we do not leak the request to other authorities for requests the user wants to block, and we do not incur extra latency by waiting for a timeout when the block list can immediately signal it does not have an answer for a particular query.

See discussion here and more generally in PR #2113


🔄 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/2160 **Author:** [@marcus0x62](https://github.com/marcus0x62) **Created:** 2/29/2024 **Status:** ✅ Merged **Merged:** 8/23/2024 **Merged by:** [@marcus0x62](https://github.com/marcus0x62) **Base:** `main` ← **Head:** `selective_authority` --- ### 📝 Commits (10+) - [`07f2117`](https://github.com/hickory-dns/hickory-dns/commit/07f211701b61da14e6f469868bb79dd2e27f19b8) Allow authorities to decline to respond to a query by returning None. - [`1e959df`](https://github.com/hickory-dns/hickory-dns/commit/1e959dfab16fa2d4566ba126c939fba1cd27b029) LookupResult tri-variant enum and associated call site changes - [`fdd83bd`](https://github.com/hickory-dns/hickory-dns/commit/fdd83bd495a17cc2daaac7e711db2058c97bf149) Change Lookup::Bypass to Lookup::Skip, add map_dyn method to LookupResult, change map(|l| Box::new ... calls to use map_dyn() - [`4ceeaca`](https://github.com/hickory-dns/hickory-dns/commit/4ceeaca0d18fb64b233c4e71bd8ec339bb66764d) Merge branch 'main' into selective_authority - [`92b0da8`](https://github.com/hickory-dns/hickory-dns/commit/92b0da88688d6ae43185c17067fa7af84d9387bc) Merge branch 'main' into selective_authority - [`c6fe59c`](https://github.com/hickory-dns/hickory-dns/commit/c6fe59cc146530d0b7430a13c80bc4ad98a85e33) resolve conflicts with upstream - [`e06b420`](https://github.com/hickory-dns/hickory-dns/commit/e06b4205866093c45e43c7207c060f7ff8507881) Merge branch 'main' into selective_authority - [`2b33238`](https://github.com/hickory-dns/hickory-dns/commit/2b332381712c7b700189eb86be6193efa2f5086e) Merge remote-tracking branch 'upstream/main' into selective_authority - [`c6d3fc6`](https://github.com/hickory-dns/hickory-dns/commit/c6d3fc6935dfb941cf9429de400e1a8eae561217) This commit reworks LookupResult into LookupControlFlow, as discussed in PR 2160 - [`332d338`](https://github.com/hickory-dns/hickory-dns/commit/332d3388fd93e6a3d1a9a955053fa224fca56df2) Merge remote-tracking branch 'upstream/main' into selective_authority ### 📊 Changes **11 files changed** (+412 additions, -134 deletions) <details> <summary>View changed files</summary> 📝 `crates/server/src/authority/authority.rs` (+174 -7) 📝 `crates/server/src/authority/authority_object.rs` (+15 -16) 📝 `crates/server/src/authority/catalog.rs` (+112 -35) 📝 `crates/server/src/authority/error.rs` (+0 -3) 📝 `crates/server/src/authority/mod.rs` (+2 -2) 📝 `crates/server/src/server/request_handler.rs` (+1 -1) 📝 `crates/server/src/store/file/authority.rs` (+9 -7) 📝 `crates/server/src/store/forwarder/authority.rs` (+12 -8) 📝 `crates/server/src/store/in_memory/authority.rs` (+59 -38) 📝 `crates/server/src/store/recursor/authority.rs` (+17 -11) 📝 `crates/server/src/store/sqlite/authority.rs` (+11 -6) </details> ### 📄 Description This PR contains changes to the lookup, search, and related authority functions that wrap the lookup in an Option. This is to allow authorities to use None to signal when a lookup was not found, but that searching should continue using other authorities configured in an authority chain. The current use case is for the block list authority. This also changes the lookup and build_response logic in catalog.rs to not call send_authoritative_response or send_forwarded_response if None is returned. The use case for this is so that when an authority like the block list is consulted, we do not leak the request to other authorities for requests the user wants to block, and we do not incur extra latency by waiting for a timeout when the block list can immediately signal it does not have an answer for a particular query. See discussion [here](https://github.com/hickory-dns/hickory-dns/pull/2113#discussion_r1439074772) and more generally in [PR #2113](https://github.com/hickory-dns/hickory-dns/pull/2113) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 11:11:26 +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#2849
No description provided.