Commit 4722a26c authored by Andres More's avatar Andres More Committed by Greg Kroah-Hartman
Browse files

staging: vt6656: replace IS_ETH_ADDRESS_EQUAL with compare_ether_addr



Code cleanup, removed custom macro to compare Ethernet addresses.
Some checkpatch warnings on indentation were not resolved.

The return value of compare_ether_addr was reversed, something to consider.

Signed-off-by: default avatarAndres More <more.andres@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent cbf05091
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -156,7 +156,7 @@ PKnownBSS BSSpSearchBSSList(void *hDeviceContext,

            if ((pCurrBSS->bActive) &&
                (pCurrBSS->bSelected == FALSE)) {
                if (IS_ETH_ADDRESS_EQUAL(pCurrBSS->abyBSSID, pbyBSSID)) {
		    if (!compare_ether_addr(pCurrBSS->abyBSSID, pbyBSSID)) {
                    if (pSSID != NULL) {
                        // compare ssid
                        if ( !memcmp(pSSID->abySSID,
@@ -296,7 +296,8 @@ void BSSvClearBSSList(void *hDeviceContext, BOOL bKeepCurrBSSID)
    for (ii = 0; ii < MAX_BSS_NUM; ii++) {
        if (bKeepCurrBSSID) {
            if (pMgmt->sBSSList[ii].bActive &&
                IS_ETH_ADDRESS_EQUAL(pMgmt->sBSSList[ii].abyBSSID, pMgmt->abyCurrBSSID)) {
		!compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID,
				    pMgmt->abyCurrBSSID)) {
 //mike mark: there are two same BSSID in list if that AP is in hidden ssid mode,one 's SSID is null,
 //                 but other's is obvious, so if it acssociate with your STA  exactly,you must keep two
 //                 of them!!!!!!!!!
@@ -341,7 +342,7 @@ PKnownBSS BSSpAddrIsInBSSList(void *hDeviceContext,
    for (ii = 0; ii < MAX_BSS_NUM; ii++) {
        pBSSList = &(pMgmt->sBSSList[ii]);
        if (pBSSList->bActive) {
            if (IS_ETH_ADDRESS_EQUAL(pBSSList->abyBSSID, abyBSSID)) {
		if (!compare_ether_addr(pBSSList->abyBSSID, abyBSSID)) {
                if (pSSID->len == ((PWLAN_IE_SSID)pBSSList->abySSID)->len){
                    if (memcmp(pSSID->abySSID,
                            ((PWLAN_IE_SSID)pBSSList->abySSID)->abySSID,
@@ -744,7 +745,8 @@ BOOL BSSbIsSTAInNodeDB(void *hDeviceContext,
    // Index = 0 reserved for AP Node
    for (ii = 1; ii < (MAX_NODE_NUM + 1); ii++) {
        if (pMgmt->sNodeDBTable[ii].bActive) {
            if (IS_ETH_ADDRESS_EQUAL(abyDstAddr, pMgmt->sNodeDBTable[ii].abyMACAddr)) {
		if (!compare_ether_addr(abyDstAddr,
					pMgmt->sNodeDBTable[ii].abyMACAddr)) {
                *puNodeIndex = ii;
                return TRUE;
            }
+8 −7
Original line number Diff line number Diff line
@@ -195,10 +195,9 @@ s_vProcessRxMACHeader (
    };

    pbyRxBuffer = (PBYTE) (pbyRxBufferAddr + cbHeaderSize);
    if (IS_ETH_ADDRESS_EQUAL(pbyRxBuffer, &pDevice->abySNAP_Bridgetunnel[0])) {
    if (!compare_ether_addr(pbyRxBuffer, &pDevice->abySNAP_Bridgetunnel[0])) {
        cbHeaderSize += 6;
    }
    else if (IS_ETH_ADDRESS_EQUAL(pbyRxBuffer, &pDevice->abySNAP_RFC1042[0])) {
    } else if (!compare_ether_addr(pbyRxBuffer, &pDevice->abySNAP_RFC1042[0])) {
        cbHeaderSize += 6;
        pwType = (PWORD) (pbyRxBufferAddr + cbHeaderSize);
        if ((*pwType!= TYPE_PKT_IPX) && (*pwType != cpu_to_le16(0xF380))) {
@@ -453,7 +452,7 @@ RXbBulkInProcessData (
    if ((pMgmt->eCurrMode == WMAC_MODE_STANDBY) ||
        (pMgmt->eCurrMode == WMAC_MODE_ESS_STA)) {
       if (pMgmt->sNodeDBTable[0].bActive) {
         if(IS_ETH_ADDRESS_EQUAL (pMgmt->abyCurrBSSID, pMACHeader->abyAddr2) ) {
	 if (!compare_ether_addr(pMgmt->abyCurrBSSID, pMACHeader->abyAddr2)) {
	    if (pMgmt->sNodeDBTable[0].uInActiveCount != 0)
                  pMgmt->sNodeDBTable[0].uInActiveCount = 0;
           }
@@ -466,7 +465,8 @@ RXbBulkInProcessData (
            return FALSE;
        }

        if ( !IS_ETH_ADDRESS_EQUAL (pDevice->abyCurrentNetAddr, pMACHeader->abyAddr1) ) {
	if (compare_ether_addr(pDevice->abyCurrentNetAddr,
			       pMACHeader->abyAddr1)) {
		return FALSE;
        }
    }
@@ -475,7 +475,8 @@ RXbBulkInProcessData (
    // Use for TKIP MIC
    s_vGetDASA(pbyFrame, &cbHeaderSize, &pDevice->sRxEthHeader);

    if (IS_ETH_ADDRESS_EQUAL((PBYTE)&(pDevice->sRxEthHeader.abySrcAddr[0]), pDevice->abyCurrentNetAddr))
    if (!compare_ether_addr((PBYTE)&(pDevice->sRxEthHeader.abySrcAddr[0]),
			    pDevice->abyCurrentNetAddr))
        return FALSE;

    if ((pMgmt->eCurrMode == WMAC_MODE_ESS_AP) || (pMgmt->eCurrMode == WMAC_MODE_IBSS_STA)) {
+4 −35
Original line number Diff line number Diff line
@@ -349,39 +349,6 @@ int iwctl_giwscan(struct net_device *dev,
			}
			iwe.u.qual.updated=7;

//2008-0409-01, <Mark> by Einsn Liu
/*
//2008-0220-03, <Modify>  by Einsn Liu
	if(pDevice->bLinkPass== TRUE && IS_ETH_ADDRESS_EQUAL(pBSS->abyBSSID, pMgmt->abyCurrBSSID)){
	#ifdef Calcu_LinkQual
	 #if 0
	  if(pDevice->byBBType == BB_TYPE_11B) {
	     if(pDevice->byCurrSQ > 120)
                  pDevice->scStatistic.LinkQuality = 100;
	     else
		 pDevice->scStatistic.LinkQuality = pDevice->byCurrSQ*100/120;
	    }
	  else if(pDevice->byBBType == BB_TYPE_11G) {
                if(pDevice->byCurrSQ < 20)
		   pDevice->scStatistic.LinkQuality = 100;
	       else if(pDevice->byCurrSQ >96)
		   pDevice->scStatistic.LinkQuality  = 0;
	       else
		   pDevice->scStatistic.LinkQuality = (96-pDevice->byCurrSQ)*100/76;
	   }
	   if(pDevice->bLinkPass !=TRUE)
	       pDevice->scStatistic.LinkQuality = 0;
	  #endif
	   if(pDevice->scStatistic.LinkQuality > 100)
   	       pDevice->scStatistic.LinkQuality = 100;
              iwe.u.qual.qual =(BYTE) pDevice->scStatistic.LinkQuality;
	#else
	iwe.u.qual.qual = pDevice->byCurrSQ;
	#endif
		}else {
	        iwe.u.qual.qual = 0;
		}
*/
                 current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
       	//ADD encryption
            memset(&iwe, 0, sizeof(iwe));
@@ -772,7 +739,8 @@ int iwctl_siwap(struct net_device *dev,
		unsigned int ii, uSameBssidNum = 0;
                  for (ii = 0; ii < MAX_BSS_NUM; ii++) {
                     if (pMgmt->sBSSList[ii].bActive &&
                        IS_ETH_ADDRESS_EQUAL(pMgmt->sBSSList[ii].abyBSSID,pMgmt->abyDesireBSSID)) {
			 !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID,
					     pMgmt->abyDesireBSSID)) {
                        uSameBssidNum++;
                     }
                  }
@@ -957,7 +925,8 @@ int iwctl_siwessid(struct net_device *dev,
                     //         by means of judging if there are two same BSSID exist in list ?
                  for (ii = 0; ii < MAX_BSS_NUM; ii++) {
                     if (pMgmt->sBSSList[ii].bActive &&
                        IS_ETH_ADDRESS_EQUAL(pMgmt->sBSSList[ii].abyBSSID, pCurr->abyBSSID)) {
			 !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID,
					     pCurr->abyBSSID)) {
                        uSameBssidNum++;
                     }
                  }
+5 −5
Original line number Diff line number Diff line
@@ -174,7 +174,7 @@ BOOL KeybGetKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyIndex,
    *pKey = NULL;
    for (i=0;i<MAX_KEY_TABLE;i++) {
        if ((pTable->KeyTable[i].bInUse == TRUE) &&
            IS_ETH_ADDRESS_EQUAL(pTable->KeyTable[i].abyBSSID,pbyBSSID)) {
	    !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) {
            if (dwKeyIndex == 0xFFFFFFFF) {
                if (pTable->KeyTable[i].PairwiseKey.bKeyValid == TRUE) {
                    *pKey = &(pTable->KeyTable[i].PairwiseKey);
@@ -245,7 +245,7 @@ BOOL KeybSetKey(
            j = i;
        }
        if ((pTable->KeyTable[i].bInUse == TRUE) &&
            IS_ETH_ADDRESS_EQUAL(pTable->KeyTable[i].abyBSSID,pbyBSSID)) {
	    !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) {
            // found table already exist
            if ((dwKeyIndex & PAIRWISE_KEY) != 0) {
                // Pairwise key
@@ -427,7 +427,7 @@ BOOL KeybRemoveKey(
    } else {
        for (i=0;i<MAX_KEY_TABLE;i++) {
            if ( (pTable->KeyTable[i].bInUse == TRUE) &&
                 IS_ETH_ADDRESS_EQUAL(pTable->KeyTable[i].abyBSSID,pbyBSSID)) {
		 !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) {

                if ((dwKeyIndex & PAIRWISE_KEY) != 0) {
                    pTable->KeyTable[i].PairwiseKey.bKeyValid = FALSE;
@@ -483,7 +483,7 @@ BOOL KeybRemoveAllKey(

    for (i=0;i<MAX_KEY_TABLE;i++) {
        if ((pTable->KeyTable[i].bInUse == TRUE) &&
            IS_ETH_ADDRESS_EQUAL(pTable->KeyTable[i].abyBSSID,pbyBSSID)) {
	    !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) {
            pTable->KeyTable[i].PairwiseKey.bKeyValid = FALSE;
	    for (u = 0; u < MAX_GROUP_KEY; u++)
		pTable->KeyTable[i].GroupKey[u].bKeyValid = FALSE;
@@ -561,7 +561,7 @@ BOOL KeybGetTransmitKey(PSKeyManagement pTable, PBYTE pbyBSSID, DWORD dwKeyType,
    *pKey = NULL;
    for (i=0;i<MAX_KEY_TABLE;i++) {
        if ((pTable->KeyTable[i].bInUse == TRUE) &&
            IS_ETH_ADDRESS_EQUAL(pTable->KeyTable[i].abyBSSID,pbyBSSID)) {
	    !compare_ether_addr(pTable->KeyTable[i].abyBSSID, pbyBSSID)) {

            if (dwKeyType == PAIRWISE_KEY) {

+0 −6
Original line number Diff line number Diff line
@@ -204,12 +204,6 @@ S802_11Header, *PS802_11Header;
    (*(PWORD)((PBYTE)(pbyEtherAddr) + 4) == 0)      \
)

#define IS_ETH_ADDRESS_EQUAL(pbyAddr1, pbyAddr2) (  \
    (*(PDWORD)(pbyAddr1) == *(PDWORD)(pbyAddr2)) && \
    (*(PWORD)((PBYTE)(pbyAddr1) + 4) ==             \
    *(PWORD)((PBYTE)(pbyAddr2) + 4))                \
)

/*---------------------  Export Classes  ----------------------------*/

/*---------------------  Export Variables  --------------------------*/
Loading