[PR #2104] [MERGED] no-std support for hickory-proto #2813

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

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/2104
Author: @domenukk
Created: 12/5/2023
Status: Merged
Merged: 3/18/2025
Merged by: @djc

Base: mainHead: no_std


📝 Commits (3)

  • a959dbb Introduce cfg guards for std feature flag
  • 5f53e25 Add required features and flags to Cargo.toml
  • 1ed8117 Add proto-aarch64-none no_std build to justfile and CI

📊 Changes

44 files changed (+269 additions, -89 deletions)

View changed files

📝 .github/workflows/test.yml (+16 -0)
📝 Cargo.lock (+4 -12)
📝 Cargo.toml (+10 -15)
📝 crates/client/Cargo.toml (+1 -1)
📝 crates/proto/Cargo.toml (+38 -22)
📝 crates/proto/src/dnssec/rdata/dnskey.rs (+2 -0)
📝 crates/proto/src/dnssec/rdata/ds.rs (+2 -0)
📝 crates/proto/src/dnssec/signer.rs (+3 -0)
📝 crates/proto/src/error.rs (+11 -0)
📝 crates/proto/src/lib.rs (+8 -1)
📝 crates/proto/src/rr/domain/label.rs (+3 -0)
📝 crates/proto/src/rr/domain/name.rs (+8 -1)
📝 crates/proto/src/rr/rdata/caa.rs (+4 -0)
📝 crates/proto/src/rr/rdata/csync.rs (+2 -0)
📝 crates/proto/src/rr/rdata/hinfo.rs (+3 -0)
📝 crates/proto/src/rr/rdata/mx.rs (+2 -0)
📝 crates/proto/src/rr/rdata/name.rs (+2 -0)
📝 crates/proto/src/rr/rdata/naptr.rs (+3 -0)
📝 crates/proto/src/rr/rdata/null.rs (+2 -0)
📝 crates/proto/src/rr/rdata/opt.rs (+3 -0)

...and 24 more files

📄 Description

This is a rather big pull request that allows the use of hickory-proto in no_std environments.

It has been tested on an embedded system and works, however there are certain gotchas, listed below.
Hence, this PR is marked as draft and we hope to hear some maintainer feedback on it.

Some gotchas are as follows:

  • So far, no-std support requires nightly features. We have feature-gated those behind an unstable feature. The std feature doesn't require nightly - everything works as normal here. The nightly features we need are:
  • This PR also depends on an open pull request to the rust-url crate. Either it gets merged, or we will have to upload a no-std compatible for to crates for the time being, see https://github.com/servo/rust-url/pull/831.
  • Similarly, it uses thiserror_core, a no-std compatible version of thiserror on cargo.
  • For lack of better randomness, all users should manually seed the RNG using seed_rng

One possible way forward, instead of going all-in on, could be to merge the unstable as well as std features from this PR and the no_std header (including all vec and string imports), but continue to depend on the upstream url and thiserror crates, so that a no_std forks is easier to maintain (by changing the imports in Cargo.toml)

Please let us know what you think :)


🔄 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/2104 **Author:** [@domenukk](https://github.com/domenukk) **Created:** 12/5/2023 **Status:** ✅ Merged **Merged:** 3/18/2025 **Merged by:** [@djc](https://github.com/djc) **Base:** `main` ← **Head:** `no_std` --- ### 📝 Commits (3) - [`a959dbb`](https://github.com/hickory-dns/hickory-dns/commit/a959dbb28a389e68383420668436c5e010a97547) Introduce cfg guards for std feature flag - [`5f53e25`](https://github.com/hickory-dns/hickory-dns/commit/5f53e25b7df2b273e4810b6c2a8cc696f784c73b) Add required features and flags to Cargo.toml - [`1ed8117`](https://github.com/hickory-dns/hickory-dns/commit/1ed811739ace449011ffc80e38dc1f8928ab7e3a) Add proto-aarch64-none no_std build to justfile and CI ### 📊 Changes **44 files changed** (+269 additions, -89 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/test.yml` (+16 -0) 📝 `Cargo.lock` (+4 -12) 📝 `Cargo.toml` (+10 -15) 📝 `crates/client/Cargo.toml` (+1 -1) 📝 `crates/proto/Cargo.toml` (+38 -22) 📝 `crates/proto/src/dnssec/rdata/dnskey.rs` (+2 -0) 📝 `crates/proto/src/dnssec/rdata/ds.rs` (+2 -0) 📝 `crates/proto/src/dnssec/signer.rs` (+3 -0) 📝 `crates/proto/src/error.rs` (+11 -0) 📝 `crates/proto/src/lib.rs` (+8 -1) 📝 `crates/proto/src/rr/domain/label.rs` (+3 -0) 📝 `crates/proto/src/rr/domain/name.rs` (+8 -1) 📝 `crates/proto/src/rr/rdata/caa.rs` (+4 -0) 📝 `crates/proto/src/rr/rdata/csync.rs` (+2 -0) 📝 `crates/proto/src/rr/rdata/hinfo.rs` (+3 -0) 📝 `crates/proto/src/rr/rdata/mx.rs` (+2 -0) 📝 `crates/proto/src/rr/rdata/name.rs` (+2 -0) 📝 `crates/proto/src/rr/rdata/naptr.rs` (+3 -0) 📝 `crates/proto/src/rr/rdata/null.rs` (+2 -0) 📝 `crates/proto/src/rr/rdata/opt.rs` (+3 -0) _...and 24 more files_ </details> ### 📄 Description This is a *rather big* pull request that allows the use of `hickory-proto` in `no_std` environments. It has been tested on an embedded system and works, however there are certain gotchas, listed below. Hence, this PR is marked as draft and we hope to hear some maintainer feedback on it. Some gotchas are as follows: - So far, `no-std` support requires nightly features. We have feature-gated those behind an `unstable` feature. The `std` feature **doesn't require nightly** - everything works as normal here. The nightly features we need are: - `ip_in_core` for all ip and network address related APIs (https://github.com/rust-lang/rust/issues/108443) - `error_in_core` for error handling without std (https://github.com/rust-lang/rust/issues/103765) - This PR also depends on an open pull request to the rust-url crate. Either it gets merged, or we will have to upload a no-std compatible for to crates for the time being, see https://github.com/servo/rust-url/pull/831. - Similarly, it uses `thiserror_core`, a no-std compatible version of `thiserror` on cargo. - For lack of better randomness, all users should manually seed the RNG using `seed_rng` One possible way forward, instead of going all-in on, could be to merge the `unstable` as well as `std` features from this PR and the `no_std` header (including all `vec` and `string` imports), but continue to depend on the upstream `url` and `thiserror` crates, so that a `no_std` forks is easier to maintain (by changing the imports in Cargo.toml) Please let us know what you think :) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 11:09:32 +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#2813
No description provided.