2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 * Purpose: private ioctl functions
25 * Date: Auguest 20, 2003
43 /*--------------------- Static Definitions -------------------------*/
45 /*--------------------- Static Classes ----------------------------*/
47 /*--------------------- Static Variables --------------------------*/
48 //static int msglevel =MSG_LEVEL_DEBUG;
49 static int msglevel
=MSG_LEVEL_INFO
;
51 #ifdef WPA_SM_Transtatus
52 SWPAResult wpa_Result
;
55 /*--------------------- Static Functions --------------------------*/
57 /*--------------------- Export Variables --------------------------*/
59 int private_ioctl(PSDevice pDevice
, struct ifreq
*rq
) {
61 PSCmdRequest pReq
= (PSCmdRequest
)rq
;
62 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
64 PWLAN_IE_SSID pItemSSID
;
66 SCmdZoneTypeSet sZoneTypeCmd
;
68 SCmdStartAP sStartAPCmd
;
79 SCmdLinkStatus sLinkStatus
;
80 BYTE abySuppRates
[] = {WLAN_EID_SUPP_RATES
, 4, 0x02, 0x04, 0x0B, 0x16};
81 BYTE abyNullAddr
[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
83 BYTE abyScanSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
88 switch(pReq
->wCmdCode
) {
90 case WLAN_CMD_BSS_SCAN
:
92 if (copy_from_user(&sScanCmd
, pReq
->data
, sizeof(SCmdScan
))) {
97 pItemSSID
= (PWLAN_IE_SSID
)sScanCmd
.ssid
;
98 if (pItemSSID
->len
!= 0) {
99 memset(abyScanSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
100 memcpy(abyScanSSID
, pItemSSID
, pItemSSID
->len
+ WLAN_IEHDR_LEN
);
102 spin_lock_irq(&pDevice
->lock
);
103 if (memcmp(pMgmt
->abyCurrBSSID
, &abyNullAddr
[0], 6) == 0)
104 BSSvClearBSSList((HANDLE
)pDevice
, FALSE
);
106 BSSvClearBSSList((HANDLE
)pDevice
, pDevice
->bLinkPass
);
107 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_BSS_SCAN..begin \n");
109 if (pItemSSID
->len
!= 0)
110 bScheduleCommand((HANDLE
) pDevice
, WLAN_CMD_BSSID_SCAN
, abyScanSSID
);
112 bScheduleCommand((HANDLE
) pDevice
, WLAN_CMD_BSSID_SCAN
, NULL
);
113 spin_unlock_irq(&pDevice
->lock
);
116 case WLAN_CMD_ZONETYPE_SET
:
117 //mike add :cann't support.
121 if (copy_from_user(&sZoneTypeCmd
, pReq
->data
, sizeof(SCmdZoneTypeSet
))) {
126 if(sZoneTypeCmd
.bWrite
==TRUE
) {
128 if(sZoneTypeCmd
.ZoneType
== ZoneType_USA
) {
130 printk("set_ZoneType:USA\n");
132 else if(sZoneTypeCmd
.ZoneType
== ZoneType_Japan
) {
134 printk("set_ZoneType:Japan\n");
136 else if(sZoneTypeCmd
.ZoneType
== ZoneType_Europe
) {
138 printk("set_ZoneType:Europe\n");
146 if(zonetype
== 0x00) { //USA
147 sZoneTypeCmd
.ZoneType
= ZoneType_USA
;
149 else if(zonetype
== 0x01) { //Japan
150 sZoneTypeCmd
.ZoneType
= ZoneType_Japan
;
152 else if(zonetype
== 0x02) { //Europe
153 sZoneTypeCmd
.ZoneType
= ZoneType_Europe
;
155 else { //Unknow ZoneType
156 printk("Error:ZoneType[%x] Unknown ???\n",zonetype
);
160 if (copy_to_user(pReq
->data
, &sZoneTypeCmd
, sizeof(SCmdZoneTypeSet
))) {
168 case WLAN_CMD_BSS_JOIN
:
170 if (copy_from_user(&sJoinCmd
, pReq
->data
, sizeof(SCmdBSSJoin
))) {
175 pItemSSID
= (PWLAN_IE_SSID
)sJoinCmd
.ssid
;
176 memset(pMgmt
->abyDesireSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
177 memcpy(pMgmt
->abyDesireSSID
, pItemSSID
, pItemSSID
->len
+ WLAN_IEHDR_LEN
);
178 if (sJoinCmd
.wBSSType
== ADHOC
) {
179 pMgmt
->eConfigMode
= WMAC_CONFIG_IBSS_STA
;
180 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to adhoc mode\n");
183 pMgmt
->eConfigMode
= WMAC_CONFIG_ESS_STA
;
184 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to STA mode\n");
186 if (sJoinCmd
.bPSEnable
== TRUE
) {
187 pDevice
->ePSMode
= WMAC_POWER_FAST
;
188 // pDevice->ePSMode = WMAC_POWER_MAX;
189 pMgmt
->wListenInterval
= 2;
190 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Power Saving On\n");
193 pDevice
->ePSMode
= WMAC_POWER_CAM
;
194 pMgmt
->wListenInterval
= 1;
195 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Power Saving Off \n");
198 if (sJoinCmd
.bShareKeyAuth
== TRUE
){
199 pMgmt
->bShareKeyAlgorithm
= TRUE
;
200 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Share Key \n");
203 pMgmt
->bShareKeyAlgorithm
= FALSE
;
204 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Open System \n");
206 pDevice
->uChannel
= sJoinCmd
.uChannel
;
207 netif_stop_queue(pDevice
->dev
);
208 spin_lock_irq(&pDevice
->lock
);
209 pMgmt
->eCurrState
= WMAC_STATE_IDLE
;
210 bScheduleCommand((HANDLE
) pDevice
, WLAN_CMD_BSSID_SCAN
, pMgmt
->abyDesireSSID
);
211 bScheduleCommand((HANDLE
) pDevice
, WLAN_CMD_SSID
, NULL
);
212 spin_unlock_irq(&pDevice
->lock
);
215 case WLAN_CMD_SET_WEP
:
216 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_WEP Key. \n");
217 memset(&sWEPCmd
, 0 ,sizeof(SCmdSetWEP
));
218 if (copy_from_user(&sWEPCmd
, pReq
->data
, sizeof(SCmdSetWEP
))) {
222 if (sWEPCmd
.bEnableWep
!= TRUE
) {
225 pDevice
->bEncryptionEnable
= FALSE
;
226 pDevice
->eEncryptionStatus
= Ndis802_11EncryptionDisabled
;
227 spin_lock_irq(&pDevice
->lock
);
228 for(uu
=0;uu
<MAX_KEY_TABLE
;uu
++)
229 MACvDisableKeyEntry(pDevice
,uu
);
230 spin_unlock_irq(&pDevice
->lock
);
231 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WEP function disable. \n");
235 for (ii
= 0; ii
< WLAN_WEP_NKEYS
; ii
++) {
236 if (sWEPCmd
.bWepKeyAvailable
[ii
]) {
237 if (ii
== sWEPCmd
.byKeyIndex
)
238 //2006-1207-01<Modify>by Einsn Liu
239 // dwKeyIndex|= (1 << 31);
240 dwKeyIndex
=ii
|(1 << 31);
243 spin_lock_irq(&pDevice
->lock
);
244 KeybSetDefaultKey( pDevice
,
247 sWEPCmd
.auWepKeyLength
[ii
],
249 (PBYTE
)&sWEPCmd
.abyWepKey
[ii
][0],
252 spin_unlock_irq(&pDevice
->lock
);
256 pDevice
->byKeyIndex
= sWEPCmd
.byKeyIndex
;
257 pDevice
->bTransmitKey
= TRUE
;
258 pDevice
->bEncryptionEnable
= TRUE
;
259 pDevice
->eEncryptionStatus
= Ndis802_11Encryption1Enabled
;
263 case WLAN_CMD_GET_LINK
:
264 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_GET_LINK status. \n");
266 memset(sLinkStatus
.abySSID
, 0 , WLAN_SSID_MAXLEN
+ 1);
268 if (pMgmt
->eCurrMode
== WMAC_MODE_IBSS_STA
)
269 sLinkStatus
.wBSSType
= ADHOC
;
271 sLinkStatus
.wBSSType
= INFRA
;
273 if (pMgmt
->eCurrState
== WMAC_STATE_JOINTED
)
274 sLinkStatus
.byState
= ADHOC_JOINTED
;
276 sLinkStatus
.byState
= ADHOC_STARTED
;
278 sLinkStatus
.uChannel
= pMgmt
->uCurrChannel
;
279 if (pDevice
->bLinkPass
== TRUE
) {
280 sLinkStatus
.bLink
= TRUE
;
281 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyCurrSSID
;
282 memcpy(sLinkStatus
.abySSID
, pItemSSID
->abySSID
, pItemSSID
->len
);
283 memcpy(sLinkStatus
.abyBSSID
, pMgmt
->abyCurrBSSID
, WLAN_BSSID_LEN
);
284 sLinkStatus
.uLinkRate
= pMgmt
->sNodeDBTable
[0].wTxDataRate
;
285 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" Link Success ! \n");
288 sLinkStatus
.bLink
= FALSE
;
290 if (copy_to_user(pReq
->data
, &sLinkStatus
, sizeof(SCmdLinkStatus
))) {
297 case WLAN_CMD_GET_LISTLEN
:
299 pBSS
= &(pMgmt
->sBSSList
[0]);
300 for (ii
= 0; ii
< MAX_BSS_NUM
; ii
++) {
301 pBSS
= &(pMgmt
->sBSSList
[ii
]);
306 sList
.uItem
= cbListCount
;
307 if (copy_to_user(pReq
->data
, &sList
, sizeof(SBSSIDList
))) {
314 case WLAN_CMD_GET_LIST
:
315 if (copy_from_user(&sList
, pReq
->data
, sizeof(SBSSIDList
))) {
319 pList
= (PSBSSIDList
)kmalloc(sizeof(SBSSIDList
) + (sList
.uItem
* sizeof(SBSSIDItem
)), (int)GFP_ATOMIC
);
324 pList
->uItem
= sList
.uItem
;
325 pBSS
= &(pMgmt
->sBSSList
[0]);
326 for (ii
= 0, jj
= 0; jj
< MAX_BSS_NUM
; jj
++) {
327 pBSS
= &(pMgmt
->sBSSList
[jj
]);
329 pList
->sBSSIDList
[ii
].uChannel
= pBSS
->uChannel
;
330 pList
->sBSSIDList
[ii
].wBeaconInterval
= pBSS
->wBeaconInterval
;
331 pList
->sBSSIDList
[ii
].wCapInfo
= pBSS
->wCapInfo
;
332 RFvRSSITodBm(pDevice
, (BYTE
)(pBSS
->uRSSI
), &ldBm
);
333 pList
->sBSSIDList
[ii
].uRSSI
= (UINT
)ldBm
;
334 // pList->sBSSIDList[ii].uRSSI = pBSS->uRSSI;
335 memcpy(pList
->sBSSIDList
[ii
].abyBSSID
, pBSS
->abyBSSID
, WLAN_BSSID_LEN
);
336 pItemSSID
= (PWLAN_IE_SSID
)pBSS
->abySSID
;
337 memset(pList
->sBSSIDList
[ii
].abySSID
, 0, WLAN_SSID_MAXLEN
+ 1);
338 memcpy(pList
->sBSSIDList
[ii
].abySSID
, pItemSSID
->abySSID
, pItemSSID
->len
);
339 if (WLAN_GET_CAP_INFO_ESS(pBSS
->wCapInfo
)) {
340 pList
->sBSSIDList
[ii
].byNetType
= INFRA
;
343 pList
->sBSSIDList
[ii
].byNetType
= ADHOC
;
345 if (WLAN_GET_CAP_INFO_PRIVACY(pBSS
->wCapInfo
)) {
346 pList
->sBSSIDList
[ii
].bWEPOn
= TRUE
;
349 pList
->sBSSIDList
[ii
].bWEPOn
= FALSE
;
352 if (ii
>= pList
->uItem
)
357 if (copy_to_user(pReq
->data
, pList
, sizeof(SBSSIDList
) + (sList
.uItem
* sizeof(SBSSIDItem
)))) {
365 case WLAN_CMD_GET_MIB
:
366 if (copy_to_user(pReq
->data
, &(pDevice
->s802_11Counter
), sizeof(SDot11MIBCount
))) {
372 case WLAN_CMD_GET_STAT
:
373 if (copy_to_user(pReq
->data
, &(pDevice
->scStatistic
), sizeof(SStatCounter
))) {
378 case WLAN_CMD_STOP_MAC
:
380 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_STOP_MAC\n");
382 netif_stop_queue(pDevice
->dev
);
383 spin_lock_irq(&pDevice
->lock
);
384 if (pDevice
->bRadioOff
== FALSE
) {
385 CARDbRadioPowerOff(pDevice
);
387 pDevice
->bLinkPass
= FALSE
;
388 ControlvMaskByte(pDevice
,MESSAGE_REQUEST_MACREG
,MAC_REG_PAPEDELAY
,LEDSTS_STS
,LEDSTS_SLOW
);
389 memset(pMgmt
->abyCurrBSSID
, 0, 6);
390 pMgmt
->eCurrState
= WMAC_STATE_IDLE
;
391 // del_timer(&pDevice->sTimerCommand);
392 // del_timer(&pMgmt->sTimerSecondCallback);
393 pDevice
->bCmdRunning
= FALSE
;
394 spin_unlock_irq(&pDevice
->lock
);
398 case WLAN_CMD_START_MAC
:
400 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_START_MAC\n");
402 if (pDevice
->bRadioOff
== TRUE
)
403 CARDbRadioPowerOn(pDevice
);
406 case WLAN_CMD_SET_HOSTAPD
:
408 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOSTAPD\n");
410 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
414 if (sValue
.dwValue
== 1) {
415 if (hostap_set_hostapd(pDevice
, 1, 1) == 0){
416 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable HOSTAP\n");
424 hostap_set_hostapd(pDevice
, 0, 1);
425 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable HOSTAP\n");
430 case WLAN_CMD_SET_HOSTAPD_STA
:
432 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOSTAPD_STA\n");
435 case WLAN_CMD_SET_802_1X
:
437 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_802_1X\n");
438 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
443 if (sValue
.dwValue
== 1) {
444 pDevice
->bEnable8021x
= TRUE
;
445 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable 802.1x\n");
448 pDevice
->bEnable8021x
= FALSE
;
449 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable 802.1x\n");
455 case WLAN_CMD_SET_HOST_WEP
:
457 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOST_WEP\n");
458 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
463 if (sValue
.dwValue
== 1) {
464 pDevice
->bEnableHostWEP
= TRUE
;
465 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable HostWEP\n");
468 pDevice
->bEnableHostWEP
= FALSE
;
469 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable HostWEP\n");
474 case WLAN_CMD_SET_WPA
:
475 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_WPA\n");
477 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
481 if (sValue
.dwValue
== 1) {
482 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"up wpadev\n");
483 memcpy(pDevice
->wpadev
->dev_addr
, pDevice
->dev
->dev_addr
, U_ETHER_ADDR_LEN
);
484 pDevice
->bWPADEVUp
= TRUE
;
487 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"close wpadev\n");
488 pDevice
->bWPADEVUp
= FALSE
;
493 case WLAN_CMD_AP_START
:
495 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_AP_START\n");
496 if (pDevice
->bRadioOff
== TRUE
) {
497 CARDbRadioPowerOn(pDevice
);
498 add_timer(&pMgmt
->sTimerSecondCallback
);
500 if (copy_from_user(&sStartAPCmd
, pReq
->data
, sizeof(SCmdStartAP
))) {
505 if (sStartAPCmd
.wBSSType
== AP
) {
506 pMgmt
->eConfigMode
= WMAC_CONFIG_AP
;
507 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to AP mode\n");
510 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct BSS type not set to AP mode\n");
516 if (sStartAPCmd
.wBBPType
== PHY80211g
) {
517 pMgmt
->byAPBBType
= PHY_TYPE_11G
;
519 else if (sStartAPCmd
.wBBPType
== PHY80211a
) {
520 pMgmt
->byAPBBType
= PHY_TYPE_11A
;
523 pMgmt
->byAPBBType
= PHY_TYPE_11B
;
526 pItemSSID
= (PWLAN_IE_SSID
)sStartAPCmd
.ssid
;
527 memset(pMgmt
->abyDesireSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
528 memcpy(pMgmt
->abyDesireSSID
, pItemSSID
, pItemSSID
->len
+ WLAN_IEHDR_LEN
);
530 if ((sStartAPCmd
.uChannel
> 0)&&(sStartAPCmd
.uChannel
<= 14))
531 pDevice
->uChannel
= sStartAPCmd
.uChannel
;
533 if ((sStartAPCmd
.uBeaconInt
>= 20) && (sStartAPCmd
.uBeaconInt
<= 1000))
534 pMgmt
->wIBSSBeaconPeriod
= sStartAPCmd
.uBeaconInt
;
536 pMgmt
->wIBSSBeaconPeriod
= 100;
538 if (sStartAPCmd
.bShareKeyAuth
== TRUE
){
539 pMgmt
->bShareKeyAlgorithm
= TRUE
;
540 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Share Key \n");
543 pMgmt
->bShareKeyAlgorithm
= FALSE
;
544 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Open System \n");
546 memcpy(pMgmt
->abyIBSSSuppRates
, abySuppRates
, 6);
548 if (sStartAPCmd
.byBasicRate
& BIT3
) {
549 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
550 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
551 pMgmt
->abyIBSSSuppRates
[4] |= BIT7
;
552 pMgmt
->abyIBSSSuppRates
[5] |= BIT7
;
553 }else if (sStartAPCmd
.byBasicRate
& BIT2
) {
554 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
555 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
556 pMgmt
->abyIBSSSuppRates
[4] |= BIT7
;
557 }else if (sStartAPCmd
.byBasicRate
& BIT1
) {
558 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
559 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
560 }else if (sStartAPCmd
.byBasicRate
& BIT1
) {
561 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
564 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
565 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
568 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Support Rate= %x %x %x %x\n",
569 pMgmt
->abyIBSSSuppRates
[2],
570 pMgmt
->abyIBSSSuppRates
[3],
571 pMgmt
->abyIBSSSuppRates
[4],
572 pMgmt
->abyIBSSSuppRates
[5]
575 netif_stop_queue(pDevice
->dev
);
576 spin_lock_irq(&pDevice
->lock
);
577 bScheduleCommand((HANDLE
)pDevice
, WLAN_CMD_RUN_AP
, NULL
);
578 spin_unlock_irq(&pDevice
->lock
);
581 case WLAN_CMD_GET_NODE_CNT
:
584 pNode
= &(pMgmt
->sNodeDBTable
[0]);
585 for (ii
= 0; ii
< (MAX_NODE_NUM
+ 1); ii
++) {
586 pNode
= &(pMgmt
->sNodeDBTable
[ii
]);
592 sNodeList
.uItem
= cbListCount
;
593 if (copy_to_user(pReq
->data
, &sNodeList
, sizeof(SNodeList
))) {
600 case WLAN_CMD_GET_NODE_LIST
:
602 if (copy_from_user(&sNodeList
, pReq
->data
, sizeof(SNodeList
))) {
606 pNodeList
= (PSNodeList
)kmalloc(sizeof(SNodeList
) + (sNodeList
.uItem
* sizeof(SNodeItem
)), (int)GFP_ATOMIC
);
607 if (pNodeList
== NULL
) {
611 pNodeList
->uItem
= sNodeList
.uItem
;
612 pNode
= &(pMgmt
->sNodeDBTable
[0]);
613 for (ii
= 0, jj
= 0; ii
< (MAX_NODE_NUM
+ 1); ii
++) {
614 pNode
= &(pMgmt
->sNodeDBTable
[ii
]);
615 if (pNode
->bActive
) {
616 pNodeList
->sNodeList
[jj
].wAID
= pNode
->wAID
;
617 memcpy(pNodeList
->sNodeList
[jj
].abyMACAddr
, pNode
->abyMACAddr
, WLAN_ADDR_LEN
);
618 pNodeList
->sNodeList
[jj
].wTxDataRate
= pNode
->wTxDataRate
;
619 pNodeList
->sNodeList
[jj
].wInActiveCount
= (WORD
)pNode
->uInActiveCount
;
620 pNodeList
->sNodeList
[jj
].wEnQueueCnt
= (WORD
)pNode
->wEnQueueCnt
;
621 pNodeList
->sNodeList
[jj
].wFlags
= (WORD
)pNode
->dwFlags
;
622 pNodeList
->sNodeList
[jj
].bPWBitOn
= pNode
->bPSEnable
;
623 pNodeList
->sNodeList
[jj
].byKeyIndex
= pNode
->byKeyIndex
;
624 pNodeList
->sNodeList
[jj
].wWepKeyLength
= pNode
->uWepKeyLength
;
625 memcpy(&(pNodeList
->sNodeList
[jj
].abyWepKey
[0]), &(pNode
->abyWepKey
[0]), WEP_KEYMAXLEN
);
626 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
627 pNodeList
->sNodeList
[jj
].abyWepKey
[0],
628 pNodeList
->sNodeList
[jj
].abyWepKey
[1],
629 pNodeList
->sNodeList
[jj
].abyWepKey
[2],
630 pNodeList
->sNodeList
[jj
].abyWepKey
[3],
631 pNodeList
->sNodeList
[jj
].abyWepKey
[4]
633 pNodeList
->sNodeList
[jj
].bIsInFallback
= pNode
->bIsInFallback
;
634 pNodeList
->sNodeList
[jj
].uTxFailures
= pNode
->uTxFailures
;
635 pNodeList
->sNodeList
[jj
].uTxAttempts
= pNode
->uTxAttempts
;
636 pNodeList
->sNodeList
[jj
].wFailureRatio
= (WORD
)pNode
->uFailureRatio
;
638 if (jj
>= pNodeList
->uItem
)
642 if (copy_to_user(pReq
->data
, pNodeList
, sizeof(SNodeList
) + (sNodeList
.uItem
* sizeof(SNodeItem
)))) {
650 #ifdef WPA_SM_Transtatus
652 memset(wpa_Result
.ifname
,0,sizeof(wpa_Result
.ifname
));
653 wpa_Result
.proto
= 0;
654 wpa_Result
.key_mgmt
= 0;
655 wpa_Result
.eap_type
= 0;
656 wpa_Result
.authenticated
= FALSE
;
657 pDevice
->fWPA_Authened
= FALSE
;
658 if (copy_from_user(&wpa_Result
, pReq
->data
, sizeof(wpa_Result
))) {
662 //DavidWang for some AP maybe good authenticate
663 if(wpa_Result
.key_mgmt
==0x20)
664 pMgmt
->Cisco_cckm
=1;
666 pMgmt
->Cisco_cckm
=0;
669 if(wpa_Result
.authenticated
==TRUE
) {
672 union iwreq_data wrqu
;
674 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyCurrSSID
;
676 memset(&wrqu
, 0, sizeof(wrqu
));
677 wrqu
.data
.flags
= RT_WPACONNECTED_EVENT_FLAG
;
678 wrqu
.data
.length
=pItemSSID
->len
;
679 wireless_send_event(pDevice
->dev
, IWEVCUSTOM
, &wrqu
, pItemSSID
->abySSID
);
682 pDevice
->fWPA_Authened
= TRUE
; //is sucessful peer to wpa_Result.authenticated?
685 //printk("get private wpa_supplicant announce WPA SM\n");
686 //printk("wpa-->ifname=%s\n",wpa_Result.ifname);
687 //printk("wpa-->proto=%d\n",wpa_Result.proto);
688 //printk("wpa-->key-mgmt=%d\n",wpa_Result.key_mgmt);
689 //printk("wpa-->eap_type=%d\n",wpa_Result.eap_type);
690 //printk("wpa-->authenticated is %s\n",(wpa_Result.authenticated==TRUE)?"TRUE":"FALSE");
697 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Private command not support..\n");