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 int msglevel
= MSG_LEVEL_INFO
;
43 #ifdef WPA_SM_Transtatus
44 SWPAResult wpa_Result
;
47 int private_ioctl(PSDevice pDevice
, struct ifreq
*rq
)
49 PSCmdRequest pReq
= (PSCmdRequest
)rq
;
50 PSMgmtObject pMgmt
= pDevice
->pMgmt
;
52 PWLAN_IE_SSID pItemSSID
;
54 SCmdZoneTypeSet sZoneTypeCmd
;
56 SCmdStartAP sStartAPCmd
;
63 unsigned int cbListCount
;
67 SCmdLinkStatus sLinkStatus
;
68 unsigned char abySuppRates
[] = {WLAN_EID_SUPP_RATES
, 4, 0x02, 0x04, 0x0B, 0x16};
69 unsigned char abyNullAddr
[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
70 unsigned long dwKeyIndex
= 0;
71 unsigned char abyScanSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
76 switch (pReq
->wCmdCode
) {
77 case WLAN_CMD_BSS_SCAN
:
78 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_BSS_SCAN..begin\n");
79 if (copy_from_user(&sScanCmd
, pReq
->data
, sizeof(SCmdScan
))) {
84 pItemSSID
= (PWLAN_IE_SSID
)sScanCmd
.ssid
;
85 if (pItemSSID
->len
> WLAN_SSID_MAXLEN
+ 1)
87 if (pItemSSID
->len
!= 0) {
88 memset(abyScanSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
89 memcpy(abyScanSSID
, pItemSSID
, pItemSSID
->len
+ WLAN_IEHDR_LEN
);
92 if (pDevice
->bMACSuspend
== true) {
93 if (pDevice
->bRadioOff
== true)
94 CARDbRadioPowerOn(pDevice
);
95 vMgrTimerInit(pDevice
);
96 MACvIntEnable(pDevice
->PortOffset
, IMR_MASK_VALUE
);
97 add_timer(&pMgmt
->sTimerSecondCallback
);
98 pDevice
->bMACSuspend
= false;
100 spin_lock_irq(&pDevice
->lock
);
101 if (memcmp(pMgmt
->abyCurrBSSID
, &abyNullAddr
[0], 6) == 0)
102 BSSvClearBSSList((void *)pDevice
, false);
104 BSSvClearBSSList((void *)pDevice
, pDevice
->bLinkPass
);
106 if (pItemSSID
->len
!= 0)
107 bScheduleCommand((void *) pDevice
, WLAN_CMD_BSSID_SCAN
, abyScanSSID
);
109 bScheduleCommand((void *) pDevice
, WLAN_CMD_BSSID_SCAN
, NULL
);
110 spin_unlock_irq(&pDevice
->lock
);
113 case WLAN_CMD_ZONETYPE_SET
:
114 /* mike add :cann't support. */
115 result
= -EOPNOTSUPP
;
118 if (copy_from_user(&sZoneTypeCmd
, pReq
->data
, sizeof(SCmdZoneTypeSet
))) {
123 if (sZoneTypeCmd
.bWrite
== true) {
125 if (sZoneTypeCmd
.ZoneType
== ZoneType_USA
) {
127 printk("set_ZoneType:USA\n");
128 } else if (sZoneTypeCmd
.ZoneType
== ZoneType_Japan
) {
130 printk("set_ZoneType:Japan\n");
131 } else if (sZoneTypeCmd
.ZoneType
== ZoneType_Europe
) {
133 printk("set_ZoneType:Europe\n");
137 unsigned char zonetype
= 0;
139 if (zonetype
== 0x00) { /* USA */
140 sZoneTypeCmd
.ZoneType
= ZoneType_USA
;
141 } else if (zonetype
== 0x01) { /* Japan */
142 sZoneTypeCmd
.ZoneType
= ZoneType_Japan
;
143 } else if (zonetype
== 0x02) { /* Europe */
144 sZoneTypeCmd
.ZoneType
= ZoneType_Europe
;
145 } else { /* Unknown ZoneType */
146 printk("Error:ZoneType[%x] Unknown ???\n", zonetype
);
150 if (copy_to_user(pReq
->data
, &sZoneTypeCmd
, sizeof(SCmdZoneTypeSet
))) {
157 case WLAN_CMD_BSS_JOIN
:
158 if (pDevice
->bMACSuspend
== true) {
159 if (pDevice
->bRadioOff
== true)
160 CARDbRadioPowerOn(pDevice
);
161 vMgrTimerInit(pDevice
);
162 MACvIntEnable(pDevice
->PortOffset
, IMR_MASK_VALUE
);
163 add_timer(&pMgmt
->sTimerSecondCallback
);
164 pDevice
->bMACSuspend
= false;
167 if (copy_from_user(&sJoinCmd
, pReq
->data
, sizeof(SCmdBSSJoin
))) {
172 pItemSSID
= (PWLAN_IE_SSID
)sJoinCmd
.ssid
;
173 if (pItemSSID
->len
> WLAN_SSID_MAXLEN
+ 1)
175 memset(pMgmt
->abyDesireSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
176 memcpy(pMgmt
->abyDesireSSID
, pItemSSID
, pItemSSID
->len
+ WLAN_IEHDR_LEN
);
177 if (sJoinCmd
.wBSSType
== ADHOC
) {
178 pMgmt
->eConfigMode
= WMAC_CONFIG_IBSS_STA
;
179 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to adhoc mode\n");
181 pMgmt
->eConfigMode
= WMAC_CONFIG_ESS_STA
;
182 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to STA mode\n");
184 if (sJoinCmd
.bPSEnable
== true) {
185 pDevice
->ePSMode
= WMAC_POWER_FAST
;
186 pMgmt
->wListenInterval
= 2;
187 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Power Saving On\n");
189 pDevice
->ePSMode
= WMAC_POWER_CAM
;
190 pMgmt
->wListenInterval
= 1;
191 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Power Saving Off\n");
194 if (sJoinCmd
.bShareKeyAuth
== true) {
195 pMgmt
->bShareKeyAlgorithm
= true;
196 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Share Key\n");
198 pMgmt
->bShareKeyAlgorithm
= false;
199 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Open System\n");
201 pDevice
->uChannel
= sJoinCmd
.uChannel
;
202 netif_stop_queue(pDevice
->dev
);
203 spin_lock_irq(&pDevice
->lock
);
204 pMgmt
->eCurrState
= WMAC_STATE_IDLE
;
205 bScheduleCommand((void *) pDevice
, WLAN_CMD_BSSID_SCAN
, pMgmt
->abyDesireSSID
);
206 bScheduleCommand((void *) pDevice
, WLAN_CMD_SSID
, NULL
);
207 spin_unlock_irq(&pDevice
->lock
);
210 case WLAN_CMD_SET_WEP
:
211 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_WEP Key.\n");
212 memset(&sWEPCmd
, 0, sizeof(SCmdSetWEP
));
213 if (copy_from_user(&sWEPCmd
, pReq
->data
, sizeof(SCmdSetWEP
))) {
217 if (sWEPCmd
.bEnableWep
!= true) {
218 pDevice
->bEncryptionEnable
= false;
219 pDevice
->eEncryptionStatus
= Ndis802_11EncryptionDisabled
;
220 MACvDisableDefaultKey(pDevice
->PortOffset
);
221 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WEP function disable.\n");
225 for (ii
= 0; ii
< WLAN_WEP_NKEYS
; ii
++) {
226 if (sWEPCmd
.bWepKeyAvailable
[ii
]) {
227 if (ii
== sWEPCmd
.byKeyIndex
)
228 dwKeyIndex
= ii
| (1 << 31);
232 KeybSetDefaultKey(&(pDevice
->sKey
),
234 sWEPCmd
.auWepKeyLength
[ii
],
236 (unsigned char *)&sWEPCmd
.abyWepKey
[ii
][0],
242 pDevice
->byKeyIndex
= sWEPCmd
.byKeyIndex
;
243 pDevice
->bTransmitKey
= true;
244 pDevice
->bEncryptionEnable
= true;
245 pDevice
->eEncryptionStatus
= Ndis802_11Encryption1Enabled
;
248 case WLAN_CMD_GET_LINK
:
249 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_GET_LINK status.\n");
251 memset(sLinkStatus
.abySSID
, 0 , WLAN_SSID_MAXLEN
+ 1);
253 if (pMgmt
->eCurrMode
== WMAC_MODE_IBSS_STA
)
254 sLinkStatus
.wBSSType
= ADHOC
;
256 sLinkStatus
.wBSSType
= INFRA
;
258 if (pMgmt
->eCurrState
== WMAC_STATE_JOINTED
)
259 sLinkStatus
.byState
= ADHOC_JOINTED
;
261 sLinkStatus
.byState
= ADHOC_STARTED
;
263 sLinkStatus
.uChannel
= pMgmt
->uCurrChannel
;
264 if (pDevice
->bLinkPass
== true) {
265 sLinkStatus
.bLink
= true;
266 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyCurrSSID
;
267 memcpy(sLinkStatus
.abySSID
, pItemSSID
->abySSID
, pItemSSID
->len
);
268 memcpy(sLinkStatus
.abyBSSID
, pMgmt
->abyCurrBSSID
, WLAN_BSSID_LEN
);
269 sLinkStatus
.uLinkRate
= pMgmt
->sNodeDBTable
[0].wTxDataRate
;
270 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" Link Success!\n");
272 sLinkStatus
.bLink
= false;
273 sLinkStatus
.uLinkRate
= 0;
275 if (copy_to_user(pReq
->data
, &sLinkStatus
, sizeof(SCmdLinkStatus
))) {
281 case WLAN_CMD_GET_LISTLEN
:
283 pBSS
= &(pMgmt
->sBSSList
[0]);
284 for (ii
= 0; ii
< MAX_BSS_NUM
; ii
++) {
285 pBSS
= &(pMgmt
->sBSSList
[ii
]);
290 sList
.uItem
= cbListCount
;
291 if (copy_to_user(pReq
->data
, &sList
, sizeof(SBSSIDList
))) {
298 case WLAN_CMD_GET_LIST
:
299 if (copy_from_user(&sList
, pReq
->data
, sizeof(SBSSIDList
))) {
303 if (sList
.uItem
> (ULONG_MAX
- sizeof(SBSSIDList
)) / sizeof(SBSSIDItem
)) {
307 pList
= (PSBSSIDList
)kmalloc(sizeof(SBSSIDList
) + (sList
.uItem
* sizeof(SBSSIDItem
)), (int)GFP_ATOMIC
);
312 pList
->uItem
= sList
.uItem
;
313 pBSS
= &(pMgmt
->sBSSList
[0]);
314 for (ii
= 0, jj
= 0; jj
< MAX_BSS_NUM
; jj
++) {
315 pBSS
= &(pMgmt
->sBSSList
[jj
]);
317 pList
->sBSSIDList
[ii
].uChannel
= pBSS
->uChannel
;
318 pList
->sBSSIDList
[ii
].wBeaconInterval
= pBSS
->wBeaconInterval
;
319 pList
->sBSSIDList
[ii
].wCapInfo
= pBSS
->wCapInfo
;
320 /* pList->sBSSIDList[ii].uRSSI = pBSS->uRSSI; */
321 RFvRSSITodBm(pDevice
, (unsigned char)(pBSS
->uRSSI
), &ldBm
);
322 pList
->sBSSIDList
[ii
].uRSSI
= (unsigned int)ldBm
;
323 memcpy(pList
->sBSSIDList
[ii
].abyBSSID
, pBSS
->abyBSSID
, WLAN_BSSID_LEN
);
324 pItemSSID
= (PWLAN_IE_SSID
)pBSS
->abySSID
;
325 memset(pList
->sBSSIDList
[ii
].abySSID
, 0, WLAN_SSID_MAXLEN
+ 1);
326 memcpy(pList
->sBSSIDList
[ii
].abySSID
, pItemSSID
->abySSID
, pItemSSID
->len
);
327 if (WLAN_GET_CAP_INFO_ESS(pBSS
->wCapInfo
)) {
328 pList
->sBSSIDList
[ii
].byNetType
= INFRA
;
330 pList
->sBSSIDList
[ii
].byNetType
= ADHOC
;
332 if (WLAN_GET_CAP_INFO_PRIVACY(pBSS
->wCapInfo
)) {
333 pList
->sBSSIDList
[ii
].bWEPOn
= true;
335 pList
->sBSSIDList
[ii
].bWEPOn
= false;
338 if (ii
>= pList
->uItem
)
343 if (copy_to_user(pReq
->data
, pList
, sizeof(SBSSIDList
) + (sList
.uItem
* sizeof(SBSSIDItem
)))) {
351 case WLAN_CMD_GET_MIB
:
352 if (copy_to_user(pReq
->data
, &(pDevice
->s802_11Counter
), sizeof(SDot11MIBCount
))) {
358 case WLAN_CMD_GET_STAT
:
359 if (copy_to_user(pReq
->data
, &(pDevice
->scStatistic
), sizeof(SStatCounter
))) {
365 case WLAN_CMD_STOP_MAC
:
366 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_STOP_MAC\n");
367 netif_stop_queue(pDevice
->dev
);
369 spin_lock_irq(&pDevice
->lock
);
370 if (pDevice
->bRadioOff
== false) {
371 CARDbRadioPowerOff(pDevice
);
373 pDevice
->bLinkPass
= false;
374 memset(pMgmt
->abyCurrBSSID
, 0, 6);
375 pMgmt
->eCurrState
= WMAC_STATE_IDLE
;
376 del_timer(&pDevice
->sTimerCommand
);
377 del_timer(&pMgmt
->sTimerSecondCallback
);
378 pDevice
->bCmdRunning
= false;
379 pDevice
->bMACSuspend
= true;
380 MACvIntDisable(pDevice
->PortOffset
);
381 spin_unlock_irq(&pDevice
->lock
);
384 case WLAN_CMD_START_MAC
:
385 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_START_MAC\n");
387 if (pDevice
->bMACSuspend
== true) {
388 if (pDevice
->bRadioOff
== true)
389 CARDbRadioPowerOn(pDevice
);
390 vMgrTimerInit(pDevice
);
391 MACvIntEnable(pDevice
->PortOffset
, IMR_MASK_VALUE
);
392 add_timer(&pMgmt
->sTimerSecondCallback
);
393 pDevice
->bMACSuspend
= false;
397 case WLAN_CMD_SET_HOSTAPD
:
398 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOSTAPD\n");
400 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
404 if (sValue
.dwValue
== 1) {
405 if (vt6655_hostap_set_hostapd(pDevice
, 1, 1) == 0) {
406 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable HOSTAP\n");
412 vt6655_hostap_set_hostapd(pDevice
, 0, 1);
413 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable HOSTAP\n");
417 case WLAN_CMD_SET_HOSTAPD_STA
:
418 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOSTAPD_STA\n");
421 case WLAN_CMD_SET_802_1X
:
422 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_802_1X\n");
423 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
428 if (sValue
.dwValue
== 1) {
429 pDevice
->bEnable8021x
= true;
430 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable 802.1x\n");
432 pDevice
->bEnable8021x
= false;
433 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable 802.1x\n");
437 case WLAN_CMD_SET_HOST_WEP
:
438 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOST_WEP\n");
439 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
444 if (sValue
.dwValue
== 1) {
445 pDevice
->bEnableHostWEP
= true;
446 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable HostWEP\n");
448 pDevice
->bEnableHostWEP
= false;
449 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable HostWEP\n");
453 case WLAN_CMD_SET_WPA
:
454 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_WPA\n");
456 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
460 if (sValue
.dwValue
== 1) {
461 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"up wpadev\n");
462 memcpy(pDevice
->wpadev
->dev_addr
, pDevice
->dev
->dev_addr
, ETH_ALEN
);
463 pDevice
->bWPADEVUp
= true;
465 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"close wpadev\n");
466 pDevice
->bWPADEVUp
= false;
470 case WLAN_CMD_AP_START
:
471 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_AP_START\n");
472 if (pDevice
->bRadioOff
== true) {
473 CARDbRadioPowerOn(pDevice
);
474 vMgrTimerInit(pDevice
);
475 MACvIntEnable(pDevice
->PortOffset
, IMR_MASK_VALUE
);
476 add_timer(&pMgmt
->sTimerSecondCallback
);
478 if (copy_from_user(&sStartAPCmd
, pReq
->data
, sizeof(SCmdStartAP
))) {
483 if (sStartAPCmd
.wBSSType
== AP
) {
484 pMgmt
->eConfigMode
= WMAC_CONFIG_AP
;
485 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to AP mode\n");
487 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct BSS type not set to AP mode\n");
492 if (sStartAPCmd
.wBBPType
== PHY80211g
) {
493 pMgmt
->byAPBBType
= PHY_TYPE_11G
;
494 } else if (sStartAPCmd
.wBBPType
== PHY80211a
) {
495 pMgmt
->byAPBBType
= PHY_TYPE_11A
;
497 pMgmt
->byAPBBType
= PHY_TYPE_11B
;
500 pItemSSID
= (PWLAN_IE_SSID
)sStartAPCmd
.ssid
;
501 if (pItemSSID
->len
> WLAN_SSID_MAXLEN
+ 1)
503 memset(pMgmt
->abyDesireSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
504 memcpy(pMgmt
->abyDesireSSID
, pItemSSID
, pItemSSID
->len
+ WLAN_IEHDR_LEN
);
506 if ((sStartAPCmd
.uChannel
> 0) && (sStartAPCmd
.uChannel
<= 14))
507 pDevice
->uChannel
= sStartAPCmd
.uChannel
;
509 if ((sStartAPCmd
.uBeaconInt
>= 20) && (sStartAPCmd
.uBeaconInt
<= 1000))
510 pMgmt
->wIBSSBeaconPeriod
= sStartAPCmd
.uBeaconInt
;
512 pMgmt
->wIBSSBeaconPeriod
= 100;
514 if (sStartAPCmd
.bShareKeyAuth
== true) {
515 pMgmt
->bShareKeyAlgorithm
= true;
516 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Share Key\n");
518 pMgmt
->bShareKeyAlgorithm
= false;
519 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Open System\n");
521 memcpy(pMgmt
->abyIBSSSuppRates
, abySuppRates
, 6);
523 if (sStartAPCmd
.byBasicRate
& BIT3
) {
524 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
525 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
526 pMgmt
->abyIBSSSuppRates
[4] |= BIT7
;
527 pMgmt
->abyIBSSSuppRates
[5] |= BIT7
;
528 } else if (sStartAPCmd
.byBasicRate
& BIT2
) {
529 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
530 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
531 pMgmt
->abyIBSSSuppRates
[4] |= BIT7
;
532 } else if (sStartAPCmd
.byBasicRate
& BIT1
) {
533 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
534 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
535 } else if (sStartAPCmd
.byBasicRate
& BIT1
) {
536 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
539 pMgmt
->abyIBSSSuppRates
[2] |= BIT7
;
540 pMgmt
->abyIBSSSuppRates
[3] |= BIT7
;
543 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Support Rate= %x %x %x %x\n",
544 pMgmt
->abyIBSSSuppRates
[2],
545 pMgmt
->abyIBSSSuppRates
[3],
546 pMgmt
->abyIBSSSuppRates
[4],
547 pMgmt
->abyIBSSSuppRates
[5]);
549 netif_stop_queue(pDevice
->dev
);
550 spin_lock_irq(&pDevice
->lock
);
551 bScheduleCommand((void *)pDevice
, WLAN_CMD_RUN_AP
, NULL
);
552 spin_unlock_irq(&pDevice
->lock
);
555 case WLAN_CMD_GET_NODE_CNT
:
557 pNode
= &(pMgmt
->sNodeDBTable
[0]);
558 for (ii
= 0; ii
< (MAX_NODE_NUM
+ 1); ii
++) {
559 pNode
= &(pMgmt
->sNodeDBTable
[ii
]);
565 sNodeList
.uItem
= cbListCount
;
566 if (copy_to_user(pReq
->data
, &sNodeList
, sizeof(SNodeList
))) {
573 case WLAN_CMD_GET_NODE_LIST
:
574 if (copy_from_user(&sNodeList
, pReq
->data
, sizeof(SNodeList
))) {
578 if (sNodeList
.uItem
> (ULONG_MAX
- sizeof(SNodeList
)) / sizeof(SNodeItem
)) {
582 pNodeList
= (PSNodeList
)kmalloc(sizeof(SNodeList
) + (sNodeList
.uItem
* sizeof(SNodeItem
)), (int)GFP_ATOMIC
);
583 if (pNodeList
== NULL
) {
587 pNodeList
->uItem
= sNodeList
.uItem
;
588 pNode
= &(pMgmt
->sNodeDBTable
[0]);
589 for (ii
= 0, jj
= 0; ii
< (MAX_NODE_NUM
+ 1); ii
++) {
590 pNode
= &(pMgmt
->sNodeDBTable
[ii
]);
591 if (pNode
->bActive
) {
592 pNodeList
->sNodeList
[jj
].wAID
= pNode
->wAID
;
593 memcpy(pNodeList
->sNodeList
[jj
].abyMACAddr
, pNode
->abyMACAddr
, WLAN_ADDR_LEN
);
594 pNodeList
->sNodeList
[jj
].wTxDataRate
= pNode
->wTxDataRate
;
595 pNodeList
->sNodeList
[jj
].wInActiveCount
= (unsigned short)pNode
->uInActiveCount
;
596 pNodeList
->sNodeList
[jj
].wEnQueueCnt
= (unsigned short)pNode
->wEnQueueCnt
;
597 pNodeList
->sNodeList
[jj
].wFlags
= (unsigned short)pNode
->dwFlags
;
598 pNodeList
->sNodeList
[jj
].bPWBitOn
= pNode
->bPSEnable
;
599 pNodeList
->sNodeList
[jj
].byKeyIndex
= pNode
->byKeyIndex
;
600 pNodeList
->sNodeList
[jj
].wWepKeyLength
= pNode
->uWepKeyLength
;
601 memcpy(&(pNodeList
->sNodeList
[jj
].abyWepKey
[0]), &(pNode
->abyWepKey
[0]), WEP_KEYMAXLEN
);
602 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
603 pNodeList
->sNodeList
[jj
].abyWepKey
[0],
604 pNodeList
->sNodeList
[jj
].abyWepKey
[1],
605 pNodeList
->sNodeList
[jj
].abyWepKey
[2],
606 pNodeList
->sNodeList
[jj
].abyWepKey
[3],
607 pNodeList
->sNodeList
[jj
].abyWepKey
[4]);
608 pNodeList
->sNodeList
[jj
].bIsInFallback
= pNode
->bIsInFallback
;
609 pNodeList
->sNodeList
[jj
].uTxFailures
= pNode
->uTxFailures
;
610 pNodeList
->sNodeList
[jj
].uTxAttempts
= pNode
->uTxAttempts
;
611 pNodeList
->sNodeList
[jj
].wFailureRatio
= (unsigned short)pNode
->uFailureRatio
;
613 if (jj
>= pNodeList
->uItem
)
617 if (copy_to_user(pReq
->data
, pNodeList
, sizeof(SNodeList
) + (sNodeList
.uItem
* sizeof(SNodeItem
)))) {
625 #ifdef WPA_SM_Transtatus
627 memset(wpa_Result
.ifname
, 0, sizeof(wpa_Result
.ifname
));
628 wpa_Result
.proto
= 0;
629 wpa_Result
.key_mgmt
= 0;
630 wpa_Result
.eap_type
= 0;
631 wpa_Result
.authenticated
= false;
632 pDevice
->fWPA_Authened
= false;
633 if (copy_from_user(&wpa_Result
, pReq
->data
, sizeof(wpa_Result
))) {
638 if (wpa_Result
.authenticated
== true) {
641 union iwreq_data wrqu
;
643 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyCurrSSID
;
645 memset(&wrqu
, 0, sizeof(wrqu
));
646 wrqu
.data
.flags
= RT_WPACONNECTED_EVENT_FLAG
;
647 wrqu
.data
.length
= pItemSSID
->len
;
648 wireless_send_event(pDevice
->dev
, IWEVCUSTOM
, &wrqu
, pItemSSID
->abySSID
);
651 pDevice
->fWPA_Authened
= true; /* is successful peer to wpa_Result.authenticated? */
658 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Private command not support..\n");