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.
Details
- Reviewers
melifaro ae - Group Reviewers
Contributor Reviewers (ports) - Commits
- rS290075: Use m_cat() to reassembly IPv6 packets.
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
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. |