Add RFC4443 ICMPv6 payload slice support#141
Add RFC4443 ICMPv6 payload slice support#141JulianSchmid merged 1 commit intoJulianSchmid:masterfrom
Conversation
Extend ICMPv6 payload decoding with dedicated slice types for RFC4443 message bodies: Destination Unreachable, Packet Too Big, Time Exceeded, Parameter Problem, Echo Request, and Echo Reply. These slices model the variable-length payload bytes after the fixed 8-byte ICMPv6 header in the same style as existing ND payload slices, and include RFC layout docs plus focused accessors (invoking-packet/data views). Wire the new slice variants into Icmpv6PayloadSlice::from_slice and from_type_u8, including per-type code validation so unsupported type/code combinations still fall back to Raw. Keep owned Icmpv6Payload unchanged for now; to_payload continues to return None for the new variable-length RFC4443 slices. For the invoking-packet message types, add as_lax_ip_slice helpers that parse the embedded packet via LaxIpSlice. Update ICMPv6 payload-slice and ICMPv6-slice tests to cover the new variants and decoding behavior.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
📝 WalkthroughWalkthroughThis PR introduces new payload slice wrapper types for ICMPv6 error and echo messages (Destination Unreachable, Packet Too Big, Time Exceeded, Parameter Problem, Echo Request, Echo Reply), expands the Icmpv6PayloadSlice enum with corresponding variants, and refactors the payload parsing dispatch logic to route to the appropriate slice type constructors. Changes
Sequence Diagram(s)sequenceDiagram
participant Client as ICMPv6Parser
participant Router as from_type_u8<br/>(routing logic)
participant DestUnreach as DestinationUnreachable<br/>PayloadSlice
participant EchoReq as EchoRequest<br/>PayloadSlice
participant LaxIP as LaxIpSlice<br/>(IP decoding)
Client->>Router: from_type_u8(icmp_type, code, payload_bytes)
alt DestinationUnreachable code valid
Router->>DestUnreach: from_slice(payload_bytes)
DestUnreach-->>Router: DestinationUnreachable(wrapper)
Router-->>Client: Icmpv6PayloadSlice::DestinationUnreachable
Note over Client,LaxIP: Optional IP packet<br/>inspection available
else PacketTooBig or TimeExceeded code valid
Router->>DestUnreach: from_slice(payload_bytes)
DestUnreach-->>Router: variant(wrapper)
Router-->>Client: Icmpv6PayloadSlice variant
else EchoRequest/Reply
Router->>EchoReq: from_slice(payload_bytes)
EchoReq-->>Router: wrapper
Router-->>Client: Icmpv6PayloadSlice::EchoRequest/Reply
end
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #141 +/- ##
=============================
=============================
☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Extend ICMPv6 payload decoding with dedicated slice types for RFC4443 message bodies: Destination Unreachable, Packet Too Big, Time Exceeded, Parameter Problem, Echo Request, and Echo Reply.
Wire the new slice variants into Icmpv6PayloadSlice::from_slice and from_type_u8, including per-type code validation so unsupported type/code combinations still fall back to Raw. Keep owned Icmpv6Payload unchanged, as the new payloads don't have fixed data; to_payload continues to return None for the new variable-length RFC4443 slices.
For the invoking-packet message types, add as_lax_ip_slice helpers that parse the embedded packet via LaxIpSlice.
Summary by CodeRabbit
Release Notes
New Features
Style