Fix a special case in ip_fragment() to produce a more sensible chain
of packets. When the data payload length excluding any headers, of an outgoing IPv4 packet exceeds PAGE_SIZE bytes, a special case in ip_fragment() can kick in to optimise the outgoing payload(s). The code which was added in r98849 as part of zero copy socket support assumes that the beginning of any MTU sized payload is aligned to where a MBUF's "m_data" pointer points. This is not always the case and can sometimes cause large IPv4 packets, as part of ping replies, to be split more than needed. Instead of iterating the MBUFs to figure out how much data is in the current chain, use the value already in the "m_pkthdr.len" field of the first MBUF in the chain. Reviewed by: ken @ Differential Revision: https://reviews.freebsd.org/D1893 MFC after: 2 weeks Sponsored by: Mellanox Technologies
This commit is contained in:
parent
0b1b7c2cec
commit
9c0f6aa762
@ -743,10 +743,8 @@ ip_fragment(struct ip *ip, struct mbuf **m_frag, int mtu,
|
||||
* be less than the receiver's page size ?
|
||||
*/
|
||||
int newlen;
|
||||
struct mbuf *m;
|
||||
|
||||
for (m = m0, off = 0; m && (off+m->m_len) <= mtu; m = m->m_next)
|
||||
off += m->m_len;
|
||||
off = MIN(mtu, m0->m_pkthdr.len);
|
||||
|
||||
/*
|
||||
* firstlen (off - hlen) must be aligned on an
|
||||
|
Loading…
x
Reference in New Issue
Block a user