masc2008 commented on PR #19595:
URL: https://github.com/apache/nuttx/pull/19595#issuecomment-5151002302
The rule comes directly from the IPv4 router requirements.
The strongest spec is RFC 1812, section 5.2.6:
> “A router MUST NOT reassemble any datagram before forwarding it.”
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
(https://www.rfc-editor.org/rfc/rfc1812.txt)
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
(https://www.rfc-editor.org/info/rfc791/)
So the intended IPv4 router behavior is:
fragment received
check IPv4 header
decide local vs forward
if forward:
forward this fragment independently
re-fragment only if egress MTU requires it
if local:
reassemble before TCP/UDP/ICMP processing
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,
and MF follows the original fragment state. That is why the PR also fixes
ipv4_fragout() to preserve original offset/MF when re-fragmenting.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]