From 545e1379643e79abd0b4a3695c3c9281f5136bd2 Mon Sep 17 00:00:00 2001 From: drochner Date: Tue, 16 Aug 2005 19:35:17 +0000 Subject: [PATCH] make the packets fed to BPF reflect reality better: -fill in the 802.11 "duration" before -use the intended channel (still not perfect because this is not necessarily the hardware setting, but better than before) while this doesn't make the driver work for me, it kills some red herrings which I've just wasted time for --- sys/dev/usb/if_ural.c | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/sys/dev/usb/if_ural.c b/sys/dev/usb/if_ural.c index 7773ea733a86..191cda2afd92 100644 --- a/sys/dev/usb/if_ural.c +++ b/sys/dev/usb/if_ural.c @@ -1,4 +1,4 @@ -/* $NetBSD: if_ural.c,v 1.6 2005/08/16 17:02:34 christos Exp $ */ +/* $NetBSD: if_ural.c,v 1.7 2005/08/16 19:35:17 drochner Exp $ */ /* $OpenBSD: if_ral.c,v 1.38 2005/07/07 08:33:22 jsg Exp $ */ /* $FreeBSD: /a/cvsroot/freebsd.repo/ncvs/src/sys/dev/usb/if_ural.c,v 1.10 2005/07/10 00:17:05 sam Exp $ */ @@ -25,7 +25,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.6 2005/08/16 17:02:34 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: if_ural.c,v 1.7 2005/08/16 19:35:17 drochner Exp $"); #include "bpfilter.h" @@ -1167,21 +1167,6 @@ ural_tx_mgt(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) desc = (struct ural_tx_desc *)data->buf; rate = IEEE80211_IS_CHAN_5GHZ(ni->ni_chan) ? 12 : 4; - -#if NBPFILTER > 0 - if (sc->sc_drvbpf != NULL) { - struct ural_tx_radiotap_header *tap = &sc->sc_txtap; - - tap->wt_flags = 0; - tap->wt_rate = rate; - tap->wt_chan_freq = htole16(ic->ic_ibss_chan->ic_freq); - tap->wt_chan_flags = htole16(ic->ic_ibss_chan->ic_flags); - tap->wt_antenna = sc->tx_ant; - - bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0); - } -#endif - data->m = m0; data->ni = ni; @@ -1200,6 +1185,20 @@ ural_tx_mgt(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) flags |= RAL_TX_TIMESTAMP; } +#if NBPFILTER > 0 + if (sc->sc_drvbpf != NULL) { + struct ural_tx_radiotap_header *tap = &sc->sc_txtap; + + tap->wt_flags = 0; + tap->wt_rate = rate; + tap->wt_chan_freq = htole16(ni->ni_chan->ic_freq); + tap->wt_chan_flags = htole16(ni->ni_chan->ic_flags); + tap->wt_antenna = sc->tx_ant; + + bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0); + } +#endif + m_copydata(m0, 0, m0->m_pkthdr.len, data->buf + RAL_TX_DESC_SIZE); ural_setup_tx_desc(sc, desc, flags, m0->m_pkthdr.len, rate); @@ -1270,8 +1269,8 @@ ural_tx_data(struct ural_softc *sc, struct mbuf *m0, struct ieee80211_node *ni) tap->wt_flags = 0; tap->wt_rate = rate; - tap->wt_chan_freq = htole16(ic->ic_ibss_chan->ic_freq); - tap->wt_chan_flags = htole16(ic->ic_ibss_chan->ic_flags); + tap->wt_chan_freq = htole16(ni->ni_chan->ic_freq); + tap->wt_chan_flags = htole16(ni->ni_chan->ic_flags); tap->wt_antenna = sc->tx_ant; bpf_mtap2(sc->sc_drvbpf, tap, sc->sc_txtap_len, m0);