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 SWPAResult wpa_Result
;
44 static int msglevel
= MSG_LEVEL_INFO
;
46 int private_ioctl(PSDevice pDevice
, struct ifreq
*rq
)
49 PSCmdRequest pReq
= (PSCmdRequest
)rq
;
50 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
52 PWLAN_IE_SSID pItemSSID
;
54 SCmdZoneTypeSet sZoneTypeCmd
;
56 SCmdStartAP sStartAPCmd
;
63 unsigned int cbListCount
;
67 SCmdLinkStatus sLinkStatus
;
68 BYTE abySuppRates
[] = {WLAN_EID_SUPP_RATES
, 4, 0x02, 0x04, 0x0B, 0x16};
69 BYTE abyNullAddr
[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
71 BYTE abyScanSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
76 switch (pReq
->wCmdCode
) {
77 case WLAN_CMD_BSS_SCAN
:
78 if (copy_from_user(&sScanCmd
, pReq
->data
, sizeof(SCmdScan
))) {
83 pItemSSID
= (PWLAN_IE_SSID
)sScanCmd
.ssid
;
84 if (pItemSSID
->len
> WLAN_SSID_MAXLEN
+ 1)
86 if (pItemSSID
->len
!= 0) {
87 memset(abyScanSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
88 memcpy(abyScanSSID
, pItemSSID
, pItemSSID
->len
+ WLAN_IEHDR_LEN
);
90 spin_lock_irq(&pDevice
->lock
);
92 if (memcmp(pMgmt
->abyCurrBSSID
, &abyNullAddr
[0], 6) == 0)
93 BSSvClearBSSList((void *)pDevice
, FALSE
);
95 BSSvClearBSSList((void *)pDevice
, pDevice
->bLinkPass
);
97 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_BSS_SCAN..begin\n");
99 if (pItemSSID
->len
!= 0)
100 bScheduleCommand((void *)pDevice
,
104 bScheduleCommand((void *) pDevice
, WLAN_CMD_BSSID_SCAN
, NULL
);
106 spin_unlock_irq(&pDevice
->lock
);
109 case WLAN_CMD_ZONETYPE_SET
:
110 result
= -EOPNOTSUPP
;
113 if (copy_from_user(&sZoneTypeCmd
, pReq
->data
, sizeof(SCmdZoneTypeSet
))) {
118 if (sZoneTypeCmd
.bWrite
== TRUE
) {
120 if (sZoneTypeCmd
.ZoneType
== ZoneType_USA
) {
122 printk("set_ZoneType:USA\n");
123 } else if (sZoneTypeCmd
.ZoneType
== ZoneType_Japan
) {
125 printk("set_ZoneType:Japan\n");
126 } else if (sZoneTypeCmd
.ZoneType
== ZoneType_Europe
) {
128 printk("set_ZoneType:Europe\n");
134 if (zonetype
== 0x00) { /* USA */
135 sZoneTypeCmd
.ZoneType
= ZoneType_USA
;
136 } else if (zonetype
== 0x01) { /* Japan */
137 sZoneTypeCmd
.ZoneType
= ZoneType_Japan
;
138 } else if (zonetype
== 0x02) { /* Europe */
139 sZoneTypeCmd
.ZoneType
= ZoneType_Europe
;
140 } else { /* Unknown ZoneType */
141 printk("Error:ZoneType[%x] Unknown ???\n", zonetype
);
146 if (copy_to_user(pReq
->data
, &sZoneTypeCmd
,
147 sizeof(SCmdZoneTypeSet
))) {
153 case WLAN_CMD_BSS_JOIN
:
154 if (copy_from_user(&sJoinCmd
, pReq
->data
, sizeof(SCmdBSSJoin
))) {
159 pItemSSID
= (PWLAN_IE_SSID
)sJoinCmd
.ssid
;
160 if (pItemSSID
->len
> WLAN_SSID_MAXLEN
+ 1)
162 memset(pMgmt
->abyDesireSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
163 memcpy(pMgmt
->abyDesireSSID
, pItemSSID
, pItemSSID
->len
+ WLAN_IEHDR_LEN
);
164 if (sJoinCmd
.wBSSType
== ADHOC
) {
165 pMgmt
->eConfigMode
= WMAC_CONFIG_IBSS_STA
;
166 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to adhoc mode\n");
168 pMgmt
->eConfigMode
= WMAC_CONFIG_ESS_STA
;
169 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to STA mode\n");
171 if (sJoinCmd
.bPSEnable
== TRUE
) {
172 pDevice
->ePSMode
= WMAC_POWER_FAST
;
173 pMgmt
->wListenInterval
= 2;
174 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Power Saving On\n");
176 pDevice
->ePSMode
= WMAC_POWER_CAM
;
177 pMgmt
->wListenInterval
= 1;
178 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Power Saving Off\n");
181 if (sJoinCmd
.bShareKeyAuth
== TRUE
) {
182 pMgmt
->bShareKeyAlgorithm
= TRUE
;
183 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Share Key\n");
185 pMgmt
->bShareKeyAlgorithm
= FALSE
;
186 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Open System\n");
189 pDevice
->uChannel
= sJoinCmd
.uChannel
;
190 netif_stop_queue(pDevice
->dev
);
191 spin_lock_irq(&pDevice
->lock
);
192 pMgmt
->eCurrState
= WMAC_STATE_IDLE
;
193 bScheduleCommand((void *) pDevice
,
195 pMgmt
->abyDesireSSID
);
196 bScheduleCommand((void *) pDevice
, WLAN_CMD_SSID
, NULL
);
197 spin_unlock_irq(&pDevice
->lock
);
200 case WLAN_CMD_SET_WEP
:
201 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_WEP Key.\n");
202 memset(&sWEPCmd
, 0, sizeof(SCmdSetWEP
));
203 if (copy_from_user(&sWEPCmd
, pReq
->data
, sizeof(SCmdSetWEP
))) {
207 if (sWEPCmd
.bEnableWep
!= TRUE
) {
210 pDevice
->bEncryptionEnable
= FALSE
;
211 pDevice
->eEncryptionStatus
= Ndis802_11EncryptionDisabled
;
212 spin_lock_irq(&pDevice
->lock
);
213 for (uu
= 0; uu
< MAX_KEY_TABLE
; uu
++)
214 MACvDisableKeyEntry(pDevice
, uu
);
215 spin_unlock_irq(&pDevice
->lock
);
216 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WEP function disable.\n");
220 for (ii
= 0; ii
< WLAN_WEP_NKEYS
; ii
++) {
221 if (sWEPCmd
.bWepKeyAvailable
[ii
]) {
222 if (ii
== sWEPCmd
.byKeyIndex
)
223 dwKeyIndex
= ii
| (1 << 31);
226 spin_lock_irq(&pDevice
->lock
);
227 KeybSetDefaultKey(pDevice
, &(pDevice
->sKey
),
229 sWEPCmd
.auWepKeyLength
[ii
],
231 (PBYTE
)&sWEPCmd
.abyWepKey
[ii
][0],
233 spin_unlock_irq(&pDevice
->lock
);
236 pDevice
->byKeyIndex
= sWEPCmd
.byKeyIndex
;
237 pDevice
->bTransmitKey
= TRUE
;
238 pDevice
->bEncryptionEnable
= TRUE
;
239 pDevice
->eEncryptionStatus
= Ndis802_11Encryption1Enabled
;
242 case WLAN_CMD_GET_LINK
:
243 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_GET_LINK status.\n");
245 memset(sLinkStatus
.abySSID
, 0, WLAN_SSID_MAXLEN
+ 1);
247 if (pMgmt
->eCurrMode
== WMAC_MODE_IBSS_STA
)
248 sLinkStatus
.wBSSType
= ADHOC
;
250 sLinkStatus
.wBSSType
= INFRA
;
252 if (pMgmt
->eCurrState
== WMAC_STATE_JOINTED
)
253 sLinkStatus
.byState
= ADHOC_JOINTED
;
255 sLinkStatus
.byState
= ADHOC_STARTED
;
257 sLinkStatus
.uChannel
= pMgmt
->uCurrChannel
;
258 if (pDevice
->bLinkPass
== TRUE
) {
259 sLinkStatus
.bLink
= TRUE
;
260 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyCurrSSID
;
261 memcpy(sLinkStatus
.abySSID
, pItemSSID
->abySSID
, pItemSSID
->len
);
262 memcpy(sLinkStatus
.abyBSSID
, pMgmt
->abyCurrBSSID
, WLAN_BSSID_LEN
);
263 sLinkStatus
.uLinkRate
= pMgmt
->sNodeDBTable
[0].wTxDataRate
;
264 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Link Success!\n");
266 sLinkStatus
.bLink
= FALSE
;
267 sLinkStatus
.uLinkRate
= 0;
269 if (copy_to_user(pReq
->data
, &sLinkStatus
,
270 sizeof(SCmdLinkStatus
))) {
276 case WLAN_CMD_GET_LISTLEN
:
278 pBSS
= &(pMgmt
->sBSSList
[0]);
279 for (ii
= 0; ii
< MAX_BSS_NUM
; ii
++) {
280 pBSS
= &(pMgmt
->sBSSList
[ii
]);
285 sList
.uItem
= cbListCount
;
286 if (copy_to_user(pReq
->data
, &sList
, sizeof(SBSSIDList
))) {
293 case WLAN_CMD_GET_LIST
:
294 if (copy_from_user(&sList
, pReq
->data
, sizeof(SBSSIDList
))) {
298 if (sList
.uItem
> (ULONG_MAX
- sizeof(SBSSIDList
)) / sizeof(SBSSIDItem
)) {
302 pList
= (PSBSSIDList
)kmalloc(sizeof(SBSSIDList
) + (sList
.uItem
* sizeof(SBSSIDItem
)), (int)GFP_ATOMIC
);
307 pList
->uItem
= sList
.uItem
;
308 pBSS
= &(pMgmt
->sBSSList
[0]);
309 for (ii
= 0, jj
= 0; jj
< MAX_BSS_NUM
; jj
++) {
310 pBSS
= &(pMgmt
->sBSSList
[jj
]);
312 pList
->sBSSIDList
[ii
].uChannel
= pBSS
->uChannel
;
313 pList
->sBSSIDList
[ii
].wBeaconInterval
= pBSS
->wBeaconInterval
;
314 pList
->sBSSIDList
[ii
].wCapInfo
= pBSS
->wCapInfo
;
315 RFvRSSITodBm(pDevice
, (BYTE
)(pBSS
->uRSSI
), &ldBm
);
316 pList
->sBSSIDList
[ii
].uRSSI
= (unsigned int) ldBm
;
317 /* pList->sBSSIDList[ii].uRSSI = pBSS->uRSSI; */
318 memcpy(pList
->sBSSIDList
[ii
].abyBSSID
, pBSS
->abyBSSID
, WLAN_BSSID_LEN
);
319 pItemSSID
= (PWLAN_IE_SSID
)pBSS
->abySSID
;
320 memset(pList
->sBSSIDList
[ii
].abySSID
, 0, WLAN_SSID_MAXLEN
+ 1);
321 memcpy(pList
->sBSSIDList
[ii
].abySSID
, pItemSSID
->abySSID
, pItemSSID
->len
);
322 if (WLAN_GET_CAP_INFO_ESS(pBSS
->wCapInfo
)) {
323 pList
->sBSSIDList
[ii
].byNetType
= INFRA
;
325 pList
->sBSSIDList
[ii
].byNetType
= ADHOC
;
327 if (WLAN_GET_CAP_INFO_PRIVACY(pBSS
->wCapInfo
)) {
328 pList
->sBSSIDList
[ii
].bWEPOn
= TRUE
;
330 pList
->sBSSIDList
[ii
].bWEPOn
= FALSE
;
333 if (ii
>= pList
->uItem
)
338 if (copy_to_user(pReq
->data
, pList
, sizeof(SBSSIDList
) + (sList
.uItem
* sizeof(SBSSIDItem
)))) {
346 case WLAN_CMD_GET_MIB
:
347 if (copy_to_user(pReq
->data
, &(pDevice
->s802_11Counter
), sizeof(SDot11MIBCount
))) {
353 case WLAN_CMD_GET_STAT
:
354 if (copy_to_user(pReq
->data
, &(pDevice
->scStatistic
), sizeof(SStatCounter
))) {
359 case WLAN_CMD_STOP_MAC
:
360 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_STOP_MAC\n");
362 netif_stop_queue(pDevice
->dev
);
363 spin_lock_irq(&pDevice
->lock
);
364 if (pDevice
->bRadioOff
== FALSE
) {
365 CARDbRadioPowerOff(pDevice
);
367 pDevice
->bLinkPass
= FALSE
;
368 ControlvMaskByte(pDevice
, MESSAGE_REQUEST_MACREG
, MAC_REG_PAPEDELAY
, LEDSTS_STS
, LEDSTS_SLOW
);
369 memset(pMgmt
->abyCurrBSSID
, 0, 6);
370 pMgmt
->eCurrState
= WMAC_STATE_IDLE
;
371 /* del_timer(&pDevice->sTimerCommand); */
372 /* del_timer(&pMgmt->sTimerSecondCallback); */
373 pDevice
->bCmdRunning
= FALSE
;
374 spin_unlock_irq(&pDevice
->lock
);
377 case WLAN_CMD_START_MAC
:
378 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_START_MAC\n");
380 if (pDevice
->bRadioOff
== TRUE
)
381 CARDbRadioPowerOn(pDevice
);
384 case WLAN_CMD_SET_HOSTAPD
:
385 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOSTAPD\n");
387 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
391 if (sValue
.dwValue
== 1) {
392 if (vt6656_hostap_set_hostapd(pDevice
, 1, 1) == 0) {
393 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable HOSTAP\n");
399 vt6656_hostap_set_hostapd(pDevice
, 0, 1);
400 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable HOSTAP\n");
404 case WLAN_CMD_SET_HOSTAPD_STA
:
405 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOSTAPD_STA\n");
408 case WLAN_CMD_SET_802_1X
:
409 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_802_1X\n");
410 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
415 if (sValue
.dwValue
== 1) {
416 pDevice
->bEnable8021x
= TRUE
;
417 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable 802.1x\n");
419 pDevice
->bEnable8021x
= FALSE
;
420 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable 802.1x\n");
424 case WLAN_CMD_SET_HOST_WEP
:
425 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOST_WEP\n");
426 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
431 if (sValue
.dwValue
== 1) {
432 pDevice
->bEnableHostWEP
= TRUE
;
433 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable HostWEP\n");
435 pDevice
->bEnableHostWEP
= FALSE
;
436 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable HostWEP\n");
440 case WLAN_CMD_SET_WPA
:
441 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_WPA\n");
443 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
447 if (sValue
.dwValue
== 1) {
448 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"up wpadev\n");
449 memcpy(pDevice
->wpadev
->dev_addr
, pDevice
->dev
->dev_addr
,
451 pDevice
->bWPADEVUp
= TRUE
;
453 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"close wpadev\n");
454 pDevice
->bWPADEVUp
= FALSE
;
458 case WLAN_CMD_AP_START
:
459 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_AP_START\n");
460 if (pDevice
->bRadioOff
== TRUE
) {
461 CARDbRadioPowerOn(pDevice
);
462 add_timer(&pMgmt
->sTimerSecondCallback
);
464 if (copy_from_user(&sStartAPCmd
, pReq
->data
, sizeof(SCmdStartAP
))) {
469 if (sStartAPCmd
.wBSSType
== AP
) {
470 pMgmt
->eConfigMode
= WMAC_CONFIG_AP
;
471 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to AP mode\n");
473 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct BSS type not set to AP mode\n");
478 if (sStartAPCmd
.wBBPType
== PHY80211g
) {
479 pMgmt
->byAPBBType
= PHY_TYPE_11G
;
480 } else if (sStartAPCmd
.wBBPType
== PHY80211a
) {
481 pMgmt
->byAPBBType
= PHY_TYPE_11A
;
483 pMgmt
->byAPBBType
= PHY_TYPE_11B
;
486 pItemSSID
= (PWLAN_IE_SSID
)sStartAPCmd
.ssid
;
487 if (pItemSSID
->len
> WLAN_SSID_MAXLEN
+ 1)
489 memset(pMgmt
->abyDesireSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
490 memcpy(pMgmt
->abyDesireSSID
, pItemSSID
, pItemSSID
->len
+ WLAN_IEHDR_LEN
);
492 if ((sStartAPCmd
.uChannel
> 0) && (sStartAPCmd
.uChannel
<= 14))
493 pDevice
->uChannel
= sStartAPCmd
.uChannel
;
495 if ((sStartAPCmd
.uBeaconInt
>= 20) && (sStartAPCmd
.uBeaconInt
<= 1000))
496 pMgmt
->wIBSSBeaconPeriod
= sStartAPCmd
.uBeaconInt
;
498 pMgmt
->wIBSSBeaconPeriod
= 100;
500 if (sStartAPCmd
.bShareKeyAuth
== TRUE
) {
501 pMgmt
->bShareKeyAlgorithm
= TRUE
;
502 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Share Key\n");
504 pMgmt
->bShareKeyAlgorithm
= FALSE
;
505 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Open System\n");
507 memcpy(pMgmt
->abyIBSSSuppRates
, abySuppRates
, 6);
509 if (sStartAPCmd
.byBasicRate
& BIT3
) {
510 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
511 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
512 pMgmt
->abyIBSSSuppRates
[4] |= BIT7
;
513 pMgmt
->abyIBSSSuppRates
[5] |= BIT7
;
514 } else if (sStartAPCmd
.byBasicRate
& BIT2
) {
515 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
516 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
517 pMgmt
->abyIBSSSuppRates
[4] |= BIT7
;
518 } else if (sStartAPCmd
.byBasicRate
& BIT1
) {
519 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
520 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
521 } else if (sStartAPCmd
.byBasicRate
& BIT1
) {
522 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
525 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
526 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
529 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Support Rate= %x %x %x %x\n",
530 pMgmt
->abyIBSSSuppRates
[2],
531 pMgmt
->abyIBSSSuppRates
[3],
532 pMgmt
->abyIBSSSuppRates
[4],
533 pMgmt
->abyIBSSSuppRates
[5]);
535 netif_stop_queue(pDevice
->dev
);
536 spin_lock_irq(&pDevice
->lock
);
537 bScheduleCommand((void *)pDevice
, WLAN_CMD_RUN_AP
, NULL
);
538 spin_unlock_irq(&pDevice
->lock
);
541 case WLAN_CMD_GET_NODE_CNT
:
543 pNode
= &(pMgmt
->sNodeDBTable
[0]);
544 for (ii
= 0; ii
< (MAX_NODE_NUM
+ 1); ii
++) {
545 pNode
= &(pMgmt
->sNodeDBTable
[ii
]);
551 sNodeList
.uItem
= cbListCount
;
552 if (copy_to_user(pReq
->data
, &sNodeList
, sizeof(SNodeList
))) {
559 case WLAN_CMD_GET_NODE_LIST
:
560 if (copy_from_user(&sNodeList
, pReq
->data
, sizeof(SNodeList
))) {
564 if (sNodeList
.uItem
> (ULONG_MAX
- sizeof(SNodeList
)) / sizeof(SNodeItem
)) {
568 pNodeList
= (PSNodeList
)kmalloc(sizeof(SNodeList
) + (sNodeList
.uItem
* sizeof(SNodeItem
)), (int)GFP_ATOMIC
);
569 if (pNodeList
== NULL
) {
573 pNodeList
->uItem
= sNodeList
.uItem
;
574 pNode
= &(pMgmt
->sNodeDBTable
[0]);
575 for (ii
= 0, jj
= 0; ii
< (MAX_NODE_NUM
+ 1); ii
++) {
576 pNode
= &(pMgmt
->sNodeDBTable
[ii
]);
577 if (pNode
->bActive
) {
578 pNodeList
->sNodeList
[jj
].wAID
= pNode
->wAID
;
579 memcpy(pNodeList
->sNodeList
[jj
].abyMACAddr
, pNode
->abyMACAddr
, WLAN_ADDR_LEN
);
580 pNodeList
->sNodeList
[jj
].wTxDataRate
= pNode
->wTxDataRate
;
581 pNodeList
->sNodeList
[jj
].wInActiveCount
= (WORD
)pNode
->uInActiveCount
;
582 pNodeList
->sNodeList
[jj
].wEnQueueCnt
= (WORD
)pNode
->wEnQueueCnt
;
583 pNodeList
->sNodeList
[jj
].wFlags
= (WORD
)pNode
->dwFlags
;
584 pNodeList
->sNodeList
[jj
].bPWBitOn
= pNode
->bPSEnable
;
585 pNodeList
->sNodeList
[jj
].byKeyIndex
= pNode
->byKeyIndex
;
586 pNodeList
->sNodeList
[jj
].wWepKeyLength
= pNode
->uWepKeyLength
;
587 memcpy(&(pNodeList
->sNodeList
[jj
].abyWepKey
[0]), &(pNode
->abyWepKey
[0]), WEP_KEYMAXLEN
);
588 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
589 pNodeList
->sNodeList
[jj
].abyWepKey
[0],
590 pNodeList
->sNodeList
[jj
].abyWepKey
[1],
591 pNodeList
->sNodeList
[jj
].abyWepKey
[2],
592 pNodeList
->sNodeList
[jj
].abyWepKey
[3],
593 pNodeList
->sNodeList
[jj
].abyWepKey
[4]);
594 pNodeList
->sNodeList
[jj
].bIsInFallback
= pNode
->bIsInFallback
;
595 pNodeList
->sNodeList
[jj
].uTxFailures
= pNode
->uTxFailures
;
596 pNodeList
->sNodeList
[jj
].uTxAttempts
= pNode
->uTxAttempts
;
597 pNodeList
->sNodeList
[jj
].wFailureRatio
= (WORD
)pNode
->uFailureRatio
;
599 if (jj
>= pNodeList
->uItem
)
603 if (copy_to_user(pReq
->data
, pNodeList
, sizeof(SNodeList
) + (sNodeList
.uItem
* sizeof(SNodeItem
)))) {
612 memset(wpa_Result
.ifname
, 0, sizeof(wpa_Result
.ifname
));
613 wpa_Result
.proto
= 0;
614 wpa_Result
.key_mgmt
= 0;
615 wpa_Result
.eap_type
= 0;
616 wpa_Result
.authenticated
= FALSE
;
617 pDevice
->fWPA_Authened
= FALSE
;
618 if (copy_from_user(&wpa_Result
, pReq
->data
, sizeof(wpa_Result
))) {
622 /* for some AP maybe good authenticate */
623 if (wpa_Result
.key_mgmt
== 0x20)
624 pMgmt
->Cisco_cckm
= 1;
626 pMgmt
->Cisco_cckm
= 0;
628 if (wpa_Result
.authenticated
== TRUE
) {
630 union iwreq_data wrqu
;
632 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyCurrSSID
;
633 memset(&wrqu
, 0, sizeof(wrqu
));
634 wrqu
.data
.flags
= RT_WPACONNECTED_EVENT_FLAG
;
635 wrqu
.data
.length
= pItemSSID
->len
;
636 wireless_send_event(pDevice
->dev
, IWEVCUSTOM
, &wrqu
, pItemSSID
->abySSID
);
639 pDevice
->fWPA_Authened
= TRUE
; /* is successful peer to wpa_Result.authenticated? */
646 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Private command not support..\n");