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: wireless ext & ioctl functions
42 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
47 #include <net/iw_handler.h>
50 /*--------------------- Static Definitions -------------------------*/
52 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
53 #define SUPPORTED_WIRELESS_EXT 18
55 #define SUPPORTED_WIRELESS_EXT 17
58 static const long frequency_list
[] = {
59 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484,
60 4915, 4920, 4925, 4935, 4940, 4945, 4960, 4980,
61 5035, 5040, 5045, 5055, 5060, 5080, 5170, 5180, 5190, 5200, 5210, 5220, 5230, 5240,
62 5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680,
63 5700, 5745, 5765, 5785, 5805, 5825
67 /*--------------------- Static Classes ----------------------------*/
70 //static int msglevel =MSG_LEVEL_DEBUG;
71 static int msglevel
=MSG_LEVEL_INFO
;
74 /*--------------------- Static Variables --------------------------*/
75 /*--------------------- Static Functions --------------------------*/
77 /*--------------------- Export Variables --------------------------*/
79 struct iw_statistics
*iwctl_get_wireless_stats(struct net_device
*dev
)
81 PSDevice pDevice
= netdev_priv(dev
);
84 pDevice
->wstats
.status
= pDevice
->eOPMode
;
85 if(pDevice
->scStatistic
.LinkQuality
> 100)
86 pDevice
->scStatistic
.LinkQuality
= 100;
87 pDevice
->wstats
.qual
.qual
=(BYTE
) pDevice
->scStatistic
.LinkQuality
;
88 RFvRSSITodBm(pDevice
, (BYTE
)(pDevice
->uCurrRSSI
), &ldBm
);
89 pDevice
->wstats
.qual
.level
= ldBm
;
90 //pDevice->wstats.qual.level = 0x100 - pDevice->uCurrRSSI;
91 pDevice
->wstats
.qual
.noise
= 0;
92 pDevice
->wstats
.qual
.updated
= 1;
93 pDevice
->wstats
.discard
.nwid
= 0;
94 pDevice
->wstats
.discard
.code
= 0;
95 pDevice
->wstats
.discard
.fragment
= 0;
96 pDevice
->wstats
.discard
.retries
= pDevice
->scStatistic
.dwTsrErr
;
97 pDevice
->wstats
.discard
.misc
= 0;
98 pDevice
->wstats
.miss
.beacon
= 0;
100 return &pDevice
->wstats
;
105 /*------------------------------------------------------------------*/
108 static int iwctl_commit(struct net_device
*dev
,
109 struct iw_request_info
*info
,
113 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCSIWCOMMIT\n");
119 * Wireless Handler : get protocol name
122 int iwctl_giwname(struct net_device
*dev
,
123 struct iw_request_info
*info
,
127 strcpy(wrq
, "802.11-a/b/g");
132 * Wireless Handler : set scan
135 int iwctl_siwscan(struct net_device
*dev
,
136 struct iw_request_info
*info
,
137 struct iw_point
*wrq
,
140 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
141 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
142 struct iw_scan_req
*req
= (struct iw_scan_req
*)extra
;
143 BYTE abyScanSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
144 PWLAN_IE_SSID pItemSSID
=NULL
;
146 if (!(pDevice
->flags
& DEVICE_FLAGS_OPENED
))
149 PRINT_K(" SIOCSIWSCAN \n");
151 if (pMgmt
->eScanState
== WMAC_IS_SCANNING
) {
153 PRINT_K("SIOCSIWSCAN(overlap??)-->In scanning...\n");
157 if(pDevice
->byReAssocCount
> 0) { //reject scan when re-associating!
158 //send scan event to wpa_Supplicant
159 union iwreq_data wrqu
;
160 PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n");
161 memset(&wrqu
, 0, sizeof(wrqu
));
162 wireless_send_event(pDevice
->dev
, SIOCGIWSCAN
, &wrqu
, NULL
);
166 spin_lock_irq(&pDevice
->lock
);
168 BSSvClearBSSList((void *) pDevice
, pDevice
->bLinkPass
);
170 //mike add: active scan OR passive scan OR desire_ssid scan
171 if(wrq
->length
== sizeof(struct iw_scan_req
)) {
172 if (wrq
->flags
& IW_SCAN_THIS_ESSID
) { //desire_ssid scan
173 memset(abyScanSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
174 pItemSSID
= (PWLAN_IE_SSID
)abyScanSSID
;
175 pItemSSID
->byElementID
= WLAN_EID_SSID
;
176 memcpy(pItemSSID
->abySSID
, req
->essid
, (int)req
->essid_len
);
177 if (pItemSSID
->abySSID
[req
->essid_len
- 1] == '\0') {
179 pItemSSID
->len
= req
->essid_len
- 1;
182 pItemSSID
->len
= req
->essid_len
;
183 pMgmt
->eScanType
= WMAC_SCAN_PASSIVE
;
184 PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n",((PWLAN_IE_SSID
)abyScanSSID
)->abySSID
,
185 ((PWLAN_IE_SSID
)abyScanSSID
)->len
);
186 bScheduleCommand((void *) pDevice
, WLAN_CMD_BSSID_SCAN
, abyScanSSID
);
187 spin_unlock_irq(&pDevice
->lock
);
191 else if(req
->scan_type
== IW_SCAN_TYPE_PASSIVE
) { //passive scan
192 pMgmt
->eScanType
= WMAC_SCAN_PASSIVE
;
196 pMgmt
->eScanType
= WMAC_SCAN_ACTIVE
;
199 pMgmt
->eScanType
= WMAC_SCAN_PASSIVE
;
200 //printk("SIOCSIWSCAN:WLAN_CMD_BSSID_SCAN\n");
201 bScheduleCommand((void *) pDevice
, WLAN_CMD_BSSID_SCAN
, NULL
);
202 spin_unlock_irq(&pDevice
->lock
);
209 * Wireless Handler : get scan results
212 int iwctl_giwscan(struct net_device
*dev
,
213 struct iw_request_info
*info
,
214 struct iw_point
*wrq
,
218 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
219 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
221 PWLAN_IE_SSID pItemSSID
;
222 PWLAN_IE_SUPP_RATES pSuppRates
, pExtSuppRates
;
223 char *current_ev
= extra
;
224 char *end_buf
= extra
+ IW_SCAN_MAX_DATA
;
225 char *current_val
= NULL
;
228 char buf
[MAX_WPA_IE_LEN
* 2 + 30];
230 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCGIWSCAN\n");
232 if (pMgmt
->eScanState
== WMAC_IS_SCANNING
) {
236 pBSS
= &(pMgmt
->sBSSList
[0]);
237 for (ii
= 0, jj
= 0; jj
< MAX_BSS_NUM
; jj
++) {
238 if (current_ev
>= end_buf
)
240 pBSS
= &(pMgmt
->sBSSList
[jj
]);
243 memset(&iwe
, 0, sizeof(iwe
));
245 iwe
.u
.ap_addr
.sa_family
= ARPHRD_ETHER
;
246 memcpy(iwe
.u
.ap_addr
.sa_data
, pBSS
->abyBSSID
, WLAN_BSSID_LEN
);
247 current_ev
= iwe_stream_add_event(info
,current_ev
,end_buf
, &iwe
, IW_EV_ADDR_LEN
);
249 memset(&iwe
, 0, sizeof(iwe
));
250 iwe
.cmd
= SIOCGIWESSID
;
251 pItemSSID
= (PWLAN_IE_SSID
)pBSS
->abySSID
;
252 iwe
.u
.data
.length
= pItemSSID
->len
;
253 iwe
.u
.data
.flags
= 1;
254 current_ev
= iwe_stream_add_point(info
,current_ev
,end_buf
, &iwe
, pItemSSID
->abySSID
);
256 memset(&iwe
, 0, sizeof(iwe
));
257 iwe
.cmd
= SIOCGIWMODE
;
258 if (WLAN_GET_CAP_INFO_ESS(pBSS
->wCapInfo
)) {
259 iwe
.u
.mode
= IW_MODE_INFRA
;
262 iwe
.u
.mode
= IW_MODE_ADHOC
;
264 iwe
.len
= IW_EV_UINT_LEN
;
265 current_ev
= iwe_stream_add_event(info
,current_ev
, end_buf
, &iwe
, IW_EV_UINT_LEN
);
267 pSuppRates
= (PWLAN_IE_SUPP_RATES
)pBSS
->abySuppRates
;
268 pExtSuppRates
= (PWLAN_IE_SUPP_RATES
)pBSS
->abyExtSuppRates
;
269 memset(&iwe
, 0, sizeof(iwe
));
270 iwe
.cmd
= SIOCGIWFREQ
;
271 iwe
.u
.freq
.m
= pBSS
->uChannel
;
274 current_ev
= iwe_stream_add_event(info
,current_ev
,end_buf
, &iwe
, IW_EV_FREQ_LEN
);
276 int f
= (int)pBSS
->uChannel
- 1;
278 iwe
.u
.freq
.m
= frequency_list
[f
] * 100000;
281 current_ev
= iwe_stream_add_event(info
,current_ev
,end_buf
, &iwe
, IW_EV_FREQ_LEN
);
283 memset(&iwe
, 0, sizeof(iwe
));
285 RFvRSSITodBm(pDevice
, (BYTE
)(pBSS
->uRSSI
), &ldBm
);
286 iwe
.u
.qual
.level
= ldBm
;
287 iwe
.u
.qual
.noise
= 0;
290 iwe
.u
.qual
.qual
= 100;
291 }else if(-ldBm
> 90) {
294 iwe
.u
.qual
.qual
=(40-(-ldBm
-50))*100/40;
296 iwe
.u
.qual
.updated
=7;
298 current_ev
= iwe_stream_add_event(info
,current_ev
, end_buf
, &iwe
, IW_EV_QUAL_LEN
);
300 memset(&iwe
, 0, sizeof(iwe
));
301 iwe
.cmd
= SIOCGIWENCODE
;
302 iwe
.u
.data
.length
= 0;
303 if (WLAN_GET_CAP_INFO_PRIVACY(pBSS
->wCapInfo
)) {
304 iwe
.u
.data
.flags
=IW_ENCODE_ENABLED
| IW_ENCODE_NOKEY
;
306 iwe
.u
.data
.flags
= IW_ENCODE_DISABLED
;
308 current_ev
= iwe_stream_add_point(info
,current_ev
,end_buf
, &iwe
, pItemSSID
->abySSID
);
310 memset(&iwe
, 0, sizeof(iwe
));
311 iwe
.cmd
= SIOCGIWRATE
;
312 iwe
.u
.bitrate
.fixed
= iwe
.u
.bitrate
.disabled
= 0;
313 current_val
= current_ev
+ IW_EV_LCP_LEN
;
315 for (kk
= 0 ; kk
< 12 ; kk
++) {
316 if (pSuppRates
->abyRates
[kk
] == 0)
318 // Bit rate given in 500 kb/s units (+ 0x80)
319 iwe
.u
.bitrate
.value
= ((pSuppRates
->abyRates
[kk
] & 0x7f) * 500000);
320 current_val
= iwe_stream_add_value(info
,current_ev
, current_val
, end_buf
, &iwe
, IW_EV_PARAM_LEN
);
322 for (kk
= 0 ; kk
< 8 ; kk
++) {
323 if (pExtSuppRates
->abyRates
[kk
] == 0)
325 // Bit rate given in 500 kb/s units (+ 0x80)
326 iwe
.u
.bitrate
.value
= ((pExtSuppRates
->abyRates
[kk
] & 0x7f) * 500000);
327 current_val
= iwe_stream_add_value(info
,current_ev
, current_val
, end_buf
, &iwe
, IW_EV_PARAM_LEN
);
330 if((current_val
- current_ev
) > IW_EV_LCP_LEN
)
331 current_ev
= current_val
;
333 memset(&iwe
, 0, sizeof(iwe
));
334 iwe
.cmd
= IWEVCUSTOM
;
335 sprintf(buf
, "bcn_int=%d", pBSS
->wBeaconInterval
);
336 iwe
.u
.data
.length
= strlen(buf
);
337 current_ev
= iwe_stream_add_point(info
,current_ev
, end_buf
, &iwe
, buf
);
339 if ((pBSS
->wWPALen
> 0) && (pBSS
->wWPALen
<= MAX_WPA_IE_LEN
)) {
340 memset(&iwe
, 0, sizeof(iwe
));
342 iwe
.u
.data
.length
= pBSS
->wWPALen
;
343 current_ev
= iwe_stream_add_point(info
,current_ev
, end_buf
, &iwe
, pBSS
->byWPAIE
);
346 if ((pBSS
->wRSNLen
> 0) && (pBSS
->wRSNLen
<= MAX_WPA_IE_LEN
)) {
347 memset(&iwe
, 0, sizeof(iwe
));
349 iwe
.u
.data
.length
= pBSS
->wRSNLen
;
350 current_ev
= iwe_stream_add_point(info
,current_ev
, end_buf
, &iwe
, pBSS
->byRSNIE
);
356 wrq
->length
= current_ev
- extra
;
363 * Wireless Handler : set frequence or channel
366 int iwctl_siwfreq(struct net_device
*dev
,
367 struct iw_request_info
*info
,
371 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
374 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCSIWFREQ \n");
376 // If setting by frequency, convert to a channel
378 (wrq
->m
>= (int) 2.412e8
) &&
379 (wrq
->m
<= (int) 2.487e8
)) {
380 int f
= wrq
->m
/ 100000;
382 while((c
< 14) && (f
!= frequency_list
[c
]))
387 // Setting by channel number
388 if((wrq
->m
> 14) || (wrq
->e
> 0))
391 int channel
= wrq
->m
;
392 if((channel
< 1) || (channel
> 14)) {
393 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"%s: New channel value of %d is invalid!\n", dev
->name
, wrq
->m
);
396 // Yes ! We can set it !!!
397 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" Set to channel = %d\n", channel
);
398 pDevice
->uChannel
= channel
;
406 * Wireless Handler : get frequence or channel
409 int iwctl_giwfreq(struct net_device
*dev
,
410 struct iw_request_info
*info
,
414 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
415 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
417 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCGIWFREQ \n");
419 #ifdef WEXT_USECHANNELS
420 wrq
->m
= (int)pMgmt
->uCurrChannel
;
424 int f
= (int)pMgmt
->uCurrChannel
- 1;
427 wrq
->m
= frequency_list
[f
] * 100000;
436 * Wireless Handler : set operation mode
439 int iwctl_siwmode(struct net_device
*dev
,
440 struct iw_request_info
*info
,
444 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
445 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
448 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCSIWMODE \n");
450 if (pMgmt
->eCurrMode
== WMAC_MODE_ESS_AP
&& pDevice
->bEnableHostapd
) {
451 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Can't set operation mode, hostapd is running \n");
458 if (pMgmt
->eConfigMode
!= WMAC_CONFIG_IBSS_STA
) {
459 pMgmt
->eConfigMode
= WMAC_CONFIG_IBSS_STA
;
460 if (pDevice
->flags
& DEVICE_FLAGS_OPENED
) {
461 pDevice
->bCommit
= TRUE
;
464 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"set mode to ad-hoc \n");
468 if (pMgmt
->eConfigMode
!= WMAC_CONFIG_ESS_STA
) {
469 pMgmt
->eConfigMode
= WMAC_CONFIG_ESS_STA
;
470 if (pDevice
->flags
& DEVICE_FLAGS_OPENED
) {
471 pDevice
->bCommit
= TRUE
;
474 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"set mode to infrastructure \n");
478 pMgmt
->eConfigMode
= WMAC_CONFIG_ESS_STA
;
482 if (pMgmt
->eConfigMode
!= WMAC_CONFIG_AP
) {
483 pMgmt
->eConfigMode
= WMAC_CONFIG_AP
;
484 if (pDevice
->flags
& DEVICE_FLAGS_OPENED
) {
485 pDevice
->bCommit
= TRUE
;
488 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"set mode to Access Point \n");
492 pMgmt
->eConfigMode
= WMAC_CONFIG_ESS_STA
;
503 * Wireless Handler : get operation mode
506 int iwctl_giwmode(struct net_device
*dev
,
507 struct iw_request_info
*info
,
511 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
512 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
515 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCGIWMODE \n");
516 // If not managed, assume it's ad-hoc
517 switch (pMgmt
->eConfigMode
) {
518 case WMAC_CONFIG_ESS_STA
:
519 *wmode
= IW_MODE_INFRA
;
521 case WMAC_CONFIG_IBSS_STA
:
522 *wmode
= IW_MODE_ADHOC
;
524 case WMAC_CONFIG_AUTO
:
525 *wmode
= IW_MODE_INFRA
;
528 *wmode
= IW_MODE_MASTER
;
531 *wmode
= IW_MODE_ADHOC
;
539 * Wireless Handler : get capability range
542 int iwctl_giwrange(struct net_device
*dev
,
543 struct iw_request_info
*info
,
544 struct iw_point
*wrq
,
547 struct iw_range
*range
= (struct iw_range
*) extra
;
549 BYTE abySupportedRates
[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
551 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCGIWRANGE\n");
553 wrq
->length
= sizeof(struct iw_range
);
554 memset(range
, 0, sizeof(struct iw_range
));
555 range
->min_nwid
= 0x0000;
556 range
->max_nwid
= 0x0000;
557 range
->num_channels
= 14;
558 // Should be based on cap_rid.country to give only
559 // what the current card support
561 for (i
= 0; i
< 14; i
++) {
562 range
->freq
[k
].i
= i
+ 1; // List index
563 range
->freq
[k
].m
= frequency_list
[i
] * 100000;
564 range
->freq
[k
++].e
= 1; // Values in table in MHz -> * 10^5 * 10
566 range
->num_frequency
= k
;
567 // Hum... Should put the right values there
568 range
->max_qual
.qual
= 100;
569 range
->max_qual
.level
= 0;
570 range
->max_qual
.noise
= 0;
571 range
->sensitivity
= 255;
573 for (i
= 0 ; i
< 13 ; i
++) {
574 range
->bitrate
[i
] = abySupportedRates
[i
] * 500000;
575 if(range
->bitrate
[i
] == 0)
578 range
->num_bitrates
= i
;
580 // Set an indication of the max TCP throughput
581 // in bit/s that we can expect using this interface.
582 // May be use for QoS stuff... Jean II
584 range
->throughput
= 5 * 1000 * 1000;
586 range
->throughput
= 1.5 * 1000 * 1000;
589 range
->max_rts
= 2312;
590 range
->min_frag
= 256;
591 range
->max_frag
= 2312;
594 // the encoding capabilities
595 range
->num_encoding_sizes
= 3;
597 range
->encoding_size
[0] = 5;
599 range
->encoding_size
[1] = 13;
600 // 256 bits for WPA-PSK
601 range
->encoding_size
[2] = 32;
602 // 4 keys are allowed
603 range
->max_encoding_tokens
= 4;
605 range
->enc_capa
= IW_ENC_CAPA_WPA
| IW_ENC_CAPA_WPA2
|
606 IW_ENC_CAPA_CIPHER_TKIP
| IW_ENC_CAPA_CIPHER_CCMP
;
609 range
->max_pmp
= 1000000;// 1 secs
611 range
->max_pmt
= 1000000;// 1 secs
612 range
->pmp_flags
= IW_POWER_PERIOD
;
613 range
->pmt_flags
= IW_POWER_TIMEOUT
;
614 range
->pm_capa
= IW_POWER_PERIOD
| IW_POWER_TIMEOUT
| IW_POWER_ALL_R
;
616 // Transmit Power - values are in mW
618 range
->txpower
[0] = 100;
619 range
->num_txpower
= 1;
620 range
->txpower_capa
= IW_TXPOW_MWATT
;
621 range
->we_version_source
= SUPPORTED_WIRELESS_EXT
;
622 range
->we_version_compiled
= WIRELESS_EXT
;
623 range
->retry_capa
= IW_RETRY_LIMIT
| IW_RETRY_LIFETIME
;
624 range
->retry_flags
= IW_RETRY_LIMIT
;
625 range
->r_time_flags
= IW_RETRY_LIFETIME
;
626 range
->min_retry
= 1;
627 range
->max_retry
= 65535;
628 range
->min_r_time
= 1024;
629 range
->max_r_time
= 65535 * 1024;
630 // Experimental measurements - boundary 11/5.5 Mb/s
631 // Note : with or without the (local->rssi), results
632 // are somewhat different. - Jean II
633 range
->avg_qual
.qual
= 6;
634 range
->avg_qual
.level
= 176; // -80 dBm
635 range
->avg_qual
.noise
= 0;
644 * Wireless Handler : set ap mac address
647 int iwctl_siwap(struct net_device
*dev
,
648 struct iw_request_info
*info
,
649 struct sockaddr
*wrq
,
652 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
653 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
655 BYTE ZeroBSSID
[WLAN_BSSID_LEN
]={0x00,0x00,0x00,0x00,0x00,0x00};
657 PRINT_K(" SIOCSIWAP \n");
659 if (wrq
->sa_family
!= ARPHRD_ETHER
)
662 memcpy(pMgmt
->abyDesireBSSID
, wrq
->sa_data
, 6);
665 if ((is_broadcast_ether_addr(pMgmt
->abyDesireBSSID
)) ||
666 (memcmp(pMgmt
->abyDesireBSSID
, ZeroBSSID
, 6) == 0)){
667 PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n");
670 //mike add: if desired AP is hidden ssid(there are two same BSSID in list),
671 // then ignore,because you don't known which one to be connect with??
673 unsigned int ii
, uSameBssidNum
= 0;
674 for (ii
= 0; ii
< MAX_BSS_NUM
; ii
++) {
675 if (pMgmt
->sBSSList
[ii
].bActive
&&
676 !compare_ether_addr(pMgmt
->sBSSList
[ii
].abyBSSID
,
677 pMgmt
->abyDesireBSSID
)) {
681 if(uSameBssidNum
>= 2) { //hit: desired AP is in hidden ssid mode!!!
682 PRINT_K("SIOCSIWAP:ignore for desired AP in hidden mode\n");
687 if (pDevice
->flags
& DEVICE_FLAGS_OPENED
) {
688 pDevice
->bCommit
= TRUE
;
695 * Wireless Handler : get ap mac address
698 int iwctl_giwap(struct net_device
*dev
,
699 struct iw_request_info
*info
,
700 struct sockaddr
*wrq
,
703 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
704 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
707 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCGIWAP \n");
709 memcpy(wrq
->sa_data
, pMgmt
->abyCurrBSSID
, 6);
711 //20080123-02,<Modify> by Einsn Liu
712 if ((pDevice
->bLinkPass
== FALSE
) && (pMgmt
->eCurrMode
!= WMAC_MODE_ESS_AP
))
713 // if ((pDevice->bLinkPass == FALSE) && (pMgmt->eCurrMode == WMAC_MODE_ESS_STA))
714 memset(wrq
->sa_data
, 0, 6);
716 if (pMgmt
->eCurrMode
== WMAC_MODE_ESS_AP
) {
717 memcpy(wrq
->sa_data
, pMgmt
->abyCurrBSSID
, 6);
720 wrq
->sa_family
= ARPHRD_ETHER
;
728 * Wireless Handler : get ap list
731 int iwctl_giwaplist(struct net_device
*dev
,
732 struct iw_request_info
*info
,
733 struct iw_point
*wrq
,
737 struct sockaddr sock
[IW_MAX_AP
];
738 struct iw_quality qual
[IW_MAX_AP
];
739 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
740 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
743 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCGIWAPLIST \n");
744 // Only super-user can see AP list
746 if (!capable(CAP_NET_ADMIN
)) {
753 PKnownBSS pBSS
= &(pMgmt
->sBSSList
[0]);
755 for (ii
= 0, jj
= 0; ii
< MAX_BSS_NUM
; ii
++) {
756 pBSS
= &(pMgmt
->sBSSList
[ii
]);
759 if ( jj
>= IW_MAX_AP
)
761 memcpy(sock
[jj
].sa_data
, pBSS
->abyBSSID
, 6);
762 sock
[jj
].sa_family
= ARPHRD_ETHER
;
763 qual
[jj
].level
= pBSS
->uRSSI
;
764 qual
[jj
].qual
= qual
[jj
].noise
= 0;
765 qual
[jj
].updated
= 2;
769 wrq
->flags
= 1; // Should be define'd
771 memcpy(extra
, sock
, sizeof(struct sockaddr
)*jj
);
772 memcpy(extra
+ sizeof(struct sockaddr
)*jj
, qual
, sizeof(struct iw_quality
)*jj
);
780 * Wireless Handler : set essid
783 int iwctl_siwessid(struct net_device
*dev
,
784 struct iw_request_info
*info
,
785 struct iw_point
*wrq
,
788 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
789 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
790 PWLAN_IE_SSID pItemSSID
;
792 if (!(pDevice
->flags
& DEVICE_FLAGS_OPENED
))
795 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCSIWESSID :\n");
797 pDevice
->fWPA_Authened
= FALSE
;
798 // Check if we asked for `any'
799 if(wrq
->flags
== 0) {
800 // Just send an empty SSID list
801 memset(pMgmt
->abyDesireSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
802 memset(pMgmt
->abyDesireBSSID
, 0xFF,6);
803 PRINT_K("set essid to 'any' \n");
804 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
805 //Unknown desired AP,so here need not associate??
810 memset(pMgmt
->abyDesireSSID
, 0, WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1);
811 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyDesireSSID
;
812 pItemSSID
->byElementID
= WLAN_EID_SSID
;
814 memcpy(pItemSSID
->abySSID
, extra
, wrq
->length
);
815 if (pItemSSID
->abySSID
[wrq
->length
- 1] == '\0') {
817 pItemSSID
->len
= wrq
->length
- 1;
820 pItemSSID
->len
= wrq
->length
;
821 PRINT_K("set essid to %s \n",pItemSSID
->abySSID
);
823 //mike:need clear desiredBSSID
824 if(pItemSSID
->len
==0) {
825 memset(pMgmt
->abyDesireBSSID
, 0xFF,6);
829 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
830 //Wext wil order another command of siwap to link with desired AP,
831 //so here need not associate??
832 if(pDevice
->bWPASuppWextEnabled
== TRUE
) {
833 /*******search if in hidden ssid mode ****/
835 PKnownBSS pCurr
= NULL
;
836 BYTE abyTmpDesireSSID
[WLAN_IEHDR_LEN
+ WLAN_SSID_MAXLEN
+ 1];
837 unsigned int ii
, uSameBssidNum
= 0;
839 memcpy(abyTmpDesireSSID
,pMgmt
->abyDesireSSID
,sizeof(abyTmpDesireSSID
));
840 pCurr
= BSSpSearchBSSList(pDevice
,
843 pDevice
->eConfigPHYMode
847 PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n");
848 vResetCommandTimer((void *) pDevice
);
849 pMgmt
->eScanType
= WMAC_SCAN_ACTIVE
;
850 bScheduleCommand((void *) pDevice
,
852 pMgmt
->abyDesireSSID
);
853 bScheduleCommand((void *) pDevice
,
855 pMgmt
->abyDesireSSID
);
857 else { //mike:to find out if that desired SSID is a hidden-ssid AP ,
858 // by means of judging if there are two same BSSID exist in list ?
859 for (ii
= 0; ii
< MAX_BSS_NUM
; ii
++) {
860 if (pMgmt
->sBSSList
[ii
].bActive
&&
861 !compare_ether_addr(pMgmt
->sBSSList
[ii
].abyBSSID
,
866 if(uSameBssidNum
>= 2) { //hit: desired AP is in hidden ssid mode!!!
867 PRINT_K("SIOCSIWESSID:hidden ssid directly associate.......\n");
868 vResetCommandTimer((void *) pDevice
);
869 pMgmt
->eScanType
= WMAC_SCAN_PASSIVE
; //this scan type,you'll submit scan result!
870 bScheduleCommand((void *) pDevice
,
872 pMgmt
->abyDesireSSID
);
873 bScheduleCommand((void *) pDevice
,
875 pMgmt
->abyDesireSSID
);
883 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"set essid = %s \n", pItemSSID
->abySSID
);
886 if (pDevice
->flags
& DEVICE_FLAGS_OPENED
) {
887 pDevice
->bCommit
= TRUE
;
896 * Wireless Handler : get essid
899 int iwctl_giwessid(struct net_device
*dev
,
900 struct iw_request_info
*info
,
901 struct iw_point
*wrq
,
905 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
906 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
907 PWLAN_IE_SSID pItemSSID
;
909 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCGIWESSID \n");
911 // Note : if wrq->u.data.flags != 0, we should
912 // get the relevant SSID from the SSID list...
914 // Get the current SSID
915 pItemSSID
= (PWLAN_IE_SSID
)pMgmt
->abyCurrSSID
;
916 //pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
917 memcpy(extra
, pItemSSID
->abySSID
, pItemSSID
->len
);
918 extra
[pItemSSID
->len
] = '\0';
920 wrq
->length
= pItemSSID
->len
;
921 wrq
->flags
= 1; // active
927 * Wireless Handler : set data rate
930 int iwctl_siwrate(struct net_device
*dev
,
931 struct iw_request_info
*info
,
932 struct iw_param
*wrq
,
935 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
939 BYTE abySupportedRates
[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
942 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCSIWRATE \n");
943 if (!(pDevice
->flags
& DEVICE_FLAGS_OPENED
)) {
948 // First : get a valid bit rate value
950 // Which type of value
951 if((wrq
->value
< 13) &&
953 // Setting by rate index
954 // Find value in the magic rate table
957 // Setting by frequency value
958 u8 normvalue
= (u8
) (wrq
->value
/500000);
960 // Check if rate is valid
961 for (i
= 0 ; i
< 13 ; i
++) {
962 if(normvalue
== abySupportedRates
[i
]) {
968 // -1 designed the max rate (mostly auto mode)
969 if(wrq
->value
== -1) {
970 // Get the highest available rate
971 for (i
= 0 ; i
< 13 ; i
++) {
972 if(abySupportedRates
[i
] == 0)
979 // Check that it is valid
980 // brate is index of abySupportedRates[]
986 // Now, check if we want a fixed or auto value
987 if(wrq
->fixed
!= 0) {
990 pDevice
->bFixRate
= TRUE
;
991 if ((pDevice
->byBBType
== BB_TYPE_11B
)&& (brate
> 3)) {
992 pDevice
->uConnectionRate
= 3;
995 pDevice
->uConnectionRate
= brate
;
996 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Fixed to Rate %d \n", pDevice
->uConnectionRate
);
1001 pDevice
->bFixRate
= FALSE
;
1002 pDevice
->uConnectionRate
= 13;
1009 * Wireless Handler : get data rate
1012 int iwctl_giwrate(struct net_device
*dev
,
1013 struct iw_request_info
*info
,
1014 struct iw_param
*wrq
,
1017 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1018 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
1020 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCGIWRATE \n");
1022 BYTE abySupportedRates
[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
1024 if (pDevice
->uConnectionRate
< 13) {
1025 brate
= abySupportedRates
[pDevice
->uConnectionRate
];
1027 if (pDevice
->byBBType
== BB_TYPE_11B
)
1029 if (pDevice
->byBBType
== BB_TYPE_11G
)
1031 if (pDevice
->byBBType
== BB_TYPE_11A
)
1035 if (pMgmt
->eCurrMode
== WMAC_MODE_ESS_AP
) {
1036 if (pDevice
->byBBType
== BB_TYPE_11B
)
1038 if (pDevice
->byBBType
== BB_TYPE_11G
)
1040 if (pDevice
->byBBType
== BB_TYPE_11A
)
1043 if (pDevice
->uConnectionRate
== 13)
1044 brate
= abySupportedRates
[pDevice
->wCurrentRate
];
1045 wrq
->value
= brate
* 500000;
1046 // If more than one rate, set auto
1047 if (pDevice
->bFixRate
== TRUE
)
1058 * Wireless Handler : set rts threshold
1061 int iwctl_siwrts(struct net_device
*dev
,
1062 struct iw_request_info
*info
,
1063 struct iw_param
*wrq
,
1066 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1069 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCSIWRTS \n");
1072 int rthr
= wrq
->value
;
1075 if((rthr
< 0) || (rthr
> 2312)) {
1078 pDevice
->wRTSThreshold
= rthr
;
1086 * Wireless Handler : get rts
1089 int iwctl_giwrts(struct net_device
*dev
,
1090 struct iw_request_info
*info
,
1091 struct iw_param
*wrq
,
1094 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1096 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCGIWRTS \n");
1097 wrq
->value
= pDevice
->wRTSThreshold
;
1098 wrq
->disabled
= (wrq
->value
>= 2312);
1105 * Wireless Handler : set fragment threshold
1108 int iwctl_siwfrag(struct net_device
*dev
,
1109 struct iw_request_info
*info
,
1110 struct iw_param
*wrq
,
1113 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1115 int fthr
= wrq
->value
;
1118 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCSIWFRAG \n");
1123 if((fthr
< 256) || (fthr
> 2312)) {
1126 fthr
&= ~0x1; // Get an even value
1127 pDevice
->wFragmentationThreshold
= (u16
)fthr
;
1134 * Wireless Handler : get fragment threshold
1137 int iwctl_giwfrag(struct net_device
*dev
,
1138 struct iw_request_info
*info
,
1139 struct iw_param
*wrq
,
1142 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1144 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCGIWFRAG \n");
1145 wrq
->value
= pDevice
->wFragmentationThreshold
;
1146 wrq
->disabled
= (wrq
->value
>= 2312);
1155 * Wireless Handler : set retry threshold
1157 int iwctl_siwretry(struct net_device
*dev
,
1158 struct iw_request_info
*info
,
1159 struct iw_param
*wrq
,
1162 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1166 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCSIWRETRY \n");
1168 if (wrq
->disabled
) {
1173 if (wrq
->flags
& IW_RETRY_LIMIT
) {
1174 if(wrq
->flags
& IW_RETRY_MAX
)
1175 pDevice
->byLongRetryLimit
= wrq
->value
;
1176 else if (wrq
->flags
& IW_RETRY_MIN
)
1177 pDevice
->byShortRetryLimit
= wrq
->value
;
1179 // No modifier : set both
1180 pDevice
->byShortRetryLimit
= wrq
->value
;
1181 pDevice
->byLongRetryLimit
= wrq
->value
;
1184 if (wrq
->flags
& IW_RETRY_LIFETIME
) {
1185 pDevice
->wMaxTransmitMSDULifetime
= wrq
->value
;
1193 * Wireless Handler : get retry threshold
1195 int iwctl_giwretry(struct net_device
*dev
,
1196 struct iw_request_info
*info
,
1197 struct iw_param
*wrq
,
1200 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1201 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCGIWRETRY \n");
1202 wrq
->disabled
= 0; // Can't be disabled
1204 // Note : by default, display the min retry number
1205 if((wrq
->flags
& IW_RETRY_TYPE
) == IW_RETRY_LIFETIME
) {
1206 wrq
->flags
= IW_RETRY_LIFETIME
;
1207 wrq
->value
= (int)pDevice
->wMaxTransmitMSDULifetime
; //ms
1208 } else if((wrq
->flags
& IW_RETRY_MAX
)) {
1209 wrq
->flags
= IW_RETRY_LIMIT
| IW_RETRY_MAX
;
1210 wrq
->value
= (int)pDevice
->byLongRetryLimit
;
1212 wrq
->flags
= IW_RETRY_LIMIT
;
1213 wrq
->value
= (int)pDevice
->byShortRetryLimit
;
1214 if((int)pDevice
->byShortRetryLimit
!= (int)pDevice
->byLongRetryLimit
)
1215 wrq
->flags
|= IW_RETRY_MIN
;
1224 * Wireless Handler : set encode mode
1226 int iwctl_siwencode(struct net_device
*dev
,
1227 struct iw_request_info
*info
,
1228 struct iw_point
*wrq
,
1231 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1232 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
1233 DWORD dwKeyIndex
= (DWORD
)(wrq
->flags
& IW_ENCODE_INDEX
);
1235 int index
= (wrq
->flags
& IW_ENCODE_INDEX
);
1238 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCSIWENCODE \n");
1240 // Check the size of the key
1241 if (wrq
->length
> WLAN_WEP232_KEYLEN
) {
1246 if (dwKeyIndex
> WLAN_WEP_NKEYS
) {
1254 // Send the key to the card
1255 if (wrq
->length
> 0) {
1257 if (wrq
->length
== WLAN_WEP232_KEYLEN
) {
1258 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Set 232 bit wep key\n");
1260 else if (wrq
->length
== WLAN_WEP104_KEYLEN
) {
1261 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Set 104 bit wep key\n");
1263 else if (wrq
->length
== WLAN_WEP40_KEYLEN
) {
1264 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Set 40 bit wep key, index= %d\n", (int)dwKeyIndex
);
1266 memset(pDevice
->abyKey
, 0, WLAN_WEP232_KEYLEN
);
1267 memcpy(pDevice
->abyKey
, extra
, wrq
->length
);
1269 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"abyKey: ");
1270 for (ii
= 0; ii
< wrq
->length
; ii
++) {
1271 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"%02x ", pDevice
->abyKey
[ii
]);
1274 if (pDevice
->flags
& DEVICE_FLAGS_OPENED
) {
1275 spin_lock_irq(&pDevice
->lock
);
1276 KeybSetDefaultKey( pDevice
,
1278 dwKeyIndex
| (1 << 31),
1284 spin_unlock_irq(&pDevice
->lock
);
1286 pDevice
->byKeyIndex
= (BYTE
)dwKeyIndex
;
1287 pDevice
->uKeyLength
= wrq
->length
;
1288 pDevice
->bTransmitKey
= TRUE
;
1289 pDevice
->bEncryptionEnable
= TRUE
;
1290 pDevice
->eEncryptionStatus
= Ndis802_11Encryption1Enabled
;
1292 // Do we want to just set the transmit key index ?
1294 pDevice
->byKeyIndex
= index
;
1295 } else if (!(wrq
->flags
& IW_ENCODE_MODE
)) {
1301 if(wrq
->flags
& IW_ENCODE_DISABLED
){
1303 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Disable WEP function\n");
1304 pMgmt
->bShareKeyAlgorithm
= FALSE
;
1305 pDevice
->bEncryptionEnable
= FALSE
;
1306 pDevice
->eEncryptionStatus
= Ndis802_11EncryptionDisabled
;
1307 if (pDevice
->flags
& DEVICE_FLAGS_OPENED
) {
1308 spin_lock_irq(&pDevice
->lock
);
1309 for (uu
= 0; uu
< MAX_KEY_TABLE
; uu
++)
1310 MACvDisableKeyEntry(pDevice
, uu
);
1311 spin_unlock_irq(&pDevice
->lock
);
1314 if(wrq
->flags
& IW_ENCODE_RESTRICTED
) {
1315 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable WEP & ShareKey System\n");
1316 pMgmt
->bShareKeyAlgorithm
= TRUE
;
1318 if(wrq
->flags
& IW_ENCODE_OPEN
) {
1319 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
"Enable WEP & Open System\n");
1320 pMgmt
->bShareKeyAlgorithm
= FALSE
;
1323 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
1324 memset(pMgmt
->abyDesireBSSID
, 0xFF,6);
1331 * Wireless Handler : get encode mode
1333 //2008-0409-06, <Mark> by Einsn Liu
1335 int iwctl_giwencode(struct net_device *dev,
1336 struct iw_request_info *info,
1337 struct iw_point *wrq,
1340 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1341 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1343 char abyKey[WLAN_WEP232_KEYLEN];
1344 unsigned int index = (unsigned int)(wrq->flags & IW_ENCODE_INDEX);
1345 PSKeyItem pKey = NULL;
1347 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n");
1350 memset(abyKey, 0, sizeof(abyKey));
1351 // Check encryption mode
1352 wrq->flags = IW_ENCODE_NOKEY;
1353 // Is WEP enabled ???
1354 if (pDevice->bEncryptionEnable)
1355 wrq->flags |= IW_ENCODE_ENABLED;
1357 wrq->flags |= IW_ENCODE_DISABLED;
1359 if (pMgmt->bShareKeyAlgorithm)
1360 wrq->flags |= IW_ENCODE_RESTRICTED;
1362 wrq->flags |= IW_ENCODE_OPEN;
1364 if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index , &pKey)){
1365 wrq->length = pKey->uKeyLength;
1366 memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
1372 wrq->flags |= index;
1373 // Copy the key to the user buffer
1374 memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
1379 int iwctl_giwencode(struct net_device
*dev
,
1380 struct iw_request_info
*info
,
1381 struct iw_point
*wrq
,
1384 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1385 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
1386 char abyKey
[WLAN_WEP232_KEYLEN
];
1388 unsigned int index
= (unsigned int)(wrq
->flags
& IW_ENCODE_INDEX
);
1389 PSKeyItem pKey
= NULL
;
1391 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCGIWENCODE\n");
1393 if (index
> WLAN_WEP_NKEYS
) {
1396 if(index
<1){//get default key
1397 if(pDevice
->byKeyIndex
<WLAN_WEP_NKEYS
){
1398 index
=pDevice
->byKeyIndex
;
1404 memset(abyKey
, 0, WLAN_WEP232_KEYLEN
);
1405 // Check encryption mode
1406 wrq
->flags
= IW_ENCODE_NOKEY
;
1407 // Is WEP enabled ???
1408 if (pDevice
->bEncryptionEnable
)
1409 wrq
->flags
|= IW_ENCODE_ENABLED
;
1411 wrq
->flags
|= IW_ENCODE_DISABLED
;
1413 if (pMgmt
->bShareKeyAlgorithm
)
1414 wrq
->flags
|= IW_ENCODE_RESTRICTED
;
1416 wrq
->flags
|= IW_ENCODE_OPEN
;
1419 if((index
==0)&&(pDevice
->eEncryptionStatus
== Ndis802_11Encryption2Enabled
||
1420 pDevice
->eEncryptionStatus
== Ndis802_11Encryption3Enabled
)){//get wpa pairwise key
1421 if (KeybGetKey(&(pDevice
->sKey
),pMgmt
->abyCurrBSSID
, 0xffffffff, &pKey
)){
1422 wrq
->length
= pKey
->uKeyLength
;
1423 memcpy(abyKey
, pKey
->abyKey
, pKey
->uKeyLength
);
1424 memcpy(extra
, abyKey
, WLAN_WEP232_KEYLEN
);
1426 }else if (KeybGetKey(&(pDevice
->sKey
), pDevice
->abyBroadcastAddr
, (BYTE
)index
, &pKey
)){
1427 wrq
->length
= pKey
->uKeyLength
;
1428 memcpy(abyKey
, pKey
->abyKey
, pKey
->uKeyLength
);
1429 memcpy(extra
, abyKey
, WLAN_WEP232_KEYLEN
);
1432 wrq
->flags
|= index
+1;
1439 * Wireless Handler : set power mode
1441 int iwctl_siwpower(struct net_device
*dev
,
1442 struct iw_request_info
*info
,
1443 struct iw_param
*wrq
,
1446 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1447 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
1450 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCSIWPOWER \n");
1452 if (!(pDevice
->flags
& DEVICE_FLAGS_OPENED
)) {
1457 if (wrq
->disabled
) {
1458 pDevice
->ePSMode
= WMAC_POWER_CAM
;
1459 PSvDisablePowerSaving(pDevice
);
1462 if ((wrq
->flags
& IW_POWER_TYPE
) == IW_POWER_TIMEOUT
) {
1463 pDevice
->ePSMode
= WMAC_POWER_FAST
;
1464 PSvEnablePowerSaving((void *) pDevice
, pMgmt
->wListenInterval
);
1466 } else if ((wrq
->flags
& IW_POWER_TYPE
) == IW_POWER_PERIOD
) {
1467 pDevice
->ePSMode
= WMAC_POWER_FAST
;
1468 PSvEnablePowerSaving((void *) pDevice
, pMgmt
->wListenInterval
);
1470 switch (wrq
->flags
& IW_POWER_MODE
) {
1471 case IW_POWER_UNICAST_R
:
1472 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCSIWPOWER: IW_POWER_UNICAST_R \n");
1475 case IW_POWER_ALL_R
:
1476 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCSIWPOWER: IW_POWER_ALL_R \n");
1479 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCSIWPOWER: IW_POWER_ON \n");
1489 * Wireless Handler : get power mode
1491 int iwctl_giwpower(struct net_device
*dev
,
1492 struct iw_request_info
*info
,
1493 struct iw_param
*wrq
,
1496 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1497 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
1498 int mode
= pDevice
->ePSMode
;
1501 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCGIWPOWER \n");
1504 if ((wrq
->disabled
= (mode
== WMAC_POWER_CAM
)))
1507 if ((wrq
->flags
& IW_POWER_TYPE
) == IW_POWER_TIMEOUT
) {
1508 wrq
->value
= (int)((pMgmt
->wListenInterval
* pMgmt
->wCurrBeaconPeriod
) << 10);
1509 wrq
->flags
= IW_POWER_TIMEOUT
;
1511 wrq
->value
= (int)((pMgmt
->wListenInterval
* pMgmt
->wCurrBeaconPeriod
) << 10);
1512 wrq
->flags
= IW_POWER_PERIOD
;
1514 wrq
->flags
|= IW_POWER_ALL_R
;
1521 * Wireless Handler : get Sensitivity
1523 int iwctl_giwsens(struct net_device
*dev
,
1524 struct iw_request_info
*info
,
1525 struct iw_param
*wrq
,
1528 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1531 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCGIWSENS \n");
1532 if (pDevice
->bLinkPass
== TRUE
) {
1533 RFvRSSITodBm(pDevice
, (BYTE
)(pDevice
->uCurrRSSI
), &ldBm
);
1539 wrq
->disabled
= (wrq
->value
== 0);
1546 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
1548 int iwctl_siwauth(struct net_device
*dev
,
1549 struct iw_request_info
*info
,
1550 struct iw_param
*wrq
,
1553 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1554 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
1556 static int wpa_version
=0; //must be static to save the last value,einsn liu
1557 static int pairwise
=0;
1559 DBG_PRT(MSG_LEVEL_DEBUG
, KERN_INFO
" SIOCSIWAUTH \n");
1560 switch (wrq
->flags
& IW_AUTH_INDEX
) {
1561 case IW_AUTH_WPA_VERSION
:
1562 wpa_version
= wrq
->value
;
1563 if(wrq
->value
== IW_AUTH_WPA_VERSION_DISABLED
) {
1564 PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n");
1565 //pDevice->bWPADEVUp = FALSE;
1567 else if(wrq
->value
== IW_AUTH_WPA_VERSION_WPA
) {
1568 PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n");
1571 PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n");
1573 //pDevice->bWPASuppWextEnabled =TRUE;
1575 case IW_AUTH_CIPHER_PAIRWISE
:
1576 pairwise
= wrq
->value
;
1577 PRINT_K("iwctl_siwauth:set pairwise=%d\n",pairwise
);
1578 if(pairwise
== IW_AUTH_CIPHER_CCMP
){
1579 pDevice
->eEncryptionStatus
= Ndis802_11Encryption3Enabled
;
1580 }else if(pairwise
== IW_AUTH_CIPHER_TKIP
){
1581 pDevice
->eEncryptionStatus
= Ndis802_11Encryption2Enabled
;
1582 } else if (pairwise
== IW_AUTH_CIPHER_WEP40
||
1583 pairwise
== IW_AUTH_CIPHER_WEP104
) {
1584 pDevice
->eEncryptionStatus
= Ndis802_11Encryption1Enabled
;
1585 }else if(pairwise
== IW_AUTH_CIPHER_NONE
){
1586 //do nothing,einsn liu
1587 }else pDevice
->eEncryptionStatus
= Ndis802_11EncryptionDisabled
;
1590 case IW_AUTH_CIPHER_GROUP
:
1591 PRINT_K("iwctl_siwauth:set GROUP=%d\n",wrq
->value
);
1592 if(wpa_version
== IW_AUTH_WPA_VERSION_DISABLED
)
1594 if(pairwise
== IW_AUTH_CIPHER_NONE
){
1595 if(wrq
->value
== IW_AUTH_CIPHER_CCMP
){
1596 pDevice
->eEncryptionStatus
= Ndis802_11Encryption3Enabled
;
1598 pDevice
->eEncryptionStatus
= Ndis802_11Encryption2Enabled
;
1602 case IW_AUTH_KEY_MGMT
:
1603 PRINT_K("iwctl_siwauth(wpa_version=%d):set KEY_MGMT=%d\n",wpa_version
,wrq
->value
);
1604 if(wpa_version
== IW_AUTH_WPA_VERSION_WPA2
){
1605 if(wrq
->value
== IW_AUTH_KEY_MGMT_PSK
)
1606 pMgmt
->eAuthenMode
= WMAC_AUTH_WPA2PSK
;
1607 else pMgmt
->eAuthenMode
= WMAC_AUTH_WPA2
;
1608 }else if(wpa_version
== IW_AUTH_WPA_VERSION_WPA
){
1609 if(wrq
->value
== 0){
1610 pMgmt
->eAuthenMode
= WMAC_AUTH_WPANONE
;
1611 }else if(wrq
->value
== IW_AUTH_KEY_MGMT_PSK
)
1612 pMgmt
->eAuthenMode
= WMAC_AUTH_WPAPSK
;
1613 else pMgmt
->eAuthenMode
= WMAC_AUTH_WPA
;
1617 case IW_AUTH_TKIP_COUNTERMEASURES
:
1619 case IW_AUTH_DROP_UNENCRYPTED
:
1621 case IW_AUTH_80211_AUTH_ALG
:
1622 PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n",wrq
->value
);
1623 if(wrq
->value
==IW_AUTH_ALG_OPEN_SYSTEM
){
1624 pMgmt
->bShareKeyAlgorithm
=FALSE
;
1625 }else if(wrq
->value
==IW_AUTH_ALG_SHARED_KEY
){
1626 pMgmt
->bShareKeyAlgorithm
=TRUE
;
1629 case IW_AUTH_WPA_ENABLED
:
1630 //pDevice->bWPADEVUp = !! wrq->value;
1631 //if(pDevice->bWPADEVUp==TRUE)
1632 // printk("iwctl_siwauth:set WPADEV to enable successful*******\n");
1634 // printk("iwctl_siwauth:set WPADEV to enable fail?????\n");
1636 case IW_AUTH_RX_UNENCRYPTED_EAPOL
:
1638 case IW_AUTH_ROAMING_CONTROL
:
1641 case IW_AUTH_PRIVACY_INVOKED
:
1642 pDevice
->bEncryptionEnable
= !!wrq
->value
;
1643 if(pDevice
->bEncryptionEnable
== FALSE
){
1646 pDevice
->eEncryptionStatus
= Ndis802_11EncryptionDisabled
;
1647 pMgmt
->bShareKeyAlgorithm
= FALSE
;
1648 pMgmt
->eAuthenMode
= WMAC_AUTH_OPEN
;
1649 //pDevice->bWPADEVUp = FALSE;
1650 PRINT_K("iwctl_siwauth:set WPADEV to disaable at 2?????\n");
1659 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_version = %d\n",wpa_version);
1660 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise = %d\n",pairwise);
1661 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->eEncryptionStatus = %d\n",pDevice->eEncryptionStatus);
1662 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->eAuthenMode = %d\n",pMgmt->eAuthenMode);
1663 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->bShareKeyAlgorithm = %s\n",pMgmt->bShareKeyAlgorithm?"TRUE":"FALSE");
1664 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->bEncryptionEnable = %s\n",pDevice->bEncryptionEnable?"TRUE":"FALSE");
1665 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->bWPADEVUp = %s\n",pDevice->bWPADEVUp?"TRUE":"FALSE");
1671 int iwctl_giwauth(struct net_device
*dev
,
1672 struct iw_request_info
*info
,
1673 struct iw_param
*wrq
,
1681 int iwctl_siwgenie(struct net_device
*dev
,
1682 struct iw_request_info
*info
,
1683 struct iw_point
*wrq
,
1686 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1687 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
1691 if ((wrq
->length
< 2) || (extra
[1]+2 != wrq
->length
)) {
1695 if(wrq
->length
> MAX_WPA_IE_LEN
){
1699 memset(pMgmt
->abyWPAIE
, 0, MAX_WPA_IE_LEN
);
1700 if(copy_from_user(pMgmt
->abyWPAIE
, extra
, wrq
->length
)){
1704 pMgmt
->wWPAIELen
= wrq
->length
;
1706 memset(pMgmt
->abyWPAIE
, 0, MAX_WPA_IE_LEN
);
1707 pMgmt
->wWPAIELen
= 0;
1710 out
://not completely ...not necessary in wpa_supplicant 0.5.8
1714 int iwctl_giwgenie(struct net_device
*dev
,
1715 struct iw_request_info
*info
,
1716 struct iw_point
*wrq
,
1719 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1720 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
1722 int space
= wrq
->length
;
1725 if(pMgmt
->wWPAIELen
> 0){
1726 wrq
->length
= pMgmt
->wWPAIELen
;
1727 if(pMgmt
->wWPAIELen
<= space
){
1728 if(copy_to_user(extra
, pMgmt
->abyWPAIE
, pMgmt
->wWPAIELen
)){
1739 int iwctl_siwencodeext(struct net_device
*dev
,
1740 struct iw_request_info
*info
,
1741 struct iw_point
*wrq
,
1744 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1745 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
1746 struct iw_encode_ext
*ext
= (struct iw_encode_ext
*)extra
;
1747 struct viawget_wpa_param
*param
=NULL
;
1751 int key_idx
, set_tx
=0;
1752 u8 seq
[IW_ENCODE_SEQ_MAX_SIZE
];
1754 size_t seq_len
=0,key_len
=0;
1762 PRINT_K("SIOCSIWENCODEEXT...... \n");
1764 blen
= sizeof(*param
);
1765 buf
= kmalloc((int)blen
, (int)GFP_KERNEL
);
1768 memset(buf
, 0, blen
);
1769 param
= (struct viawget_wpa_param
*) buf
;
1773 case IW_ENCODE_ALG_NONE
:
1774 alg_name
= WPA_ALG_NONE
;
1776 case IW_ENCODE_ALG_WEP
:
1777 alg_name
= WPA_ALG_WEP
;
1779 case IW_ENCODE_ALG_TKIP
:
1780 alg_name
= WPA_ALG_TKIP
;
1782 case IW_ENCODE_ALG_CCMP
:
1783 alg_name
= WPA_ALG_CCMP
;
1786 PRINT_K("Unknown alg = %d\n",ext
->alg
);
1791 memcpy(addr
, ext
->addr
.sa_data
, ETH_ALEN
);
1793 key_idx
= (wrq
->flags
&IW_ENCODE_INDEX
) - 1;
1795 if(ext
->ext_flags
& IW_ENCODE_EXT_SET_TX_KEY
)
1797 //recover seq,seq_len
1798 if(ext
->ext_flags
& IW_ENCODE_EXT_RX_SEQ_VALID
) {
1799 seq_len
=IW_ENCODE_SEQ_MAX_SIZE
;
1800 memcpy(seq
, ext
->rx_seq
, seq_len
);
1802 //recover key,key_len
1804 key_len
=ext
->key_len
;
1805 memcpy(key
, &ext
->key
[0], key_len
);
1808 memset(key_array
, 0, 64);
1810 memcpy(key_array
, key
, key_len
);
1811 if (key_len
== 32) {
1812 // notice ! the oder
1813 memcpy(&key_array
[16], &key
[24], 8);
1814 memcpy(&key_array
[24], &key
[16], 8);
1818 /**************Translate iw_encode_ext to viawget_wpa_param****************/
1819 memcpy(param
->addr
, addr
, ETH_ALEN
);
1820 param
->u
.wpa_key
.alg_name
= (int)alg_name
;
1821 param
->u
.wpa_key
.set_tx
= set_tx
;
1822 param
->u
.wpa_key
.key_index
= key_idx
;
1823 param
->u
.wpa_key
.key_len
= key_len
;
1824 param
->u
.wpa_key
.key
= (u8
*)key_array
;
1825 param
->u
.wpa_key
.seq
= (u8
*)seq
;
1826 param
->u
.wpa_key
.seq_len
= seq_len
;
1828 //****set if current action is Network Manager count??
1829 //****this method is so foolish,but there is no other way???
1830 if(param
->u
.wpa_key
.alg_name
== WPA_ALG_NONE
) {
1831 if(param
->u
.wpa_key
.key_index
==0) {
1832 pDevice
->bwextstep0
= TRUE
;
1834 if((pDevice
->bwextstep0
= TRUE
)&&(param
->u
.wpa_key
.key_index
==1)) {
1835 pDevice
->bwextstep0
= FALSE
;
1836 pDevice
->bwextstep1
= TRUE
;
1838 if((pDevice
->bwextstep1
= TRUE
)&&(param
->u
.wpa_key
.key_index
==2)) {
1839 pDevice
->bwextstep1
= FALSE
;
1840 pDevice
->bwextstep2
= TRUE
;
1842 if((pDevice
->bwextstep2
= TRUE
)&&(param
->u
.wpa_key
.key_index
==3)) {
1843 pDevice
->bwextstep2
= FALSE
;
1844 pDevice
->bwextstep3
= TRUE
;
1847 if(pDevice
->bwextstep3
== TRUE
) {
1848 PRINT_K("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n");
1849 pDevice
->bwextstep0
= FALSE
;
1850 pDevice
->bwextstep1
= FALSE
;
1851 pDevice
->bwextstep2
= FALSE
;
1852 pDevice
->bwextstep3
= FALSE
;
1853 pDevice
->bWPASuppWextEnabled
= TRUE
;
1854 memset(pMgmt
->abyDesireBSSID
, 0xFF,6);
1855 KeyvInitTable(pDevice
,&pDevice
->sKey
);
1859 spin_lock_irq(&pDevice
->lock
);
1860 ret
= wpa_set_keys(pDevice
, param
, TRUE
);
1861 spin_unlock_irq(&pDevice
->lock
);
1870 int iwctl_giwencodeext(struct net_device
*dev
,
1871 struct iw_request_info
*info
,
1872 struct iw_point
*wrq
,
1878 int iwctl_siwmlme(struct net_device
*dev
,
1879 struct iw_request_info
* info
,
1880 struct iw_point
*wrq
,
1883 PSDevice pDevice
= (PSDevice
)netdev_priv(dev
);
1884 PSMgmtObject pMgmt
= &(pDevice
->sMgmtObj
);
1885 struct iw_mlme
*mlme
= (struct iw_mlme
*)extra
;
1886 //u16 reason = cpu_to_le16(mlme->reason_code);
1889 if(memcmp(pMgmt
->abyCurrBSSID
, mlme
->addr
.sa_data
, ETH_ALEN
)){
1894 case IW_MLME_DEAUTH
:
1895 //this command seems to be not complete,please test it --einsnliu
1896 //printk("iwctl_siwmlme--->send DEAUTH\n");
1897 /* bScheduleCommand((void *) pDevice,
1901 case IW_MLME_DISASSOC
:
1902 if(pDevice
->bLinkPass
== TRUE
){
1903 PRINT_K("iwctl_siwmlme--->send DISASSOCIATE\n");
1904 bScheduleCommand((void *) pDevice
,
1905 WLAN_CMD_DISASSOCIATE
,
1919 /*------------------------------------------------------------------*/
1921 * Structures to export the Wireless Handlers
1926 static const iw_handler iwctl_handler[] =
1928 (iw_handler) iwctl_commit, // SIOCSIWCOMMIT
1929 (iw_handler) iwctl_giwname, // SIOCGIWNAME
1930 (iw_handler) NULL, // SIOCSIWNWID
1931 (iw_handler) iwctl_siwfreq, // SIOCSIWFREQ
1932 (iw_handler) iwctl_giwfreq, // SIOCGIWFREQ
1933 (iw_handler) iwctl_siwmode, // SIOCSIWMODE
1934 (iw_handler) iwctl_giwmode, // SIOCGIWMODE
1935 (iw_handler) NULL, // SIOCSIWSENS
1936 (iw_handler) iwctl_giwsens, // SIOCGIWSENS
1937 (iw_handler) NULL, // SIOCSIWRANGE
1938 (iw_handler) iwctl_giwrange, // SIOCGIWRANGE
1939 (iw_handler) NULL, // SIOCSIWPRIV
1940 (iw_handler) NULL, // SIOCGIWPRIV
1941 (iw_handler) NULL, // SIOCSIWSTATS
1942 (iw_handler) NULL, // SIOCGIWSTATS
1943 (iw_handler) NULL, // SIOCSIWSPY
1944 (iw_handler) NULL, // SIOCGIWSPY
1945 (iw_handler) NULL, // -- hole --
1946 (iw_handler) NULL, // -- hole --
1947 (iw_handler) iwctl_siwap, // SIOCSIWAP
1948 (iw_handler) iwctl_giwap, // SIOCGIWAP
1949 (iw_handler) NULL, // -- hole -- 0x16
1950 (iw_handler) iwctl_giwaplist, // SIOCGIWAPLIST
1951 (iw_handler) iwctl_siwscan, // SIOCSIWSCAN
1952 (iw_handler) iwctl_giwscan, // SIOCGIWSCAN
1953 (iw_handler) iwctl_siwessid, // SIOCSIWESSID
1954 (iw_handler) iwctl_giwessid, // SIOCGIWESSID
1955 (iw_handler) NULL, // SIOCSIWNICKN
1956 (iw_handler) NULL, // SIOCGIWNICKN
1957 (iw_handler) NULL, // -- hole --
1958 (iw_handler) NULL, // -- hole --
1959 (iw_handler) iwctl_siwrate, // SIOCSIWRATE 0x20
1960 (iw_handler) iwctl_giwrate, // SIOCGIWRATE
1961 (iw_handler) iwctl_siwrts, // SIOCSIWRTS
1962 (iw_handler) iwctl_giwrts, // SIOCGIWRTS
1963 (iw_handler) iwctl_siwfrag, // SIOCSIWFRAG
1964 (iw_handler) iwctl_giwfrag, // SIOCGIWFRAG
1965 (iw_handler) NULL, // SIOCSIWTXPOW
1966 (iw_handler) NULL, // SIOCGIWTXPOW
1967 (iw_handler) iwctl_siwretry, // SIOCSIWRETRY
1968 (iw_handler) iwctl_giwretry, // SIOCGIWRETRY
1969 (iw_handler) iwctl_siwencode, // SIOCSIWENCODE
1970 (iw_handler) iwctl_giwencode, // SIOCGIWENCODE
1971 (iw_handler) iwctl_siwpower, // SIOCSIWPOWER
1972 (iw_handler) iwctl_giwpower, // SIOCGIWPOWER
1973 (iw_handler) NULL, // -- hole --
1974 (iw_handler) NULL, // -- hole --
1975 (iw_handler) iwctl_siwgenie, // SIOCSIWGENIE
1976 (iw_handler) iwctl_giwgenie, // SIOCGIWGENIE
1977 (iw_handler) iwctl_siwauth, // SIOCSIWAUTH
1978 (iw_handler) iwctl_giwauth, // SIOCGIWAUTH
1979 (iw_handler) iwctl_siwencodeext, // SIOCSIWENCODEEXT
1980 (iw_handler) iwctl_giwencodeext, // SIOCGIWENCODEEXT
1981 (iw_handler) NULL, // SIOCSIWPMKSA
1982 (iw_handler) NULL, // -- hole --
1987 static const iw_handler iwctl_handler
[] =
1989 (iw_handler
) iwctl_commit
, // SIOCSIWCOMMIT
1990 (iw_handler
) NULL
, // SIOCGIWNAME
1991 (iw_handler
) NULL
, // SIOCSIWNWID
1992 (iw_handler
) NULL
, // SIOCGIWNWID
1993 (iw_handler
) NULL
, // SIOCSIWFREQ
1994 (iw_handler
) NULL
, // SIOCGIWFREQ
1995 (iw_handler
) NULL
, // SIOCSIWMODE
1996 (iw_handler
) NULL
, // SIOCGIWMODE
1997 (iw_handler
) NULL
, // SIOCSIWSENS
1998 (iw_handler
) NULL
, // SIOCGIWSENS
1999 (iw_handler
) NULL
, // SIOCSIWRANGE
2000 (iw_handler
) iwctl_giwrange
, // SIOCGIWRANGE
2001 (iw_handler
) NULL
, // SIOCSIWPRIV
2002 (iw_handler
) NULL
, // SIOCGIWPRIV
2003 (iw_handler
) NULL
, // SIOCSIWSTATS
2004 (iw_handler
) NULL
, // SIOCGIWSTATS
2005 (iw_handler
) NULL
, // SIOCSIWSPY
2006 (iw_handler
) NULL
, // SIOCGIWSPY
2007 (iw_handler
) NULL
, // -- hole --
2008 (iw_handler
) NULL
, // -- hole --
2009 (iw_handler
) NULL
, // SIOCSIWAP
2010 (iw_handler
) NULL
, // SIOCGIWAP
2011 (iw_handler
) NULL
, // -- hole -- 0x16
2012 (iw_handler
) NULL
, // SIOCGIWAPLIST
2013 (iw_handler
) iwctl_siwscan
, // SIOCSIWSCAN
2014 (iw_handler
) iwctl_giwscan
, // SIOCGIWSCAN
2015 (iw_handler
) NULL
, // SIOCSIWESSID
2016 (iw_handler
) NULL
, // SIOCGIWESSID
2017 (iw_handler
) NULL
, // SIOCSIWNICKN
2018 (iw_handler
) NULL
, // SIOCGIWNICKN
2019 (iw_handler
) NULL
, // -- hole --
2020 (iw_handler
) NULL
, // -- hole --
2021 (iw_handler
) NULL
, // SIOCSIWRATE 0x20
2022 (iw_handler
) NULL
, // SIOCGIWRATE
2023 (iw_handler
) NULL
, // SIOCSIWRTS
2024 (iw_handler
) NULL
, // SIOCGIWRTS
2025 (iw_handler
) NULL
, // SIOCSIWFRAG
2026 (iw_handler
) NULL
, // SIOCGIWFRAG
2027 (iw_handler
) NULL
, // SIOCSIWTXPOW
2028 (iw_handler
) NULL
, // SIOCGIWTXPOW
2029 (iw_handler
) NULL
, // SIOCSIWRETRY
2030 (iw_handler
) NULL
, // SIOCGIWRETRY
2031 (iw_handler
) NULL
, // SIOCSIWENCODE
2032 (iw_handler
) NULL
, // SIOCGIWENCODE
2033 (iw_handler
) NULL
, // SIOCSIWPOWER
2034 (iw_handler
) NULL
, // SIOCGIWPOWER
2035 (iw_handler
) NULL
, // -- hole --
2036 (iw_handler
) NULL
, // -- hole --
2037 (iw_handler
) NULL
, // SIOCSIWGENIE
2038 (iw_handler
) NULL
, // SIOCGIWGENIE
2039 (iw_handler
) NULL
, // SIOCSIWAUTH
2040 (iw_handler
) NULL
, // SIOCGIWAUTH
2041 (iw_handler
) NULL
, // SIOCSIWENCODEEXT
2042 (iw_handler
) NULL
, // SIOCGIWENCODEEXT
2043 (iw_handler
) NULL
, // SIOCSIWPMKSA
2044 (iw_handler
) NULL
, // -- hole --
2048 static const iw_handler iwctl_private_handler
[] =
2050 NULL
, // SIOCIWFIRSTPRIV
2054 struct iw_priv_args iwctl_private_args
[] = {
2056 IW_PRIV_TYPE_CHAR
| 1024, 0,
2062 const struct iw_handler_def iwctl_handler_def
=
2064 .get_wireless_stats
= &iwctl_get_wireless_stats
,
2065 .num_standard
= sizeof(iwctl_handler
)/sizeof(iw_handler
),
2066 // .num_private = sizeof(iwctl_private_handler)/sizeof(iw_handler),
2067 // .num_private_args = sizeof(iwctl_private_args)/sizeof(struct iw_priv_args),
2069 .num_private_args
= 0,
2070 .standard
= (iw_handler
*) iwctl_handler
,
2071 // .private = (iw_handler *) iwctl_private_handler,
2072 // .private_args = (struct iw_priv_args *)iwctl_private_args,
2074 .private_args
= NULL
,