diff options
author | glebius <glebius@FreeBSD.org> | 2013-03-17 07:37:10 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2013-03-17 07:37:10 +0000 |
commit | 09c3ea7c844d5dbcddd89629f703b84c753cdd17 (patch) | |
tree | 882f78ec4f53a36ad2806db5add2e49d46558739 /sys/netinet | |
parent | afdfb863d6e2a2abc194a74c429d06da714a78f0 (diff) | |
download | FreeBSD-src-09c3ea7c844d5dbcddd89629f703b84c753cdd17.zip FreeBSD-src-09c3ea7c844d5dbcddd89629f703b84c753cdd17.tar.gz |
In m_megapullup() instead of reserving some space at the end of packet,
m_align() it, reserving space to prepend data.
Reviewed by: mav
Diffstat (limited to 'sys/netinet')
-rw-r--r-- | sys/netinet/libalias/alias.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/sys/netinet/libalias/alias.c b/sys/netinet/libalias/alias.c index 33876c4..8f23699 100644 --- a/sys/netinet/libalias/alias.c +++ b/sys/netinet/libalias/alias.c @@ -1749,26 +1749,22 @@ LibAliasUnLoadAllModule(void) struct mbuf * m_megapullup(struct mbuf *m, int len) { struct mbuf *mcl; - + if (len > m->m_pkthdr.len) goto bad; - - /* Do not reallocate packet if it is sequentional, - * writable and has some extra space for expansion. - * XXX: Constant 100bytes is completely empirical. */ -#define RESERVE 100 - if (m->m_next == NULL && M_WRITABLE(m) && M_TRAILINGSPACE(m) >= RESERVE) + + if (m->m_next == NULL && M_WRITABLE(m)) return (m); - mcl = m_get2(len + RESERVE, M_NOWAIT, MT_DATA, M_PKTHDR); + mcl = m_get2(len, M_NOWAIT, MT_DATA, M_PKTHDR); if (mcl == NULL) goto bad; - + m_align(mcl, len); m_move_pkthdr(mcl, m); m_copydata(m, 0, len, mtod(mcl, caddr_t)); mcl->m_len = mcl->m_pkthdr.len = len; m_freem(m); - + return (mcl); bad: m_freem(m); |