From d8ed1054415585ff91573c64d88c0c2a67483a28 Mon Sep 17 00:00:00 2001 From: Claudio Jeker Date: Wed, 3 Jan 2007 18:19:07 +0000 Subject: M_DUP_PKTHDR() cleanup. On static mbufs M_DUP_PKTHDR() will leak mbuf tags. See similar commit to dev/usb/if_rum.c for more info. With this commit all drivers have been switched away from the incorrect M_DUP_PKTHDR() usage. OK mglocker@ --- sys/dev/pci/if_ipw.c | 12 +++++++----- sys/dev/pci/if_iwi.c | 12 +++++++----- sys/dev/pci/if_wpi.c | 12 +++++++----- 3 files changed, 21 insertions(+), 15 deletions(-) (limited to 'sys/dev/pci') diff --git a/sys/dev/pci/if_ipw.c b/sys/dev/pci/if_ipw.c index 216352972a5..9e3a738784c 100644 --- a/sys/dev/pci/if_ipw.c +++ b/sys/dev/pci/if_ipw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_ipw.c,v 1.65 2006/11/26 11:14:22 deraadt Exp $ */ +/* $OpenBSD: if_ipw.c,v 1.66 2007/01/03 18:19:06 claudio Exp $ */ /*- * Copyright (c) 2004-2006 @@ -883,11 +883,12 @@ ipw_data_intr(struct ipw_softc *sc, struct ipw_status *status, tap->wr_chan_freq = htole16(ic->ic_ibss_chan->ic_freq); tap->wr_chan_flags = htole16(ic->ic_ibss_chan->ic_flags); - 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 @@ -1147,11 +1148,12 @@ ipw_tx_start(struct ifnet *ifp, struct mbuf *m, struct ieee80211_node *ni) tap->wt_chan_freq = htole16(ic->ic_ibss_chan->ic_freq); tap->wt_chan_flags = htole16(ic->ic_ibss_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 diff --git a/sys/dev/pci/if_iwi.c b/sys/dev/pci/if_iwi.c index 7d6908936a2..a9961587b90 100644 --- a/sys/dev/pci/if_iwi.c +++ b/sys/dev/pci/if_iwi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwi.c,v 1.78 2006/11/26 11:14:22 deraadt Exp $ */ +/* $OpenBSD: if_iwi.c,v 1.79 2007/01/03 18:19:06 claudio Exp $ */ /*- * Copyright (c) 2004-2006 @@ -963,11 +963,12 @@ iwi_frame_intr(struct iwi_softc *sc, struct iwi_rx_data *data, if (frame->antenna & 0x40) tap->wr_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; - 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 @@ -1272,11 +1273,12 @@ iwi_tx_start(struct ifnet *ifp, 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 diff --git a/sys/dev/pci/if_wpi.c b/sys/dev/pci/if_wpi.c index feb616a5176..9eba593dccc 100644 --- a/sys/dev/pci/if_wpi.c +++ b/sys/dev/pci/if_wpi.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_wpi.c,v 1.37 2006/11/26 11:14:22 deraadt Exp $ */ +/* $OpenBSD: if_wpi.c,v 1.38 2007/01/03 18:19:06 claudio Exp $ */ /*- * Copyright (c) 2006 @@ -1157,11 +1157,12 @@ wpi_rx_intr(struct wpi_softc *sc, struct wpi_rx_desc *desc, if (letoh16(head->flags) & 0x4) tap->wr_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; - 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 @@ -1470,11 +1471,12 @@ wpi_tx_data(struct wpi_softc *sc, struct mbuf *m0, struct ieee80211_node *ni, if (wh->i_fc[1] & IEEE80211_FC1_WEP) tap->wt_flags |= IEEE80211_RADIOTAP_F_WEP; - 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 -- cgit v1.2.3