97 static bool ChannelExceedZoneType(
105 s_MgrMakeAssocRequest(
108 unsigned char *pDAddr,
109 unsigned short wCurrCapInfo,
110 unsigned short wListenInterval,
118 s_vMgrRxAssocRequest(
122 unsigned int uNodeIndex
127 s_MgrMakeReAssocRequest(
130 unsigned char *pDAddr,
131 unsigned short wCurrCapInfo,
132 unsigned short wListenInterval,
140 s_vMgrRxAssocResponse(
149 s_vMgrRxDisassociation(
158 s_vMgrRxAuthenSequence_1(
166 s_vMgrRxAuthenSequence_2(
174 s_vMgrRxAuthenSequence_3(
182 s_vMgrRxAuthenSequence_4(
190 s_vMgrRxAuthentication(
198 s_vMgrRxDeauthentication(
208 s_vMgrRxProbeRequest(
216 s_vMgrRxProbeResponse(
244 unsigned short wCurrCapInfo,
245 unsigned short wCurrBeaconPeriod,
246 unsigned int uCurrChannel,
247 unsigned short wCurrATIMWinodw,
249 unsigned char *pCurrBSSID,
258 s_MgrMakeAssocResponse(
261 unsigned short wCurrCapInfo,
262 unsigned short wAssocStatus,
263 unsigned short wAssocAID,
264 unsigned char *pDstAddr,
272 s_MgrMakeReAssocResponse(
275 unsigned short wCurrCapInfo,
276 unsigned short wAssocStatus,
277 unsigned short wAssocAID,
278 unsigned char *pDstAddr,
286 s_MgrMakeProbeResponse(
289 unsigned short wCurrCapInfo,
290 unsigned short wCurrBeaconPeriod,
291 unsigned int uCurrChannel,
292 unsigned short wCurrATIMWinodw,
293 unsigned char *pDstAddr,
295 unsigned char *pCurrBSSID,
298 unsigned char byPHYType
306 unsigned short wStatus
314 unsigned int uBSSMode,
324 unsigned char *pbyCCSPK,
325 unsigned char *pbyCCSGK
328 static void Encyption_Rebuild(
466 void *hDeviceContext,
503 pTxPacket = s_MgrMakeAssocRequest
515 if (pTxPacket !=
NULL ){
542 void *hDeviceContext,
582 pTxPacket = s_MgrMakeReAssocRequest
594 if (pTxPacket !=
NULL ){
621 void *hDeviceContext,
623 unsigned char *abyDestAddress,
624 unsigned short wReason,
683 s_vMgrRxAssocRequest(
687 unsigned int uNodeIndex
693 unsigned short wAssocStatus = 0;
694 unsigned short wAssocAID = 0;
736 abyCurrExtSuppRates[1] = 0;
764 wAssocAID = (
unsigned short)uNodeIndex;
796 pTxPacket = s_MgrMakeAssocResponse
807 if (pTxPacket !=
NULL ){
809 if (pDevice->bEnableHostapd) {
845 s_vMgrRxReAssocRequest(
849 unsigned int uNodeIndex
855 unsigned short wAssocStatus = 0;
856 unsigned short wAssocAID = 0;
895 abyCurrExtSuppRates[1] = 0;
923 wAssocAID = (
unsigned short)uNodeIndex;
954 pTxPacket = s_MgrMakeReAssocResponse
966 if (pTxPacket !=
NULL ){
968 if (pDevice->bEnableHostapd) {
995 s_vMgrRxAssocResponse(
1004 unsigned char *pbyIEs;
1018 (sFrame.
pwAid == 0) ||
1053 dev_kfree_skb(pDevice->
skb);
1067 skb_reset_mac_header(pDevice->
skb);
1076 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
1079 unsigned char buf[512];
1089 memset(&wrqu, 0,
sizeof (wrqu));
1090 wrqu.data.length = len;
1099 memcpy(buf, pbyIEs, len);
1100 memset(&wrqu, 0,
sizeof (wrqu));
1101 wrqu.data.length = len;
1107 memset(&wrqu, 0,
sizeof (wrqu));
1112 #endif //#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
1128 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
1156 void *hDeviceContext,
1214 void *hDeviceContext,
1216 unsigned char *abyDestAddress,
1217 unsigned short wReason,
1270 s_vMgrRxAuthentication(
1291 s_vMgrRxAuthenSequence_1(pDevice,pMgmt, &sFrame);
1294 s_vMgrRxAuthenSequence_2(pDevice, pMgmt, &sFrame);
1298 s_vMgrRxAuthenSequence_3(pDevice, pMgmt, &sFrame);
1301 s_vMgrRxAuthenSequence_4(pDevice, pMgmt, &sFrame);
1328 s_vMgrRxAuthenSequence_1(
1335 unsigned int uNodeIndex;
1408 if (pDevice->bEnableHostapd) {
1434 s_vMgrRxAuthenSequence_2(
1536 s_vMgrRxAuthenSequence_3(
1543 unsigned int uStatusCode = 0 ;
1544 unsigned int uNodeIndex = 0;
1600 if (pDevice->bEnableHostapd) {
1624 s_vMgrRxAuthenSequence_4(
1663 s_vMgrRxDisassociation(
1670 unsigned int uNodeIndex = 0;
1703 skb_reset_mac_header(pDevice->
skb);
1712 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
1716 memset(&wrqu, 0,
sizeof (wrqu));
1718 printk(
"wireless_send_event--->SIOCGIWAP(disassociated)\n");
1742 s_vMgrRxDeauthentication(
1749 unsigned int uNodeIndex = 0;
1778 netif_stop_queue(pDevice->
dev);
1790 skb_reset_mac_header(pDevice->
skb);
1798 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
1802 memset(&wrqu, 0,
sizeof (wrqu));
1804 PRINT_K(
"wireless_send_event--->SIOCGIWAP(disauthen)\n");
1830 ChannelExceedZoneType(
1839 if((byCurrChannel<1) ||(byCurrChannel>11))
1844 if((byCurrChannel<1) ||(byCurrChannel>13))
1879 bool bIsBSSIDEqual =
false;
1880 bool bIsSSIDEqual =
false;
1881 bool bTSFLargeDiff =
false;
1882 bool bTSFOffsetPostive =
false;
1883 bool bUpdateTSF =
false;
1884 bool bIsAPBeacon =
false;
1885 bool bIsChannelEqual =
false;
1886 unsigned int uLocateByteIndex;
1887 unsigned char byTIMBitOn = 0;
1888 unsigned short wAIDNumber = 0;
1889 unsigned int uNodeIndex;
1892 unsigned short wStartIndex = 0;
1893 unsigned short wAIDIndex = 0;
1894 unsigned char byCurrChannel = pRxPacket->
byRxChannel;
1897 bool bChannelHit =
false;
1898 bool bUpdatePhyParameter =
false;
1899 unsigned char byIEChannel = 0;
1911 (sFrame.
pSSID == 0) ||
1923 byIEChannel = sFrame.
pDSParms->byCurrChannel;
1925 if (byCurrChannel != byIEChannel) {
1927 bChannelHit =
false;
1928 byCurrChannel = byIEChannel;
1935 if(ChannelExceedZoneType(pDevice,byCurrChannel)==
true)
1948 if (pBSSList ==
NULL) {
1997 if(byCurrChannel == (
unsigned char)pMgmt->
uCurrChannel)
1998 bIsChannelEqual =
true;
2039 bIsBSSIDEqual =
true;
2056 bIsSSIDEqual =
true;
2061 (bIsBSSIDEqual ==
true) &&
2062 (bIsSSIDEqual ==
true) &&
2069 if (pBSSList !=
NULL) {
2073 bUpdatePhyParameter =
true;
2079 bUpdatePhyParameter =
true;
2108 if (bUpdatePhyParameter ==
true) {
2119 (
unsigned char) pBSSList->uChannel,
2130 }
else if (bIsChannelEqual ==
false) {
2139 if (sFrame.
pCFParms->wCFPDurRemaining > 0) {
2152 bTSFOffsetPostive =
true;
2155 bTSFOffsetPostive =
false;
2159 bTSFOffsetPostive =
true;
2162 bTSFOffsetPostive =
false;
2165 if (bTSFOffsetPostive) {
2172 if (
HIDWORD(qwTSFOffset) != 0 ||
2174 bTSFLargeDiff =
true;
2179 if (bIsAPBeacon ==
true) {
2197 wAIDIndex = (wAIDNumber >> 3);
2198 if ((wAIDNumber > 0) && (wAIDIndex >= wStartIndex)) {
2199 uLocateByteIndex = wAIDIndex - wStartIndex;
2201 if (sFrame.
pTIM->len >= (uLocateByteIndex + 4)) {
2202 byTIMBitOn = (0x01) << ((wAIDNumber) % 8);
2203 pMgmt->
bInTIM = sFrame.
pTIM->byVirtBitMap[uLocateByteIndex] & byTIMBitOn ?
true :
false;
2242 if (bIsBSSIDEqual) {
2248 if (bTSFLargeDiff && bTSFOffsetPostive &&
2313 if (netif_queue_stopped(pDevice->
dev)){
2314 netif_wake_queue(pDevice->
dev);
2321 else if (bIsSSIDEqual) {
2325 if (bTSFLargeDiff && bTSFOffsetPostive) {
2390 void *hDeviceContext,
2396 unsigned short wMaxBasicRate;
2397 unsigned short wMaxSuppRate;
2398 unsigned char byTopCCKBasicRate;
2399 unsigned char byTopOFDMBasicRate;
2402 unsigned char abyRATE[] = {0x82, 0x84, 0x8B, 0x96, 0x24, 0x30, 0x48, 0x6C, 0x0C, 0x12, 0x18, 0x60};
2403 unsigned char abyCCK_RATE[] = {0x82, 0x84, 0x8B, 0x96};
2404 unsigned char abyOFDM_RATE[] = {0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
2405 unsigned short wSuppRate;
2436 for (ii = 0; ii < 4; ii++)
2441 for (ii = 0; ii < 8; ii++)
2449 for (ii = 0; ii < 4; ii++)
2451 for (ii = 4; ii < 8; ii++)
2453 for (ii = 0; ii < 4; ii++)
2491 &wMaxBasicRate, &wMaxSuppRate, &wSuppRate,
2492 &byTopCCKBasicRate, &byTopOFDMBasicRate);
2645 void *hDeviceContext,
2653 unsigned int ii,
uu;
2658 unsigned short wMaxBasicRate =
RATE_1M;
2659 unsigned short wMaxSuppRate =
RATE_1M;
2660 unsigned short wSuppRate;
2661 unsigned char byTopCCKBasicRate =
RATE_1M;
2662 unsigned char byTopOFDMBasicRate =
RATE_1M;
2666 if (pMgmt->
sBSSList[ii].bActive ==
true)
2670 if (ii == MAX_BSS_NUM) {
2717 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
2719 Encyption_Rebuild(pDevice, pCurr);
2722 s_vMgrSynchBSS(pDevice,
2755 if ((pItemExtRates->len > 0) && (pItemRates->len < 8)) {
2756 for (ii = 0; ii < (
unsigned int)(8 - pItemRates->len); ) {
2757 pItemRates->abyRates[pItemRates->len + ii] = pItemExtRates->abyRates[ii];
2759 if (pItemExtRates->len <= ii)
2762 pItemRates->len += (
unsigned char)ii;
2763 if (pItemExtRates->len - ii > 0) {
2764 pItemExtRates->len -= (
unsigned char)ii;
2765 for (uu = 0; uu < pItemExtRates->len; uu ++) {
2766 pItemExtRates->abyRates[uu] = pItemExtRates->abyRates[uu + ii];
2769 pItemExtRates->len = 0;
2774 &wMaxBasicRate, &wMaxSuppRate, &wSuppRate,
2775 &byTopCCKBasicRate, &byTopOFDMBasicRate);
2796 if (bResult ==
false) {
2841 s_vMgrSynchBSS(pDevice,
2860 NULL,
true, &wMaxBasicRate, &wMaxSuppRate, &wSuppRate,
2861 &byTopCCKBasicRate, &byTopOFDMBasicRate);
2909 unsigned int uBSSMode,
2918 unsigned char abyCurrSuppRatesG[] = {
WLAN_EID_SUPP_RATES, 8, 0x02, 0x04, 0x0B, 0x16, 0x24, 0x30, 0x48, 0x6C};
2921 unsigned char abyCurrSuppRatesA[] = {
WLAN_EID_SUPP_RATES, 8, 0x0C, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C};
2927 if (s_bCipherMatch(pCurr,
2930 &(pMgmt->
byCSSGK)) ==
false) {
2944 pDevice->
bCCK =
true;
2956 CARDbUpdateTSF(pDevice, pCurr->byRxRate, pCurr->qwBSSTimestamp, pCurr->qwLocalTSF);
3069 static void Encyption_Rebuild(
3086 if(pCurr->bWPAValid ==
true) {
3088 if(pCurr->abyPKType[0] ==
WPA_TKIP) {
3090 PRINT_K(
"Encyption_Rebuild--->ssid reset config to [WPAPSK-TKIP]\n");
3094 PRINT_K(
"Encyption_Rebuild--->ssid reset config to [WPAPSK-AES]\n");
3097 else if(pCurr->bWPA2Valid ==
true) {
3101 PRINT_K(
"Encyption_Rebuild--->ssid reset config to [WPA2PSK-TKIP]\n");
3105 PRINT_K(
"Encyption_Rebuild--->ssid reset config to [WPA2PSK-AES]\n");
3132 unsigned char byMask[8] = {1, 2, 4, 8, 0x10, 0x20, 0x40, 0x80};
3133 unsigned char byMap;
3134 unsigned int ii, jj;
3135 bool bStartFound =
false;
3136 bool bMulticast =
false;
3137 unsigned short wStartIndex = 0;
3138 unsigned short wEndIndex = 0;
3146 bMulticast = (byMap & byMask[0]) != 0;
3163 wStartIndex &= ~
BIT0;
3166 wEndIndex = ((wEndIndex + 1) & ~
BIT0);
3170 pTIM->len = 3 + (wEndIndex - wStartIndex) + 1;
3180 for (ii = wStartIndex, jj =0 ; ii <= wEndIndex; ii++, jj++) {
3181 pTIM->byVirtBitMap[jj] = pMgmt->
abyPSTxMap[ii];
3185 pTIM->byVirtBitMap[0] &= ~
BIT0;
3205 unsigned short wCurrCapInfo,
3206 unsigned short wCurrBeaconPeriod,
3207 unsigned int uCurrChannel,
3208 unsigned short wCurrATIMWinodw,
3210 unsigned char *pCurrBSSID,
3217 unsigned char abyBroadcastAddr[] = {0xff, 0xff, 0xff, 0xff, 0xff, 0xff};
3218 unsigned char *pbyBuffer;
3219 unsigned int uLength = 0;
3267 sFrame.
pDSParms->byCurrChannel = (
unsigned char)uCurrChannel;
3273 s_vMgrFormatTIM(pMgmt, sFrame.
pTIM);
3284 sFrame.
pIBSSParms->wATIMWindow = wCurrATIMWinodw;
3323 pbyBuffer = (
unsigned char *)(sFrame.
pBuf + sFrame.
len);
3370 sFrame.
len += uLength;
3377 sFrame.
pERP->len = 1;
3378 sFrame.
pERP->byContext = 0;
3431 s_MgrMakeProbeResponse(
3434 unsigned short wCurrCapInfo,
3435 unsigned short wCurrBeaconPeriod,
3436 unsigned int uCurrChannel,
3437 unsigned short wCurrATIMWinodw,
3438 unsigned char *pDstAddr,
3440 unsigned char *pCurrBSSID,
3443 unsigned char byPHYType
3448 unsigned char *pbyBuffer;
3449 unsigned int uLength = 0;
3499 sFrame.
pDSParms->byCurrChannel = (
unsigned char)uCurrChannel;
3514 sFrame.
pERP->len = 1;
3515 sFrame.
pERP->byContext = 0;
3527 pbyBuffer = (
unsigned char *)(sFrame.
pBuf + sFrame.
len);
3574 sFrame.
len += uLength;
3620 s_MgrMakeAssocRequest(
3623 unsigned char *pDAddr,
3624 unsigned short wCurrCapInfo,
3625 unsigned short wListenInterval,
3633 unsigned char *pbyIEs;
3634 unsigned char *pbyRSN;
3781 unsigned short *pwPMKID;
3835 if (pMgmt->
pCurrBSS->sRSNCapObj.bRSNCapExist ==
true) {
3846 pwPMKID = (
unsigned short *)pbyRSN;
3856 if (*pwPMKID != 0) {
3857 sFrame.
pRSN->
len += (2 + (*pwPMKID)*16);
3895 s_MgrMakeReAssocRequest(
3898 unsigned char *pDAddr,
3899 unsigned short wCurrCapInfo,
3900 unsigned short wListenInterval,
3908 unsigned char *pbyIEs;
3909 unsigned char *pbyRSN;
4037 unsigned short *pwPMKID;
4091 if (pMgmt->
pCurrBSS->sRSNCapObj.bRSNCapExist ==
true) {
4102 pwPMKID = (
unsigned short *)pbyRSN;
4112 if (*pwPMKID != 0) {
4113 sFrame.
pRSN->
len += (2 + (*pwPMKID)*16);
4147 s_MgrMakeAssocResponse(
4150 unsigned short wCurrCapInfo,
4151 unsigned short wAssocStatus,
4152 unsigned short wAssocAID,
4153 unsigned char *pDstAddr,
4221 s_MgrMakeReAssocResponse(
4224 unsigned short wCurrCapInfo,
4225 unsigned short wAssocStatus,
4226 unsigned short wAssocAID,
4227 unsigned char *pDstAddr,
4295 s_vMgrRxProbeResponse(
4303 unsigned char byCurrChannel = pRxPacket->
byRxChannel;
4305 unsigned char byIEChannel = 0;
4306 bool bChannelHit =
true;
4318 (sFrame.
pSSID == 0) ||
4325 if(sFrame.
pSSID->len == 0)
4333 byIEChannel = sFrame.
pDSParms->byCurrChannel;
4335 if (byCurrChannel != byIEChannel) {
4337 bChannelHit =
false;
4338 byCurrChannel = byIEChannel;
4346 if(ChannelExceedZoneType(pDevice,byCurrChannel)==
true)
4420 s_vMgrRxProbeRequest(
4445 if (sFrame.
pSSID->len != 0) {
4460 pTxPacket = s_MgrMakeProbeResponse
4475 if (pTxPacket !=
NULL ){
4511 void *hDeviceContext,
4517 bool bInScan =
false;
4518 unsigned int uNodeIndex = 0;
4545 s_vMgrRxAssocRequest(pDevice, pMgmt, pRxPacket, uNodeIndex);
4552 s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket,
false);
4572 s_vMgrRxReAssocRequest(pDevice, pMgmt, pRxPacket, uNodeIndex);
4578 s_vMgrRxAssocResponse(pDevice, pMgmt, pRxPacket,
true);
4584 s_vMgrRxProbeRequest(pDevice, pMgmt, pRxPacket);
4591 s_vMgrRxProbeResponse(pDevice, pMgmt, pRxPacket);
4600 s_vMgrRxBeacon(pDevice, pMgmt, pRxPacket, bInScan);
4622 s_vMgrRxDisassociation(pDevice, pMgmt, pRxPacket);
4628 s_vMgrRxAuthentication(pDevice, pMgmt, pRxPacket);
4634 s_vMgrRxDeauthentication(pDevice, pMgmt, pRxPacket);
4660 void *hDeviceContext,
4674 pTxPacket = s_MgrMakeBeacon
4716 unsigned short wStatus