summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2006-12-30 22:43:02 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2006-12-30 22:43:02 +0000
commit631e97bb25e5dc9cfda3af9cba2b2679c10084fe (patch)
tree14c93a04ddfb945175ffd923ba827977102ff174 /sys
parent176ba5afb38ff8c1af0458556877f76175414932 (diff)
Don't use M_DUP_PKTHDR() on static mbufs. M_DUP_PKTHDR() copies the mtag
chain and so a later MFREE() is needed to free the chain again. Just initialize a minimal mbuf header for bpf_mtap(). See earlier rum(4) commit for the full story. OK mglocker@ Sounds good jsg@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ic/acx.c12
-rw-r--r--sys/dev/ic/malo.c17
-rw-r--r--sys/dev/ic/pgt.c13
3 files changed, 24 insertions, 18 deletions
diff --git a/sys/dev/ic/acx.c b/sys/dev/ic/acx.c
index b672422215a..6095233a573 100644
--- a/sys/dev/ic/acx.c
+++ b/sys/dev/ic/acx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: acx.c,v 1.58 2006/12/17 21:45:48 claudio Exp $ */
+/* $OpenBSD: acx.c,v 1.59 2006/12/30 22:43:01 claudio Exp $ */
/*
* Copyright (c) 2006 Jonathan Gray <jsg@openbsd.org>
@@ -971,11 +971,12 @@ acx_start(struct ifnet *ifp)
tap->wt_chan_flags =
htole16(ic->ic_bss->ni_chan->ic_flags);
- M_DUP_PKTHDR(&mb, m);
mb.m_data = (caddr_t)tap;
mb.m_len = sc->sc_txtap_len;
mb.m_next = m;
- mb.m_pkthdr.len += mb.m_len;
+ mb.m_nextpkt = NULL;
+ mb.m_type = 0;
+ mb.m_flags = 0;
bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_OUT);
}
#endif
@@ -1328,11 +1329,12 @@ acx_rxeof(struct acx_softc *sc)
tap->wr_rssi = head->rbh_level;
tap->wr_max_rssi = ic->ic_max_rssi;
- M_DUP_PKTHDR(&mb, m);
mb.m_data = (caddr_t)tap;
mb.m_len = sc->sc_rxtap_len;
mb.m_next = m;
- mb.m_pkthdr.len += mb.m_len;
+ mb.m_nextpkt = NULL;
+ mb.m_type = 0;
+ mb.m_flags = 0;
bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_IN);
}
#endif
diff --git a/sys/dev/ic/malo.c b/sys/dev/ic/malo.c
index ce30f91284e..95b47ee55bf 100644
--- a/sys/dev/ic/malo.c
+++ b/sys/dev/ic/malo.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: malo.c,v 1.53 2006/12/30 01:10:16 claudio Exp $ */
+/* $OpenBSD: malo.c,v 1.54 2006/12/30 22:43:01 claudio Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -1439,11 +1439,12 @@ malo_tx_mgt(struct malo_softc *sc, struct mbuf *m0, struct ieee80211_node *ni)
tap->wt_chan_freq = htole16(ic->ic_bss->ni_chan->ic_freq);
tap->wt_chan_flags = htole16(ic->ic_bss->ni_chan->ic_flags);
- M_DUP_PKTHDR(&mb, m0);
mb.m_data = (caddr_t)tap;
mb.m_len = sc->sc_txtap_len;
mb.m_next = m0;
- mb.m_pkthdr.len += mb.m_len;
+ mb.m_nextpkt = NULL;
+ mb.m_type = 0;
+ mb.m_flags = 0;
bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_OUT);
}
#endif
@@ -1550,11 +1551,12 @@ malo_tx_data(struct malo_softc *sc, struct mbuf *m0,
tap->wt_chan_freq = htole16(ic->ic_bss->ni_chan->ic_freq);
tap->wt_chan_flags = htole16(ic->ic_bss->ni_chan->ic_flags);
- M_DUP_PKTHDR(&mb, m0);
mb.m_data = (caddr_t)tap;
mb.m_len = sc->sc_txtap_len;
mb.m_next = m0;
- mb.m_pkthdr.len += mb.m_len;
+ mb.m_nextpkt = NULL;
+ mb.m_type = 0;
+ mb.m_flags = 0;
bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_OUT);
}
#endif
@@ -1735,11 +1737,12 @@ malo_rx_intr(struct malo_softc *sc)
tap->wr_rssi = desc->rssi;
tap->wr_max_rssi = ic->ic_max_rssi;
- M_DUP_PKTHDR(&mb, m);
mb.m_data = (caddr_t)tap;
mb.m_len = sc->sc_rxtap_len;
mb.m_next = m;
- mb.m_pkthdr.len += mb.m_len;
+ mb.m_nextpkt = NULL;
+ mb.m_type = 0;
+ mb.m_flags = 0;
bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_IN);
}
#endif
diff --git a/sys/dev/ic/pgt.c b/sys/dev/ic/pgt.c
index 9e8376b3524..80030ef9b6a 100644
--- a/sys/dev/ic/pgt.c
+++ b/sys/dev/ic/pgt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pgt.c,v 1.39 2006/12/07 23:50:10 mglocker Exp $ */
+/* $OpenBSD: pgt.c,v 1.40 2006/12/30 22:43:01 claudio Exp $ */
/*
* Copyright (c) 2006 Claudio Jeker <claudio@openbsd.org>
@@ -1022,12 +1022,12 @@ input:
tap->wr_rssi = rssi;
tap->wr_max_rssi = ic->ic_max_rssi;
- M_DUP_PKTHDR(&mb, m);
mb.m_data = (caddr_t)tap;
mb.m_len = sc->sc_rxtap_len;
mb.m_next = m;
- mb.m_pkthdr.len += mb.m_len;
-
+ mb.m_nextpkt = NULL;
+ mb.m_type = 0;
+ mb.m_flags = 0;
bpf_mtap(sc->sc_drvbpf, &mb, BPF_DIRECTION_IN);
}
#endif
@@ -2231,11 +2231,12 @@ pgt_start(struct ifnet *ifp)
htole16(ic->ic_bss->ni_chan->ic_flags);
if (m != NULL) {
- M_DUP_PKTHDR(&mb, m);
mb.m_data = (caddr_t)tap;
mb.m_len = sc->sc_txtap_len;
mb.m_next = m;
- mb.m_pkthdr.len += mb.m_len;
+ mb.m_nextpkt = NULL;
+ mb.m_type = 0;
+ mb.m_flags = 0;
bpf_mtap(sc->sc_drvbpf, &mb,
BPF_DIRECTION_OUT);