Documentation/cImages/baseline-2.3.ndz: patch-03-radiotap-fcs-fix.diff

File patch-03-radiotap-fcs-fix.diff, 3.5 KB (added by mcgrof, 17 years ago)

Standardise Radiotap FCS Handling

  • net80211/ieee80211_monitor.c

    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  
    242242                    p = start + roundup(p - start, 2) + 4;
    243243                    break;
    244244
    245                 case IEEE80211_RADIOTAP_FCS:
    246                     /* 32-bit */
    247                     p = start + roundup(p - start, 4) + 4;
    248                     break;
    249 
    250245                case IEEE80211_RADIOTAP_TSFT:
    251246                    /* 64-bit */
    252247                    p = start + roundup(p - start, 8) + 8;
     
    492487                    th->wr_flags |= IEEE80211_RADIOTAP_F_SHORTPRE;
    493488                if (ds->ds_rxstat.rs_status & HAL_RXERR_CRC)
    494489                    th->wr_flags |= IEEE80211_RADIOTAP_F_BADFCS;
     490                if (skb->len >= IEEE80211_CRC_LEN)
     491                    th->wr_flags |= IEEE80211_RADIOTAP_F_FCS;
    495492
    496493                th->wr_rate = sc->sc_hwmap[ds->ds_rxstat.rs_rate].ieeerate;
    497494                th->wr_chan_freq = cpu_to_le16(ic->ic_curchan->ic_freq);
     
    527524                th->wr_dbm_antsignal = th->wr_dbm_antnoise + rssi;
    528525                th->wr_antenna = ds->ds_rxstat.rs_antenna;
    529526                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;
    534527               
    535528                th->wr_tsft = cpu_to_le64(mactime);
    536529            }
     
    550543            break;
    551544        }
    552545        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 */
    555549                skb_trim(skb1, skb1->len - IEEE80211_CRC_LEN);
    556550            }
    557551            skb1->dev = dev; /* NB: deliver to wlanX */
  • net80211/ieee80211_monitor.h

    diff -Naur madwifi-0.9.3.1/net80211/ieee80211_monitor.h madwifi-0.9.3.1-radiotap/net80211/ieee80211_monitor.h
    old new  
    116116    (1 << IEEE80211_RADIOTAP_DBM_ANTNOISE)  | \
    117117        (1 << IEEE80211_RADIOTAP_ANTENNA)       | \
    118118        (1 << IEEE80211_RADIOTAP_DB_ANTSIGNAL)  | \
    119         (1 << IEEE80211_RADIOTAP_FCS)           | \
    120119        0)
    121120
    122121struct ath_rx_radiotap_header {
     
    130129    int8_t  wr_dbm_antnoise;
    131130        u_int8_t wr_antenna;
    132131        u_int8_t wr_antsignal;
    133     u_int8_t wr_pad[2]; /* Ensure fcs is on 32 bit boundary */
    134     __le32 wr_fcs;
    135132}__attribute__((__packed__));
    136133
    137134#define ATH_TX_RADIOTAP_PRESENT (               \
  • net80211/ieee80211_radiotap.h

    diff -Naur madwifi-0.9.3.1/net80211/ieee80211_radiotap.h madwifi-0.9.3.1-radiotap/net80211/ieee80211_radiotap.h
    old new  
    153153 *      Unitless indication of the Rx/Tx antenna for this packet.
    154154 *      The first antenna is antenna 0.
    155155 *
    156  * IEEE80211_RADIOTAP_FCS               u_int32_t       data
    157  *
    158  *  FCS from frame in network byte order.
    159156 */
    160157enum ieee80211_radiotap_type {
    161158    IEEE80211_RADIOTAP_TSFT = 0,
     
    172169    IEEE80211_RADIOTAP_ANTENNA = 11,
    173170    IEEE80211_RADIOTAP_DB_ANTSIGNAL = 12,
    174171    IEEE80211_RADIOTAP_DB_ANTNOISE = 13,
    175     IEEE80211_RADIOTAP_FCS = 14,
    176172    IEEE80211_RADIOTAP_EXT = 31,
    177173};
    178174