NDIS_STATUS RTMPCheckRxError( IN PRTMP_ADAPTER pAd, IN PHEADER_802_11 pHeader, IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxINFO) { PCIPHER_KEY pWpaKey; INT dBm; if (pAd->bPromiscuous == TRUE) return(NDIS_STATUS_SUCCESS); if(pRxINFO == NULL) return(NDIS_STATUS_FAILURE); if (pRxINFO->Crc) { dBm = (INT) (pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; if (dBm <= -87) pAd->StaCfg.RPIDensity[0] += 1; else if (dBm <= -82) pAd->StaCfg.RPIDensity[1] += 1; else if (dBm <= -77) pAd->StaCfg.RPIDensity[2] += 1; else if (dBm <= -72) pAd->StaCfg.RPIDensity[3] += 1; else if (dBm <= -67) pAd->StaCfg.RPIDensity[4] += 1; else if (dBm <= -62) pAd->StaCfg.RPIDensity[5] += 1; else if (dBm <= -57) pAd->StaCfg.RPIDensity[6] += 1; else if (dBm > -57) pAd->StaCfg.RPIDensity[7] += 1; return(NDIS_STATUS_FAILURE); } pAd->StaCfg.CLBusyBytes += (pRxWI->MPDUtotalByteCount+ 14); if (pHeader->FC.ToDs) { DBGPRINT_RAW(RT_DEBUG_ERROR, ("Err;FC.ToDs\n")); return NDIS_STATUS_FAILURE; } if (pRxWI->MPDUtotalByteCount > MAX_AGGREGATION_SIZE) { DBGPRINT_RAW(RT_DEBUG_ERROR, ("received packet too long\n")); return NDIS_STATUS_FAILURE; } if (pRxINFO->Decrypted && pRxINFO->CipherErr) { if ((pRxINFO->CipherErr == 2) && pRxINFO->MyBss) { pWpaKey = &pAd->SharedKey[BSS0][pRxWI->KeyIndex]; RTMPReportMicError(pAd, pWpaKey); DBGPRINT_RAW(RT_DEBUG_ERROR,("Rx MIC Value error\n")); } if (pRxINFO->Decrypted && (pAd->SharedKey[BSS0][pRxWI->KeyIndex].CipherAlg == CIPHER_AES) && (pHeader->Sequence == pAd->FragFrame.Sequence)) { return(NDIS_STATUS_SUCCESS); } return(NDIS_STATUS_FAILURE); } return(NDIS_STATUS_SUCCESS); }
/* ======================================================================== Routine Description: Check Rx descriptor, return NDIS_STATUS_FAILURE if any error dound Arguments: pRxD Pointer to the Rx descriptor Return Value: NDIS_STATUS_SUCCESS No err NDIS_STATUS_FAILURE Error Note: ======================================================================== */ NDIS_STATUS RTMPCheckRxError( IN RTMP_ADAPTER *pAd, IN PHEADER_802_11 pHeader, IN RXWI_STRUC *pRxWI, IN RXINFO_STRUC *pRxInfo) { PCIPHER_KEY pWpaKey; INT dBm; if(pRxInfo == NULL) return(NDIS_STATUS_FAILURE); /* Phy errors & CRC errors*/ if (pRxInfo->Crc) { /* Check RSSI for Noise Hist statistic collection.*/ dBm = (INT) (pRxWI->RxWIRSSI0) - pAd->BbpRssiToDbmDelta; if (dBm <= -87) pAd->StaCfg.RPIDensity[0] += 1; else if (dBm <= -82) pAd->StaCfg.RPIDensity[1] += 1; else if (dBm <= -77) pAd->StaCfg.RPIDensity[2] += 1; else if (dBm <= -72) pAd->StaCfg.RPIDensity[3] += 1; else if (dBm <= -67) pAd->StaCfg.RPIDensity[4] += 1; else if (dBm <= -62) pAd->StaCfg.RPIDensity[5] += 1; else if (dBm <= -57) pAd->StaCfg.RPIDensity[6] += 1; else if (dBm > -57) pAd->StaCfg.RPIDensity[7] += 1; return(NDIS_STATUS_FAILURE); } /* Add Rx size to channel load counter, we should ignore error counts*/ pAd->StaCfg.CLBusyBytes += (pRxWI->RxWIMPDUByteCnt + 14); #ifndef CLIENT_WDS if (pHeader->FC.ToDs ) { DBGPRINT_RAW(RT_DEBUG_ERROR, ("Err;FC.ToDs\n")); return NDIS_STATUS_FAILURE; } #endif /* CLIENT_WDS */ /* Paul 04-03 for OFDM Rx length issue*/ if (pRxWI->RxWIMPDUByteCnt > MAX_AGGREGATION_SIZE) { DBGPRINT_RAW(RT_DEBUG_ERROR, ("received packet too long\n")); return NDIS_STATUS_FAILURE; } /* Drop not U2M frames, cant's drop here because we will drop beacon in this case*/ /* I am kind of doubting the U2M bit operation*/ /* if (pRxD->U2M == 0)*/ /* return(NDIS_STATUS_FAILURE);*/ /* drop decyption fail frame*/ if (pRxInfo->Decrypted && pRxInfo->CipherErr) { if (((pRxInfo->CipherErr & 1) == 1) && INFRA_ON(pAd)) RTMPSendWirelessEvent(pAd, IW_ICV_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); if (((pRxInfo->CipherErr & 2) == 2) && INFRA_ON(pAd)) RTMPSendWirelessEvent(pAd, IW_MIC_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); /* MIC Error*/ if ((pRxInfo->CipherErr == 2) && pRxInfo->MyBss) { pWpaKey = &pAd->SharedKey[BSS0][pRxWI->RxWIKeyIndex]; #ifdef WPA_SUPPLICANT_SUPPORT if (pAd->StaCfg.WpaSupplicantUP) WpaSendMicFailureToWpaSupplicant(pAd->net_dev, (pWpaKey->Type == PAIRWISEKEY) ? TRUE:FALSE); else #endif /* WPA_SUPPLICANT_SUPPORT */ RTMPReportMicError(pAd, pWpaKey); DBGPRINT_RAW(RT_DEBUG_ERROR,("Rx MIC Value error\n")); } if (pRxInfo->Decrypted && (pAd->SharedKey[BSS0][pRxWI->RxWIKeyIndex].CipherAlg == CIPHER_AES) && (pHeader->Sequence == pAd->FragFrame.Sequence)) { /* Acceptable since the First FragFrame no CipherErr problem.*/ return(NDIS_STATUS_SUCCESS); } return(NDIS_STATUS_FAILURE); } return(NDIS_STATUS_SUCCESS); }
/* ======================================================================== Routine Description: Check Rx descriptor, return NDIS_STATUS_FAILURE if any error dound Arguments: pRxD Pointer to the Rx descriptor Return Value: NDIS_STATUS_SUCCESS No err NDIS_STATUS_FAILURE Error Note: ======================================================================== */ int RTMPCheckRxError(struct rt_rtmp_adapter *pAd, struct rt_header_802_11 * pHeader, struct rt_rxwi * pRxWI, IN PRT28XX_RXD_STRUC pRxINFO) { struct rt_cipher_key *pWpaKey; int dBm; if (pAd->bPromiscuous == TRUE) return (NDIS_STATUS_SUCCESS); if (pRxINFO == NULL) return (NDIS_STATUS_FAILURE); /* Phy errors & CRC errors */ if (pRxINFO->Crc) { /* Check RSSI for Noise Hist statistic collection. */ dBm = (int)(pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; if (dBm <= -87) pAd->StaCfg.RPIDensity[0] += 1; else if (dBm <= -82) pAd->StaCfg.RPIDensity[1] += 1; else if (dBm <= -77) pAd->StaCfg.RPIDensity[2] += 1; else if (dBm <= -72) pAd->StaCfg.RPIDensity[3] += 1; else if (dBm <= -67) pAd->StaCfg.RPIDensity[4] += 1; else if (dBm <= -62) pAd->StaCfg.RPIDensity[5] += 1; else if (dBm <= -57) pAd->StaCfg.RPIDensity[6] += 1; else if (dBm > -57) pAd->StaCfg.RPIDensity[7] += 1; return (NDIS_STATUS_FAILURE); } /* Add Rx size to channel load counter, we should ignore error counts */ pAd->StaCfg.CLBusyBytes += (pRxWI->MPDUtotalByteCount + 14); /* Drop ToDs promiscuous frame, it is opened due to CCX 2 channel load statistics */ if (pHeader->FC.ToDs) { DBGPRINT_RAW(RT_DEBUG_ERROR, ("Err;FC.ToDs\n")); return NDIS_STATUS_FAILURE; } /* Paul 04-03 for OFDM Rx length issue */ if (pRxWI->MPDUtotalByteCount > MAX_AGGREGATION_SIZE) { DBGPRINT_RAW(RT_DEBUG_ERROR, ("received packet too long\n")); return NDIS_STATUS_FAILURE; } /* Drop not U2M frames, can't's drop here because we will drop beacon in this case */ /* I am kind of doubting the U2M bit operation */ /* if (pRxD->U2M == 0) */ /* return(NDIS_STATUS_FAILURE); */ /* drop decyption fail frame */ if (pRxINFO->Decrypted && pRxINFO->CipherErr) { if (((pRxINFO->CipherErr & 1) == 1) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) RTMPSendWirelessEvent(pAd, IW_ICV_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID]. Addr, BSS0, 0); if (((pRxINFO->CipherErr & 2) == 2) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) RTMPSendWirelessEvent(pAd, IW_MIC_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID]. Addr, BSS0, 0); /* */ /* MIC Error */ /* */ if ((pRxINFO->CipherErr == 2) && pRxINFO->MyBss) { pWpaKey = &pAd->SharedKey[BSS0][pRxWI->KeyIndex]; RTMPReportMicError(pAd, pWpaKey); DBGPRINT_RAW(RT_DEBUG_ERROR, ("Rx MIC Value error\n")); } if (pRxINFO->Decrypted && (pAd->SharedKey[BSS0][pRxWI->KeyIndex].CipherAlg == CIPHER_AES) && (pHeader->Sequence == pAd->FragFrame.Sequence)) { /* */ /* Acceptable since the First FragFrame no CipherErr problem. */ /* */ return (NDIS_STATUS_SUCCESS); } return (NDIS_STATUS_FAILURE); } return (NDIS_STATUS_SUCCESS); }
/* ======================================================================== Routine Description: Check Rx descriptor, return NDIS_STATUS_FAILURE if any error dound Arguments: pRxD Pointer to the Rx descriptor Return Value: NDIS_STATUS_SUCCESS No err NDIS_STATUS_FAILURE Error Note: ======================================================================== */ NDIS_STATUS RTMPCheckRxError( IN PRTMP_ADAPTER pAd, IN PHEADER_802_11 pHeader, IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxD) { PCIPHER_KEY pWpaKey; INT dBm; // Phy errors & CRC errors if (/*(pRxD->PhyErr) ||*/ (pRxD->Crc)) { // Check RSSI for Noise Hist statistic collection. dBm = (INT) (pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; if (dBm <= -87) pAd->StaCfg.RPIDensity[0] += 1; else if (dBm <= -82) pAd->StaCfg.RPIDensity[1] += 1; else if (dBm <= -77) pAd->StaCfg.RPIDensity[2] += 1; else if (dBm <= -72) pAd->StaCfg.RPIDensity[3] += 1; else if (dBm <= -67) pAd->StaCfg.RPIDensity[4] += 1; else if (dBm <= -62) pAd->StaCfg.RPIDensity[5] += 1; else if (dBm <= -57) pAd->StaCfg.RPIDensity[6] += 1; else if (dBm > -57) pAd->StaCfg.RPIDensity[7] += 1; return(NDIS_STATUS_FAILURE); } // Add Rx size to channel load counter, we should ignore error counts pAd->StaCfg.CLBusyBytes += (pRxD->SDL0 + 14); // Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics if (pHeader != NULL) { #ifndef CLIENT_WDS if (pHeader->FC.ToDs ) { return(NDIS_STATUS_FAILURE); } #endif // CLIENT_WDS // } // Drop not U2M frames, cant's drop here because we will drop beacon in this case // I am kind of doubting the U2M bit operation // if (pRxD->U2M == 0) // return(NDIS_STATUS_FAILURE); // drop decyption fail frame if (pRxD->CipherErr) { if (pRxD->CipherErr == 2) {DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: ICV ok but MICErr "));} else if (pRxD->CipherErr == 1) {DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: ICV Err "));} else if (pRxD->CipherErr == 3) DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: Key not valid ")); if (((pRxD->CipherErr & 1) == 1) && INFRA_ON(pAd)) RTMPSendWirelessEvent(pAd, IW_ICV_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); DBGPRINT_RAW(RT_DEBUG_TRACE,(" %d (len=%d, Mcast=%d, MyBss=%d, Wcid=%d, KeyId=%d)\n", pRxD->CipherErr, pRxD->SDL0, pRxD->Mcast | pRxD->Bcast, pRxD->MyBss, pRxWI->WirelessCliID, // CipherName[pRxD->CipherAlg], pRxWI->KeyIndex)); // // MIC Error // if (pRxD->CipherErr == 2) { pWpaKey = &pAd->SharedKey[BSS0][pRxWI->KeyIndex]; #ifdef WPA_SUPPLICANT_SUPPORT if (pAd->StaCfg.WpaSupplicantUP) WpaSendMicFailureToWpaSupplicant(pAd, (pWpaKey->Type == PAIRWISEKEY) ? TRUE:FALSE); else #endif // WPA_SUPPLICANT_SUPPORT // RTMPReportMicError(pAd, pWpaKey); if (((pRxD->CipherErr & 2) == 2) && INFRA_ON(pAd)) RTMPSendWirelessEvent(pAd, IW_MIC_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); DBGPRINT_RAW(RT_DEBUG_ERROR,("Rx MIC Value error\n")); } if (pHeader == NULL) return(NDIS_STATUS_SUCCESS); /*if ((pRxD->CipherAlg == CIPHER_AES) && (pHeader->Sequence == pAd->FragFrame.Sequence)) { // // Acceptable since the First FragFrame no CipherErr problem. // return(NDIS_STATUS_SUCCESS); }*/ return(NDIS_STATUS_FAILURE); } return(NDIS_STATUS_SUCCESS); }
/* ======================================================================== Routine Description: Check Rx descriptor, return NDIS_STATUS_FAILURE if any error dound Arguments: pRxD Pointer to the Rx descriptor Return Value: NDIS_STATUS_SUCCESS No err NDIS_STATUS_FAILURE Error Note: ======================================================================== */ NDIS_STATUS RTMPCheckRxError( IN PRTMP_ADAPTER pAd, IN PHEADER_802_11 pHeader, IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxINFO) { PCIPHER_KEY pWpaKey; INT dBm; if (pAd->bPromiscuous == TRUE) return(NDIS_STATUS_SUCCESS); if(pRxINFO == NULL) return(NDIS_STATUS_FAILURE); // Phy errors & CRC errors if (pRxINFO->Crc) { // Check RSSI for Noise Hist statistic collection. dBm = (INT) (pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; if (dBm <= -87) pAd->StaCfg.RPIDensity[0] += 1; else if (dBm <= -82) pAd->StaCfg.RPIDensity[1] += 1; else if (dBm <= -77) pAd->StaCfg.RPIDensity[2] += 1; else if (dBm <= -72) pAd->StaCfg.RPIDensity[3] += 1; else if (dBm <= -67) pAd->StaCfg.RPIDensity[4] += 1; else if (dBm <= -62) pAd->StaCfg.RPIDensity[5] += 1; else if (dBm <= -57) pAd->StaCfg.RPIDensity[6] += 1; else if (dBm > -57) pAd->StaCfg.RPIDensity[7] += 1; return(NDIS_STATUS_FAILURE); } // Add Rx size to channel load counter, we should ignore error counts pAd->StaCfg.CLBusyBytes += (pRxWI->MPDUtotalByteCount+ 14); // Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics if (pHeader->FC.ToDs) { DBGPRINT_RAW(RT_DEBUG_ERROR, ("Err;FC.ToDs\n")); return NDIS_STATUS_FAILURE; } // Paul 04-03 for OFDM Rx length issue if (pRxWI->MPDUtotalByteCount > MAX_AGGREGATION_SIZE) { DBGPRINT_RAW(RT_DEBUG_ERROR, ("received packet too long\n")); return NDIS_STATUS_FAILURE; } // Drop not U2M frames, cant's drop here because we will drop beacon in this case // I am kind of doubting the U2M bit operation // if (pRxD->U2M == 0) // return(NDIS_STATUS_FAILURE); // drop decyption fail frame if (pRxINFO->Decrypted && pRxINFO->CipherErr) { // // MIC Error // if ((pRxINFO->CipherErr == 2) && pRxINFO->MyBss) { pWpaKey = &pAd->SharedKey[BSS0][pRxWI->KeyIndex]; RTMPReportMicError(pAd, pWpaKey); DBGPRINT_RAW(RT_DEBUG_ERROR,("Rx MIC Value error\n")); } if (pRxINFO->Decrypted && (pAd->SharedKey[BSS0][pRxWI->KeyIndex].CipherAlg == CIPHER_AES) && (pHeader->Sequence == pAd->FragFrame.Sequence)) { // // Acceptable since the First FragFrame no CipherErr problem. // return(NDIS_STATUS_SUCCESS); } return(NDIS_STATUS_FAILURE); } return(NDIS_STATUS_SUCCESS); }
/* ======================================================================== Routine Description: Check Rx descriptor, return NDIS_STATUS_FAILURE if any error found ======================================================================== */ INT RTMPCheckRxError(RTMP_ADAPTER *pAd, HEADER_802_11 *pHeader, RX_BLK *pRxBlk, IN RXINFO_STRUC *pRxInfo) { if(pRxInfo == NULL) return NDIS_STATUS_FAILURE; /* Phy errors & CRC errors*/ if (pRxInfo->Crc) { INT dBm = (pRxBlk->rssi[0]) - pAd->BbpRssiToDbmDelta; /* Check RSSI for Noise Hist statistic collection.*/ if (dBm <= -87) pAd->StaCfg.RPIDensity[0] += 1; else if (dBm <= -82) pAd->StaCfg.RPIDensity[1] += 1; else if (dBm <= -77) pAd->StaCfg.RPIDensity[2] += 1; else if (dBm <= -72) pAd->StaCfg.RPIDensity[3] += 1; else if (dBm <= -67) pAd->StaCfg.RPIDensity[4] += 1; else if (dBm <= -62) pAd->StaCfg.RPIDensity[5] += 1; else if (dBm <= -57) pAd->StaCfg.RPIDensity[6] += 1; else if (dBm > -57) pAd->StaCfg.RPIDensity[7] += 1; return NDIS_STATUS_FAILURE; } /* Add Rx size to channel load counter, we should ignore error counts*/ //pAd->StaCfg.CLBusyBytes += (pRxBlk->MPDUtotalByteCnt + 14); /* Drop ToDs promiscous frame, it is opened due to CCX 2 channel load statistics*/ if (pHeader != NULL) { if (pHeader->FC.ToDs) { return NDIS_STATUS_FAILURE; } } /* Paul 04-03 for OFDM Rx length issue*/ if (pRxBlk->MPDUtotalByteCnt > MAX_AGGREGATION_SIZE) { DBGPRINT(RT_DEBUG_ERROR, ("received packet too long\n")); return NDIS_STATUS_FAILURE; } /* Drop not U2M frames, cant's drop here because we will drop beacon in this case I am kind of doubting the U2M bit operation */ /* if (pRxInfo->U2M == 0) return NDIS_STATUS_FAILURE; */ /* drop decyption fail frame*/ if (pRxInfo->Decrypted && pRxInfo->CipherErr) { if (pRxInfo->CipherErr == 2) {DBGPRINT(RT_DEBUG_TRACE,("RxErr: ICV ok but MICErr"));} else if (pRxInfo->CipherErr == 1) {DBGPRINT(RT_DEBUG_TRACE,("RxErr: ICV Err"));} else if (pRxInfo->CipherErr == 3) DBGPRINT(RT_DEBUG_TRACE,("RxErr: Key not valid")); if (INFRA_ON(pAd) && pRxInfo->MyBss) { if ((pRxInfo->CipherErr & 1) == 1) { RTMPSendWirelessEvent(pAd, IW_ICV_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); } /* MIC Error*/ if (pRxInfo->CipherErr == 2) { CIPHER_KEY *pWpaKey = &pAd->SharedKey[BSS0][pRxBlk->key_idx]; #ifdef WPA_SUPPLICANT_SUPPORT if (pAd->StaCfg.wpa_supplicant_info.WpaSupplicantUP) WpaSendMicFailureToWpaSupplicant(pAd->net_dev,pHeader->Addr2, (pWpaKey->Type == PAIRWISEKEY) ? TRUE:FALSE, (INT) pRxBlk->key_idx, NULL); else #endif /* WPA_SUPPLICANT_SUPPORT */ RTMPReportMicError(pAd, pWpaKey); RTMPSendWirelessEvent(pAd, IW_MIC_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); } } DBGPRINT(RT_DEBUG_TRACE, ("%s(): %d (len=%d, Mcast=%d, MyBss=%d, Wcid=%d, KeyId=%d)\n", __FUNCTION__, pRxInfo->CipherErr, pRxBlk->MPDUtotalByteCnt, pRxInfo->Mcast | pRxInfo->Bcast, pRxInfo->MyBss, pRxBlk->wcid, pRxBlk->key_idx)); #ifdef DBG dump_rxinfo(pAd, pRxInfo); dump_rxwi(pAd, pRxBlk->pRxWI); hex_dump("ErrorPkt", (UCHAR *)pHeader, pRxBlk->MPDUtotalByteCnt); #endif if (pHeader == NULL) return NDIS_STATUS_SUCCESS; return NDIS_STATUS_FAILURE; } return NDIS_STATUS_SUCCESS; }
NDIS_STATUS RTMPCheckRxError( IN PRTMP_ADAPTER pAd, IN PHEADER_802_11 pHeader, IN PRXWI_STRUC pRxWI, IN PRT28XX_RXD_STRUC pRxD) { PCIPHER_KEY pWpaKey; INT dBm; if ( (pRxD->Crc)) { dBm = (INT) (pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; if (dBm <= -87) pAd->StaCfg.RPIDensity[0] += 1; else if (dBm <= -82) pAd->StaCfg.RPIDensity[1] += 1; else if (dBm <= -77) pAd->StaCfg.RPIDensity[2] += 1; else if (dBm <= -72) pAd->StaCfg.RPIDensity[3] += 1; else if (dBm <= -67) pAd->StaCfg.RPIDensity[4] += 1; else if (dBm <= -62) pAd->StaCfg.RPIDensity[5] += 1; else if (dBm <= -57) pAd->StaCfg.RPIDensity[6] += 1; else if (dBm > -57) pAd->StaCfg.RPIDensity[7] += 1; return(NDIS_STATUS_FAILURE); } pAd->StaCfg.CLBusyBytes += (pRxD->SDL0 + 14); if (pHeader != NULL) { if (pHeader->FC.ToDs) { return(NDIS_STATUS_FAILURE); } } if (pRxD->CipherErr) { if (pRxD->CipherErr == 2) {DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: ICV ok but MICErr "));} else if (pRxD->CipherErr == 1) {DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: ICV Err "));} else if (pRxD->CipherErr == 3) DBGPRINT_RAW(RT_DEBUG_TRACE,("pRxD ERROR: Key not valid ")); if (((pRxD->CipherErr & 1) == 1) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) RTMPSendWirelessEvent(pAd, IW_ICV_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); DBGPRINT_RAW(RT_DEBUG_TRACE,(" %d (len=%d, Mcast=%d, MyBss=%d, Wcid=%d, KeyId=%d)\n", pRxD->CipherErr, pRxD->SDL0, pRxD->Mcast | pRxD->Bcast, pRxD->MyBss, pRxWI->WirelessCliID, pRxWI->KeyIndex)); if (pRxD->CipherErr == 2) { pWpaKey = &pAd->SharedKey[BSS0][pRxWI->KeyIndex]; #ifdef WPA_SUPPLICANT_SUPPORT if (pAd->StaCfg.WpaSupplicantUP) WpaSendMicFailureToWpaSupplicant(pAd, (pWpaKey->Type == PAIRWISEKEY) ? TRUE:FALSE); else #endif RTMPReportMicError(pAd, pWpaKey); if (((pRxD->CipherErr & 2) == 2) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) RTMPSendWirelessEvent(pAd, IW_MIC_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID].Addr, BSS0, 0); DBGPRINT_RAW(RT_DEBUG_ERROR,("Rx MIC Value error\n")); } if (pHeader == NULL) return(NDIS_STATUS_SUCCESS); return(NDIS_STATUS_FAILURE); } return(NDIS_STATUS_SUCCESS); }
/* ======================================================================== Routine Description: Check Rx descriptor, return NDIS_STATUS_FAILURE if any error dound Arguments: pRxD Pointer to the Rx descriptor Return Value: NDIS_STATUS_SUCCESS No err NDIS_STATUS_FAILURE Error Note: ======================================================================== */ int RTMPCheckRxError(struct rt_rtmp_adapter *pAd, struct rt_header_802_11 * pHeader, struct rt_rxwi * pRxWI, IN PRT28XX_RXD_STRUC pRxD) { struct rt_cipher_key *pWpaKey; int dBm; /* Phy errors & CRC errors */ if ( /*(pRxD->PhyErr) || */ (pRxD->Crc)) { /* Check RSSI for Noise Hist statistic collection. */ dBm = (int)(pRxWI->RSSI0) - pAd->BbpRssiToDbmDelta; if (dBm <= -87) pAd->StaCfg.RPIDensity[0] += 1; else if (dBm <= -82) pAd->StaCfg.RPIDensity[1] += 1; else if (dBm <= -77) pAd->StaCfg.RPIDensity[2] += 1; else if (dBm <= -72) pAd->StaCfg.RPIDensity[3] += 1; else if (dBm <= -67) pAd->StaCfg.RPIDensity[4] += 1; else if (dBm <= -62) pAd->StaCfg.RPIDensity[5] += 1; else if (dBm <= -57) pAd->StaCfg.RPIDensity[6] += 1; else if (dBm > -57) pAd->StaCfg.RPIDensity[7] += 1; return (NDIS_STATUS_FAILURE); } /* Add Rx size to channel load counter, we should ignore error counts */ pAd->StaCfg.CLBusyBytes += (pRxD->SDL0 + 14); /* Drop ToDs promiscuous frame, it is opened due to CCX 2 channel load statistics */ if (pHeader != NULL) { if (pHeader->FC.ToDs) { return (NDIS_STATUS_FAILURE); } } /* Drop not U2M frames, can't's drop here because we will drop beacon in this case */ /* I am kind of doubting the U2M bit operation */ /* if (pRxD->U2M == 0) */ /* return(NDIS_STATUS_FAILURE); */ /* drop decyption fail frame */ if (pRxD->CipherErr) { if (pRxD->CipherErr == 2) { DBGPRINT_RAW(RT_DEBUG_TRACE, ("pRxD ERROR: ICV ok but MICErr ")); } else if (pRxD->CipherErr == 1) { DBGPRINT_RAW(RT_DEBUG_TRACE, ("pRxD ERROR: ICV Err ")); } else if (pRxD->CipherErr == 3) DBGPRINT_RAW(RT_DEBUG_TRACE, ("pRxD ERROR: Key not valid ")); if (((pRxD->CipherErr & 1) == 1) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) RTMPSendWirelessEvent(pAd, IW_ICV_ERROR_EVENT_FLAG, pAd->MacTab.Content[BSSID_WCID]. Addr, BSS0, 0); DBGPRINT_RAW(RT_DEBUG_TRACE, (" %d (len=%d, Mcast=%d, MyBss=%d, Wcid=%d, KeyId=%d)\n", pRxD->CipherErr, pRxD->SDL0, pRxD->Mcast | pRxD->Bcast, pRxD->MyBss, pRxWI->WirelessCliID, /* CipherName[pRxD->CipherAlg], */ pRxWI->KeyIndex)); /* */ /* MIC Error */ /* */ if (pRxD->CipherErr == 2) { pWpaKey = &pAd->SharedKey[BSS0][pRxWI->KeyIndex]; if (pAd->StaCfg.WpaSupplicantUP) WpaSendMicFailureToWpaSupplicant(pAd, (pWpaKey-> Type == PAIRWISEKEY) ? TRUE : FALSE); else RTMPReportMicError(pAd, pWpaKey); if (((pRxD->CipherErr & 2) == 2) && pAd->CommonCfg.bWirelessEvent && INFRA_ON(pAd)) RTMPSendWirelessEvent(pAd, IW_MIC_ERROR_EVENT_FLAG, pAd->MacTab. Content[BSSID_WCID].Addr, BSS0, 0); DBGPRINT_RAW(RT_DEBUG_ERROR, ("Rx MIC Value error\n")); } if (pHeader == NULL) return (NDIS_STATUS_SUCCESS); /*if ((pRxD->CipherAlg == CIPHER_AES) && (pHeader->Sequence == pAd->FragFrame.Sequence)) { // // Acceptable since the First FragFrame no CipherErr problem. // return(NDIS_STATUS_SUCCESS); } */ return (NDIS_STATUS_FAILURE); } return (NDIS_STATUS_SUCCESS); }