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
41 /*--------------------- Static Definitions -------------------------*/
43 /*--------------------- Static Classes ----------------------------*/
45 /*--------------------- Static Variables --------------------------*/
46 //static int msglevel =MSG_LEVEL_DEBUG;
47 static int msglevel
=MSG_LEVEL_INFO
;
49 #ifdef WPA_SM_Transtatus
50 SWPAResult wpa_Result
;
53 /*--------------------- Static Functions --------------------------*/
55 /*--------------------- Export Variables --------------------------*/
57 int private_ioctl(PSDevice pDevice
, struct ifreq
*rq
) {
59 PSCmdRequest pReq
= (PSCmdRequest
)rq
;
60 PSMgmtObject pMgmt
= pDevice
->pMgmt
;
62 PWLAN_IE_SSID pItemSSID
;
64 SCmdZoneTypeSet sZoneTypeCmd
;
66 SCmdStartAP sStartAPCmd
;
73 unsigned int cbListCount
;
77 SCmdLinkStatus sLinkStatus
;
78 unsigned char abySuppRates
[] = {WLAN_EID_SUPP_RATES
, 4, 0x02, 0x04, 0x0B, 0x16};
79 unsigned char abyNullAddr
[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
80 unsigned long dwKeyIndex
= 0;
81 unsigned char abyScanSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
86 switch (pReq
->wCmdCode
) {
88 case WLAN_CMD_BSS_SCAN
:
90 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_BSS_SCAN..begin \n");
91 if (copy_from_user(&sScanCmd
, pReq
->data
, sizeof(SCmdScan
))) {
96 pItemSSID
= (PWLAN_IE_SSID
)sScanCmd
.ssid
;
97 if (pItemSSID
->len
!= 0) {
98 memset(abyScanSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
99 memcpy(abyScanSSID
, pItemSSID
, pItemSSID
->len
+ WLAN_IEHDR_LEN
);
102 if (pDevice
->bMACSuspend
== true) {
103 if (pDevice
->bRadioOff
== true)
104 CARDbRadioPowerOn(pDevice
);
105 vMgrTimerInit(pDevice
);
106 MACvIntEnable(pDevice
->PortOffset
, IMR_MASK_VALUE
);
107 add_timer(&pMgmt
->sTimerSecondCallback
);
108 pDevice
->bMACSuspend
= false;
110 spin_lock_irq(&pDevice
->lock
);
111 if (memcmp(pMgmt
->abyCurrBSSID
, &abyNullAddr
[0], 6) == 0)
112 BSSvClearBSSList((void *)pDevice
, false);
114 BSSvClearBSSList((void *)pDevice
, pDevice
->bLinkPass
);
116 if (pItemSSID
->len
!= 0)
117 bScheduleCommand((void *) pDevice
, WLAN_CMD_BSSID_SCAN
, abyScanSSID
);
119 bScheduleCommand((void *) pDevice
, WLAN_CMD_BSSID_SCAN
, NULL
);
120 spin_unlock_irq(&pDevice
->lock
);
123 case WLAN_CMD_ZONETYPE_SET
:
124 //mike add :cann't support.
128 if (copy_from_user(&sZoneTypeCmd
, pReq
->data
, sizeof(SCmdZoneTypeSet
))) {
133 if(sZoneTypeCmd
.bWrite
==true) {
135 if(sZoneTypeCmd
.ZoneType
== ZoneType_USA
) {
137 printk("set_ZoneType:USA\n");
139 else if(sZoneTypeCmd
.ZoneType
== ZoneType_Japan
) {
141 printk("set_ZoneType:Japan\n");
143 else if(sZoneTypeCmd
.ZoneType
== ZoneType_Europe
) {
145 printk("set_ZoneType:Europe\n");
150 unsigned char zonetype
=0;
153 if(zonetype
== 0x00) { //USA
154 sZoneTypeCmd
.ZoneType
= ZoneType_USA
;
156 else if(zonetype
== 0x01) { //Japan
157 sZoneTypeCmd
.ZoneType
= ZoneType_Japan
;
159 else if(zonetype
== 0x02) { //Europe
160 sZoneTypeCmd
.ZoneType
= ZoneType_Europe
;
162 else { //Unknown ZoneType
163 printk("Error:ZoneType[%x] Unknown ???\n",zonetype
);
167 if (copy_to_user(pReq
->data
, &sZoneTypeCmd
, sizeof(SCmdZoneTypeSet
))) {
175 case WLAN_CMD_BSS_JOIN
:
177 if (pDevice
->bMACSuspend
== true) {
178 if (pDevice
->bRadioOff
== true)
179 CARDbRadioPowerOn(pDevice
);
180 vMgrTimerInit(pDevice
);
181 MACvIntEnable(pDevice
->PortOffset
, IMR_MASK_VALUE
);
182 add_timer(&pMgmt
->sTimerSecondCallback
);
183 pDevice
->bMACSuspend
= false;
186 if (copy_from_user(&sJoinCmd
, pReq
->data
, sizeof(SCmdBSSJoin
))) {
191 pItemSSID
= (PWLAN_IE_SSID
)sJoinCmd
.ssid
;
192 memset(pMgmt
->abyDesireSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
193 memcpy(pMgmt
->abyDesireSSID
, pItemSSID
, pItemSSID
->len
+ WLAN_IEHDR_LEN
);
194 if (sJoinCmd
.wBSSType
== ADHOC
) {
195 pMgmt
->eConfigMode
= WMAC_CONFIG_IBSS_STA
;
196 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to adhoc mode\n");
199 pMgmt
->eConfigMode
= WMAC_CONFIG_ESS_STA
;
200 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to STA mode\n");
202 if (sJoinCmd
.bPSEnable
== true) {
203 pDevice
->ePSMode
= WMAC_POWER_FAST
;
204 // pDevice->ePSMode = WMAC_POWER_MAX;
205 pMgmt
->wListenInterval
= 2;
206 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Power Saving On\n");
209 pDevice
->ePSMode
= WMAC_POWER_CAM
;
210 pMgmt
->wListenInterval
= 1;
211 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Power Saving Off \n");
214 if (sJoinCmd
.bShareKeyAuth
== true){
215 pMgmt
->bShareKeyAlgorithm
= true;
216 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Share Key \n");
219 pMgmt
->bShareKeyAlgorithm
= false;
220 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Open System \n");
222 pDevice
->uChannel
= sJoinCmd
.uChannel
;
223 netif_stop_queue(pDevice
->dev
);
224 spin_lock_irq(&pDevice
->lock
);
225 pMgmt
->eCurrState
= WMAC_STATE_IDLE
;
226 bScheduleCommand((void *) pDevice
, WLAN_CMD_BSSID_SCAN
, pMgmt
->abyDesireSSID
);
227 bScheduleCommand((void *) pDevice
, WLAN_CMD_SSID
, NULL
);
228 spin_unlock_irq(&pDevice
->lock
);
231 case WLAN_CMD_SET_WEP
:
232 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_WEP Key. \n");
233 memset(&sWEPCmd
, 0 ,sizeof(SCmdSetWEP
));
234 if (copy_from_user(&sWEPCmd
, pReq
->data
, sizeof(SCmdSetWEP
))) {
238 if (sWEPCmd
.bEnableWep
!= true) {
239 pDevice
->bEncryptionEnable
= false;
240 pDevice
->eEncryptionStatus
= Ndis802_11EncryptionDisabled
;
241 MACvDisableDefaultKey(pDevice
->PortOffset
);
242 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WEP function disable. \n");
246 for (ii
= 0; ii
< WLAN_WEP_NKEYS
; ii
++) {
247 if (sWEPCmd
.bWepKeyAvailable
[ii
]) {
248 if (ii
== sWEPCmd
.byKeyIndex
)
249 //2006-1123-02,<Modify> by EinsnLiu
250 //Evaluate the "dwKeyIndex" error
251 // dwKeyIndex |= (1 << 31);
252 dwKeyIndex
=ii
|(1 << 31);
256 KeybSetDefaultKey(&(pDevice
->sKey
),
258 sWEPCmd
.auWepKeyLength
[ii
],
260 (unsigned char *)&sWEPCmd
.abyWepKey
[ii
][0],
266 pDevice
->byKeyIndex
= sWEPCmd
.byKeyIndex
;
267 pDevice
->bTransmitKey
= true;
268 pDevice
->bEncryptionEnable
= true;
269 pDevice
->eEncryptionStatus
= Ndis802_11Encryption1Enabled
;
273 case WLAN_CMD_GET_LINK
:
274 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_GET_LINK status. \n");
276 memset(sLinkStatus
.abySSID
, 0 , WLAN_SSID_MAXLEN
+ 1);
278 if (pMgmt
->eCurrMode
== WMAC_MODE_IBSS_STA
)
279 sLinkStatus
.wBSSType
= ADHOC
;
281 sLinkStatus
.wBSSType
= INFRA
;
283 if (pMgmt
->eCurrState
== WMAC_STATE_JOINTED
)
284 sLinkStatus
.byState
= ADHOC_JOINTED
;
286 sLinkStatus
.byState
= ADHOC_STARTED
;
288 sLinkStatus
.uChannel
= pMgmt
->uCurrChannel
;
289 if (pDevice
->bLinkPass
== true) {
290 sLinkStatus
.bLink
= true;
291 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyCurrSSID
;
292 memcpy(sLinkStatus
.abySSID
, pItemSSID
->abySSID
, pItemSSID
->len
);
293 memcpy(sLinkStatus
.abyBSSID
, pMgmt
->abyCurrBSSID
, WLAN_BSSID_LEN
);
294 sLinkStatus
.uLinkRate
= pMgmt
->sNodeDBTable
[0].wTxDataRate
;
295 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" Link Success ! \n");
298 sLinkStatus
.bLink
= false;
300 if (copy_to_user(pReq
->data
, &sLinkStatus
, sizeof(SCmdLinkStatus
))) {
307 case WLAN_CMD_GET_LISTLEN
:
309 pBSS
= &(pMgmt
->sBSSList
[0]);
310 for (ii
= 0; ii
< MAX_BSS_NUM
; ii
++) {
311 pBSS
= &(pMgmt
->sBSSList
[ii
]);
316 sList
.uItem
= cbListCount
;
317 if (copy_to_user(pReq
->data
, &sList
, sizeof(SBSSIDList
))) {
324 case WLAN_CMD_GET_LIST
:
325 if (copy_from_user(&sList
, pReq
->data
, sizeof(SBSSIDList
))) {
329 pList
= (PSBSSIDList
)kmalloc(sizeof(SBSSIDList
) + (sList
.uItem
* sizeof(SBSSIDItem
)), (int)GFP_ATOMIC
);
334 pList
->uItem
= sList
.uItem
;
335 pBSS
= &(pMgmt
->sBSSList
[0]);
336 for (ii
= 0, jj
= 0; jj
< MAX_BSS_NUM
; jj
++) {
337 pBSS
= &(pMgmt
->sBSSList
[jj
]);
339 pList
->sBSSIDList
[ii
].uChannel
= pBSS
->uChannel
;
340 pList
->sBSSIDList
[ii
].wBeaconInterval
= pBSS
->wBeaconInterval
;
341 pList
->sBSSIDList
[ii
].wCapInfo
= pBSS
->wCapInfo
;
342 // pList->sBSSIDList[ii].uRSSI = pBSS->uRSSI;
343 RFvRSSITodBm(pDevice
, (unsigned char)(pBSS
->uRSSI
), &ldBm
);
344 pList
->sBSSIDList
[ii
].uRSSI
= (unsigned int)ldBm
;
345 memcpy(pList
->sBSSIDList
[ii
].abyBSSID
, pBSS
->abyBSSID
, WLAN_BSSID_LEN
);
346 pItemSSID
= (PWLAN_IE_SSID
)pBSS
->abySSID
;
347 memset(pList
->sBSSIDList
[ii
].abySSID
, 0, WLAN_SSID_MAXLEN
+ 1);
348 memcpy(pList
->sBSSIDList
[ii
].abySSID
, pItemSSID
->abySSID
, pItemSSID
->len
);
349 if (WLAN_GET_CAP_INFO_ESS(pBSS
->wCapInfo
)) {
350 pList
->sBSSIDList
[ii
].byNetType
= INFRA
;
353 pList
->sBSSIDList
[ii
].byNetType
= ADHOC
;
355 if (WLAN_GET_CAP_INFO_PRIVACY(pBSS
->wCapInfo
)) {
356 pList
->sBSSIDList
[ii
].bWEPOn
= true;
359 pList
->sBSSIDList
[ii
].bWEPOn
= false;
362 if (ii
>= pList
->uItem
)
367 if (copy_to_user(pReq
->data
, pList
, sizeof(SBSSIDList
) + (sList
.uItem
* sizeof(SBSSIDItem
)))) {
375 case WLAN_CMD_GET_MIB
:
376 if (copy_to_user(pReq
->data
, &(pDevice
->s802_11Counter
), sizeof(SDot11MIBCount
))) {
382 case WLAN_CMD_GET_STAT
:
383 if (copy_to_user(pReq
->data
, &(pDevice
->scStatistic
), sizeof(SStatCounter
))) {
388 case WLAN_CMD_STOP_MAC
:
390 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_STOP_MAC\n");
391 netif_stop_queue(pDevice
->dev
);
393 spin_lock_irq(&pDevice
->lock
);
394 if (pDevice
->bRadioOff
== false) {
395 CARDbRadioPowerOff(pDevice
);
397 pDevice
->bLinkPass
= false;
398 memset(pMgmt
->abyCurrBSSID
, 0, 6);
399 pMgmt
->eCurrState
= WMAC_STATE_IDLE
;
400 del_timer(&pDevice
->sTimerCommand
);
401 del_timer(&pMgmt
->sTimerSecondCallback
);
402 pDevice
->bCmdRunning
= false;
403 pDevice
->bMACSuspend
= true;
404 MACvIntDisable(pDevice
->PortOffset
);
405 spin_unlock_irq(&pDevice
->lock
);
409 case WLAN_CMD_START_MAC
:
411 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_START_MAC\n");
413 if (pDevice
->bMACSuspend
== true) {
414 if (pDevice
->bRadioOff
== true)
415 CARDbRadioPowerOn(pDevice
);
416 vMgrTimerInit(pDevice
);
417 MACvIntEnable(pDevice
->PortOffset
, IMR_MASK_VALUE
);
418 add_timer(&pMgmt
->sTimerSecondCallback
);
419 pDevice
->bMACSuspend
= false;
423 case WLAN_CMD_SET_HOSTAPD
:
425 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOSTAPD\n");
427 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
431 if (sValue
.dwValue
== 1) {
432 if (vt6655_hostap_set_hostapd(pDevice
, 1, 1) == 0){
433 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable HOSTAP\n");
441 vt6655_hostap_set_hostapd(pDevice
, 0, 1);
442 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable HOSTAP\n");
447 case WLAN_CMD_SET_HOSTAPD_STA
:
449 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOSTAPD_STA\n");
452 case WLAN_CMD_SET_802_1X
:
454 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_802_1X\n");
455 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
460 if (sValue
.dwValue
== 1) {
461 pDevice
->bEnable8021x
= true;
462 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable 802.1x\n");
465 pDevice
->bEnable8021x
= false;
466 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable 802.1x\n");
472 case WLAN_CMD_SET_HOST_WEP
:
474 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOST_WEP\n");
475 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
480 if (sValue
.dwValue
== 1) {
481 pDevice
->bEnableHostWEP
= true;
482 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable HostWEP\n");
485 pDevice
->bEnableHostWEP
= false;
486 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable HostWEP\n");
491 case WLAN_CMD_SET_WPA
:
492 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_WPA\n");
494 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
498 if (sValue
.dwValue
== 1) {
499 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"up wpadev\n");
500 memcpy(pDevice
->wpadev
->dev_addr
, pDevice
->dev
->dev_addr
, ETH_ALEN
);
501 pDevice
->bWPADEVUp
= true;
504 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"close wpadev\n");
505 pDevice
->bWPADEVUp
= false;
510 case WLAN_CMD_AP_START
:
512 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_AP_START\n");
513 if (pDevice
->bRadioOff
== true) {
514 CARDbRadioPowerOn(pDevice
);
515 vMgrTimerInit(pDevice
);
516 MACvIntEnable(pDevice
->PortOffset
, IMR_MASK_VALUE
);
517 add_timer(&pMgmt
->sTimerSecondCallback
);
519 if (copy_from_user(&sStartAPCmd
, pReq
->data
, sizeof(SCmdStartAP
))) {
524 if (sStartAPCmd
.wBSSType
== AP
) {
525 pMgmt
->eConfigMode
= WMAC_CONFIG_AP
;
526 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to AP mode\n");
529 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct BSS type not set to AP mode\n");
535 if (sStartAPCmd
.wBBPType
== PHY80211g
) {
536 pMgmt
->byAPBBType
= PHY_TYPE_11G
;
538 else if (sStartAPCmd
.wBBPType
== PHY80211a
) {
539 pMgmt
->byAPBBType
= PHY_TYPE_11A
;
542 pMgmt
->byAPBBType
= PHY_TYPE_11B
;
545 pItemSSID
= (PWLAN_IE_SSID
)sStartAPCmd
.ssid
;
546 memset(pMgmt
->abyDesireSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
547 memcpy(pMgmt
->abyDesireSSID
, pItemSSID
, pItemSSID
->len
+ WLAN_IEHDR_LEN
);
549 if ((sStartAPCmd
.uChannel
> 0)&&(sStartAPCmd
.uChannel
<= 14))
550 pDevice
->uChannel
= sStartAPCmd
.uChannel
;
552 if ((sStartAPCmd
.uBeaconInt
>= 20) && (sStartAPCmd
.uBeaconInt
<= 1000))
553 pMgmt
->wIBSSBeaconPeriod
= sStartAPCmd
.uBeaconInt
;
555 pMgmt
->wIBSSBeaconPeriod
= 100;
557 if (sStartAPCmd
.bShareKeyAuth
== true){
558 pMgmt
->bShareKeyAlgorithm
= true;
559 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Share Key \n");
562 pMgmt
->bShareKeyAlgorithm
= false;
563 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Open System \n");
565 memcpy(pMgmt
->abyIBSSSuppRates
, abySuppRates
, 6);
567 if (sStartAPCmd
.byBasicRate
& BIT3
) {
568 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
569 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
570 pMgmt
->abyIBSSSuppRates
[4] |= BIT7
;
571 pMgmt
->abyIBSSSuppRates
[5] |= BIT7
;
572 }else if (sStartAPCmd
.byBasicRate
& BIT2
) {
573 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
574 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
575 pMgmt
->abyIBSSSuppRates
[4] |= BIT7
;
576 }else if (sStartAPCmd
.byBasicRate
& BIT1
) {
577 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
578 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
579 }else if (sStartAPCmd
.byBasicRate
& BIT1
) {
580 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
583 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
584 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
587 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Support Rate= %x %x %x %x\n",
588 pMgmt
->abyIBSSSuppRates
[2],
589 pMgmt
->abyIBSSSuppRates
[3],
590 pMgmt
->abyIBSSSuppRates
[4],
591 pMgmt
->abyIBSSSuppRates
[5]
594 netif_stop_queue(pDevice
->dev
);
595 spin_lock_irq(&pDevice
->lock
);
596 bScheduleCommand((void *)pDevice
, WLAN_CMD_RUN_AP
, NULL
);
597 spin_unlock_irq(&pDevice
->lock
);
600 case WLAN_CMD_GET_NODE_CNT
:
603 pNode
= &(pMgmt
->sNodeDBTable
[0]);
604 for (ii
= 0; ii
< (MAX_NODE_NUM
+ 1); ii
++) {
605 pNode
= &(pMgmt
->sNodeDBTable
[ii
]);
611 sNodeList
.uItem
= cbListCount
;
612 if (copy_to_user(pReq
->data
, &sNodeList
, sizeof(SNodeList
))) {
619 case WLAN_CMD_GET_NODE_LIST
:
621 if (copy_from_user(&sNodeList
, pReq
->data
, sizeof(SNodeList
))) {
625 pNodeList
= (PSNodeList
)kmalloc(sizeof(SNodeList
) + (sNodeList
.uItem
* sizeof(SNodeItem
)), (int)GFP_ATOMIC
);
626 if (pNodeList
== NULL
) {
630 pNodeList
->uItem
= sNodeList
.uItem
;
631 pNode
= &(pMgmt
->sNodeDBTable
[0]);
632 for (ii
= 0, jj
= 0; ii
< (MAX_NODE_NUM
+ 1); ii
++) {
633 pNode
= &(pMgmt
->sNodeDBTable
[ii
]);
634 if (pNode
->bActive
) {
635 pNodeList
->sNodeList
[jj
].wAID
= pNode
->wAID
;
636 memcpy(pNodeList
->sNodeList
[jj
].abyMACAddr
, pNode
->abyMACAddr
, WLAN_ADDR_LEN
);
637 pNodeList
->sNodeList
[jj
].wTxDataRate
= pNode
->wTxDataRate
;
638 pNodeList
->sNodeList
[jj
].wInActiveCount
= (unsigned short)pNode
->uInActiveCount
;
639 pNodeList
->sNodeList
[jj
].wEnQueueCnt
= (unsigned short)pNode
->wEnQueueCnt
;
640 pNodeList
->sNodeList
[jj
].wFlags
= (unsigned short)pNode
->dwFlags
;
641 pNodeList
->sNodeList
[jj
].bPWBitOn
= pNode
->bPSEnable
;
642 pNodeList
->sNodeList
[jj
].byKeyIndex
= pNode
->byKeyIndex
;
643 pNodeList
->sNodeList
[jj
].wWepKeyLength
= pNode
->uWepKeyLength
;
644 memcpy(&(pNodeList
->sNodeList
[jj
].abyWepKey
[0]), &(pNode
->abyWepKey
[0]), WEP_KEYMAXLEN
);
645 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
646 pNodeList
->sNodeList
[jj
].abyWepKey
[0],
647 pNodeList
->sNodeList
[jj
].abyWepKey
[1],
648 pNodeList
->sNodeList
[jj
].abyWepKey
[2],
649 pNodeList
->sNodeList
[jj
].abyWepKey
[3],
650 pNodeList
->sNodeList
[jj
].abyWepKey
[4]
652 pNodeList
->sNodeList
[jj
].bIsInFallback
= pNode
->bIsInFallback
;
653 pNodeList
->sNodeList
[jj
].uTxFailures
= pNode
->uTxFailures
;
654 pNodeList
->sNodeList
[jj
].uTxAttempts
= pNode
->uTxAttempts
;
655 pNodeList
->sNodeList
[jj
].wFailureRatio
= (unsigned short)pNode
->uFailureRatio
;
657 if (jj
>= pNodeList
->uItem
)
661 if (copy_to_user(pReq
->data
, pNodeList
, sizeof(SNodeList
) + (sNodeList
.uItem
* sizeof(SNodeItem
)))) {
669 #ifdef WPA_SM_Transtatus
671 memset(wpa_Result
.ifname
,0,sizeof(wpa_Result
.ifname
));
672 wpa_Result
.proto
= 0;
673 wpa_Result
.key_mgmt
= 0;
674 wpa_Result
.eap_type
= 0;
675 wpa_Result
.authenticated
= false;
676 pDevice
->fWPA_Authened
= false;
677 if (copy_from_user(&wpa_Result
, pReq
->data
, sizeof(wpa_Result
))) {
682 if(wpa_Result
.authenticated
==true) {
685 union iwreq_data wrqu
;
687 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyCurrSSID
;
689 memset(&wrqu
, 0, sizeof(wrqu
));
690 wrqu
.data
.flags
= RT_WPACONNECTED_EVENT_FLAG
;
691 wrqu
.data
.length
=pItemSSID
->len
;
692 wireless_send_event(pDevice
->dev
, IWEVCUSTOM
, &wrqu
, pItemSSID
->abySSID
);
695 pDevice
->fWPA_Authened
= true; //is successful peer to wpa_Result.authenticated?
698 //printk("get private wpa_supplicant announce WPA SM\n");
699 //printk("wpa-->ifname=%s\n",wpa_Result.ifname);
700 //printk("wpa-->proto=%d\n",wpa_Result.proto);
701 //printk("wpa-->key-mgmt=%d\n",wpa_Result.key_mgmt);
702 //printk("wpa-->eap_type=%d\n",wpa_Result.eap_type);
703 //printk("wpa-->authenticated is %s\n",(wpa_Result.authenticated==true)?"true":"false");
710 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Private command not support..\n");
720 unsigned long dwKeyIndex,
721 unsigned char *pbyKey,
722 unsigned long uKeyLength
728 memset(&pDevice->abyWepKey[dwKeyIndex][0], 0, WLAN_WEPMAX_KEYLEN);
729 memcpy(&pDevice->abyWepKey[dwKeyIndex][0], pbyKey, uKeyLength);
731 pDevice->bWepKeyAvailable[dwKeyIndex] = true;
732 pDevice->auWepKeyLength[dwKeyIndex] = uKeyLength;
734 MACvSetDefaultKeyEntry(pDevice->PortOffset, uKeyLength, dwKeyIndex,
735 (unsigned long *) &(pDevice->abyWepKey[dwKeyIndex][0]), pDevice->byLocalID);
737 if (pDevice->eEncryptionStatus < Ndis802_11EncryptionNotSupported) {
738 for(ii=0; ii<MAX_GROUP_KEY; ii++) {
739 if ((pDevice->bWepKeyAvailable[ii] == true) &&
740 (pDevice->auWepKeyLength[ii] == WLAN_WEP232_KEYLEN)) {
741 pDevice->uCurrentWEPMode = TX_WEP_SW232;
742 MACvDisableDefaultKey(pDevice->PortOffset);
746 if ((ii == MAX_GROUP_KEY) &&
747 (pDevice->eEncryptionStatus < Ndis802_11EncryptionNotSupported)) {
748 MACvEnableDefaultKey(pDevice->PortOffset, pDevice->byLocalID);