Page MenuHomeFreeBSD

Use m_cat() to reassembly IPv6 packets
ClosedPublic

Authored by jonlooney_gmail.com on Oct 10 2015, 2:01 AM.
Referenced Files
Unknown Object (File)
Tue, May 7, 7:56 PM
Unknown Object (File)
Wed, Apr 17, 5:59 AM
Unknown Object (File)
Wed, Apr 17, 5:50 AM
Unknown Object (File)
Apr 9 2024, 7:27 AM
Unknown Object (File)
Mar 18 2024, 4:41 PM
Unknown Object (File)
Mar 15 2024, 5:39 PM
Unknown Object (File)
Mar 15 2024, 5:36 PM
Unknown Object (File)
Jan 7 2024, 4:17 PM

Details

Summary

Currently frag6_input() reassembles packets by creating mbuf chains using m_next. Switching to the m_cat() function has the potential to free mbufs when the last mbuf of one fragment or the first mbuf of the next fragment have a significant amount of empty space.

Test Plan

I sent large pings and monitored the correctness of the return data to ensure it wasn't corrupted during reassembly.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

jonlooney_gmail.com retitled this revision from to Use m_cat() to reassembly IPv6 packets.
jonlooney_gmail.com updated this object.
jonlooney_gmail.com edited the test plan for this revision. (Show Details)
jonlooney_gmail.com set the repository for this revision to rS FreeBSD src repository - subversion.
jonlooney_gmail.com added a project: network.
jonlooney_gmail.com added a subscriber: network.
ae added inline comments.
sys/netinet6/frag6.c
524 ↗(On Diff #9290)

Is this loop still needed? m_cat() has the same loop.

sys/netinet6/frag6.c
524 ↗(On Diff #9290)

I considered removing it, but it does actually serve as a performance optimization.

Consider the case of a full-size (64K) packet fragmented along (roughly) 1500-byte boundaries. That would produce roughly 44 fragments, each using (optimistically) one mbuf cluster.

Without this loop, each call to m_cat() would start at the first mbuf and loop through the (growing) list to find the last mbuf in the chain. With this loop, the frag6_input() function just has to loop through the newly-added mbufs to find the tail of the chain and m_cat() does not need to loop through any mbufs.

Therefore, while we certainly could remove this without sacrificing functionality, it would reduce performance, particularly as the mbuf chain size grows.

ae added a reviewer: ae.
This revision is now accepted and ready to land.Oct 10 2015, 6:54 PM
melifaro added a reviewer: melifaro.
melifaro added a subscriber: melifaro.

Looks fine to me

This revision was automatically updated to reflect the committed changes.