Repository navigation
fix: preserve label boundaries in DNS name compression - #542
Merged
keepsimple1 merged 2 commits intoNov 14, 2026
Merged
keepsimple1 merged 2 commits into
keepsimple1 merged 2 commits into
Conversation
Fixes keepsimple1#541. AI assistance: OpenAI Codex assisted with implementation, tests, and local review.
Owner
|
Thanks for your PR. If you feel your PR is ready for review, please click "Ready for review" so that Github updates its status. |
Sealdot
marked this pull request as ready for review
November 12, 2026 06:54
Contributor
Author
|
Thanks! CI is green and the change is complete on my side — marked ready for review. |
keepsimple1
reviewed
Nov 13, 2026
keepsimple1
left a comment
Owner
There was a problem hiding this comment.
LGTM with two small nits inlines. Thanks!
Maintainer review on keepsimple1#542: the \A case is unrelated to the fix and may change; trailing-dot equivalence is already covered by test_dns_outgoing_compression_max_length_labels.
keepsimple1
approved these changes
Nov 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #541.
write_namejoins unescaped labels with dots to index previously written suffixes. As a result,L\.A.B.local.andL.A.B.local.share a key even though their label sequences differ. The second name can become a pointer to the first name on the wire.Index suffixes by their length-prefixed label bytes instead. This preserves exact label boundaries and UTF-8 bytes, queries borrowed suffix slices, and copies a suffix into the index only when recording a new entry. Existing label validation, packet rollback and packet splitting continue to use the same paths. Ordinary names still compress against identical names and shared suffixes.
Four regression tests check the actual wire bytes and pointer targets. They cover both insertion orders, suffix collisions, dots with backslashes, equivalent escaped names, a 63-byte UTF-8 label in a legal 255-byte name, and exact-fit/spill packet limits. Existing serialization byte expectations are retained.
Validation
On macOS aarch64, Rust 1.97.1, one Cargo job and one test thread:
cargo check --all-featuresandcargo check --no-default-featurespassed with the same dependency lock.2840d279locally: 34 parser/supplemental tests passed, including the read-side escaping and wire-length regressions.The full library/documentation runs preceded a final test-only change qualifying three
MSG_HEADER_LENreferences so the tests also compile with #540. The implementation and assertions are identical. The final source was rechecked with the four regressions, formatting, all-target/all-feature strict Clippy, MSRV checks, and the #540 combination.Initial validation attempts are retained in the local evidence: Rust 1.71 offline resolution could not find the cached index, so it was rerun successfully with a task-local sparse online index. The first #540 combination did not compile because #540 removed an import used by the new tests; the three qualified constant references described above fixed that test-only issue.
The integration test executables, cross-host network behavior, Windows/Linux, CI's Rust 1.99.1, and nightly fuzz builds were not run locally. No external CI was manually triggered.
AI assistance
OpenAI Codex assisted with the implementation, tests, local review, and this draft.