diff options
author | 2007-12-30 17:37:57 +0000 | |
---|---|---|
committer | 2007-12-30 17:37:57 +0000 | |
commit | 720a5450e8b3d74437730025b81548088df5ec12 (patch) | |
tree | fee2976403f433f3955a2bc435e923ac5bca22bb | |
parent | Simplify code by avoiding manual manipulations of the free space (diff) | |
download | wireguard-openbsd-720a5450e8b3d74437730025b81548088df5ec12.tar.xz wireguard-openbsd-720a5450e8b3d74437730025b81548088df5ec12.zip |
Only do pullups when necessary, m_pullup() always prepends an mbuf
which is very bad if it is not necessary as it causes scrary mbuf
fragmentation.
tested and OK mglocker@
-rw-r--r-- | sys/dev/ic/pgt.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c index f5652536c8c..357d0b7098a 100644 --- a/sys/dev/ic/pgt.c +++ b/sys/dev/ic/pgt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: pgt.c,v 1.45 2007/09/18 00:46:41 krw Exp $ */ +/* $OpenBSD: pgt.c,v 1.46 2007/12/30 17:37:57 claudio Exp $ */ /* * Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org> @@ -837,10 +837,13 @@ pgt_ieee80211_encap(struct pgt_softc *sc, struct ether_header *eh, } M_PREPEND(m, sizeof(*frame) + sizeof(*snap), M_DONTWAIT); - if (m != NULL) - m = m_pullup(m, sizeof(*frame) + sizeof(*snap)); if (m == NULL) return (m); + if (m->m_len < sizeof(*frame) + sizeof(*snap)) { + m = m_pullup(m, sizeof(*frame) + sizeof(*snap)); + if (m == NULL) + return (m); + } frame = mtod(m, struct ieee80211_frame *); snap = (struct llc *)&frame[1]; if (ni != NULL) { |