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 unsigned char abySuppRates
[] = {WLAN_EID_SUPP_RATES
, 4, 0x02, 0x04, 0x0B, 0x16};
68 unsigned char abyNullAddr
[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
69 unsigned long dwKeyIndex
= 0;
70 unsigned char abyScanSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
75 switch (pReq
->wCmdCode
) {
76 case WLAN_CMD_BSS_SCAN
:
77 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_BSS_SCAN..begin\n");
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
);
91 if (pDevice
->bMACSuspend
== true) {
92 if (pDevice
->bRadioOff
== true)
93 CARDbRadioPowerOn(pDevice
);
94 vMgrTimerInit(pDevice
);
95 MACvIntEnable(pDevice
->PortOffset
, IMR_MASK_VALUE
);
96 add_timer(&pMgmt
->sTimerSecondCallback
);
97 pDevice
->bMACSuspend
= false;
99 spin_lock_irq(&pDevice
->lock
);
100 if (memcmp(pMgmt
->abyCurrBSSID
, &abyNullAddr
[0], 6) == 0)
101 BSSvClearBSSList((void *)pDevice
, false);
103 BSSvClearBSSList((void *)pDevice
, pDevice
->bLinkPass
);
105 if (pItemSSID
->len
!= 0)
106 bScheduleCommand((void *)pDevice
, WLAN_CMD_BSSID_SCAN
, abyScanSSID
);
108 bScheduleCommand((void *)pDevice
, WLAN_CMD_BSSID_SCAN
, NULL
);
109 spin_unlock_irq(&pDevice
->lock
);
112 case WLAN_CMD_ZONETYPE_SET
:
113 /* mike add :can't support. */
114 result
= -EOPNOTSUPP
;
117 if (copy_from_user(&sZoneTypeCmd
, pReq
->data
, sizeof(SCmdZoneTypeSet
))) {
122 if (sZoneTypeCmd
.bWrite
== true) {
124 if (sZoneTypeCmd
.ZoneType
== ZoneType_USA
) {
126 printk("set_ZoneType:USA\n");
127 } else if (sZoneTypeCmd
.ZoneType
== ZoneType_Japan
) {
129 printk("set_ZoneType:Japan\n");
130 } else if (sZoneTypeCmd
.ZoneType
== ZoneType_Europe
) {
132 printk("set_ZoneType:Europe\n");
136 unsigned char zonetype
= 0;
138 if (zonetype
== 0x00) { /* USA */
139 sZoneTypeCmd
.ZoneType
= ZoneType_USA
;
140 } else if (zonetype
== 0x01) { /* Japan */
141 sZoneTypeCmd
.ZoneType
= ZoneType_Japan
;
142 } else if (zonetype
== 0x02) { /* Europe */
143 sZoneTypeCmd
.ZoneType
= ZoneType_Europe
;
144 } else { /* Unknown ZoneType */
145 printk("Error:ZoneType[%x] Unknown ???\n", zonetype
);
149 if (copy_to_user(pReq
->data
, &sZoneTypeCmd
, sizeof(SCmdZoneTypeSet
))) {
156 case WLAN_CMD_BSS_JOIN
:
157 if (pDevice
->bMACSuspend
== true) {
158 if (pDevice
->bRadioOff
== true)
159 CARDbRadioPowerOn(pDevice
);
160 vMgrTimerInit(pDevice
);
161 MACvIntEnable(pDevice
->PortOffset
, IMR_MASK_VALUE
);
162 add_timer(&pMgmt
->sTimerSecondCallback
);
163 pDevice
->bMACSuspend
= false;
166 if (copy_from_user(&sJoinCmd
, pReq
->data
, sizeof(SCmdBSSJoin
))) {
171 pItemSSID
= (PWLAN_IE_SSID
)sJoinCmd
.ssid
;
172 if (pItemSSID
->len
> WLAN_SSID_MAXLEN
+ 1)
174 memset(pMgmt
->abyDesireSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
175 memcpy(pMgmt
->abyDesireSSID
, pItemSSID
, pItemSSID
->len
+ WLAN_IEHDR_LEN
);
176 if (sJoinCmd
.wBSSType
== ADHOC
) {
177 pMgmt
->eConfigMode
= WMAC_CONFIG_IBSS_STA
;
178 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to adhoc mode\n");
180 pMgmt
->eConfigMode
= WMAC_CONFIG_ESS_STA
;
181 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to STA mode\n");
183 if (sJoinCmd
.bPSEnable
== true) {
184 pDevice
->ePSMode
= WMAC_POWER_FAST
;
185 pMgmt
->wListenInterval
= 2;
186 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Power Saving On\n");
188 pDevice
->ePSMode
= WMAC_POWER_CAM
;
189 pMgmt
->wListenInterval
= 1;
190 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Power Saving Off\n");
193 if (sJoinCmd
.bShareKeyAuth
== true) {
194 pMgmt
->bShareKeyAlgorithm
= true;
195 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Share Key\n");
197 pMgmt
->bShareKeyAlgorithm
= false;
198 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Open System\n");
200 pDevice
->uChannel
= sJoinCmd
.uChannel
;
201 netif_stop_queue(pDevice
->dev
);
202 spin_lock_irq(&pDevice
->lock
);
203 pMgmt
->eCurrState
= WMAC_STATE_IDLE
;
204 bScheduleCommand((void *)pDevice
, WLAN_CMD_BSSID_SCAN
, pMgmt
->abyDesireSSID
);
205 bScheduleCommand((void *)pDevice
, WLAN_CMD_SSID
, NULL
);
206 spin_unlock_irq(&pDevice
->lock
);
209 case WLAN_CMD_SET_WEP
:
210 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_WEP Key.\n");
211 memset(&sWEPCmd
, 0, sizeof(SCmdSetWEP
));
212 if (copy_from_user(&sWEPCmd
, pReq
->data
, sizeof(SCmdSetWEP
))) {
216 if (sWEPCmd
.bEnableWep
!= true) {
217 pDevice
->bEncryptionEnable
= false;
218 pDevice
->eEncryptionStatus
= Ndis802_11EncryptionDisabled
;
219 MACvDisableDefaultKey(pDevice
->PortOffset
);
220 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WEP function disable.\n");
224 for (ii
= 0; ii
< WLAN_WEP_NKEYS
; ii
++) {
225 if (sWEPCmd
.bWepKeyAvailable
[ii
]) {
226 if (ii
== sWEPCmd
.byKeyIndex
)
227 dwKeyIndex
= ii
| (1 << 31);
231 KeybSetDefaultKey(&(pDevice
->sKey
),
233 sWEPCmd
.auWepKeyLength
[ii
],
235 (unsigned char *)&sWEPCmd
.abyWepKey
[ii
][0],
241 pDevice
->byKeyIndex
= sWEPCmd
.byKeyIndex
;
242 pDevice
->bTransmitKey
= true;
243 pDevice
->bEncryptionEnable
= true;
244 pDevice
->eEncryptionStatus
= Ndis802_11Encryption1Enabled
;
247 case WLAN_CMD_GET_LINK
: {
248 SCmdLinkStatus sLinkStatus
;
250 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_GET_LINK status.\n");
252 memset(&sLinkStatus
, 0, sizeof(sLinkStatus
));
254 if (pMgmt
->eCurrMode
== WMAC_MODE_IBSS_STA
)
255 sLinkStatus
.wBSSType
= ADHOC
;
257 sLinkStatus
.wBSSType
= INFRA
;
259 if (pMgmt
->eCurrState
== WMAC_STATE_JOINTED
)
260 sLinkStatus
.byState
= ADHOC_JOINTED
;
262 sLinkStatus
.byState
= ADHOC_STARTED
;
264 sLinkStatus
.uChannel
= pMgmt
->uCurrChannel
;
265 if (pDevice
->bLinkPass
== true) {
266 sLinkStatus
.bLink
= true;
267 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyCurrSSID
;
268 memcpy(sLinkStatus
.abySSID
, pItemSSID
->abySSID
, pItemSSID
->len
);
269 memcpy(sLinkStatus
.abyBSSID
, pMgmt
->abyCurrBSSID
, WLAN_BSSID_LEN
);
270 sLinkStatus
.uLinkRate
= pMgmt
->sNodeDBTable
[0].wTxDataRate
;
271 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" Link Success!\n");
273 sLinkStatus
.bLink
= false;
274 sLinkStatus
.uLinkRate
= 0;
276 if (copy_to_user(pReq
->data
, &sLinkStatus
, sizeof(SCmdLinkStatus
))) {
282 case WLAN_CMD_GET_LISTLEN
:
284 pBSS
= &(pMgmt
->sBSSList
[0]);
285 for (ii
= 0; ii
< MAX_BSS_NUM
; ii
++) {
286 pBSS
= &(pMgmt
->sBSSList
[ii
]);
291 sList
.uItem
= cbListCount
;
292 if (copy_to_user(pReq
->data
, &sList
, sizeof(SBSSIDList
))) {
299 case WLAN_CMD_GET_LIST
:
300 if (copy_from_user(&sList
, pReq
->data
, sizeof(SBSSIDList
))) {
304 if (sList
.uItem
> (ULONG_MAX
- sizeof(SBSSIDList
)) / sizeof(SBSSIDItem
)) {
308 pList
= (PSBSSIDList
)kmalloc(sizeof(SBSSIDList
) + (sList
.uItem
* sizeof(SBSSIDItem
)), (int)GFP_ATOMIC
);
313 pList
->uItem
= sList
.uItem
;
314 pBSS
= &(pMgmt
->sBSSList
[0]);
315 for (ii
= 0, jj
= 0; jj
< MAX_BSS_NUM
; jj
++) {
316 pBSS
= &(pMgmt
->sBSSList
[jj
]);
318 pList
->sBSSIDList
[ii
].uChannel
= pBSS
->uChannel
;
319 pList
->sBSSIDList
[ii
].wBeaconInterval
= pBSS
->wBeaconInterval
;
320 pList
->sBSSIDList
[ii
].wCapInfo
= pBSS
->wCapInfo
;
321 /* pList->sBSSIDList[ii].uRSSI = pBSS->uRSSI; */
322 RFvRSSITodBm(pDevice
, (unsigned char)(pBSS
->uRSSI
), &ldBm
);
323 pList
->sBSSIDList
[ii
].uRSSI
= (unsigned int)ldBm
;
324 memcpy(pList
->sBSSIDList
[ii
].abyBSSID
, pBSS
->abyBSSID
, WLAN_BSSID_LEN
);
325 pItemSSID
= (PWLAN_IE_SSID
)pBSS
->abySSID
;
326 memset(pList
->sBSSIDList
[ii
].abySSID
, 0, WLAN_SSID_MAXLEN
+ 1);
327 memcpy(pList
->sBSSIDList
[ii
].abySSID
, pItemSSID
->abySSID
, pItemSSID
->len
);
328 if (WLAN_GET_CAP_INFO_ESS(pBSS
->wCapInfo
))
329 pList
->sBSSIDList
[ii
].byNetType
= INFRA
;
331 pList
->sBSSIDList
[ii
].byNetType
= ADHOC
;
333 if (WLAN_GET_CAP_INFO_PRIVACY(pBSS
->wCapInfo
))
334 pList
->sBSSIDList
[ii
].bWEPOn
= true;
336 pList
->sBSSIDList
[ii
].bWEPOn
= false;
339 if (ii
>= pList
->uItem
)
344 if (copy_to_user(pReq
->data
, pList
, sizeof(SBSSIDList
) + (sList
.uItem
* sizeof(SBSSIDItem
)))) {
352 case WLAN_CMD_GET_MIB
:
353 if (copy_to_user(pReq
->data
, &(pDevice
->s802_11Counter
), sizeof(SDot11MIBCount
))) {
359 case WLAN_CMD_GET_STAT
:
360 if (copy_to_user(pReq
->data
, &(pDevice
->scStatistic
), sizeof(SStatCounter
))) {
366 case WLAN_CMD_STOP_MAC
:
367 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_STOP_MAC\n");
368 netif_stop_queue(pDevice
->dev
);
370 spin_lock_irq(&pDevice
->lock
);
371 if (pDevice
->bRadioOff
== false)
372 CARDbRadioPowerOff(pDevice
);
374 pDevice
->bLinkPass
= false;
375 memset(pMgmt
->abyCurrBSSID
, 0, 6);
376 pMgmt
->eCurrState
= WMAC_STATE_IDLE
;
377 del_timer(&pDevice
->sTimerCommand
);
378 del_timer(&pMgmt
->sTimerSecondCallback
);
379 pDevice
->bCmdRunning
= false;
380 pDevice
->bMACSuspend
= true;
381 MACvIntDisable(pDevice
->PortOffset
);
382 spin_unlock_irq(&pDevice
->lock
);
385 case WLAN_CMD_START_MAC
:
386 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_START_MAC\n");
388 if (pDevice
->bMACSuspend
== true) {
389 if (pDevice
->bRadioOff
== true)
390 CARDbRadioPowerOn(pDevice
);
391 vMgrTimerInit(pDevice
);
392 MACvIntEnable(pDevice
->PortOffset
, IMR_MASK_VALUE
);
393 add_timer(&pMgmt
->sTimerSecondCallback
);
394 pDevice
->bMACSuspend
= false;
398 case WLAN_CMD_SET_HOSTAPD
:
399 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOSTAPD\n");
401 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
405 if (sValue
.dwValue
== 1) {
406 if (vt6655_hostap_set_hostapd(pDevice
, 1, 1) == 0) {
407 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable HOSTAP\n");
413 vt6655_hostap_set_hostapd(pDevice
, 0, 1);
414 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable HOSTAP\n");
418 case WLAN_CMD_SET_HOSTAPD_STA
:
419 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOSTAPD_STA\n");
422 case WLAN_CMD_SET_802_1X
:
423 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_802_1X\n");
424 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
429 if (sValue
.dwValue
== 1) {
430 pDevice
->bEnable8021x
= true;
431 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable 802.1x\n");
433 pDevice
->bEnable8021x
= false;
434 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable 802.1x\n");
438 case WLAN_CMD_SET_HOST_WEP
:
439 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_HOST_WEP\n");
440 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
445 if (sValue
.dwValue
== 1) {
446 pDevice
->bEnableHostWEP
= true;
447 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable HostWEP\n");
449 pDevice
->bEnableHostWEP
= false;
450 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable HostWEP\n");
454 case WLAN_CMD_SET_WPA
:
455 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_SET_WPA\n");
457 if (copy_from_user(&sValue
, pReq
->data
, sizeof(SCmdValue
))) {
461 if (sValue
.dwValue
== 1) {
462 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"up wpadev\n");
463 eth_hw_addr_inherit(pDevice
->wpadev
, pDevice
->dev
);
464 pDevice
->bWPADEVUp
= true;
466 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"close wpadev\n");
467 pDevice
->bWPADEVUp
= false;
471 case WLAN_CMD_AP_START
:
472 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"WLAN_CMD_AP_START\n");
473 if (pDevice
->bRadioOff
== true) {
474 CARDbRadioPowerOn(pDevice
);
475 vMgrTimerInit(pDevice
);
476 MACvIntEnable(pDevice
->PortOffset
, IMR_MASK_VALUE
);
477 add_timer(&pMgmt
->sTimerSecondCallback
);
479 if (copy_from_user(&sStartAPCmd
, pReq
->data
, sizeof(SCmdStartAP
))) {
484 if (sStartAPCmd
.wBSSType
== AP
) {
485 pMgmt
->eConfigMode
= WMAC_CONFIG_AP
;
486 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct set to AP mode\n");
488 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"ioct BSS type not set to AP mode\n");
493 if (sStartAPCmd
.wBBPType
== PHY80211g
)
494 pMgmt
->byAPBBType
= PHY_TYPE_11G
;
495 else if (sStartAPCmd
.wBBPType
== PHY80211a
)
496 pMgmt
->byAPBBType
= PHY_TYPE_11A
;
498 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= %*ph\n",
544 4, pMgmt
->abyIBSSSuppRates
+ 2);
546 netif_stop_queue(pDevice
->dev
);
547 spin_lock_irq(&pDevice
->lock
);
548 bScheduleCommand((void *)pDevice
, WLAN_CMD_RUN_AP
, NULL
);
549 spin_unlock_irq(&pDevice
->lock
);
552 case WLAN_CMD_GET_NODE_CNT
:
554 pNode
= &(pMgmt
->sNodeDBTable
[0]);
555 for (ii
= 0; ii
< (MAX_NODE_NUM
+ 1); ii
++) {
556 pNode
= &(pMgmt
->sNodeDBTable
[ii
]);
562 sNodeList
.uItem
= cbListCount
;
563 if (copy_to_user(pReq
->data
, &sNodeList
, sizeof(SNodeList
))) {
570 case WLAN_CMD_GET_NODE_LIST
:
571 if (copy_from_user(&sNodeList
, pReq
->data
, sizeof(SNodeList
))) {
575 if (sNodeList
.uItem
> (ULONG_MAX
- sizeof(SNodeList
)) / sizeof(SNodeItem
)) {
579 pNodeList
= (PSNodeList
)kmalloc(sizeof(SNodeList
) + (sNodeList
.uItem
* sizeof(SNodeItem
)), (int)GFP_ATOMIC
);
580 if (pNodeList
== NULL
) {
584 pNodeList
->uItem
= sNodeList
.uItem
;
585 pNode
= &(pMgmt
->sNodeDBTable
[0]);
586 for (ii
= 0, jj
= 0; ii
< (MAX_NODE_NUM
+ 1); ii
++) {
587 pNode
= &(pMgmt
->sNodeDBTable
[ii
]);
588 if (pNode
->bActive
) {
589 pNodeList
->sNodeList
[jj
].wAID
= pNode
->wAID
;
590 memcpy(pNodeList
->sNodeList
[jj
].abyMACAddr
, pNode
->abyMACAddr
, WLAN_ADDR_LEN
);
591 pNodeList
->sNodeList
[jj
].wTxDataRate
= pNode
->wTxDataRate
;
592 pNodeList
->sNodeList
[jj
].wInActiveCount
= (unsigned short)pNode
->uInActiveCount
;
593 pNodeList
->sNodeList
[jj
].wEnQueueCnt
= (unsigned short)pNode
->wEnQueueCnt
;
594 pNodeList
->sNodeList
[jj
].wFlags
= (unsigned short)pNode
->dwFlags
;
595 pNodeList
->sNodeList
[jj
].bPWBitOn
= pNode
->bPSEnable
;
596 pNodeList
->sNodeList
[jj
].byKeyIndex
= pNode
->byKeyIndex
;
597 pNodeList
->sNodeList
[jj
].wWepKeyLength
= pNode
->uWepKeyLength
;
598 memcpy(&(pNodeList
->sNodeList
[jj
].abyWepKey
[0]), &(pNode
->abyWepKey
[0]), WEP_KEYMAXLEN
);
599 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"key= %2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
600 pNodeList
->sNodeList
[jj
].abyWepKey
[0],
601 pNodeList
->sNodeList
[jj
].abyWepKey
[1],
602 pNodeList
->sNodeList
[jj
].abyWepKey
[2],
603 pNodeList
->sNodeList
[jj
].abyWepKey
[3],
604 pNodeList
->sNodeList
[jj
].abyWepKey
[4]);
605 pNodeList
->sNodeList
[jj
].bIsInFallback
= pNode
->bIsInFallback
;
606 pNodeList
->sNodeList
[jj
].uTxFailures
= pNode
->uTxFailures
;
607 pNodeList
->sNodeList
[jj
].uTxAttempts
= pNode
->uTxAttempts
;
608 pNodeList
->sNodeList
[jj
].wFailureRatio
= (unsigned short)pNode
->uFailureRatio
;
610 if (jj
>= pNodeList
->uItem
)
614 if (copy_to_user(pReq
->data
, pNodeList
, sizeof(SNodeList
) + (sNodeList
.uItem
* sizeof(SNodeItem
)))) {
622 #ifdef WPA_SM_Transtatus
624 memset(wpa_Result
.ifname
, 0, sizeof(wpa_Result
.ifname
));
625 wpa_Result
.proto
= 0;
626 wpa_Result
.key_mgmt
= 0;
627 wpa_Result
.eap_type
= 0;
628 wpa_Result
.authenticated
= false;
629 pDevice
->fWPA_Authened
= false;
630 if (copy_from_user(&wpa_Result
, pReq
->data
, sizeof(wpa_Result
))) {
635 if (wpa_Result
.authenticated
== true) {
638 union iwreq_data wrqu
;
640 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyCurrSSID
;
642 memset(&wrqu
, 0, sizeof(wrqu
));
643 wrqu
.data
.flags
= RT_WPACONNECTED_EVENT_FLAG
;
644 wrqu
.data
.length
= pItemSSID
->len
;
645 wireless_send_event(pDevice
->dev
, IWEVCUSTOM
, &wrqu
, pItemSSID
->abySSID
);
648 pDevice
->fWPA_Authened
= true; /* is successful peer to wpa_Result.authenticated? */
655 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Private command not support..\n");