From 3b60f0f307f68509b6ea727bb52b7f7b36b0100b Mon Sep 17 00:00:00 2001 From: Alexander Egorenkov Date: Thu, 4 Mar 2010 13:14:37 +0100 Subject: [PATCH] Notify net80211 about MIC failures; Set BADFCS and FRAG flags in radiotap header for received frames --- rt2860.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/rt2860.c b/rt2860.c index a280d53..4835508 100644 --- a/rt2860.c +++ b/rt2860.c @@ -4524,7 +4524,7 @@ static int rt2860_rx_eof(struct rt2860_softc *sc, int limit) bus_dma_segment_t segs[1]; bus_dmamap_t dma_map; uint32_t index, desc_flags; - uint8_t cipher_err, rssi, ant, phymode, bw, shortgi, mcs; + uint8_t cipher_err, rssi, ant, phymode, bw, shortgi, mcs, keyidx; int8_t rssi_dbm; int error, nsegs, len, ampdu, amsdu, nframes, i; @@ -4652,6 +4652,15 @@ static int rt2860_rx_eof(struct rt2860_softc *sc, int limit) "%s: rxdesc: cipher error=0x%02x\n", device_get_nameunit(sc->dev), cipher_err); + if ((cipher_err == RT2860_RXDESC_FLAGS_CIPHER_ERR_MIC) && + (desc_flags & RT2860_RXDESC_FLAGS_MYBSS)) + { + keyidx = (rxwi->udf_bssidx_keyidx >> RT2860_RXWI_KEYIDX_SHIFT) & + RT2860_RXWI_KEYIDX_MASK; + + ieee80211_notify_michael_failure(ic, wh, keyidx); + } + ifp->if_ierrors++; if (!(ifp->if_flags & IFF_PROMISC)) @@ -4736,6 +4745,12 @@ static int rt2860_rx_eof(struct rt2860_softc *sc, int limit) else tap->rate = rt2860_rxrate(rxwi); + if (desc_flags & RT2860_RXDESC_FLAGS_CRC_ERR) + tap->flags |= IEEE80211_RADIOTAP_F_BADFCS; + + if (desc_flags & RT2860_RXDESC_FLAGS_FRAG) + tap->flags |= IEEE80211_RADIOTAP_F_FRAG; + if (rxwi->bw_mcs & RT2860_RXWI_MCS_SHOTPRE) tap->flags |= IEEE80211_RADIOTAP_F_SHORTPRE; -- 2.11.4.GIT