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)
Sun, Apr 20, 11:08 PM
Unknown Object (File)
Mon, Apr 14, 8:09 PM
Unknown Object (File)
Thu, Apr 10, 2:06 PM
Unknown Object (File)
Feb 9 2025, 10:02 PM
Unknown Object (File)
Feb 4 2025, 2:04 PM
Unknown Object (File)
Jan 29 2025, 5:19 AM
Unknown Object (File)
Jan 22 2025, 11:53 PM
Unknown Object (File)
Jan 18 2025, 10:12 AM

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 Skipped
Unit
Tests Skipped

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

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

sys/netinet6/frag6.c
524

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.