[PR #1855] [MERGED] Add wireformat buffer to DnsResponse #2658

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

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/1855
Author: @mattias-p
Created: 12/7/2022
Status: Merged
Merged: 1/5/2023
Merged by: @bluejekyll

Base: mainHead: response-buffer


📝 Commits (10+)

  • fc09743 Rename DnsResponse::into_inner() -> into_message()
  • 4b531f2 Make DnsResponse immutable
  • 123b09c Use original buffer in more places
  • a5a4a49 Add buffer to DnsResponse
  • 0a101c1 Add test/example
  • 8283d21 Lint
  • bfc2e29 When constructing a DnsResponse from a buffer, include the buffer
  • 95f1ef8 Refactor
  • 641123f Make QuicStream::receive() return DnsResponse
  • 0899d82 Replace impl From for DnsResponse with DnsResponse::from_message()

📊 Changes

22 files changed (+282 additions, -133 deletions)

View changed files

📝 crates/client/src/client/async_client.rs (+53 -3)
📝 crates/client/src/client/memoize_client_handle.rs (+1 -1)
📝 crates/client/src/rr/dnssec/tsig.rs (+4 -1)
📝 crates/proto/src/https/https_client_stream.rs (+4 -5)
📝 crates/proto/src/quic/quic_client_stream.rs (+1 -2)
📝 crates/proto/src/quic/quic_stream.rs (+3 -2)
📝 crates/proto/src/quic/tests.rs (+1 -1)
📝 crates/proto/src/udp/udp_client_stream.rs (+7 -8)
📝 crates/proto/src/xfer/dns_multiplexer.rs (+3 -3)
📝 crates/proto/src/xfer/dns_response.rs (+49 -30)
📝 crates/proto/src/xfer/dnssec_dns_handle.rs (+3 -3)
📝 crates/proto/src/xfer/retry_dns_handle.rs (+1 -1)
📝 crates/recursor/src/recursor.rs (+2 -1)
📝 crates/resolver/src/caching_client.rs (+22 -12)
📝 crates/resolver/src/error.rs (+2 -4)
📝 crates/resolver/src/lookup.rs (+2 -2)
📝 crates/resolver/src/lookup_ip.rs (+3 -3)
📝 tests/integration-tests/src/mock_client.rs (+1 -1)
📝 tests/integration-tests/tests/lookup_tests.rs (+22 -18)
📝 tests/integration-tests/tests/name_server_pool_tests.rs (+92 -28)

...and 2 more files

📄 Description

This PR adds a wireformat buffer to the DnsResponse struct, allowing the caller to know the exact bytes that were received in a given response.

This is my second attempt at achieving the same goal. During the review of my first attempt (#1823) @djc suggested an alternative approach. We refined his idea a little and agreed that it seemed like a better way. This is an implementation of that idea.

Fixes #1814.


🔄 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/1855 **Author:** [@mattias-p](https://github.com/mattias-p) **Created:** 12/7/2022 **Status:** ✅ Merged **Merged:** 1/5/2023 **Merged by:** [@bluejekyll](https://github.com/bluejekyll) **Base:** `main` ← **Head:** `response-buffer` --- ### 📝 Commits (10+) - [`fc09743`](https://github.com/hickory-dns/hickory-dns/commit/fc09743b3051194d520f23ef7bdb7f3a8a90ed81) Rename DnsResponse::into_inner() -> into_message() - [`4b531f2`](https://github.com/hickory-dns/hickory-dns/commit/4b531f2ca80a4bcd7bf0acafe0f5bd0360c30961) Make DnsResponse immutable - [`123b09c`](https://github.com/hickory-dns/hickory-dns/commit/123b09ccbbd72a233f0f7fdf28d4a2fbb3b668db) Use original buffer in more places - [`a5a4a49`](https://github.com/hickory-dns/hickory-dns/commit/a5a4a491c3cdbe7aedbe65ff82e33d4bd7e1af93) Add buffer to DnsResponse - [`0a101c1`](https://github.com/hickory-dns/hickory-dns/commit/0a101c1e8d22e3ec70de1c413049976891607991) Add test/example - [`8283d21`](https://github.com/hickory-dns/hickory-dns/commit/8283d213a75ca30f011e48f4d63cbdfb7ffe1148) Lint - [`bfc2e29`](https://github.com/hickory-dns/hickory-dns/commit/bfc2e29eca4025308dffb3d2cb481feb670f6024) When constructing a DnsResponse from a buffer, include the buffer - [`95f1ef8`](https://github.com/hickory-dns/hickory-dns/commit/95f1ef8e9731eb070225b196febd29d8be3df8a1) Refactor - [`641123f`](https://github.com/hickory-dns/hickory-dns/commit/641123fa05d3a4d805157bcb150f8f4dac386644) Make QuicStream::receive() return DnsResponse - [`0899d82`](https://github.com/hickory-dns/hickory-dns/commit/0899d82cc1b9594275cb4305793dd9c86a435dca) Replace impl From<Message> for DnsResponse with DnsResponse::from_message() ### 📊 Changes **22 files changed** (+282 additions, -133 deletions) <details> <summary>View changed files</summary> 📝 `crates/client/src/client/async_client.rs` (+53 -3) 📝 `crates/client/src/client/memoize_client_handle.rs` (+1 -1) 📝 `crates/client/src/rr/dnssec/tsig.rs` (+4 -1) 📝 `crates/proto/src/https/https_client_stream.rs` (+4 -5) 📝 `crates/proto/src/quic/quic_client_stream.rs` (+1 -2) 📝 `crates/proto/src/quic/quic_stream.rs` (+3 -2) 📝 `crates/proto/src/quic/tests.rs` (+1 -1) 📝 `crates/proto/src/udp/udp_client_stream.rs` (+7 -8) 📝 `crates/proto/src/xfer/dns_multiplexer.rs` (+3 -3) 📝 `crates/proto/src/xfer/dns_response.rs` (+49 -30) 📝 `crates/proto/src/xfer/dnssec_dns_handle.rs` (+3 -3) 📝 `crates/proto/src/xfer/retry_dns_handle.rs` (+1 -1) 📝 `crates/recursor/src/recursor.rs` (+2 -1) 📝 `crates/resolver/src/caching_client.rs` (+22 -12) 📝 `crates/resolver/src/error.rs` (+2 -4) 📝 `crates/resolver/src/lookup.rs` (+2 -2) 📝 `crates/resolver/src/lookup_ip.rs` (+3 -3) 📝 `tests/integration-tests/src/mock_client.rs` (+1 -1) 📝 `tests/integration-tests/tests/lookup_tests.rs` (+22 -18) 📝 `tests/integration-tests/tests/name_server_pool_tests.rs` (+92 -28) _...and 2 more files_ </details> ### 📄 Description This PR adds a wireformat buffer to the DnsResponse struct, allowing the caller to know the exact bytes that were received in a given response. This is my second attempt at achieving the same goal. During the review of my first attempt (#1823) @djc suggested an alternative approach. We refined his idea a little and agreed that it seemed like a better way. This is an implementation of that idea. Fixes #1814. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 11:01:07 +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#2658
No description provided.