Commit 9a0e756c authored by Andres More's avatar Andres More Committed by Greg Kroah-Hartman

Staging: vt6656: incorporated ETH_ALEN macro instead of custom one

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: default avatarAndres More <more.andres@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 26e5b65b
......@@ -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;
......
......@@ -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;
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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 {
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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;
......
......@@ -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;
......
This diff is collapsed.
......@@ -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;
......
......@@ -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++) {
......
......@@ -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;
......
......@@ -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);
}
}
......
......@@ -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;
......
......@@ -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 {
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment