Lines Matching +full:data +full:- +full:width
1 /*-
2 * SPDX-License-Identifier: BSD-2-Clause
22 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
72 th->it_len = htole16(roundup2(tlen, sizeof(uint32_t))); in ieee80211_radiotap_attachv()
73 th->it_present = htole32(tx_radiotap); in ieee80211_radiotap_attachv()
74 ic->ic_th = th; in ieee80211_radiotap_attachv()
75 /* calculate offset to channel data */ in ieee80211_radiotap_attachv()
76 off = -1; in ieee80211_radiotap_attachv()
81 if (off == -1) { in ieee80211_radiotap_attachv()
84 /* NB: we handle this case but data will have no chan spec */ in ieee80211_radiotap_attachv()
86 ic->ic_txchan = ((uint8_t *) th) + off; in ieee80211_radiotap_attachv()
88 rh->it_len = htole16(roundup2(rlen, sizeof(uint32_t))); in ieee80211_radiotap_attachv()
89 rh->it_present = htole32(rx_radiotap); in ieee80211_radiotap_attachv()
90 ic->ic_rh = rh; in ieee80211_radiotap_attachv()
91 /* calculate offset to channel data */ in ieee80211_radiotap_attachv()
92 off = -1; in ieee80211_radiotap_attachv()
97 if (off == -1) { in ieee80211_radiotap_attachv()
100 /* NB: we handle this case but data will have no chan spec */ in ieee80211_radiotap_attachv()
102 ic->ic_rxchan = ((uint8_t *) rh) + off; in ieee80211_radiotap_attachv()
114 struct ieee80211com *ic = vap->iv_ic; in ieee80211_radiotap_vattach()
115 struct ieee80211_radiotap_header *th = ic->ic_th; in ieee80211_radiotap_vattach()
117 if (th != NULL && ic->ic_rh != NULL) { in ieee80211_radiotap_vattach()
119 bpfattach2(vap->iv_ifp, DLT_IEEE802_11_RADIO, in ieee80211_radiotap_vattach()
120 sizeof(struct ieee80211_frame) + le16toh(th->it_len), in ieee80211_radiotap_vattach()
121 &vap->iv_rawbpf); in ieee80211_radiotap_vattach()
139 rc->freq = htole16(c->ic_freq); in set_channel()
140 rc->flags = htole16(c->ic_flags); in set_channel()
153 rc->flags = htole32(c->ic_flags); in set_xchannel()
154 rc->freq = htole16(c->ic_freq); in set_xchannel()
155 rc->ieee = c->ic_ieee; in set_xchannel()
156 rc->maxpow = c->ic_maxregpower; in set_xchannel()
165 if (ic->ic_rxchan != NULL) { in ieee80211_radiotap_chan_change()
166 struct ieee80211_radiotap_header *rh = ic->ic_rh; in ieee80211_radiotap_chan_change()
168 if (rh->it_present & htole32(1<<IEEE80211_RADIOTAP_XCHANNEL)) in ieee80211_radiotap_chan_change()
169 set_xchannel(ic->ic_rxchan, ic->ic_curchan); in ieee80211_radiotap_chan_change()
170 else if (rh->it_present & htole32(1<<IEEE80211_RADIOTAP_CHANNEL)) in ieee80211_radiotap_chan_change()
171 set_channel(ic->ic_rxchan, ic->ic_curchan); in ieee80211_radiotap_chan_change()
173 if (ic->ic_txchan != NULL) { in ieee80211_radiotap_chan_change()
174 struct ieee80211_radiotap_header *th = ic->ic_th; in ieee80211_radiotap_chan_change()
176 if (th->it_present & htole32(1<<IEEE80211_RADIOTAP_XCHANNEL)) in ieee80211_radiotap_chan_change()
177 set_xchannel(ic->ic_txchan, ic->ic_curchan); in ieee80211_radiotap_chan_change()
178 else if (th->it_present & htole32(1<<IEEE80211_RADIOTAP_CHANNEL)) in ieee80211_radiotap_chan_change()
179 set_channel(ic->ic_txchan, ic->ic_curchan); in ieee80211_radiotap_chan_change()
184 * Distribute radiotap data (+packet) to all monitor mode
191 struct ieee80211com *ic = vap0->iv_ic; in spam_vaps()
194 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { in spam_vaps()
196 vap->iv_opmode == IEEE80211_M_MONITOR && in spam_vaps()
197 (vap->iv_flags_ext & IEEE80211_FEXT_BPF) && in spam_vaps()
198 vap->iv_state != IEEE80211_S_INIT) in spam_vaps()
199 bpf_mtap2(vap->iv_rawbpf, rh, len, m); in spam_vaps()
204 * Dispatch radiotap data for transmitted packet.
209 struct ieee80211com *ic = vap0->iv_ic; in ieee80211_radiotap_tx()
210 struct ieee80211_radiotap_header *th = ic->ic_th; in ieee80211_radiotap_tx()
214 len = le16toh(th->it_len); in ieee80211_radiotap_tx()
216 if (vap0->iv_flags_ext & IEEE80211_FEXT_BPF) in ieee80211_radiotap_tx()
217 bpf_mtap2(vap0->iv_rawbpf, th, len, m); in ieee80211_radiotap_tx()
221 if (ic->ic_montaps != 0) in ieee80211_radiotap_tx()
226 * Dispatch radiotap data for received packet.
231 struct ieee80211com *ic = vap0->iv_ic; in ieee80211_radiotap_rx()
232 struct ieee80211_radiotap_header *rh = ic->ic_rh; in ieee80211_radiotap_rx()
236 len = le16toh(rh->it_len); in ieee80211_radiotap_rx()
238 if (vap0->iv_flags_ext & IEEE80211_FEXT_BPF) in ieee80211_radiotap_rx()
239 bpf_mtap2(vap0->iv_rawbpf, rh, len, m); in ieee80211_radiotap_rx()
245 if (ic->ic_montaps != 0 && (m->m_flags & M_BCAST) == 0) in ieee80211_radiotap_rx()
250 * Dispatch radiotap data for a packet received outside the normal
257 struct ieee80211_radiotap_header *rh = ic->ic_rh; in ieee80211_radiotap_rx_all()
258 int len = le16toh(rh->it_len); in ieee80211_radiotap_rx_all()
262 TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { in ieee80211_radiotap_rx_all()
264 vap->iv_state != IEEE80211_S_INIT) in ieee80211_radiotap_rx_all()
265 bpf_mtap2(vap->iv_rawbpf, rh, len, m); in ieee80211_radiotap_rx_all()
272 * known -1 is returned.
279 size_t align, width; in radiotap_offset() member
283 .width = sizeof(uint64_t), in radiotap_offset()
287 .width = sizeof(uint8_t), in radiotap_offset()
291 .width = sizeof(uint8_t), in radiotap_offset()
295 .width = 2*sizeof(uint16_t), in radiotap_offset()
299 .width = sizeof(uint16_t), in radiotap_offset()
303 .width = sizeof(uint8_t), in radiotap_offset()
307 .width = sizeof(uint8_t), in radiotap_offset()
311 .width = sizeof(uint16_t), in radiotap_offset()
315 .width = sizeof(uint16_t), in radiotap_offset()
319 .width = sizeof(uint16_t), in radiotap_offset()
323 .width = sizeof(uint8_t), in radiotap_offset()
327 .width = sizeof(uint8_t), in radiotap_offset()
331 .width = sizeof(uint8_t), in radiotap_offset()
335 .width = sizeof(uint8_t), in radiotap_offset()
339 .width = 2*sizeof(uint32_t), in radiotap_offset()
343 .width = 3*sizeof(uint8_t), in radiotap_offset()
346 uint32_t present = le32toh(rh->it_present); in radiotap_offset()
358 return -1; in radiotap_offset()
362 if (off + items[i].width > le16toh(rh->it_len)) { in radiotap_offset()
363 /* NB: item does not fit in header data */ in radiotap_offset()
364 net80211_printf("%s: item %d not in header data, " in radiotap_offset()
365 "off %d width %zu len %d\n", __func__, i, in radiotap_offset()
366 off, items[i].width, le16toh(rh->it_len)); in radiotap_offset()
367 return -1; in radiotap_offset()
371 off += items[i].width; in radiotap_offset()
373 return -1; in radiotap_offset()