fix(listener): integrate SERVFAIL, query validation, and UDP truncation (#31 #32 #33) - #34
Merged
Conversation
- #32: is_standard_query_header ingress guard (UDP/TCP) + parse_quick full Additional validation (compression pointers, OPT root/unique, EDNS options) - #31: truncate_udp_response at record boundaries with TC bit, integrated into send_udp_response/try_send_udp_response (all 5 UDP send paths) - #33: strict try_build SERVFAIL for UDP/TCP + DoH reuse, write_all TCP framing - fix: permit-exhaustion path uses non-blocking send (backpressure drop) with fast SERVFAIL from pre-parsed data, never blocks the receive loop - tests: 99 lib + 6 bin + 9 doh integration, clippy -D warnings, fmt clean
- overload: drop packets that failed parse_quick instead of full re-parse - TCP: use write_all_vectored for zero-alloc complete frame writes - DRY: reuse is_standard_query_header in the strict SERVFAIL builder - document fast-path Additional validation trade-off - inline the listener_servfail one-line wrapper
… 4.2.1) hickory's bounded encoder rolls back its write offset but not the backing buffer when a record does not fit, so truncated output could carry partial bytes from the failed record past the (corrected) header counts. Re-walk the emitted sections with valid_message_len and trim to the last complete record boundary. Verified red-green: without the trim, a >512B TXT response emitted 13 bytes of trailing garbage. test(listener): cover overload drop of parse_quick-rejected packets - trailing-data packet passes the header gate but fails parse_quick, so it reaches the overload branch and must stay silent there ci: run binary listener tests in CI test job (were never executed) docs: document inbound validation/SERVFAIL/truncation behavior
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.
Summary
Integrates three related listener-robustness PRs and their review fixes into a single coherent change set:
Review fixes applied on top
valid_message_lenre-walks the emitted sections and trims trailing garbage. Verified red-green: without the trim, a >512B TXT response emitted 13 bytes of trailing data.write_all_vectored(zero-allocation, complete-frame guarantee).is_standard_query_headerso listener and fast-path validation cannot drift apart.cargo test --bin kixdns) are now executed by the CI test job — they previously never ran.Verification
cargo test --lib— 100 passedcargo test --bin kixdns— 6 passed (real UDP/TCP/DoH integration, incl. overload + malformed silence)cargo test --test doh_integration— 9 passedcargo clippy --all-targets --all-features --locked -- -D warnings— cleancargo fmt --all -- --check— cleanCloses #31, #32, #33.