[PR #2151] [MERGED] fix(proto): fix internal representation of OPT #2840

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

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/2151
Author: @esensar
Created: 2/22/2024
Status: Merged
Merged: 2/29/2024
Merged by: @bluejekyll

Base: mainHead: fix/opt_options_repr


📝 Commits (6)

  • 1e34eb5 fix(proto): fix internal representation of OPT
  • f11e8e1 Remove println from equality check
  • ebc2934 Resolve PR comments
  • db92eb5 Add a note about multiple options with same code
  • 2575f19 Fix clippy errors
  • 040bb8f Add test case with multiple options with same code

📊 Changes

1 file changed (+88 additions, -31 deletions)

View changed files

📝 crates/proto/src/rr/rdata/opt.rs (+88 -31)

📄 Description

Current implementation of OPT represents options as hash map, which prevents same EdnsCode from appearing more than once. There are options that may appear more than once
(e.g. EDE https://www.rfc-editor.org/rfc/rfc8914.html).

Unfortunately, this is a breaking change. I haven't figured out a solution that would not break the API and would not introduce some kind of overhead.

BREAKING CHANGE: Changes representation of OPT from HashMap to a Vec, which means that as_ref and as_mut also now return &Vec rather than &HashMap.


Sponsored by Quad9


🔄 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/2151 **Author:** [@esensar](https://github.com/esensar) **Created:** 2/22/2024 **Status:** ✅ Merged **Merged:** 2/29/2024 **Merged by:** [@bluejekyll](https://github.com/bluejekyll) **Base:** `main` ← **Head:** `fix/opt_options_repr` --- ### 📝 Commits (6) - [`1e34eb5`](https://github.com/hickory-dns/hickory-dns/commit/1e34eb5ad1bd9b50e4095b0ef3543ebb1d6d8ea9) fix(proto): fix internal representation of OPT - [`f11e8e1`](https://github.com/hickory-dns/hickory-dns/commit/f11e8e12864e7cf40652c7d61eabce0b6edaa3f9) Remove println from equality check - [`ebc2934`](https://github.com/hickory-dns/hickory-dns/commit/ebc293448ff6c4e10bc504b54976a6fb7ea97fe8) Resolve PR comments - [`db92eb5`](https://github.com/hickory-dns/hickory-dns/commit/db92eb57a6af5cf3a3caaaaba921c23106934280) Add a note about multiple options with same code - [`2575f19`](https://github.com/hickory-dns/hickory-dns/commit/2575f19630cae022e1ee7d06f7651522affc1a7f) Fix clippy errors - [`040bb8f`](https://github.com/hickory-dns/hickory-dns/commit/040bb8f4ba5f7392bbc2dbefca22443849a47b09) Add test case with multiple options with same code ### 📊 Changes **1 file changed** (+88 additions, -31 deletions) <details> <summary>View changed files</summary> 📝 `crates/proto/src/rr/rdata/opt.rs` (+88 -31) </details> ### 📄 Description Current implementation of OPT represents options as hash map, which prevents same `EdnsCode` from appearing more than once. There are options that may appear more than once (e.g. EDE https://www.rfc-editor.org/rfc/rfc8914.html). Unfortunately, this is a breaking change. I haven't figured out a solution that would not break the API and would not introduce some kind of overhead. BREAKING CHANGE: Changes representation of OPT from `HashMap` to a `Vec`, which means that `as_ref` and `as_mut` also now return `&Vec` rather than `&HashMap`. --- >Sponsored by [Quad9](https://quad9.net/) --- <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:10 +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#2840
No description provided.