diff options
| author | Sam Leffler <sam@FreeBSD.org> | 2004-04-01 00:38:45 +0000 |
|---|---|---|
| committer | Sam Leffler <sam@FreeBSD.org> | 2004-04-01 00:38:45 +0000 |
| commit | 2f1ad18b34dfc1fccb48307f231b0ed2cbf268fa (patch) | |
| tree | d7cf9a83baabf9976c2b03fef74b9ddd06a31392 /sys/dev/wi | |
| parent | 8d798b52fdfc38cd3d4fcbb244e62851115e637c (diff) | |
Notes
Diffstat (limited to 'sys/dev/wi')
| -rw-r--r-- | sys/dev/wi/if_wi.c | 17 | ||||
| -rw-r--r-- | sys/dev/wi/if_wivar.h | 2 |
2 files changed, 13 insertions, 6 deletions
diff --git a/sys/dev/wi/if_wi.c b/sys/dev/wi/if_wi.c index fb45ee94921a2..dc2e75e310c00 100644 --- a/sys/dev/wi/if_wi.c +++ b/sys/dev/wi/if_wi.c @@ -482,15 +482,20 @@ wi_attach(device_t dev) &sc->sc_drvbpf); /* * Initialize constant fields. + * XXX make header lengths a multiple of 32-bits so subsequent + * headers are properly aligned; this is a kludge to keep + * certain applications happy. * * NB: the channel is setup each time we transition to the * RUN state to avoid filling it in for each frame. */ - sc->sc_tx_th.wt_ihdr.it_len = sizeof(sc->sc_tx_th); - sc->sc_tx_th.wt_ihdr.it_present = WI_TX_RADIOTAP_PRESENT; + sc->sc_tx_th_len = roundup(sizeof(sc->sc_tx_th), sizeof(u_int32_t)); + sc->sc_tx_th.wt_ihdr.it_len = htole16(sc->sc_tx_th_len); + sc->sc_tx_th.wt_ihdr.it_present = htole32(WI_TX_RADIOTAP_PRESENT); - sc->sc_rx_th.wr_ihdr.it_len = sizeof(sc->sc_rx_th); - sc->sc_rx_th.wr_ihdr.it_present = WI_RX_RADIOTAP_PRESENT; + sc->sc_rx_th_len = roundup(sizeof(sc->sc_rx_th), sizeof(u_int32_t)); + sc->sc_rx_th.wr_ihdr.it_len = htole16(sc->sc_rx_th_len); + sc->sc_rx_th.wr_ihdr.it_present = htole32(WI_RX_RADIOTAP_PRESENT); #endif return (0); } @@ -944,7 +949,7 @@ wi_start(struct ifnet *ifp) sc->sc_tx_th.wt_rate = ni->ni_rates.rs_rates[ni->ni_txrate]; bpf_mtap2(sc->sc_drvbpf, - &sc->sc_tx_th, sizeof(sc->sc_tx_th), m0); + &sc->sc_tx_th, sc->sc_tx_th_len, m0); } #endif m_copydata(m0, 0, sizeof(struct ieee80211_frame), @@ -1495,7 +1500,7 @@ wi_rx_intr(struct wi_softc *sc) if (frmhdr.wi_status & WI_STAT_PCF) sc->sc_rx_th.wr_flags |= IEEE80211_RADIOTAP_F_CFP; bpf_mtap2(sc->sc_drvbpf, - &sc->sc_rx_th, sizeof(sc->sc_rx_th), m); + &sc->sc_rx_th, sc->sc_rx_th_len, m); } #endif wh = mtod(m, struct ieee80211_frame *); diff --git a/sys/dev/wi/if_wivar.h b/sys/dev/wi/if_wivar.h index bd7e16b60cb6d..0a8388e77b7bf 100644 --- a/sys/dev/wi/if_wivar.h +++ b/sys/dev/wi/if_wivar.h @@ -168,10 +168,12 @@ struct wi_softc { struct wi_tx_radiotap_header th; u_int8_t pad[64]; } u_tx_rt; + int sc_tx_th_len; union { struct wi_rx_radiotap_header th; u_int8_t pad[64]; } u_rx_rt; + int sc_rx_th_len; }; #define sc_if sc_ic.ic_if #define sc_tx_th u_tx_rt.th |
