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
34 #if !defined(__IOCTL_H__)
37 #if !defined(__IOCMD_H__)
40 #if !defined(__MAC_H__)
43 #if !defined(__CARD_H__)
46 #if !defined(__HOSTAP_H__)
49 #if !defined(__UMEM_H__)
52 #if !defined(__WPACTL_H__)
55 #if !defined(__RF_H__)
60 /*--------------------- Static Definitions -------------------------*/
62 /*--------------------- Static Classes ----------------------------*/
64 /*--------------------- Static Variables --------------------------*/
65 //static int msglevel =MSG_LEVEL_DEBUG;
66 static int msglevel
=MSG_LEVEL_INFO
;
68 /*--------------------- Static Functions --------------------------*/
70 #ifdef WPA_SM_Transtatus
71 SWPAResult wpa_Result
;
75 /*--------------------- Export Variables --------------------------*/
77 int private_ioctl(PSDevice pDevice
, struct ifreq
*rq
) {
79 PSCmdRequest pReq
= (PSCmdRequest
)rq
;
80 PSMgmtObject pMgmt
= pDevice
->pMgmt
;
82 PWLAN_IE_SSID pItemSSID
;
84 SCmdZoneTypeSet sZoneTypeCmd
;
86 SCmdStartAP sStartAPCmd
;
97 SCmdLinkStatus sLinkStatus
;
98 BYTE abySuppRates
[] = {WLAN_EID_SUPP_RATES
, 4, 0x02, 0x04, 0x0B, 0x16};
99 BYTE abyNullAddr
[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
101 BYTE abyScanSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
107 switch(pReq
->wCmdCode
) {
109 case WLAN_CMD_BSS_SCAN
:
111 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_BSS_SCAN..begin \n");
112 if (copy_from_user(&sScanCmd
, pReq
->data
, sizeof(SCmdScan
))) {
117 pItemSSID
= (PWLAN_IE_SSID
)sScanCmd
.ssid
;
118 if (pItemSSID
->len
!= 0) {
119 memset(abyScanSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
120 memcpy(abyScanSSID
, pItemSSID
, pItemSSID
->len
+ WLAN_IEHDR_LEN
);
123 if (pDevice
->bMACSuspend
== TRUE
) {
124 if (pDevice
->bRadioOff
== TRUE
)
125 CARDbRadioPowerOn(pDevice
);
126 vMgrTimerInit(pDevice
);
127 MACvIntEnable(pDevice
->PortOffset
, IMR_MASK_VALUE
);
128 add_timer(&pMgmt
->sTimerSecondCallback
);
129 pDevice
->bMACSuspend
= FALSE
;
131 spin_lock_irq(&pDevice
->lock
);
132 if (memcmp(pMgmt
->abyCurrBSSID
, &abyNullAddr
[0], 6) == 0)
133 BSSvClearBSSList((HANDLE
)pDevice
, FALSE
);
135 BSSvClearBSSList((HANDLE
)pDevice
, pDevice
->bLinkPass
);
137 if (pItemSSID
->len
!= 0)
138 bScheduleCommand((HANDLE
) pDevice
, WLAN_CMD_BSSID_SCAN
, abyScanSSID
);
140 bScheduleCommand((HANDLE
) pDevice
, WLAN_CMD_BSSID_SCAN
, NULL
);
141 spin_unlock_irq(&pDevice
->lock
);
144 case WLAN_CMD_ZONETYPE_SET
:
145 //mike add :cann't support.
149 if (copy_from_user(&sZoneTypeCmd
, pReq
->data
, sizeof(SCmdZoneTypeSet
))) {
154 if(sZoneTypeCmd
.bWrite
==TRUE
) {
156 if(sZoneTypeCmd
.ZoneType
== ZoneType_USA
) {
158 printk("set_ZoneType:USA\n");
160 else if(sZoneTypeCmd
.ZoneType
== ZoneType_Japan
) {
162 printk("set_ZoneType:Japan\n");
164 else if(sZoneTypeCmd
.ZoneType
== ZoneType_Europe
) {
166 printk("set_ZoneType:Europe\n");
174 if(zonetype
== 0x00) { //USA
175 sZoneTypeCmd
.ZoneType
= ZoneType_USA
;
177 else if(zonetype
== 0x01) { //Japan
178 sZoneTypeCmd
.ZoneType
= ZoneType_Japan
;
180 else if(zonetype
== 0x02) { //Europe
181 sZoneTypeCmd
.ZoneType
= ZoneType_Europe
;
183 else { //Unknow ZoneType
184 printk("Error:ZoneType[%x] Unknown ???\n",zonetype
);
188 if (copy_to_user(pReq
->data
, &sZoneTypeCmd
, sizeof(SCmdZoneTypeSet
))) {
196 case WLAN_CMD_BSS_JOIN
:
198 if (pDevice
->bMACSuspend
== TRUE
) {
199 if (pDevice
->bRadioOff
== TRUE
)
200 CARDbRadioPowerOn(pDevice
);
201 vMgrTimerInit(pDevice
);
202 MACvIntEnable(pDevice
->PortOffset
, IMR_MASK_VALUE
);
203 add_timer(&pMgmt
->sTimerSecondCallback
);
204 pDevice
->bMACSuspend
= FALSE
;
207 if (copy_from_user(&sJoinCmd
, pReq
->data
, sizeof(SCmdBSSJoin
))) {
212 pItemSSID
= (PWLAN_IE_SSID
)sJoinCmd
.ssid
;
213 memset(pMgmt
->abyDesireSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
214 memcpy(pMgmt
->abyDesireSSID
, pItemSSID
, pItemSSID
->len
+ WLAN_IEHDR_LEN
);
215 if (sJoinCmd
.wBSSType
== ADHOC
) {
216 pMgmt
->eConfigMode
= WMAC_CONFIG_IBSS_STA
;
217 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to adhoc mode\n");
220 pMgmt
->eConfigMode
= WMAC_CONFIG_ESS_STA
;
221 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to STA mode\n");
223 if (sJoinCmd
.bPSEnable
== TRUE
) {
224 pDevice
->ePSMode
= WMAC_POWER_FAST
;
225 // pDevice->ePSMode = WMAC_POWER_MAX;
226 pMgmt
->wListenInterval
= 2;
227 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Power Saving On\n");
230 pDevice
->ePSMode
= WMAC_POWER_CAM
;
231 pMgmt
->wListenInterval
= 1;
232 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Power Saving Off \n");
235 if (sJoinCmd
.bShareKeyAuth
== TRUE
){
236 pMgmt
->bShareKeyAlgorithm
= TRUE
;
237 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Share Key \n");
240 pMgmt
->bShareKeyAlgorithm
= FALSE
;
241 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Open System \n");
243 pDevice
->uChannel
= sJoinCmd
.uChannel
;
244 netif_stop_queue(pDevice
->dev
);
245 spin_lock_irq(&pDevice
->lock
);
246 pMgmt
->eCurrState
= WMAC_STATE_IDLE
;
247 bScheduleCommand((HANDLE
) pDevice
, WLAN_CMD_BSSID_SCAN
, pMgmt
->abyDesireSSID
);
248 bScheduleCommand((HANDLE
) pDevice
, WLAN_CMD_SSID
, NULL
);
249 spin_unlock_irq(&pDevice
->lock
);
252 case WLAN_CMD_SET_WEP
:
254 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_WEP Key. \n");
255 memset(&sWEPCmd
, 0 ,sizeof(SCmdSetWEP
));
256 if (copy_from_user(&sWEPCmd
, pReq
->data
, sizeof(SCmdSetWEP
))) {
260 if (sWEPCmd
.bEnableWep
!= TRUE
) {
261 pDevice
->bEncryptionEnable
= FALSE
;
262 pDevice
->eEncryptionStatus
= Ndis802_11EncryptionDisabled
;
263 MACvDisableDefaultKey(pDevice
->PortOffset
);
264 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WEP function disable. \n");
268 for (ii
= 0; ii
< WLAN_WEP_NKEYS
; ii
++) {
269 if (sWEPCmd
.bWepKeyAvailable
[ii
]) {
270 if (ii
== sWEPCmd
.byKeyIndex
)
271 //2006-1123-02,<Modify> by EinsnLiu
272 //Evaluate the "dwKeyIndex" error
273 // dwKeyIndex |= (1 << 31);
274 dwKeyIndex
=ii
|(1 << 31);
278 KeybSetDefaultKey(&(pDevice
->sKey
),
280 sWEPCmd
.auWepKeyLength
[ii
],
282 (PBYTE
)&sWEPCmd
.abyWepKey
[ii
][0],
288 pDevice
->byKeyIndex
= sWEPCmd
.byKeyIndex
;
289 pDevice
->bTransmitKey
= TRUE
;
290 pDevice
->bEncryptionEnable
= TRUE
;
291 pDevice
->eEncryptionStatus
= Ndis802_11Encryption1Enabled
;
295 case WLAN_CMD_GET_LINK
:
296 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_GET_LINK status. \n");
298 memset(sLinkStatus
.abySSID
, 0 , WLAN_SSID_MAXLEN
+ 1);
300 if (pMgmt
->eCurrMode
== WMAC_MODE_IBSS_STA
)
301 sLinkStatus
.wBSSType
= ADHOC
;
303 sLinkStatus
.wBSSType
= INFRA
;
305 if (pMgmt
->eCurrState
== WMAC_STATE_JOINTED
)
306 sLinkStatus
.byState
= ADHOC_JOINTED
;
308 sLinkStatus
.byState
= ADHOC_STARTED
;
310 sLinkStatus
.uChannel
= pMgmt
->uCurrChannel
;
311 if (pDevice
->bLinkPass
== TRUE
) {
312 sLinkStatus
.bLink
= TRUE
;
313 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyCurrSSID
;
314 memcpy(sLinkStatus
.abySSID
, pItemSSID
->abySSID
, pItemSSID
->len
);
315 memcpy(sLinkStatus
.abyBSSID
, pMgmt
->abyCurrBSSID
, WLAN_BSSID_LEN
);
316 sLinkStatus
.uLinkRate
= pMgmt
->sNodeDBTable
[0].wTxDataRate
;
317 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" Link Success ! \n");
320 sLinkStatus
.bLink
= FALSE
;
322 if (copy_to_user(pReq
->data
, &sLinkStatus
, sizeof(SCmdLinkStatus
))) {
329 case WLAN_CMD_GET_LISTLEN
:
331 pBSS
= &(pMgmt
->sBSSList
[0]);
332 for (ii
= 0; ii
< MAX_BSS_NUM
; ii
++) {
333 pBSS
= &(pMgmt
->sBSSList
[ii
]);
338 sList
.uItem
= cbListCount
;
339 if (copy_to_user(pReq
->data
, &sList
, sizeof(SBSSIDList
))) {
346 case WLAN_CMD_GET_LIST
:
347 if (copy_from_user(&sList
, pReq
->data
, sizeof(SBSSIDList
))) {
351 pList
= (PSBSSIDList
)kmalloc(sizeof(SBSSIDList
) + (sList
.uItem
* sizeof(SBSSIDItem
)), (int)GFP_ATOMIC
);
356 pList
->uItem
= sList
.uItem
;
357 pBSS
= &(pMgmt
->sBSSList
[0]);
358 for (ii
= 0, jj
= 0; jj
< MAX_BSS_NUM
; jj
++) {
359 pBSS
= &(pMgmt
->sBSSList
[jj
]);
361 pList
->sBSSIDList
[ii
].uChannel
= pBSS
->uChannel
;
362 pList
->sBSSIDList
[ii
].wBeaconInterval
= pBSS
->wBeaconInterval
;
363 pList
->sBSSIDList
[ii
].wCapInfo
= pBSS
->wCapInfo
;
364 // pList->sBSSIDList[ii].uRSSI = pBSS->uRSSI;
365 RFvRSSITodBm(pDevice
, (BYTE
)(pBSS
->uRSSI
), &ldBm
);
366 pList
->sBSSIDList
[ii
].uRSSI
= (UINT
)ldBm
;
367 memcpy(pList
->sBSSIDList
[ii
].abyBSSID
, pBSS
->abyBSSID
, WLAN_BSSID_LEN
);
368 pItemSSID
= (PWLAN_IE_SSID
)pBSS
->abySSID
;
369 memset(pList
->sBSSIDList
[ii
].abySSID
, 0, WLAN_SSID_MAXLEN
+ 1);
370 memcpy(pList
->sBSSIDList
[ii
].abySSID
, pItemSSID
->abySSID
, pItemSSID
->len
);
371 if (WLAN_GET_CAP_INFO_ESS(pBSS
->wCapInfo
)) {
372 pList
->sBSSIDList
[ii
].byNetType
= INFRA
;
375 pList
->sBSSIDList
[ii
].byNetType
= ADHOC
;
377 if (WLAN_GET_CAP_INFO_PRIVACY(pBSS
->wCapInfo
)) {
378 pList
->sBSSIDList
[ii
].bWEPOn
= TRUE
;
381 pList
->sBSSIDList
[ii
].bWEPOn
= FALSE
;
384 if (ii
>= pList
->uItem
)
389 if (copy_to_user(pReq
->data
, pList
, sizeof(SBSSIDList
) + (sList
.uItem
* sizeof(SBSSIDItem
)))) {
397 case WLAN_CMD_GET_MIB
:
398 if (copy_to_user(pReq
->data
, &(pDevice
->s802_11Counter
), sizeof(SDot11MIBCount
))) {
404 case WLAN_CMD_GET_STAT
:
405 if (copy_to_user(pReq
->data
, &(pDevice
->scStatistic
), sizeof(SStatCounter
))) {
410 case WLAN_CMD_STOP_MAC
:
412 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_STOP_MAC\n");
413 netif_stop_queue(pDevice
->dev
);
415 spin_lock_irq(&pDevice
->lock
);
416 if (pDevice
->bRadioOff
== FALSE
) {
417 CARDbRadioPowerOff(pDevice
);
419 pDevice
->bLinkPass
= FALSE
;
420 memset(pMgmt
->abyCurrBSSID
, 0, 6);
421 pMgmt
->eCurrState
= WMAC_STATE_IDLE
;
422 del_timer(&pDevice
->sTimerCommand
);
423 del_timer(&pMgmt
->sTimerSecondCallback
);
424 pDevice
->bCmdRunning
= FALSE
;
425 pDevice
->bMACSuspend
= TRUE
;
426 MACvIntDisable(pDevice
->PortOffset
);
427 spin_unlock_irq(&pDevice
->lock
);
431 case WLAN_CMD_START_MAC
:
433 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_START_MAC\n");
435 if (pDevice
->bMACSuspend
== TRUE
) {
436 if (pDevice
->bRadioOff
== TRUE
)
437 CARDbRadioPowerOn(pDevice
);
438 vMgrTimerInit(pDevice
);
439 MACvIntEnable(pDevice
->PortOffset
, IMR_MASK_VALUE
);
440 add_timer(&pMgmt
->sTimerSecondCallback
);
441 pDevice
->bMACSuspend
= FALSE
;
445 case WLAN_CMD_SET_HOSTAPD
:
447 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOSTAPD\n");
449 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
453 if (sValue
.dwValue
== 1) {
454 if (hostap_set_hostapd(pDevice
, 1, 1) == 0){
455 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable HOSTAP\n");
463 hostap_set_hostapd(pDevice
, 0, 1);
464 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable HOSTAP\n");
469 case WLAN_CMD_SET_HOSTAPD_STA
:
471 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOSTAPD_STA\n");
474 case WLAN_CMD_SET_802_1X
:
476 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_802_1X\n");
477 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
482 if (sValue
.dwValue
== 1) {
483 pDevice
->bEnable8021x
= TRUE
;
484 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable 802.1x\n");
487 pDevice
->bEnable8021x
= FALSE
;
488 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable 802.1x\n");
494 case WLAN_CMD_SET_HOST_WEP
:
496 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOST_WEP\n");
497 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
502 if (sValue
.dwValue
== 1) {
503 pDevice
->bEnableHostWEP
= TRUE
;
504 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable HostWEP\n");
507 pDevice
->bEnableHostWEP
= FALSE
;
508 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable HostWEP\n");
513 case WLAN_CMD_SET_WPA
:
514 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_WPA\n");
516 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
520 if (sValue
.dwValue
== 1) {
521 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"up wpadev\n");
522 memcpy(pDevice
->wpadev
->dev_addr
, pDevice
->dev
->dev_addr
, U_ETHER_ADDR_LEN
);
523 pDevice
->bWPADEVUp
= TRUE
;
526 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"close wpadev\n");
527 pDevice
->bWPADEVUp
= FALSE
;
532 case WLAN_CMD_AP_START
:
534 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_AP_START\n");
535 if (pDevice
->bRadioOff
== TRUE
) {
536 CARDbRadioPowerOn(pDevice
);
537 vMgrTimerInit(pDevice
);
538 MACvIntEnable(pDevice
->PortOffset
, IMR_MASK_VALUE
);
539 add_timer(&pMgmt
->sTimerSecondCallback
);
541 if (copy_from_user(&sStartAPCmd
, pReq
->data
, sizeof(SCmdStartAP
))) {
546 if (sStartAPCmd
.wBSSType
== AP
) {
547 pMgmt
->eConfigMode
= WMAC_CONFIG_AP
;
548 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to AP mode\n");
551 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct BSS type not set to AP mode\n");
557 if (sStartAPCmd
.wBBPType
== PHY80211g
) {
558 pMgmt
->byAPBBType
= PHY_TYPE_11G
;
560 else if (sStartAPCmd
.wBBPType
== PHY80211a
) {
561 pMgmt
->byAPBBType
= PHY_TYPE_11A
;
564 pMgmt
->byAPBBType
= PHY_TYPE_11B
;
567 pItemSSID
= (PWLAN_IE_SSID
)sStartAPCmd
.ssid
;
568 memset(pMgmt
->abyDesireSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
569 memcpy(pMgmt
->abyDesireSSID
, pItemSSID
, pItemSSID
->len
+ WLAN_IEHDR_LEN
);
571 if ((sStartAPCmd
.uChannel
> 0)&&(sStartAPCmd
.uChannel
<= 14))
572 pDevice
->uChannel
= sStartAPCmd
.uChannel
;
574 if ((sStartAPCmd
.uBeaconInt
>= 20) && (sStartAPCmd
.uBeaconInt
<= 1000))
575 pMgmt
->wIBSSBeaconPeriod
= sStartAPCmd
.uBeaconInt
;
577 pMgmt
->wIBSSBeaconPeriod
= 100;
579 if (sStartAPCmd
.bShareKeyAuth
== TRUE
){
580 pMgmt
->bShareKeyAlgorithm
= TRUE
;
581 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Share Key \n");
584 pMgmt
->bShareKeyAlgorithm
= FALSE
;
585 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Open System \n");
587 memcpy(pMgmt
->abyIBSSSuppRates
, abySuppRates
, 6);
589 if (sStartAPCmd
.byBasicRate
& BIT3
) {
590 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
591 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
592 pMgmt
->abyIBSSSuppRates
[4] |= BIT7
;
593 pMgmt
->abyIBSSSuppRates
[5] |= BIT7
;
594 }else if (sStartAPCmd
.byBasicRate
& BIT2
) {
595 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
596 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
597 pMgmt
->abyIBSSSuppRates
[4] |= BIT7
;
598 }else if (sStartAPCmd
.byBasicRate
& BIT1
) {
599 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
600 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
601 }else if (sStartAPCmd
.byBasicRate
& BIT1
) {
602 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
605 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
606 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
609 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Support Rate= %x %x %x %x\n",
610 pMgmt
->abyIBSSSuppRates
[2],
611 pMgmt
->abyIBSSSuppRates
[3],
612 pMgmt
->abyIBSSSuppRates
[4],
613 pMgmt
->abyIBSSSuppRates
[5]
616 netif_stop_queue(pDevice
->dev
);
617 spin_lock_irq(&pDevice
->lock
);
618 bScheduleCommand((HANDLE
)pDevice
, WLAN_CMD_RUN_AP
, NULL
);
619 spin_unlock_irq(&pDevice
->lock
);
622 case WLAN_CMD_GET_NODE_CNT
:
625 pNode
= &(pMgmt
->sNodeDBTable
[0]);
626 for (ii
= 0; ii
< (MAX_NODE_NUM
+ 1); ii
++) {
627 pNode
= &(pMgmt
->sNodeDBTable
[ii
]);
633 sNodeList
.uItem
= cbListCount
;
634 if (copy_to_user(pReq
->data
, &sNodeList
, sizeof(SNodeList
))) {
641 case WLAN_CMD_GET_NODE_LIST
:
643 if (copy_from_user(&sNodeList
, pReq
->data
, sizeof(SNodeList
))) {
647 pNodeList
= (PSNodeList
)kmalloc(sizeof(SNodeList
) + (sNodeList
.uItem
* sizeof(SNodeItem
)), (int)GFP_ATOMIC
);
648 if (pNodeList
== NULL
) {
652 pNodeList
->uItem
= sNodeList
.uItem
;
653 pNode
= &(pMgmt
->sNodeDBTable
[0]);
654 for (ii
= 0, jj
= 0; ii
< (MAX_NODE_NUM
+ 1); ii
++) {
655 pNode
= &(pMgmt
->sNodeDBTable
[ii
]);
656 if (pNode
->bActive
) {
657 pNodeList
->sNodeList
[jj
].wAID
= pNode
->wAID
;
658 memcpy(pNodeList
->sNodeList
[jj
].abyMACAddr
, pNode
->abyMACAddr
, WLAN_ADDR_LEN
);
659 pNodeList
->sNodeList
[jj
].wTxDataRate
= pNode
->wTxDataRate
;
660 pNodeList
->sNodeList
[jj
].wInActiveCount
= (WORD
)pNode
->uInActiveCount
;
661 pNodeList
->sNodeList
[jj
].wEnQueueCnt
= (WORD
)pNode
->wEnQueueCnt
;
662 pNodeList
->sNodeList
[jj
].wFlags
= (WORD
)pNode
->dwFlags
;
663 pNodeList
->sNodeList
[jj
].bPWBitOn
= pNode
->bPSEnable
;
664 pNodeList
->sNodeList
[jj
].byKeyIndex
= pNode
->byKeyIndex
;
665 pNodeList
->sNodeList
[jj
].wWepKeyLength
= pNode
->uWepKeyLength
;
666 memcpy(&(pNodeList
->sNodeList
[jj
].abyWepKey
[0]), &(pNode
->abyWepKey
[0]), WEP_KEYMAXLEN
);
667 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
668 pNodeList
->sNodeList
[jj
].abyWepKey
[0],
669 pNodeList
->sNodeList
[jj
].abyWepKey
[1],
670 pNodeList
->sNodeList
[jj
].abyWepKey
[2],
671 pNodeList
->sNodeList
[jj
].abyWepKey
[3],
672 pNodeList
->sNodeList
[jj
].abyWepKey
[4]
674 pNodeList
->sNodeList
[jj
].bIsInFallback
= pNode
->bIsInFallback
;
675 pNodeList
->sNodeList
[jj
].uTxFailures
= pNode
->uTxFailures
;
676 pNodeList
->sNodeList
[jj
].uTxAttempts
= pNode
->uTxAttempts
;
677 pNodeList
->sNodeList
[jj
].wFailureRatio
= (WORD
)pNode
->uFailureRatio
;
679 if (jj
>= pNodeList
->uItem
)
683 if (copy_to_user(pReq
->data
, pNodeList
, sizeof(SNodeList
) + (sNodeList
.uItem
* sizeof(SNodeItem
)))) {
691 #ifdef WPA_SM_Transtatus
693 memset(wpa_Result
.ifname
,0,sizeof(wpa_Result
.ifname
));
694 wpa_Result
.proto
= 0;
695 wpa_Result
.key_mgmt
= 0;
696 wpa_Result
.eap_type
= 0;
697 wpa_Result
.authenticated
= FALSE
;
698 pDevice
->fWPA_Authened
= FALSE
;
699 if (copy_from_user(&wpa_Result
, pReq
->data
, sizeof(wpa_Result
))) {
704 if(wpa_Result
.authenticated
==TRUE
) {
707 union iwreq_data wrqu
;
709 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyCurrSSID
;
711 memset(&wrqu
, 0, sizeof(wrqu
));
712 wrqu
.data
.flags
= RT_WPACONNECTED_EVENT_FLAG
;
713 wrqu
.data
.length
=pItemSSID
->len
;
714 wireless_send_event(pDevice
->dev
, IWEVCUSTOM
, &wrqu
, pItemSSID
->abySSID
);
717 pDevice
->fWPA_Authened
= TRUE
; //is sucessful peer to wpa_Result.authenticated?
720 //printk("get private wpa_supplicant announce WPA SM\n");
721 //printk("wpa-->ifname=%s\n",wpa_Result.ifname);
722 //printk("wpa-->proto=%d\n",wpa_Result.proto);
723 //printk("wpa-->key-mgmt=%d\n",wpa_Result.key_mgmt);
724 //printk("wpa-->eap_type=%d\n",wpa_Result.eap_type);
725 //printk("wpa-->authenticated is %s\n",(wpa_Result.authenticated==TRUE)?"TRUE":"FALSE");
733 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Private command not support..\n");
751 ZERO_MEMORY(&pDevice->abyWepKey[dwKeyIndex][0], WLAN_WEPMAX_KEYLEN);
752 MEMvCopy(&pDevice->abyWepKey[dwKeyIndex][0], pbyKey, uKeyLength);
754 pDevice->bWepKeyAvailable[dwKeyIndex] = TRUE;
755 pDevice->auWepKeyLength[dwKeyIndex] = uKeyLength;
757 MACvSetDefaultKeyEntry(pDevice->PortOffset, uKeyLength, dwKeyIndex,
758 (PDWORD) &(pDevice->abyWepKey[dwKeyIndex][0]), pDevice->byLocalID);
760 if (pDevice->eEncryptionStatus < Ndis802_11EncryptionNotSupported) {
761 for(ii=0; ii<MAX_GROUP_KEY; ii++) {
762 if ((pDevice->bWepKeyAvailable[ii] == TRUE) &&
763 (pDevice->auWepKeyLength[ii] == WLAN_WEP232_KEYLEN)) {
764 pDevice->uCurrentWEPMode = TX_WEP_SW232;
765 MACvDisableDefaultKey(pDevice->PortOffset);
769 if ((ii == MAX_GROUP_KEY) &&
770 (pDevice->eEncryptionStatus < Ndis802_11EncryptionNotSupported)) {
771 MACvEnableDefaultKey(pDevice->PortOffset, pDevice->byLocalID);