Date: Wed, 25 Feb 2015 13:58:43 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r279281 - head/sys/netinet Message-ID: <201502251358.t1PDwhmh020279@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: hselasky Date: Wed Feb 25 13:58:43 2015 New Revision: 279281 URL: https://svnweb.freebsd.org/changeset/base/279281 Log: 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 Modified: head/sys/netinet/ip_output.c Modified: head/sys/netinet/ip_output.c ============================================================================== --- head/sys/netinet/ip_output.c Wed Feb 25 12:26:45 2015 (r279280) +++ head/sys/netinet/ip_output.c Wed Feb 25 13:58:43 2015 (r279281) @@ -743,10 +743,8 @@ ip_fragment(struct ip *ip, struct mbuf * * 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201502251358.t1PDwhmh020279>