Standardise Radiotap FCS Handling
http://madwifi.org/ticket/1221
This patch was rebased for madwifi-0.9.3.1
Signed-Off by: Luis Rodriguez <mcgrof@winlab.rutgers.edu>
diff -Naur madwifi-0.9.3.1/net80211/ieee80211_monitor.c madwifi-0.9.3.1-radiotap/net80211/ieee80211_monitor.c
old
|
new
|
|
242 | 242 | p = start + roundup(p - start, 2) + 4; |
243 | 243 | break; |
244 | 244 | |
245 | | case IEEE80211_RADIOTAP_FCS: |
246 | | /* 32-bit */ |
247 | | p = start + roundup(p - start, 4) + 4; |
248 | | break; |
249 | | |
250 | 245 | case IEEE80211_RADIOTAP_TSFT: |
251 | 246 | /* 64-bit */ |
252 | 247 | p = start + roundup(p - start, 8) + 8; |
… |
… |
|
492 | 487 | th->wr_flags |= IEEE80211_RADIOTAP_F_SHORTPRE; |
493 | 488 | if (ds->ds_rxstat.rs_status & HAL_RXERR_CRC) |
494 | 489 | th->wr_flags |= IEEE80211_RADIOTAP_F_BADFCS; |
| 490 | if (skb->len >= IEEE80211_CRC_LEN) |
| 491 | th->wr_flags |= IEEE80211_RADIOTAP_F_FCS; |
495 | 492 | |
496 | 493 | th->wr_rate = sc->sc_hwmap[ds->ds_rxstat.rs_rate].ieeerate; |
497 | 494 | th->wr_chan_freq = cpu_to_le16(ic->ic_curchan->ic_freq); |
… |
… |
|
527 | 524 | th->wr_dbm_antsignal = th->wr_dbm_antnoise + rssi; |
528 | 525 | th->wr_antenna = ds->ds_rxstat.rs_antenna; |
529 | 526 | th->wr_antsignal = rssi; |
530 | | if (skb->len >= IEEE80211_CRC_LEN) |
531 | | th->wr_fcs = cpu_to_le32p((u32 *)&skb1->data[skb1->len - IEEE80211_CRC_LEN]); |
532 | | else |
533 | | th->wr_fcs = 0; |
534 | 527 | |
535 | 528 | th->wr_tsft = cpu_to_le64(mactime); |
536 | 529 | } |
… |
… |
|
550 | 543 | break; |
551 | 544 | } |
552 | 545 | if (skb1) { |
553 | | if (!tx && skb->len >= IEEE80211_CRC_LEN) { |
554 | | /* Remove FCS from end of rx frames*/ |
| 546 | if (!tx && (vap->iv_dev->type != ARPHRD_IEEE80211_RADIOTAP) && (skb1->len >= IEEE80211_CRC_LEN)) { |
| 547 | /* Remove FCS from end of rx frames when |
| 548 | * delivering to non-Radiotap VAPs */ |
555 | 549 | skb_trim(skb1, skb1->len - IEEE80211_CRC_LEN); |
556 | 550 | } |
557 | 551 | skb1->dev = dev; /* NB: deliver to wlanX */ |
diff -Naur madwifi-0.9.3.1/net80211/ieee80211_monitor.h madwifi-0.9.3.1-radiotap/net80211/ieee80211_monitor.h
old
|
new
|
|
116 | 116 | (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE) | \ |
117 | 117 | (1 << IEEE80211_RADIOTAP_ANTENNA) | \ |
118 | 118 | (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL) | \ |
119 | | (1 << IEEE80211_RADIOTAP_FCS) | \ |
120 | 119 | 0) |
121 | 120 | |
122 | 121 | struct ath_rx_radiotap_header { |
… |
… |
|
130 | 129 | int8_t wr_dbm_antnoise; |
131 | 130 | u_int8_t wr_antenna; |
132 | 131 | u_int8_t wr_antsignal; |
133 | | u_int8_t wr_pad[2]; /* Ensure fcs is on 32 bit boundary */ |
134 | | __le32 wr_fcs; |
135 | 132 | }__attribute__((__packed__)); |
136 | 133 | |
137 | 134 | #define ATH_TX_RADIOTAP_PRESENT ( \ |
diff -Naur madwifi-0.9.3.1/net80211/ieee80211_radiotap.h madwifi-0.9.3.1-radiotap/net80211/ieee80211_radiotap.h
old
|
new
|
|
153 | 153 | * Unitless indication of the Rx/Tx antenna for this packet. |
154 | 154 | * The first antenna is antenna 0. |
155 | 155 | * |
156 | | * IEEE80211_RADIOTAP_FCS u_int32_t data |
157 | | * |
158 | | * FCS from frame in network byte order. |
159 | 156 | */ |
160 | 157 | enum ieee80211_radiotap_type { |
161 | 158 | IEEE80211_RADIOTAP_TSFT = 0, |
… |
… |
|
172 | 169 | IEEE80211_RADIOTAP_ANTENNA = 11, |
173 | 170 | IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12, |
174 | 171 | IEEE80211_RADIOTAP_DB_ANTNOISE = 13, |
175 | | IEEE80211_RADIOTAP_FCS = 14, |
176 | 172 | IEEE80211_RADIOTAP_EXT = 31, |
177 | 173 | }; |
178 | 174 | |