summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2007-12-30 17:37:58 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2007-12-30 17:37:58 +0000
commita91454538e106286c36186fb1faa1aa6f56eccd5 (patch)
tree0861a89e3634d1add0e1fc03df68145bc522e6ab /sys
parent0445e2941753180f562367df0c31679db5e815f9 (diff)
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@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/pgt.c9
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) {