- Use m_getcl() instead of hand allocating.
Sponsored by: Nginx, Inc.
This commit is contained in:
parent
c69f77c339
commit
39f6074e2e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=248323
@ -842,23 +842,19 @@ tcp_output(struct tcpcb *tp)
|
||||
TCPSTAT_INC(tcps_sndpack);
|
||||
TCPSTAT_ADD(tcps_sndbyte, len);
|
||||
}
|
||||
MGETHDR(m, M_NOWAIT, MT_DATA);
|
||||
#ifdef INET6
|
||||
if (MHLEN < hdrlen + max_linkhdr)
|
||||
m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR);
|
||||
else
|
||||
#endif
|
||||
m = m_gethdr(M_NOWAIT, MT_DATA);
|
||||
|
||||
if (m == NULL) {
|
||||
SOCKBUF_UNLOCK(&so->so_snd);
|
||||
error = ENOBUFS;
|
||||
goto out;
|
||||
}
|
||||
#ifdef INET6
|
||||
if (MHLEN < hdrlen + max_linkhdr) {
|
||||
MCLGET(m, M_NOWAIT);
|
||||
if ((m->m_flags & M_EXT) == 0) {
|
||||
SOCKBUF_UNLOCK(&so->so_snd);
|
||||
m_freem(m);
|
||||
error = ENOBUFS;
|
||||
goto out;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
m->m_data += max_linkhdr;
|
||||
m->m_len = hdrlen;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user