Skip to content

net/ipv6: Forward reassembled fragments through fragout - #19598

Draft
masc2008 wants to merge 1 commit into
apache:masterfrom
masc2008:ipv6-reassembled-forward-fragout
Draft

net/ipv6: Forward reassembled fragments through fragout#19598
masc2008 wants to merge 1 commit into
apache:masterfrom
masc2008:ipv6-reassembled-forward-fragout

Conversation

@masc2008

@masc2008 masc2008 commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

Summary

  • track IPv6 packets produced by local fragment reassembly
  • allow only those reassembled packets to bypass the IPv6 forwarding MTU drop when CONFIG_NET_IPFRAG is enabled
  • keep normal oversized IPv6 forwarding on the Packet Too Big path

Why

NAT66 and IPFILTER may reassemble IPv6 fragments before forwarding so they can inspect the full packet. If the reassembled transit packet is larger than the egress MTU, ipv6_dev_forward() drops it before the existing egress ip_fragout() path can split it again.

Behavior

Normal unfragmented IPv6 packets are still not fragmented by the router. The exception is limited to packets that were already fragmented on ingress and were reassembled inside the stack before forwarding.

Testing

Style/build checks:

  • git diff --check HEAD~1..HEAD
  • make -C tools -f Makefile.host nxstyle
  • tools/nxstyle include/nuttx/net/netdev.h
  • tools/nxstyle net/ipforward/ipv6_forward.c
  • tools/nxstyle net/ipfrag/ipv6_frag.c
  • tools/nxstyle net/netdev/netdev_register.c
  • make -j8 with sim:dynconns

Functional emulator method:

  • Configure sim:dynconns with two simulator network devices and IPv6/IPFRAG/IPFILTER enabled.
  • Run NuttX with two TAP-backed interfaces connected to two Linux namespaces.
  • Topology: nuttxfrag-a (2001:db8:1::2/64) -> NuttX eth0 (2001:db8:1::1/64) -> NuttX eth1 (2001:db8:2::1/64) -> nuttxfrag-b (2001:db8:2::2/64).
  • Send a 2400-byte IPv6 echo request from namespace A to namespace B.
  • Capture IPv6 Fragment headers on namespace B egress with tcpdump.
  • Pass condition: namespace B captures the re-forwarded packet as IPv6 fragments after NuttX local reassembly.

Functional emulator log:

$ git diff --check HEAD~1..HEAD
<no output>

$ tools/nxstyle include/nuttx/net/netdev.h
$ tools/nxstyle net/ipforward/ipv6_forward.c
$ tools/nxstyle net/ipfrag/ipv6_frag.c
$ tools/nxstyle net/netdev/netdev_register.c
<no output>

$ sudo -E /home/hma/misc/misc_tools/bugs/ipfrag/test_ipv6_reassembled_forward_fragout.sh --keep
Captured egress IPv6 fragments: 2

$ tcpdump -n -vv -r /tmp/nuttx-ipfrag-forward/egress-fragments.pcap
11:34:07.152749 IP6 (flowlabel 0xcf7c5, hlim 63, next-header Fragment (44) payload length: 1456) 2001:db8:1::2 > 2001:db8:2::2: frag (0x00000001:0|1448) ICMP6, echo request, id 64993, seq 1
11:34:07.152809 IP6 (flowlabel 0xcf7c5, hlim 63, next-header Fragment (44) payload length: 968) 2001:db8:1::2 > 2001:db8:2::2: frag (0x00000001:1448|960)

NAT66 and IPFILTER may reassemble IPv6 fragments before forwarding so they can inspect the full packet.  If the reassembled transit packet is larger than the egress MTU, ipv6_dev_forward() currently drops it before the existing egress ip_fragout() path can split it again.

Track packets produced by IPv6 reassembly and allow only those packets to bypass the forwarding MTU drop when CONFIG_NET_IPFRAG is enabled.  Normal oversized IPv6 forwarded packets still take the Packet Too Big path.

Signed-off-by: shichunma <masc2008@gmail.com>
@github-actions github-actions Bot added Area: Networking Effects networking subsystem Size: S The size of the change in this PR is small labels Aug 2, 2026
@github-actions

github-actions Bot commented Aug 2, 2026

Copy link
Copy Markdown

MemBrowse Memory Report

No memory changes detected for:

@masc2008
masc2008 marked this pull request as draft August 2, 2026 02:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Area: Networking Effects networking subsystem Size: S The size of the change in this PR is small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant