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: Andres More <more.andres@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
parent
cbf05091e5
commit
4722a26cc6
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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,8 +465,9 @@ RXbBulkInProcessData (
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
if ( !IS_ETH_ADDRESS_EQUAL (pDevice->abyCurrentNetAddr, pMACHeader->abyAddr1) ) {
|
||||
return FALSE;
|
||||
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)) {
|
||||
|
|
|
@ -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++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
||||
|
|
|
@ -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 --------------------------*/
|
||||
|
|
|
@ -79,7 +79,8 @@ BOOL WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader)
|
|||
for (ii = 0; ii < DUPLICATE_RX_CACHE_LENGTH; ii++) {
|
||||
pCacheEntry = &(pCache->asCacheEntry[uIndex]);
|
||||
if ((pCacheEntry->wFmSequence == pMACHeader->wSeqCtl) &&
|
||||
(IS_ETH_ADDRESS_EQUAL (&(pCacheEntry->abyAddr2[0]), &(pMACHeader->abyAddr2[0]))) &&
|
||||
(!compare_ether_addr(&(pCacheEntry->abyAddr2[0]),
|
||||
&(pMACHeader->abyAddr2[0]))) &&
|
||||
(LOBYTE(pCacheEntry->wFrameCtl) == LOBYTE(pMACHeader->wFrameCtl))
|
||||
) {
|
||||
/* Duplicate match */
|
||||
|
@ -118,7 +119,7 @@ unsigned int WCTLuSearchDFCB(PSDevice pDevice, PS802_11Header pMACHeader)
|
|||
|
||||
for (ii = 0; ii < pDevice->cbDFCB; ii++) {
|
||||
if ((pDevice->sRxDFCB[ii].bInUse == TRUE) &&
|
||||
(IS_ETH_ADDRESS_EQUAL(&(pDevice->sRxDFCB[ii].abyAddr2[0]),
|
||||
(!compare_ether_addr(&(pDevice->sRxDFCB[ii].abyAddr2[0]),
|
||||
&(pMACHeader->abyAddr2[0])))) {
|
||||
return ii;
|
||||
}
|
||||
|
|
|
@ -1705,7 +1705,8 @@ s_vMgrRxDeauthentication(
|
|||
pDevice->fWPA_Authened = FALSE;
|
||||
DBG_PRT(MSG_LEVEL_NOTICE, KERN_INFO "AP deauthed me, reason=%d.\n", cpu_to_le16((*(sFrame.pwReason))));
|
||||
// TODO: update BSS list for specific BSSID if pre-authentication case
|
||||
if (IS_ETH_ADDRESS_EQUAL(sFrame.pHdr->sA3.abyAddr3, pMgmt->abyCurrBSSID)) {
|
||||
if (!compare_ether_addr(sFrame.pHdr->sA3.abyAddr3,
|
||||
pMgmt->abyCurrBSSID)) {
|
||||
if (pMgmt->eCurrState >= WMAC_STATE_AUTHPENDING) {
|
||||
pMgmt->sNodeDBTable[0].bActive = FALSE;
|
||||
pMgmt->eCurrMode = WMAC_MODE_STANDBY;
|
||||
|
@ -3099,12 +3100,6 @@ s_vMgrSynchBSS (
|
|||
PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
|
||||
/* 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, pCurr->abyBSSID)) {
|
||||
// uSameBssidNum++;
|
||||
// }
|
||||
// }
|
||||
// if( uSameBssidNum>=2) { //we only check AP in hidden sssid mode
|
||||
if ((pMgmt->eAuthenMode == WMAC_AUTH_WPAPSK) || //networkmanager 0.7.0 does not give the pairwise-key selsection,
|
||||
(pMgmt->eAuthenMode == WMAC_AUTH_WPA2PSK)) { // so we need re-selsect it according to real pairwise-key info.
|
||||
|
|
|
@ -402,7 +402,7 @@ int wpa_set_wpadev(PSDevice pDevice, int val)
|
|||
|
||||
} else {
|
||||
// Key Table Full
|
||||
if (IS_ETH_ADDRESS_EQUAL(¶m->addr[0], pDevice->abyBSSID)) {
|
||||
if (!compare_ether_addr(¶m->addr[0], pDevice->abyBSSID)) {
|
||||
//DBG_PRN_WLAN03(("return NDIS_STATUS_INVALID_DATA -Key Table Full.2\n"));
|
||||
return -EINVAL;
|
||||
|
||||
|
|
Loading…
Reference in New Issue