net: Fix IP fragment forwarding and L4 handling - #19595
Conversation
|
The rule comes directly from the IPv4 router requirements. The strongest spec is RFC 1812, section 5.2.6:
It also gives the reason: fragments may take different paths, so a transit router cannot safely assume it will see all fragments. Source: RFC 1812 section 5.2.6 The original IPv4 spec, RFC 791, also says the basic model is fragmentation at gateways, with reassembly at the destination host’s IP layer. Source: RFC 791 section 3.2 So the intended IPv4 router behavior is: fragment received One more related point: RFC 791’s fragmentation algorithm says that if a fragment is split again, the new fragment offset is based on the original offset plus the new split offset, |
Allow non-local IPv4 fragments to reach the forwarding path before local fragment reassembly. This lets routers forward fragmented datagrams without requiring local reassembly state. Keep NAT44 and IP filter builds on the existing reassembly path because those features can depend on L4 headers. Preserve the original fragment offset and MF flag when fragout must split an already-fragmented packet for a smaller egress MTU. Signed-off-by: shichunma <shichunma@bestechnic.com>
9232dc0 to
48dfff5
Compare
NAT66 needs transport headers to create or match address and port mappings. Consume IPv6 fragments through local reassembly before NAT66 processing so forwarded fragmented traffic is not translated fragment-by-fragment without L4 context. Also dispatch inbound NAT66 using the parsed IPv6 next-header value, matching the outbound path and allowing packets with extension headers before the transport header to be translated. Signed-off-by: shichunma <shichunma@bestechnic.com>
01e086b to
6dfb82d
Compare
IPv6 input currently lets fragmented packets continue into the IP filter path before reassembly. Forwarded IP filter rules can inspect L4 fields, but non-first IPv6 fragments do not carry the transport header. Consume IPv6 fragments through the existing reassembly/drop helper before NAT66 or IP filter processing. This keeps plain IPv6 forwarding unchanged when neither L4-dependent feature is enabled, while avoiding filtering incomplete fragments. Signed-off-by: shichunma <shichunma@bestechnic.com>
Summary
Testing