
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
--- madwifi-0.9.3.1/net80211/ieee80211_monitor.c	2007-02-14 18:45:48.000000000 -0500
+++ madwifi-0.9.3.1-radiotap/net80211/ieee80211_monitor.c	2007-07-13 14:44:08.000000000 -0400
@@ -242,11 +242,6 @@
 					p = start + roundup(p - start, 2) + 4;
 					break;
 
-				case IEEE80211_RADIOTAP_FCS:
-					/* 32-bit */
-					p = start + roundup(p - start, 4) + 4;
-					break;
-
 				case IEEE80211_RADIOTAP_TSFT:
 					/* 64-bit */
 					p = start + roundup(p - start, 8) + 8;
@@ -492,6 +487,8 @@
 					th->wr_flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
 				if (ds->ds_rxstat.rs_status & HAL_RXERR_CRC)
 					th->wr_flags |= IEEE80211_RADIOTAP_F_BADFCS;
+				if (skb->len >= IEEE80211_CRC_LEN) 
+					th->wr_flags |= IEEE80211_RADIOTAP_F_FCS;
 
 				th->wr_rate = sc->sc_hwmap[ds->ds_rxstat.rs_rate].ieeerate;
 				th->wr_chan_freq = cpu_to_le16(ic->ic_curchan->ic_freq);
@@ -527,10 +524,6 @@
 				th->wr_dbm_antsignal = th->wr_dbm_antnoise + rssi;
 				th->wr_antenna = ds->ds_rxstat.rs_antenna;
 				th->wr_antsignal = rssi;
-				if (skb->len >= IEEE80211_CRC_LEN) 
-					th->wr_fcs = cpu_to_le32p((u32 *)&skb1->data[skb1->len - IEEE80211_CRC_LEN]);
-				else 
-					th->wr_fcs = 0;
 				
 				th->wr_tsft = cpu_to_le64(mactime);
 			}
@@ -550,8 +543,9 @@
 			break;
 		}
 		if (skb1) {
-			if (!tx && skb->len >= IEEE80211_CRC_LEN) {
-				/* Remove FCS from end of rx frames*/
+			if (!tx && (vap->iv_dev->type != ARPHRD_IEEE80211_RADIOTAP) && (skb1->len >= IEEE80211_CRC_LEN)) {
+				/* Remove FCS from end of rx frames when
+				 * delivering to non-Radiotap VAPs */
 				skb_trim(skb1, skb1->len - IEEE80211_CRC_LEN);
 			}
 			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
--- madwifi-0.9.3.1/net80211/ieee80211_monitor.h	2007-01-29 23:57:52.000000000 -0500
+++ madwifi-0.9.3.1-radiotap/net80211/ieee80211_monitor.h	2007-07-13 14:46:53.000000000 -0400
@@ -116,7 +116,6 @@
 	(1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)	| \
         (1 << IEEE80211_RADIOTAP_ANTENNA)       | \
         (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL)  | \
-        (1 << IEEE80211_RADIOTAP_FCS)           | \
         0)
 
 struct ath_rx_radiotap_header {
@@ -130,8 +129,6 @@
 	int8_t  wr_dbm_antnoise;
         u_int8_t wr_antenna;
         u_int8_t wr_antsignal;
-	u_int8_t wr_pad[2]; /* Ensure fcs is on 32 bit boundary */
-	__le32 wr_fcs;
 }__attribute__((__packed__));
 
 #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
--- madwifi-0.9.3.1/net80211/ieee80211_radiotap.h	2007-01-29 22:51:52.000000000 -0500
+++ madwifi-0.9.3.1-radiotap/net80211/ieee80211_radiotap.h	2007-07-13 14:44:08.000000000 -0400
@@ -153,9 +153,6 @@
  *      Unitless indication of the Rx/Tx antenna for this packet.
  *      The first antenna is antenna 0.
  *
- * IEEE80211_RADIOTAP_FCS           	u_int32_t       data
- *
- *	FCS from frame in network byte order.
  */
 enum ieee80211_radiotap_type {
 	IEEE80211_RADIOTAP_TSFT = 0,
@@ -172,7 +169,6 @@
 	IEEE80211_RADIOTAP_ANTENNA = 11,
 	IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
 	IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
-	IEEE80211_RADIOTAP_FCS = 14,
 	IEEE80211_RADIOTAP_EXT = 31,
 };
 
