From: Andres More <more.andres@xxxxxxxxx> Replaced custom U_ETHER_ADDR_LEN by ETH_ALEN from <linux/if_ether.h>. Resolved checkpatch findings on the changed lines, mostly indentation. Signed-off-by: Andres More <more.andres@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx> --- drivers/staging/vt6656/aes_ccmp.c | 11 +- drivers/staging/vt6656/desc.h | 6 +- drivers/staging/vt6656/device.h | 22 ++-- drivers/staging/vt6656/dpc.c | 85 ++++++++------- drivers/staging/vt6656/ioctl.c | 4 +- drivers/staging/vt6656/key.c | 4 +- drivers/staging/vt6656/key.h | 2 +- drivers/staging/vt6656/main_usb.c | 41 ++++--- drivers/staging/vt6656/mib.c | 19 ++-- drivers/staging/vt6656/mib.h | 4 +- drivers/staging/vt6656/rxtx.c | 218 +++++++++++++++++++++++-------------- drivers/staging/vt6656/rxtx.h | 6 +- drivers/staging/vt6656/tether.c | 2 +- drivers/staging/vt6656/tether.h | 22 ++-- drivers/staging/vt6656/wctl.c | 6 +- drivers/staging/vt6656/wmgr.c | 52 +++++---- drivers/staging/vt6656/wpa2.c | 31 +++-- drivers/staging/vt6656/wpactl.c | 2 +- 18 files changed, 310 insertions(+), 227 deletions(-) diff --git a/drivers/staging/vt6656/aes_ccmp.c b/drivers/staging/vt6656/aes_ccmp.c index 401a7d2..a1beaa9 100644 --- a/drivers/staging/vt6656/aes_ccmp.c +++ b/drivers/staging/vt6656/aes_ccmp.c @@ -277,7 +277,7 @@ int ii,jj,kk; pbyPayload = pbyIV + 8; //IV-length abyNonce[0] = 0x00; //now is 0, if Qos here will be priority - memcpy(&(abyNonce[1]), pMACHeader->abyAddr2, U_ETHER_ADDR_LEN); + memcpy(&(abyNonce[1]), pMACHeader->abyAddr2, ETH_ALEN); abyNonce[7] = pbyIV[7]; abyNonce[8] = pbyIV[6]; abyNonce[9] = pbyIV[5]; @@ -299,16 +299,17 @@ int ii,jj,kk; byTmp = (BYTE)(pMACHeader->wFrameCtl >> 8); byTmp &= 0x87; MIC_HDR1[3] = byTmp | 0x40; - memcpy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, U_ETHER_ADDR_LEN); - memcpy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, U_ETHER_ADDR_LEN); + memcpy(&(MIC_HDR1[4]), pMACHeader->abyAddr1, ETH_ALEN); + memcpy(&(MIC_HDR1[10]), pMACHeader->abyAddr2, ETH_ALEN); //MIC_HDR2 - memcpy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, U_ETHER_ADDR_LEN); + memcpy(&(MIC_HDR2[0]), pMACHeader->abyAddr3, ETH_ALEN); byTmp = (BYTE)(pMACHeader->wSeqCtl & 0xff); MIC_HDR2[6] = byTmp & 0x0f; MIC_HDR2[7] = 0; + if ( bA4 ) { - memcpy(&(MIC_HDR2[8]), pMACHeader->abyAddr4, U_ETHER_ADDR_LEN); + memcpy(&(MIC_HDR2[8]), pMACHeader->abyAddr4, ETH_ALEN); } else { MIC_HDR2[8] = 0x00; MIC_HDR2[9] = 0x00; diff --git a/drivers/staging/vt6656/desc.h b/drivers/staging/vt6656/desc.h index f10530f..c87ea6b 100644 --- a/drivers/staging/vt6656/desc.h +++ b/drivers/staging/vt6656/desc.h @@ -206,8 +206,8 @@ typedef const SRrvTime_atim *PCSRrvTime_atim; typedef struct tagSRTSData { WORD wFrameControl; WORD wDurationID; - BYTE abyRA[U_ETHER_ADDR_LEN]; - BYTE abyTA[U_ETHER_ADDR_LEN]; + BYTE abyRA[ETH_ALEN]; + BYTE abyTA[ETH_ALEN]; }__attribute__ ((__packed__)) SRTSData, *PSRTSData; typedef const SRTSData *PCSRTSData; @@ -282,7 +282,7 @@ typedef const SRTS_a_FB *PCSRTS_a_FB; typedef struct tagSCTSData { WORD wFrameControl; WORD wDurationID; - BYTE abyRA[U_ETHER_ADDR_LEN]; + BYTE abyRA[ETH_ALEN]; WORD wReserved; }__attribute__ ((__packed__)) SCTSData, *PSCTSData; diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index 8b541d1..29bb597 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -107,7 +107,7 @@ #define MAC_MAX_CONTEXT_REG (256+128) #define MAX_MULTICAST_ADDRESS_NUM 32 -#define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * U_ETHER_ADDR_LEN) +#define MULTICAST_ADDRESS_LIST_SIZE (MAX_MULTICAST_ADDRESS_NUM * ETH_ALEN) //#define OP_MODE_INFRASTRUCTURE 0 @@ -369,7 +369,7 @@ typedef struct tagSQuietControl { // The receive duplicate detection cache entry typedef struct tagSCacheEntry{ WORD wFmSequence; - BYTE abyAddr2[U_ETHER_ADDR_LEN]; + BYTE abyAddr2[ETH_ALEN]; WORD wFrameCtl; } SCacheEntry, *PSCacheEntry; @@ -387,7 +387,7 @@ typedef struct tagSDeFragControlBlock { WORD wSequence; WORD wFragNum; - BYTE abyAddr2[U_ETHER_ADDR_LEN]; + BYTE abyAddr2[ETH_ALEN]; UINT uLifetime; struct sk_buff* skb; PBYTE pbyRxBuffer; @@ -547,10 +547,10 @@ typedef struct __device_info { BYTE byOriginalZonetype; BOOL bLinkPass; // link status: OK or fail - BYTE abyCurrentNetAddr[U_ETHER_ADDR_LEN]; - BYTE abyPermanentNetAddr[U_ETHER_ADDR_LEN]; + BYTE abyCurrentNetAddr[ETH_ALEN]; + BYTE abyPermanentNetAddr[ETH_ALEN]; // SW network address -// BYTE abySoftwareNetAddr[U_ETHER_ADDR_LEN]; + /* u8 abySoftwareNetAddr[ETH_ALEN]; */ BOOL bExistSWNetAddr; // Adapter statistics @@ -671,8 +671,8 @@ typedef struct __device_info { CARD_OP_MODE eOPMode; BOOL bBSSIDFilter; WORD wMaxTransmitMSDULifetime; - BYTE abyBSSID[U_ETHER_ADDR_LEN]; - BYTE abyDesireBSSID[U_ETHER_ADDR_LEN]; + BYTE abyBSSID[ETH_ALEN]; + BYTE abyDesireBSSID[ETH_ALEN]; WORD wCTSDuration; // update while speed change WORD wACKDuration; // update while speed change WORD wRTSTransmitLen; // update while speed change @@ -826,9 +826,9 @@ typedef struct __device_info { SEthernetHeader sTxEthHeader; SEthernetHeader sRxEthHeader; - BYTE abyBroadcastAddr[U_ETHER_ADDR_LEN]; - BYTE abySNAP_RFC1042[U_ETHER_ADDR_LEN]; - BYTE abySNAP_Bridgetunnel[U_ETHER_ADDR_LEN]; + BYTE abyBroadcastAddr[ETH_ALEN]; + BYTE abySNAP_RFC1042[ETH_ALEN]; + BYTE abySNAP_Bridgetunnel[ETH_ALEN]; // Pre-Authentication & PMK cache SPMKID gsPMKID; diff --git a/drivers/staging/vt6656/dpc.c b/drivers/staging/vt6656/dpc.c index 835c6d6..9e833bb 100644 --- a/drivers/staging/vt6656/dpc.c +++ b/drivers/staging/vt6656/dpc.c @@ -234,11 +234,11 @@ s_vProcessRxMACHeader ( } } - cbHeaderSize -= (U_ETHER_ADDR_LEN * 2); + cbHeaderSize -= (ETH_ALEN * 2); pbyRxBuffer = (PBYTE) (pbyRxBufferAddr + cbHeaderSize); - for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) + for (ii = 0; ii < ETH_ALEN; ii++) *pbyRxBuffer++ = pDevice->sRxEthHeader.abyDstAddr[ii]; - for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) + for (ii = 0; ii < ETH_ALEN; ii++) *pbyRxBuffer++ = pDevice->sRxEthHeader.abySrcAddr[ii]; *pcbHeadSize = cbHeaderSize; @@ -267,43 +267,48 @@ s_vGetDASA ( OUT PSEthernetHeader psEthHeader ) { - UINT cbHeaderSize = 0; - PS802_11Header pMACHeader; - int ii; - - pMACHeader = (PS802_11Header) (pbyRxBufferAddr + cbHeaderSize); - - if ((pMACHeader->wFrameCtl & FC_TODS) == 0) { - if (pMACHeader->wFrameCtl & FC_FROMDS) { - for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) { - psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr1[ii]; - psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr3[ii]; - } - } - else { - // IBSS mode - for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) { - psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr1[ii]; - psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr2[ii]; - } - } - } - else { - // Is AP mode.. - if (pMACHeader->wFrameCtl & FC_FROMDS) { - for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) { - psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr3[ii]; - psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr4[ii]; - cbHeaderSize += 6; - } - } - else { - for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) { - psEthHeader->abyDstAddr[ii] = pMACHeader->abyAddr3[ii]; - psEthHeader->abySrcAddr[ii] = pMACHeader->abyAddr2[ii]; - } - } - }; + UINT cbHeaderSize = 0; + PS802_11Header pMACHeader; + int ii; + + pMACHeader = (PS802_11Header) (pbyRxBufferAddr + cbHeaderSize); + + if ((pMACHeader->wFrameCtl & FC_TODS) == 0) { + if (pMACHeader->wFrameCtl & FC_FROMDS) { + for (ii = 0; ii < ETH_ALEN; ii++) { + psEthHeader->abyDstAddr[ii] = + pMACHeader->abyAddr1[ii]; + psEthHeader->abySrcAddr[ii] = + pMACHeader->abyAddr3[ii]; + } + } else { + /* IBSS mode */ + for (ii = 0; ii < ETH_ALEN; ii++) { + psEthHeader->abyDstAddr[ii] = + pMACHeader->abyAddr1[ii]; + psEthHeader->abySrcAddr[ii] = + pMACHeader->abyAddr2[ii]; + } + } + } else { + /* Is AP mode.. */ + if (pMACHeader->wFrameCtl & FC_FROMDS) { + for (ii = 0; ii < ETH_ALEN; ii++) { + psEthHeader->abyDstAddr[ii] = + pMACHeader->abyAddr3[ii]; + psEthHeader->abySrcAddr[ii] = + pMACHeader->abyAddr4[ii]; + cbHeaderSize += 6; + } + } else { + for (ii = 0; ii < ETH_ALEN; ii++) { + psEthHeader->abyDstAddr[ii] = + pMACHeader->abyAddr3[ii]; + psEthHeader->abySrcAddr[ii] = + pMACHeader->abyAddr2[ii]; + } + } + }; *pcbHeaderSize = cbHeaderSize; } diff --git a/drivers/staging/vt6656/ioctl.c b/drivers/staging/vt6656/ioctl.c index 6f33005..d7a78f2 100644 --- a/drivers/staging/vt6656/ioctl.c +++ b/drivers/staging/vt6656/ioctl.c @@ -480,7 +480,9 @@ int private_ioctl(PSDevice pDevice, struct ifreq *rq) { }; if (sValue.dwValue == 1) { DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "up wpadev\n"); - memcpy(pDevice->wpadev->dev_addr, pDevice->dev->dev_addr, U_ETHER_ADDR_LEN); + memcpy(pDevice->wpadev->dev_addr, + pDevice->dev->dev_addr, + ETH_ALEN); pDevice->bWPADEVUp = TRUE; } else { diff --git a/drivers/staging/vt6656/key.c b/drivers/staging/vt6656/key.c index 13fc69a..0cd2751 100644 --- a/drivers/staging/vt6656/key.c +++ b/drivers/staging/vt6656/key.c @@ -312,7 +312,7 @@ BOOL KeybSetKey ( } } if (j < (MAX_KEY_TABLE-1)) { - memcpy(pTable->KeyTable[j].abyBSSID,pbyBSSID,U_ETHER_ADDR_LEN); + memcpy(pTable->KeyTable[j].abyBSSID, pbyBSSID, ETH_ALEN); pTable->KeyTable[j].bInUse = TRUE; if ((dwKeyIndex & PAIRWISE_KEY) != 0) { // Pairwise key @@ -700,7 +700,7 @@ BOOL KeybSetDefaultKey ( } pTable->KeyTable[MAX_KEY_TABLE-1].bInUse = TRUE; - for(ii=0;ii<U_ETHER_ADDR_LEN;ii++) + for (ii = 0; ii < ETH_ALEN; ii++) pTable->KeyTable[MAX_KEY_TABLE-1].abyBSSID[ii] = 0xFF; // Group key diff --git a/drivers/staging/vt6656/key.h b/drivers/staging/vt6656/key.h index b15a64c..da8dfe0 100644 --- a/drivers/staging/vt6656/key.h +++ b/drivers/staging/vt6656/key.h @@ -71,7 +71,7 @@ typedef struct tagSKeyItem typedef struct tagSKeyTable { - BYTE abyBSSID[U_ETHER_ADDR_LEN]; //6 + BYTE abyBSSID[ETH_ALEN]; /* 6 */ BYTE byReserved0[2]; //8 SKeyItem PairwiseKey; SKeyItem GroupKey[MAX_GROUP_KEY]; //64*5 = 320, 320+8=328 diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index ea6c94d..c0bad4f 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -295,14 +295,13 @@ static void usb_device_reset(PSDevice pDevice); static void device_set_options(PSDevice pDevice) { - BYTE abyBroadcastAddr[U_ETHER_ADDR_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - BYTE abySNAP_RFC1042[U_ETHER_ADDR_LEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; - BYTE abySNAP_Bridgetunnel[U_ETHER_ADDR_LEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; + BYTE abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + BYTE abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; + u8 abySNAP_Bridgetunnel[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; - - memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, U_ETHER_ADDR_LEN); - memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, U_ETHER_ADDR_LEN); - memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, U_ETHER_ADDR_LEN); + memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, ETH_ALEN); + memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, ETH_ALEN); + memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, ETH_ALEN); pDevice->cbTD = TX_DESC_DEF0; pDevice->cbRD = RX_DESC_DEF0; @@ -359,9 +358,9 @@ static VOID device_init_diversity_timer(PSDevice pDevice) { static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) { - BYTE abyBroadcastAddr[U_ETHER_ADDR_LEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; - BYTE abySNAP_RFC1042[U_ETHER_ADDR_LEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; - BYTE abySNAP_Bridgetunnel[U_ETHER_ADDR_LEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; + u8 abyBroadcastAddr[ETH_ALEN] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; + u8 abySNAP_RFC1042[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0x00}; + u8 abySNAP_Bridgetunnel[ETH_ALEN] = {0xAA, 0xAA, 0x03, 0x00, 0x00, 0xF8}; BYTE byAntenna; UINT ii; CMD_CARD_INIT sInitCmd; @@ -375,10 +374,12 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "---->INIbInitAdapter. [%d][%d]\n", InitType, pDevice->byPacketType); spin_lock_irq(&pDevice->lock); - if (InitType == DEVICE_INIT_COLD) { - memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, U_ETHER_ADDR_LEN); - memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, U_ETHER_ADDR_LEN); - memcpy(pDevice->abySNAP_Bridgetunnel, abySNAP_Bridgetunnel, U_ETHER_ADDR_LEN); + if (InitType == DEVICE_INIT_COLD) { + memcpy(pDevice->abyBroadcastAddr, abyBroadcastAddr, ETH_ALEN); + memcpy(pDevice->abySNAP_RFC1042, abySNAP_RFC1042, ETH_ALEN); + memcpy(pDevice->abySNAP_Bridgetunnel, + abySNAP_Bridgetunnel, + ETH_ALEN); if ( !FIRMWAREbCheckVersion(pDevice) ) { if (FIRMWAREbDownload(pDevice) == TRUE) { @@ -603,7 +604,9 @@ static BOOL device_init_registers(PSDevice pDevice, DEVICE_INIT_TYPE InitType) // get Permanent network address memcpy(pDevice->abyPermanentNetAddr,&(sInitRsp.byNetAddr[0]),6); - memcpy(pDevice->abyCurrentNetAddr, pDevice->abyPermanentNetAddr, U_ETHER_ADDR_LEN); + memcpy(pDevice->abyCurrentNetAddr, + pDevice->abyPermanentNetAddr, + ETH_ALEN); // if exist SW network address, use SW network address. @@ -757,7 +760,7 @@ static const struct net_device_ops device_netdev_ops = { static int __devinit vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) { - BYTE fake_mac[U_ETHER_ADDR_LEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x01};//fake MAC address + u8 fake_mac[ETH_ALEN] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x01}; struct usb_device *udev = interface_to_usbdev(intf); int rc = 0; struct net_device *netdev = NULL; @@ -798,7 +801,7 @@ vt6656_probe(struct usb_interface *intf, const struct usb_device_id *id) //2007-0821-01<Add>by MikeLiu usb_set_intfdata(intf, pDevice); SET_NETDEV_DEV(netdev, &intf->dev); - memcpy(pDevice->dev->dev_addr, fake_mac, U_ETHER_ADDR_LEN); //use fake mac address + memcpy(pDevice->dev->dev_addr, fake_mac, ETH_ALEN); rc = register_netdev(netdev); if (rc != 0) { printk(KERN_ERR DEVICE_NAME " Failed to register netdev\n"); @@ -1101,8 +1104,8 @@ static int device_open(struct net_device *dev) { // Init for Key Management KeyvInitTable(pDevice,&pDevice->sKey); - memcpy(pDevice->sMgmtObj.abyMACAddr, pDevice->abyCurrentNetAddr, U_ETHER_ADDR_LEN); - memcpy(pDevice->dev->dev_addr, pDevice->abyCurrentNetAddr, U_ETHER_ADDR_LEN); + memcpy(pDevice->sMgmtObj.abyMACAddr, pDevice->abyCurrentNetAddr, ETH_ALEN); + memcpy(pDevice->dev->dev_addr, pDevice->abyCurrentNetAddr, ETH_ALEN); pDevice->bStopTx0Pkt = FALSE; pDevice->bStopDataPkt = FALSE; pDevice->bRoaming = FALSE; //DavidWang diff --git a/drivers/staging/vt6656/mib.c b/drivers/staging/vt6656/mib.c index 910e610..b6f138e 100644 --- a/drivers/staging/vt6656/mib.c +++ b/drivers/staging/vt6656/mib.c @@ -156,18 +156,17 @@ void STAvUpdateRDStatCounter (PSStatCounter pStatistic, BYTE byRSR, BYTE byNewRSR, BYTE byRxSts, BYTE byRxRate, PBYTE pbyBuffer, UINT cbFrameLength) { - //need change - PS802_11Header pHeader = (PS802_11Header)pbyBuffer; + /* need change */ + PS802_11Header pHeader = (PS802_11Header)pbyBuffer; - if (byRSR & RSR_ADDROK) - pStatistic->dwRsrADDROk++; - if (byRSR & RSR_CRCOK) { - pStatistic->dwRsrCRCOk++; + if (byRSR & RSR_ADDROK) + pStatistic->dwRsrADDROk++; + if (byRSR & RSR_CRCOK) { + pStatistic->dwRsrCRCOk++; + pStatistic->ullRsrOK++; - pStatistic->ullRsrOK++; - - if (cbFrameLength >= U_ETHER_ADDR_LEN) { - // update counters in case that successful transmit + if (cbFrameLength >= ETH_ALEN) { + /* update counters in case of successful transmission */ if (byRSR & RSR_ADDRBROAD) { pStatistic->ullRxBroadcastFrames++; pStatistic->ullRxBroadcastBytes += (ULONGLONG)cbFrameLength; diff --git a/drivers/staging/vt6656/mib.h b/drivers/staging/vt6656/mib.h index ac996d2..d1d7817 100644 --- a/drivers/staging/vt6656/mib.h +++ b/drivers/staging/vt6656/mib.h @@ -91,7 +91,7 @@ typedef struct tagSMib2Counter { LONG ifType; LONG ifMtu; DWORD ifSpeed; - BYTE ifPhysAddress[U_ETHER_ADDR_LEN]; + BYTE ifPhysAddress[ETH_ALEN]; LONG ifAdminStatus; LONG ifOperStatus; DWORD ifLastChange; @@ -231,7 +231,7 @@ typedef struct tagSTxPktInfo { BYTE byBroadMultiUni; WORD wLength; WORD wFIFOCtl; - BYTE abyDestAddr[U_ETHER_ADDR_LEN]; + BYTE abyDestAddr[ETH_ALEN]; } STxPktInfo, *PSTxPktInfo; diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index d9fa36c..03b8b4d 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -322,7 +322,9 @@ s_vSaveTxPktInfo(PSDevice pDevice, BYTE byPktNum, PBYTE pbyDestAddr, WORD wPktLe pStatistic->abyTxPktInfo[byPktNum].wLength = wPktLength; pStatistic->abyTxPktInfo[byPktNum].wFIFOCtl = wFIFOCtl; - memcpy(pStatistic->abyTxPktInfo[byPktNum].abyDestAddr, pbyDestAddr, U_ETHER_ADDR_LEN); + memcpy(pStatistic->abyTxPktInfo[byPktNum].abyDestAddr, + pbyDestAddr, + ETH_ALEN); } @@ -1026,18 +1028,27 @@ s_vFillRTSHead ( pBuf->Data.wDurationID = pBuf->wDuration_aa; //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 - if ((pDevice->eOPMode == OP_MODE_ADHOC) || - (pDevice->eOPMode == OP_MODE_AP)) { - memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - } + + if ((pDevice->eOPMode == OP_MODE_ADHOC) || + (pDevice->eOPMode == OP_MODE_AP)) { + memcpy(&(pBuf->Data.abyRA[0]), + &(psEthHeader->abyDstAddr[0]), + ETH_ALEN); + } else { - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } - if (pDevice->eOPMode == OP_MODE_AP) { - memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } + memcpy(&(pBuf->Data.abyRA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } + if (pDevice->eOPMode == OP_MODE_AP) { + memcpy(&(pBuf->Data.abyTA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } else { - memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyTA[0]), + &(psEthHeader->abySrcAddr[0]), + ETH_ALEN); } } else { @@ -1063,19 +1074,27 @@ s_vFillRTSHead ( //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 - if ((pDevice->eOPMode == OP_MODE_ADHOC) || - (pDevice->eOPMode == OP_MODE_AP)) { - memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - } + if ((pDevice->eOPMode == OP_MODE_ADHOC) || + (pDevice->eOPMode == OP_MODE_AP)) { + memcpy(&(pBuf->Data.abyRA[0]), + &(psEthHeader->abyDstAddr[0]), + ETH_ALEN); + } else { - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); } - if (pDevice->eOPMode == OP_MODE_AP) { - memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } + if (pDevice->eOPMode == OP_MODE_AP) { + memcpy(&(pBuf->Data.abyTA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } else { - memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyTA[0]), + &(psEthHeader->abySrcAddr[0]), + ETH_ALEN); } } // if (byFBOption == AUTO_FB_NONE) @@ -1094,20 +1113,26 @@ s_vFillRTSHead ( //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 - if ((pDevice->eOPMode == OP_MODE_ADHOC) || - (pDevice->eOPMode == OP_MODE_AP)) { - memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - } - else { - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } - - if (pDevice->eOPMode == OP_MODE_AP) { - memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } - else { - memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); - } + if ((pDevice->eOPMode == OP_MODE_ADHOC) || + (pDevice->eOPMode == OP_MODE_AP)) { + memcpy(&(pBuf->Data.abyRA[0]), + &(psEthHeader->abyDstAddr[0]), + ETH_ALEN); + } else { + memcpy(&(pBuf->Data.abyRA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } + + if (pDevice->eOPMode == OP_MODE_AP) { + memcpy(&(pBuf->Data.abyTA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } else { + memcpy(&(pBuf->Data.abyTA[0]), + &(psEthHeader->abySrcAddr[0]), + ETH_ALEN); + } } else { @@ -1125,19 +1150,25 @@ s_vFillRTSHead ( //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 - if ((pDevice->eOPMode == OP_MODE_ADHOC) || - (pDevice->eOPMode == OP_MODE_AP)) { - memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - } - else { - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } - if (pDevice->eOPMode == OP_MODE_AP) { - memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } - else { - memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); - } + if ((pDevice->eOPMode == OP_MODE_ADHOC) || + (pDevice->eOPMode == OP_MODE_AP)) { + memcpy(&(pBuf->Data.abyRA[0]), + &(psEthHeader->abyDstAddr[0]), + ETH_ALEN); + } else { + memcpy(&(pBuf->Data.abyRA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } + if (pDevice->eOPMode == OP_MODE_AP) { + memcpy(&(pBuf->Data.abyTA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } else { + memcpy(&(pBuf->Data.abyTA[0]), + &(psEthHeader->abySrcAddr[0]), + ETH_ALEN); + } } } else if (byPktType == PK_TYPE_11B) { @@ -1153,20 +1184,26 @@ s_vFillRTSHead ( //Get RTS Frame body pBuf->Data.wFrameControl = TYPE_CTL_RTS;//0x00B4 - - if ((pDevice->eOPMode == OP_MODE_ADHOC) || + if ((pDevice->eOPMode == OP_MODE_ADHOC) || (pDevice->eOPMode == OP_MODE_AP)) { - memcpy(&(pBuf->Data.abyRA[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), + &(psEthHeader->abyDstAddr[0]), + ETH_ALEN); } else { - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); } if (pDevice->eOPMode == OP_MODE_AP) { - memcpy(&(pBuf->Data.abyTA[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } - else { - memcpy(&(pBuf->Data.abyTA[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyTA[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } else { + memcpy(&(pBuf->Data.abyTA[0]), + &(psEthHeader->abySrcAddr[0]), + ETH_ALEN); } } } @@ -1222,7 +1259,9 @@ s_vFillCTSHead ( pBuf->Data.wDurationID = pBuf->wDuration_ba; pBuf->Data.wFrameControl = TYPE_CTL_CTS;//0x00C4 pBuf->Data.wReserved = 0x0000; - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyCurrentNetAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), + &(pDevice->abyCurrentNetAddr[0]), + ETH_ALEN); } else { //if (byFBOption != AUTO_FB_NONE && uDMAIdx != TYPE_ATIMDMA && uDMAIdx != TYPE_BEACONDMA) PSCTS pBuf = (PSCTS)pvCTS; //Get SignalField,ServiceField,Length @@ -1239,16 +1278,13 @@ s_vFillCTSHead ( pBuf->Data.wDurationID = pBuf->wDuration_ba; pBuf->Data.wFrameControl = TYPE_CTL_CTS;//0x00C4 pBuf->Data.wReserved = 0x0000; - memcpy(&(pBuf->Data.abyRA[0]), &(pDevice->abyCurrentNetAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pBuf->Data.abyRA[0]), + &(pDevice->abyCurrentNetAddr[0]), + ETH_ALEN); } } } - - - - - /*+ * * Description: @@ -1843,21 +1879,35 @@ s_vGenerateMACHeader ( } if (pDevice->eOPMode == OP_MODE_AP) { - memcpy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - memcpy(&(pMACHeader->abyAddr2[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - memcpy(&(pMACHeader->abyAddr3[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); + memcpy(&(pMACHeader->abyAddr1[0]), + &(psEthHeader->abyDstAddr[0]), + ETH_ALEN); + memcpy(&(pMACHeader->abyAddr2[0]), &(pDevice->abyBSSID[0]), ETH_ALEN); + memcpy(&(pMACHeader->abyAddr3[0]), + &(psEthHeader->abySrcAddr[0]), + ETH_ALEN); pMACHeader->wFrameCtl |= FC_FROMDS; - } - else { - if (pDevice->eOPMode == OP_MODE_ADHOC) { - memcpy(&(pMACHeader->abyAddr1[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - memcpy(&(pMACHeader->abyAddr2[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); - memcpy(&(pMACHeader->abyAddr3[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); - } - else { - memcpy(&(pMACHeader->abyAddr3[0]), &(psEthHeader->abyDstAddr[0]), U_ETHER_ADDR_LEN); - memcpy(&(pMACHeader->abyAddr2[0]), &(psEthHeader->abySrcAddr[0]), U_ETHER_ADDR_LEN); - memcpy(&(pMACHeader->abyAddr1[0]), &(pDevice->abyBSSID[0]), U_ETHER_ADDR_LEN); + } else { + if (pDevice->eOPMode == OP_MODE_ADHOC) { + memcpy(&(pMACHeader->abyAddr1[0]), + &(psEthHeader->abyDstAddr[0]), + ETH_ALEN); + memcpy(&(pMACHeader->abyAddr2[0]), + &(psEthHeader->abySrcAddr[0]), + ETH_ALEN); + memcpy(&(pMACHeader->abyAddr3[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); + } else { + memcpy(&(pMACHeader->abyAddr3[0]), + &(psEthHeader->abyDstAddr[0]), + ETH_ALEN); + memcpy(&(pMACHeader->abyAddr2[0]), + &(psEthHeader->abySrcAddr[0]), + ETH_ALEN); + memcpy(&(pMACHeader->abyAddr1[0]), + &(pDevice->abyBSSID[0]), + ETH_ALEN); pMACHeader->wFrameCtl |= FC_TODS; } } @@ -2089,8 +2139,12 @@ CMD_STATUS csMgmt_xmit( memset((PVOID)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderSize - wTxBufSize)); - memcpy(&(sEthHeader.abyDstAddr[0]), &(pPacket->p80211Header->sA3.abyAddr1[0]), U_ETHER_ADDR_LEN); - memcpy(&(sEthHeader.abySrcAddr[0]), &(pPacket->p80211Header->sA3.abyAddr2[0]), U_ETHER_ADDR_LEN); + memcpy(&(sEthHeader.abyDstAddr[0]), + &(pPacket->p80211Header->sA3.abyAddr1[0]), + ETH_ALEN); + memcpy(&(sEthHeader.abySrcAddr[0]), + &(pPacket->p80211Header->sA3.abyAddr2[0]), + ETH_ALEN); //========================= // No Fragmentation //========================= @@ -2521,8 +2575,12 @@ vDMA0_tx_80211(PSDevice pDevice, struct sk_buff *skb) { cbHeaderSize = wTxBufSize + sizeof(SRrvTime_ab) + cbMICHDR + sizeof(STxDataHead_ab); } memset((PVOID)(pbyTxBufferAddr + wTxBufSize), 0, (cbHeaderSize - wTxBufSize)); - memcpy(&(sEthHeader.abyDstAddr[0]), &(p80211Header->sA3.abyAddr1[0]), U_ETHER_ADDR_LEN); - memcpy(&(sEthHeader.abySrcAddr[0]), &(p80211Header->sA3.abyAddr2[0]), U_ETHER_ADDR_LEN); + memcpy(&(sEthHeader.abyDstAddr[0]), + &(p80211Header->sA3.abyAddr1[0]), + ETH_ALEN); + memcpy(&(sEthHeader.abySrcAddr[0]), + &(p80211Header->sA3.abyAddr2[0]), + ETH_ALEN); //========================= // No Fragmentation //========================= diff --git a/drivers/staging/vt6656/rxtx.h b/drivers/staging/vt6656/rxtx.h index 6bc22d3..133f475 100644 --- a/drivers/staging/vt6656/rxtx.h +++ b/drivers/staging/vt6656/rxtx.h @@ -43,8 +43,8 @@ typedef struct tagSRTSDataF { WORD wFrameControl; WORD wDurationID; - BYTE abyRA[U_ETHER_ADDR_LEN]; - BYTE abyTA[U_ETHER_ADDR_LEN]; + BYTE abyRA[ETH_ALEN]; + BYTE abyTA[ETH_ALEN]; } SRTSDataF, *PSRTSDataF; // @@ -53,7 +53,7 @@ typedef struct tagSRTSDataF { typedef struct tagSCTSDataF { WORD wFrameControl; WORD wDurationID; - BYTE abyRA[U_ETHER_ADDR_LEN]; + BYTE abyRA[ETH_ALEN]; WORD wReserved; } SCTSDataF, *PSCTSDataF; diff --git a/drivers/staging/vt6656/tether.c b/drivers/staging/vt6656/tether.c index ab1368a..a7c716f 100644 --- a/drivers/staging/vt6656/tether.c +++ b/drivers/staging/vt6656/tether.c @@ -68,7 +68,7 @@ BYTE ETHbyGetHashIndexByCrc32(PBYTE pbyMultiAddr) BYTE byHash = 0; /* get the least 6-bits from CRC generator */ - byTmpHash = (BYTE)(CRCdwCrc32(pbyMultiAddr, U_ETHER_ADDR_LEN, + byTmpHash = (BYTE)(CRCdwCrc32(pbyMultiAddr, ETH_ALEN, 0xFFFFFFFFL) & 0x3F); /* reverse most bit to least bit */ for (ii = 0; ii < (sizeof(byTmpHash) * 8); ii++) { diff --git a/drivers/staging/vt6656/tether.h b/drivers/staging/vt6656/tether.h index 5a3c326..af119dd 100644 --- a/drivers/staging/vt6656/tether.h +++ b/drivers/staging/vt6656/tether.h @@ -29,17 +29,17 @@ #ifndef __TETHER_H__ #define __TETHER_H__ +#include <linux/if_ether.h> #include "ttype.h" /*--------------------- Export Definitions -------------------------*/ // // constants // -#define U_ETHER_ADDR_LEN 6 // Ethernet address length #define U_TYPE_LEN 2 // #define U_CRC_LEN 4 // -#define U_HEADER_LEN (U_ETHER_ADDR_LEN * 2 + U_TYPE_LEN) -#define U_ETHER_ADDR_STR_LEN (U_ETHER_ADDR_LEN * 2 + 1) +#define U_HEADER_LEN (ETH_ALEN * 2 + U_TYPE_LEN) +#define U_ETHER_ADDR_STR_LEN (ETH_ALEN * 2 + 1) // Ethernet address string length #define MIN_DATA_LEN 46 // min data length @@ -167,8 +167,8 @@ // Ethernet packet // typedef struct tagSEthernetHeader { - BYTE abyDstAddr[U_ETHER_ADDR_LEN]; - BYTE abySrcAddr[U_ETHER_ADDR_LEN]; + BYTE abyDstAddr[ETH_ALEN]; + BYTE abySrcAddr[ETH_ALEN]; WORD wType; }__attribute__ ((__packed__)) SEthernetHeader, *PSEthernetHeader; @@ -178,8 +178,8 @@ SEthernetHeader, *PSEthernetHeader; // 802_3 packet // typedef struct tagS802_3Header { - BYTE abyDstAddr[U_ETHER_ADDR_LEN]; - BYTE abySrcAddr[U_ETHER_ADDR_LEN]; + BYTE abyDstAddr[ETH_ALEN]; + BYTE abySrcAddr[ETH_ALEN]; WORD wLen; }__attribute__ ((__packed__)) S802_3Header, *PS802_3Header; @@ -190,11 +190,11 @@ S802_3Header, *PS802_3Header; typedef struct tagS802_11Header { WORD wFrameCtl; WORD wDurationID; - BYTE abyAddr1[U_ETHER_ADDR_LEN]; - BYTE abyAddr2[U_ETHER_ADDR_LEN]; - BYTE abyAddr3[U_ETHER_ADDR_LEN]; + BYTE abyAddr1[ETH_ALEN]; + BYTE abyAddr2[ETH_ALEN]; + BYTE abyAddr3[ETH_ALEN]; WORD wSeqCtl; - BYTE abyAddr4[U_ETHER_ADDR_LEN]; + BYTE abyAddr4[ETH_ALEN]; }__attribute__ ((__packed__)) S802_11Header, *PS802_11Header; diff --git a/drivers/staging/vt6656/wctl.c b/drivers/staging/vt6656/wctl.c index 40986da..956add6 100644 --- a/drivers/staging/vt6656/wctl.c +++ b/drivers/staging/vt6656/wctl.c @@ -91,7 +91,7 @@ BOOL WCTLbIsDuplicate (PSCache pCache, PS802_11Header pMACHeader) /* Not fount in cache - insert */ pCacheEntry = &pCache->asCacheEntry[pCache->uInPtr]; pCacheEntry->wFmSequence = pMACHeader->wSeqCtl; - memcpy(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->abyAddr2[0]), U_ETHER_ADDR_LEN); + memcpy(&(pCacheEntry->abyAddr2[0]), &(pMACHeader->abyAddr2[0]), ETH_ALEN); pCacheEntry->wFrameCtl = pMACHeader->wFrameCtl; ADD_ONE_WITH_WRAP_AROUND(pCache->uInPtr, DUPLICATE_RX_CACHE_LENGTH); return FALSE; @@ -154,7 +154,9 @@ UINT ii; pDevice->sRxDFCB[ii].bInUse = TRUE; pDevice->sRxDFCB[ii].wSequence = (pMACHeader->wSeqCtl >> 4); pDevice->sRxDFCB[ii].wFragNum = (pMACHeader->wSeqCtl & 0x000F); - memcpy(&(pDevice->sRxDFCB[ii].abyAddr2[0]), &(pMACHeader->abyAddr2[0]), U_ETHER_ADDR_LEN); + memcpy(&(pDevice->sRxDFCB[ii].abyAddr2[0]), + &(pMACHeader->abyAddr2[0]), + ETH_ALEN); return(ii); } } diff --git a/drivers/staging/vt6656/wmgr.c b/drivers/staging/vt6656/wmgr.c index 330aea6..9b4ff79 100644 --- a/drivers/staging/vt6656/wmgr.c +++ b/drivers/staging/vt6656/wmgr.c @@ -3773,13 +3773,17 @@ s_MgrMakeAssocRequest( pwPMKID = (PWORD)pbyRSN; // Point to PMKID count *pwPMKID = 0; // Initialize PMKID count pbyRSN += 2; // Point to PMKID list - for (ii = 0; ii < pDevice->gsPMKID.BSSIDInfoCount; ii++) { - if ( !memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], pMgmt->abyCurrBSSID, U_ETHER_ADDR_LEN)) { - (*pwPMKID) ++; - memcpy(pbyRSN, pDevice->gsPMKID.BSSIDInfo[ii].PMKID, 16); - pbyRSN += 16; - } - } + for (ii = 0; ii < pDevice->gsPMKID.BSSIDInfoCount; ii++) { + if (!memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], + pMgmt->abyCurrBSSID, + ETH_ALEN)) { + (*pwPMKID)++; + memcpy(pbyRSN, + pDevice->gsPMKID.BSSIDInfo[ii].PMKID, + 16); + pbyRSN += 16; + } + } if (*pwPMKID != 0) { sFrame.pRSN->len += (2 + (*pwPMKID)*16); } @@ -4030,10 +4034,14 @@ s_MgrMakeReAssocRequest( *pwPMKID = 0; // Initialize PMKID count pbyRSN += 2; // Point to PMKID list for (ii = 0; ii < pDevice->gsPMKID.BSSIDInfoCount; ii++) { - if ( !memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], pMgmt->abyCurrBSSID, U_ETHER_ADDR_LEN)) { - (*pwPMKID) ++; - memcpy(pbyRSN, pDevice->gsPMKID.BSSIDInfo[ii].PMKID, 16); - pbyRSN += 16; + if (!memcmp(&pDevice->gsPMKID.BSSIDInfo[ii].BSSID[0], + pMgmt->abyCurrBSSID, + ETH_ALEN)) { + (*pwPMKID)++; + memcpy(pbyRSN, + pDevice->gsPMKID.BSSIDInfo[ii].PMKID, + 16); + pbyRSN += 16; } } if (*pwPMKID != 0) { @@ -4057,8 +4065,6 @@ s_MgrMakeReAssocRequest( return pTxPacket; } - - /*+ * * Routine Description: @@ -4070,7 +4076,6 @@ s_MgrMakeReAssocRequest( * -*/ - PSTxMgmtPacket s_MgrMakeAssocResponse( IN PSDevice pDevice, @@ -4745,13 +4750,16 @@ bAdd_PMKID_Candidate ( // Update Old Candidate for (ii = 0; ii < pDevice->gsPMKIDCandidate.NumCandidates; ii++) { - pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii]; - if ( !memcmp(pCandidateList->BSSID, pbyBSSID, U_ETHER_ADDR_LEN)) { - if ((psRSNCapObj->bRSNCapExist == TRUE) && (psRSNCapObj->wRSNCap & BIT0)) { - pCandidateList->Flags |= NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; - } else { - pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); - } + pCandidateList = &pDevice->gsPMKIDCandidate.CandidateList[ii]; + if (!memcmp(pCandidateList->BSSID, pbyBSSID, ETH_ALEN)) { + if ((psRSNCapObj->bRSNCapExist == TRUE) + && (psRSNCapObj->wRSNCap & BIT0)) { + pCandidateList->Flags |= + NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED; + } else { + pCandidateList->Flags &= + ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); + } return TRUE; } } @@ -4763,7 +4771,7 @@ bAdd_PMKID_Candidate ( } else { pCandidateList->Flags &= ~(NDIS_802_11_PMKID_CANDIDATE_PREAUTH_ENABLED); } - memcpy(pCandidateList->BSSID, pbyBSSID, U_ETHER_ADDR_LEN); + memcpy(pCandidateList->BSSID, pbyBSSID, ETH_ALEN); pDevice->gsPMKIDCandidate.NumCandidates++; DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"NumCandidates:%d\n", (int)pDevice->gsPMKIDCandidate.NumCandidates); return TRUE; diff --git a/drivers/staging/vt6656/wpa2.c b/drivers/staging/vt6656/wpa2.c index fa3aeed..f8be30d 100644 --- a/drivers/staging/vt6656/wpa2.c +++ b/drivers/staging/vt6656/wpa2.c @@ -337,20 +337,25 @@ WPA2uSetIEs( } pRSNIEs->len +=2; - if ((pMgmt->gsPMKIDCache.BSSIDInfoCount > 0) && - (pMgmt->bRoaming == TRUE) && + if ((pMgmt->gsPMKIDCache.BSSIDInfoCount > 0) && + (pMgmt->bRoaming == TRUE) && (pMgmt->eAuthenMode == WMAC_AUTH_WPA2)) { - // RSN PMKID - pwPMKID = (PWORD)(&pRSNIEs->abyRSN[18]); // Point to PMKID count - *pwPMKID = 0; // Initialize PMKID count - pbyBuffer = &pRSNIEs->abyRSN[20]; // Point to PMKID list - for (ii = 0; ii < pMgmt->gsPMKIDCache.BSSIDInfoCount; ii++) { - if ( !memcmp(&pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyBSSID[0], pMgmt->abyCurrBSSID, U_ETHER_ADDR_LEN)) { - (*pwPMKID) ++; - memcpy(pbyBuffer, pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyPMKID, 16); - pbyBuffer += 16; - } - } + /* RSN PMKID, pointer to PMKID count */ + pwPMKID = (PWORD)(&pRSNIEs->abyRSN[18]); + *pwPMKID = 0; /* Initialize PMKID count */ + pbyBuffer = &pRSNIEs->abyRSN[20]; /* Point to PMKID list */ + for (ii = 0; ii < pMgmt->gsPMKIDCache.BSSIDInfoCount; ii++) { + if (!memcmp(&pMgmt-> + gsPMKIDCache.BSSIDInfo[ii].abyBSSID[0], + pMgmt->abyCurrBSSID, + ETH_ALEN)) { + (*pwPMKID)++; + memcpy(pbyBuffer, + pMgmt->gsPMKIDCache.BSSIDInfo[ii].abyPMKID, + 16); + pbyBuffer += 16; + } + } if (*pwPMKID != 0) { pRSNIEs->len += (2 + (*pwPMKID)*16); } else { diff --git a/drivers/staging/vt6656/wpactl.c b/drivers/staging/vt6656/wpactl.c index 4555bc0..25b784c 100644 --- a/drivers/staging/vt6656/wpactl.c +++ b/drivers/staging/vt6656/wpactl.c @@ -103,7 +103,7 @@ static int wpa_init_wpadev(PSDevice pDevice) wpadev_priv = netdev_priv(pDevice->wpadev); *wpadev_priv = *pDevice; - memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, U_ETHER_ADDR_LEN); + memcpy(pDevice->wpadev->dev_addr, dev->dev_addr, ETH_ALEN); pDevice->wpadev->base_addr = dev->base_addr; pDevice->wpadev->irq = dev->irq; pDevice->wpadev->mem_start = dev->mem_start; -- 1.7.0.3 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/devel