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
;
77 SCmdLinkStatus sLinkStatus
;
78 BYTE abySuppRates
[] = {WLAN_EID_SUPP_RATES
, 4, 0x02, 0x04, 0x0B, 0x16};
79 BYTE abyNullAddr
[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
81 BYTE 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((HANDLE
)pDevice
, FALSE
);
114 BSSvClearBSSList((HANDLE
)pDevice
, pDevice
->bLinkPass
);
116 if (pItemSSID
->len
!= 0)
117 bScheduleCommand((HANDLE
) pDevice
, WLAN_CMD_BSSID_SCAN
, abyScanSSID
);
119 bScheduleCommand((HANDLE
) 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");
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 { //Unknow 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((HANDLE
) pDevice
, WLAN_CMD_BSSID_SCAN
, pMgmt
->abyDesireSSID
);
227 bScheduleCommand((HANDLE
) 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 (PBYTE
)&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
, (BYTE
)(pBSS
->uRSSI
), &ldBm
);
344 pList
->sBSSIDList
[ii
].uRSSI
= (UINT
)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 (hostap_set_hostapd(pDevice
, 1, 1) == 0){
433 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable HOSTAP\n");
441 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
, U_ETHER_ADDR_LEN
);
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((HANDLE
)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
= (WORD
)pNode
->uInActiveCount
;
639 pNodeList
->sNodeList
[jj
].wEnQueueCnt
= (WORD
)pNode
->wEnQueueCnt
;
640 pNodeList
->sNodeList
[jj
].wFlags
= (WORD
)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
= (WORD
)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 sucessful 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");
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 (PDWORD) &(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);