1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-18 10:35:55 +00:00

Use m_getcl() instead of hand made allocation.

Sponsored by:	Nginx, Inc.
This commit is contained in:
Gleb Smirnoff 2013-03-15 12:33:23 +00:00
parent 5f5f055441
commit aa48181169
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248320

View File

@ -497,21 +497,16 @@ ip6_input(struct mbuf *m)
if (m && m->m_next != NULL && m->m_pkthdr.len < MCLBYTES) {
struct mbuf *n;
MGETHDR(n, M_NOWAIT, MT_HEADER);
if (n)
M_MOVE_PKTHDR(n, m);
if (n && n->m_pkthdr.len > MHLEN) {
MCLGET(n, M_NOWAIT);
if ((n->m_flags & M_EXT) == 0) {
m_freem(n);
n = NULL;
}
}
if (m->m_pkthdr.len > MHLEN)
n = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
else
n = m_gethdr(M_NOWAIT, MT_DATA);
if (n == NULL) {
m_freem(m);
return; /* ENOBUFS */
}
M_MOVE_PKTHDR(n, m);
m_copydata(m, 0, n->m_pkthdr.len, mtod(n, caddr_t));
n->m_len = n->m_pkthdr.len;
m_freem(m);