[PR #1975] [MERGED] Fix truncation for UDP #2730

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

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/1975
Author: @nmittler
Created: 6/21/2023
Status: Merged
Merged: 6/27/2023
Merged by: @bluejekyll

Base: mainHead: recv_buf


📝 Commits (1)

📊 Changes

9 files changed (+206 additions, -31 deletions)

View changed files

📝 crates/proto/src/serialize/binary/encoder.rs (+4 -4)
📝 crates/proto/src/udp/mod.rs (+4 -0)
📝 crates/proto/src/udp/udp_client_stream.rs (+15 -7)
📝 crates/proto/src/udp/udp_stream.rs (+2 -1)
📝 crates/server/src/authority/catalog.rs (+16 -15)
📝 crates/server/src/authority/message_response.rs (+5 -0)
📝 crates/server/src/server/response_handler.rs (+41 -3)
📝 crates/server/src/server/server_future.rs (+1 -1)
tests/integration-tests/tests/truncation_tests.rs (+118 -0)

📄 Description

This fixes a couple of issues for UDP on both the client and server:

  • Previously, the UdpClientStream was using a fixed 2048 for the size of the receive buffer. This can cause problems on interfaces with a larger MTU. PR 1096 adjusted this value on the server side to 4096 (the maximum as recommended by RFC6891). This PR sets a constant that is shared by the UDP client and server. Additionally, the client uses EDNS in the request to further trim down the buffer size.
  • The Server previously was not setting a maximum for the BinEncoder, which defaults to u16::MAX (i.e. effectively no truncation for UDP). This PR sets an appropriate maximum for the BinEncoder based on the response EDNS and protocol being used.

Fixes: #1973


🔄 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/1975 **Author:** [@nmittler](https://github.com/nmittler) **Created:** 6/21/2023 **Status:** ✅ Merged **Merged:** 6/27/2023 **Merged by:** [@bluejekyll](https://github.com/bluejekyll) **Base:** `main` ← **Head:** `recv_buf` --- ### 📝 Commits (1) - [`96681da`](https://github.com/hickory-dns/hickory-dns/commit/96681daf98aac469f8883aad61dcc9ec82703a91) Fix truncation for UDP ### 📊 Changes **9 files changed** (+206 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `crates/proto/src/serialize/binary/encoder.rs` (+4 -4) 📝 `crates/proto/src/udp/mod.rs` (+4 -0) 📝 `crates/proto/src/udp/udp_client_stream.rs` (+15 -7) 📝 `crates/proto/src/udp/udp_stream.rs` (+2 -1) 📝 `crates/server/src/authority/catalog.rs` (+16 -15) 📝 `crates/server/src/authority/message_response.rs` (+5 -0) 📝 `crates/server/src/server/response_handler.rs` (+41 -3) 📝 `crates/server/src/server/server_future.rs` (+1 -1) ➕ `tests/integration-tests/tests/truncation_tests.rs` (+118 -0) </details> ### 📄 Description This fixes a couple of issues for UDP on both the client and server: * Previously, the UdpClientStream was using a fixed `2048` for the size of the receive buffer. This can cause problems on interfaces with a larger MTU. [PR 1096](#1096) adjusted this value on the server side to 4096 (the maximum as recommended by RFC6891). This PR sets a constant that is shared by the UDP client and server. Additionally, the client uses EDNS in the request to further trim down the buffer size. * The Server previously was not setting a maximum for the `BinEncoder`, which defaults to `u16::MAX` (i.e. effectively no truncation for UDP). This PR sets an appropriate maximum for the `BinEncoder` based on the response EDNS and protocol being used. Fixes: #1973 --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 11:05:12 +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#2730
No description provided.