svn commit: r335474 - stable/10/sys/netinet/libalias
Andrey V. Elsukov
ae at FreeBSD.org
Thu Jun 21 11:24:22 UTC 2018
Author: ae
Date: Thu Jun 21 11:24:20 2018
New Revision: 335474
URL: https://svnweb.freebsd.org/changeset/base/335474
Log:
MFC r335133:
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
Modified:
stable/10/sys/netinet/libalias/alias.c
Directory Properties:
stable/10/ (props changed)
Modified: stable/10/sys/netinet/libalias/alias.c
==============================================================================
--- stable/10/sys/netinet/libalias/alias.c Thu Jun 21 10:51:25 2018 (r335473)
+++ stable/10/sys/netinet/libalias/alias.c Thu Jun 21 11:24:20 2018 (r335474)
@@ -1749,7 +1749,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)
@@ -1758,7 +1759,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);
More information about the svn-src-stable
mailing list