diff options
author | glebius <glebius@FreeBSD.org> | 2012-01-17 12:14:26 +0000 |
---|---|---|
committer | glebius <glebius@FreeBSD.org> | 2012-01-17 12:14:26 +0000 |
commit | 7d3312f434070f9e91e1e5aacd462a155ce05b9d (patch) | |
tree | 3657e0a1a87a4202a3b6f1499c49a7249d016d58 /sys/contrib/pf/net/if_pfsync.c | |
parent | 068b515b9c2bee0a6be1a03fa2b0b5f7724cf08f (diff) | |
download | FreeBSD-src-7d3312f434070f9e91e1e5aacd462a155ce05b9d.zip FreeBSD-src-7d3312f434070f9e91e1e5aacd462a155ce05b9d.tar.gz |
Allocate our mbuf with m_get2().
Diffstat (limited to 'sys/contrib/pf/net/if_pfsync.c')
-rw-r--r-- | sys/contrib/pf/net/if_pfsync.c | 34 |
1 files changed, 10 insertions, 24 deletions
diff --git a/sys/contrib/pf/net/if_pfsync.c b/sys/contrib/pf/net/if_pfsync.c index f1ba0d8..0f3f5cc 100644 --- a/sys/contrib/pf/net/if_pfsync.c +++ b/sys/contrib/pf/net/if_pfsync.c @@ -2121,9 +2121,6 @@ pfsync_sendout(void) #ifdef notyet struct tdb *t; #endif -#ifdef __FreeBSD__ - size_t pktlen; -#endif int offset; int q, count = 0; @@ -2145,44 +2142,33 @@ pfsync_sendout(void) return; } - MGETHDR(m, M_DONTWAIT, MT_DATA); - if (m == NULL) { #ifdef __FreeBSD__ + m = m_get2(M_NOWAIT, MT_DATA, M_PKTHDR, max_linkhdr + sc->sc_len); + if (m == NULL) { sc->sc_ifp->if_oerrors++; + V_pfsyncstats.pfsyncs_onomem++; + return; + } #else + MGETHDR(m, M_DONTWAIT, MT_DATA); + if (m == NULL) { sc->sc_if.if_oerrors++; -#endif - V_pfsyncstats.pfsyncs_onomem++; + pfsyncstats.pfsyncs_onomem++; pfsync_drop(sc); return; } -#ifdef __FreeBSD__ - pktlen = max_linkhdr + sc->sc_len; - if (pktlen > MHLEN) { - /* Find the right pool to allocate from. */ - /* XXX: This is ugly. */ - m_cljget(m, M_DONTWAIT, pktlen <= MCLBYTES ? MCLBYTES : -#if MJUMPAGESIZE != MCLBYTES - pktlen <= MJUMPAGESIZE ? MJUMPAGESIZE : -#endif - pktlen <= MJUM9BYTES ? MJUM9BYTES : MJUM16BYTES); -#else if (max_linkhdr + sc->sc_len > MHLEN) { MCLGETI(m, M_DONTWAIT, NULL, max_linkhdr + sc->sc_len); -#endif if (!ISSET(m->m_flags, M_EXT)) { m_free(m); -#ifdef __FreeBSD__ - sc->sc_ifp->if_oerrors++; -#else sc->sc_if.if_oerrors++; -#endif - V_pfsyncstats.pfsyncs_onomem++; + pfsyncstats.pfsyncs_onomem++; pfsync_drop(sc); return; } } +#endif m->m_data += max_linkhdr; m->m_len = m->m_pkthdr.len = sc->sc_len; |