fix(packet): parse SOA natively to stop malformed replies (#128) #137

Merged
razvandimescu merged 1 commits from fix/soa-compression-roundtrip into main 2026-04-24 18:59:57 +08:00
razvandimescu commented 2026-04-23 05:37:02 +08:00 (Migrated from github.com)

Summary

  • SOA was stored as DnsRecord::UNKNOWN (opaque rdata), so RFC 1035 §3.3.13 compression pointers in MNAME/RNAME — offsets into the upstream packet — were re-emitted verbatim. Once Numa applied its own compression, those pointers landed on garbage and clients rejected the reply ("malformed reply packet" in kdig, issue #128).
  • Parse SOA natively via read_qname and write via write_qname, mirroring the existing NS/CNAME/MX pattern. Adds the SOA arm to record_rdata_canonical for RRSIG verification.

Closes #128.

Test plan

  • cargo test — 354 lib tests + 1 new integration test pass.
  • make all (fmt + clippy + audit + test) green.
  • New regression tests/soa_compression_bug.rs — hand-rolled upstream packet (CNAME chain + compressed SOA in authority that points into answer rdata), round-trips through Numa, validated with hickory-proto strict parse.
  • Field check: confirm kdig @<numa> odin.adobe.com https no longer reports "malformed reply packet" against the affected upstream/cache combo from the issue.
## Summary - SOA was stored as `DnsRecord::UNKNOWN` (opaque rdata), so RFC 1035 §3.3.13 compression pointers in MNAME/RNAME — offsets into the *upstream* packet — were re-emitted verbatim. Once Numa applied its own compression, those pointers landed on garbage and clients rejected the reply ("malformed reply packet" in kdig, issue #128). - Parse SOA natively via `read_qname` and write via `write_qname`, mirroring the existing NS/CNAME/MX pattern. Adds the SOA arm to `record_rdata_canonical` for RRSIG verification. Closes #128. ## Test plan - [x] `cargo test` — 354 lib tests + 1 new integration test pass. - [x] `make all` (fmt + clippy + audit + test) green. - [x] New regression `tests/soa_compression_bug.rs` — hand-rolled upstream packet (CNAME chain + compressed SOA in authority that points into answer rdata), round-trips through Numa, validated with `hickory-proto` strict parse. - [ ] Field check: confirm `kdig @<numa> odin.adobe.com https` no longer reports "malformed reply packet" against the affected upstream/cache combo from the issue.
Sign in to join this conversation.