In m_megapullup() use m_getjcl() to allocate 9k or 16k mbuf when requested.

It is better to try allocate a big mbuf, than just silently drop a big
packet. A better solution could be reworking of libalias modules to be
able use m_copydata()/m_copyback() instead of requiring the single
contiguous buffer.

PR:		229006
MFC after:	1 week
This commit is contained in:
ae 2018-06-14 11:15:39 +00:00
parent a3a3e0b0ab
commit 76167af160

View File

@ -1751,7 +1751,8 @@ LibAliasUnLoadAllModule(void)
* the input packet, on failure NULL. The input packet is always consumed.
*/
struct mbuf *
m_megapullup(struct mbuf *m, int len) {
m_megapullup(struct mbuf *m, int len)
{
struct mbuf *mcl;
if (len > m->m_pkthdr.len)
@ -1760,7 +1761,14 @@ m_megapullup(struct mbuf *m, int len) {
if (m->m_next == NULL && M_WRITABLE(m))
return (m);
mcl = m_get2(len, M_NOWAIT, MT_DATA, M_PKTHDR);
if (len <= MJUMPAGESIZE)
mcl = m_get2(len, M_NOWAIT, MT_DATA, M_PKTHDR);
else if (len <= MJUM9BYTES)
mcl = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, MJUM9BYTES);
else if (len <= MJUM16BYTES)
mcl = m_getjcl(M_NOWAIT, MT_DATA, M_PKTHDR, MJUM16BYTES);
else
goto bad;
if (mcl == NULL)
goto bad;
m_align(mcl, len);