1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33#include "device.h"
34#include "ioctl.h"
35#include "iocmd.h"
36#include "mac.h"
37#include "card.h"
38#include "hostap.h"
39#include "power.h"
40#include "rf.h"
41
42#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
43#include "iowpa.h"
44#include "wpactl.h"
45#endif
46
47#include <net/iw_handler.h>
48extern WORD TxRate_iwconfig;
49
50
51
52
53#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
54#define SUPPORTED_WIRELESS_EXT 18
55#else
56#define SUPPORTED_WIRELESS_EXT 17
57#endif
58
59static const long frequency_list[] = {
60 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484,
61 4915, 4920, 4925, 4935, 4940, 4945, 4960, 4980,
62 5035, 5040, 5045, 5055, 5060, 5080, 5170, 5180, 5190, 5200, 5210, 5220, 5230, 5240,
63 5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680,
64 5700, 5745, 5765, 5785, 5805, 5825
65 };
66
67
68
69
70
71
72static int msglevel =MSG_LEVEL_INFO;
73
74
75
76
77
78
79
80struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev)
81{
82 PSDevice pDevice = netdev_priv(dev);
83 long ldBm;
84
85 pDevice->wstats.status = pDevice->eOPMode;
86 #ifdef Calcu_LinkQual
87 #if 0
88 if(pDevice->byBBType == BB_TYPE_11B) {
89 if(pDevice->byCurrSQ > 120)
90 pDevice->scStatistic.LinkQuality = 100;
91 else
92 pDevice->scStatistic.LinkQuality = pDevice->byCurrSQ*100/120;
93 }
94 else if(pDevice->byBBType == BB_TYPE_11G) {
95 if(pDevice->byCurrSQ < 20)
96 pDevice->scStatistic.LinkQuality = 100;
97 else if(pDevice->byCurrSQ >96)
98 pDevice->scStatistic.LinkQuality = 0;
99 else
100 pDevice->scStatistic.LinkQuality = (96-pDevice->byCurrSQ)*100/76;
101 }
102 if(pDevice->bLinkPass !=TRUE)
103 pDevice->scStatistic.LinkQuality = 0;
104 #endif
105 if(pDevice->scStatistic.LinkQuality > 100)
106 pDevice->scStatistic.LinkQuality = 100;
107 pDevice->wstats.qual.qual =(BYTE) pDevice->scStatistic.LinkQuality;
108 #else
109 pDevice->wstats.qual.qual = pDevice->byCurrSQ;
110 #endif
111 RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm);
112 pDevice->wstats.qual.level = ldBm;
113
114 pDevice->wstats.qual.noise = 0;
115 pDevice->wstats.qual.updated = 1;
116 pDevice->wstats.discard.nwid = 0;
117 pDevice->wstats.discard.code = 0;
118 pDevice->wstats.discard.fragment = 0;
119 pDevice->wstats.discard.retries = (U32)pDevice->scStatistic.dwTsrErr;
120 pDevice->wstats.discard.misc = 0;
121 pDevice->wstats.miss.beacon = 0;
122
123 return &pDevice->wstats;
124}
125
126
127
128
129
130
131static int iwctl_commit(struct net_device *dev,
132 struct iw_request_info *info,
133 void *wrq,
134 char *extra)
135{
136 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWCOMMIT \n");
137
138 return 0;
139
140}
141
142
143
144
145int iwctl_giwname(struct net_device *dev,
146 struct iw_request_info *info,
147 char *wrq,
148 char *extra)
149{
150 strcpy(wrq, "802.11-a/b/g");
151 return 0;
152}
153
154int iwctl_giwnwid(struct net_device *dev,
155 struct iw_request_info *info,
156 struct iw_param *wrq,
157 char *extra)
158{
159
160
161
162
163 return -EOPNOTSUPP;
164}
165
166
167
168
169
170int iwctl_siwscan(struct net_device *dev,
171 struct iw_request_info *info,
172 struct iw_point *wrq,
173 char *extra)
174{
175 PSDevice pDevice = (PSDevice)netdev_priv(dev);
176 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
177 struct iw_scan_req *req = (struct iw_scan_req *)extra;
178 BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
179 PWLAN_IE_SSID pItemSSID=NULL;
180 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWSCAN \n");
181
182
183if(pDevice->byReAssocCount > 0) {
184
185 union iwreq_data wrqu;
186 PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n");
187 memset(&wrqu, 0, sizeof(wrqu));
188 wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL);
189 return 0;
190}
191
192 spin_lock_irq(&pDevice->lock);
193 BSSvClearBSSList((HANDLE)pDevice, pDevice->bLinkPass);
194
195
196 if(wrq->length == sizeof(struct iw_scan_req)) {
197 if (wrq->flags & IW_SCAN_THIS_ESSID) {
198 memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
199 pItemSSID = (PWLAN_IE_SSID)abyScanSSID;
200 pItemSSID->byElementID = WLAN_EID_SSID;
201 memcpy(pItemSSID->abySSID, req->essid, (int)req->essid_len);
202 if (pItemSSID->abySSID[req->essid_len - 1] == '\0') {
203 if(req->essid_len>0)
204 pItemSSID->len = req->essid_len - 1;
205 }
206 else
207 pItemSSID->len = req->essid_len;
208 pMgmt->eScanType = WMAC_SCAN_PASSIVE;
209 PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n",((PWLAN_IE_SSID)abyScanSSID)->abySSID,
210 ((PWLAN_IE_SSID)abyScanSSID)->len);
211 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID);
212 spin_unlock_irq(&pDevice->lock);
213
214 return 0;
215 }
216 else if(req->scan_type == IW_SCAN_TYPE_PASSIVE) {
217 pMgmt->eScanType = WMAC_SCAN_PASSIVE;
218 }
219 }
220 else {
221 pMgmt->eScanType = WMAC_SCAN_ACTIVE;
222 }
223
224 pMgmt->eScanType = WMAC_SCAN_PASSIVE;
225
226 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, NULL);
227 spin_unlock_irq(&pDevice->lock);
228
229 return 0;
230}
231
232
233
234
235
236
237int iwctl_giwscan(struct net_device *dev,
238 struct iw_request_info *info,
239 struct iw_point *wrq,
240 char *extra)
241{
242 int ii, jj, kk;
243 PSDevice pDevice = (PSDevice)netdev_priv(dev);
244 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
245 PKnownBSS pBSS;
246 PWLAN_IE_SSID pItemSSID;
247 PWLAN_IE_SUPP_RATES pSuppRates, pExtSuppRates;
248 char *current_ev = extra;
249 char *end_buf = extra + IW_SCAN_MAX_DATA;
250 char *current_val = NULL;
251 struct iw_event iwe;
252 long ldBm;
253 char buf[MAX_WPA_IE_LEN * 2 + 30];
254
255
256 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN \n");
257
258 if (pMgmt->eScanState == WMAC_IS_SCANNING) {
259
260 return -EAGAIN;
261 }
262 pBSS = &(pMgmt->sBSSList[0]);
263 for (ii = 0, jj = 0; jj < MAX_BSS_NUM ; jj++) {
264 if (current_ev >= end_buf)
265 break;
266 pBSS = &(pMgmt->sBSSList[jj]);
267 if (pBSS->bActive) {
268
269 memset(&iwe, 0, sizeof(iwe));
270 iwe.cmd = SIOCGIWAP;
271 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
272 memcpy(iwe.u.ap_addr.sa_data, pBSS->abyBSSID, WLAN_BSSID_LEN);
273 current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_ADDR_LEN);
274
275 memset(&iwe, 0, sizeof(iwe));
276 iwe.cmd = SIOCGIWESSID;
277 pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID;
278 iwe.u.data.length = pItemSSID->len;
279 iwe.u.data.flags = 1;
280 current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID);
281
282 memset(&iwe, 0, sizeof(iwe));
283 iwe.cmd = SIOCGIWMODE;
284 if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) {
285 iwe.u.mode = IW_MODE_INFRA;
286 }
287 else {
288 iwe.u.mode = IW_MODE_ADHOC;
289 }
290 iwe.len = IW_EV_UINT_LEN;
291 current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
292
293 pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates;
294 pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates;
295 memset(&iwe, 0, sizeof(iwe));
296 iwe.cmd = SIOCGIWFREQ;
297 iwe.u.freq.m = pBSS->uChannel;
298 iwe.u.freq.e = 0;
299 iwe.u.freq.i = 0;
300 current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN);
301
302 {
303 int f = (int)pBSS->uChannel - 1;
304 if(f < 0)f = 0;
305 iwe.u.freq.m = frequency_list[f] * 100000;
306 iwe.u.freq.e = 1;
307 }
308 current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN);
309
310 memset(&iwe, 0, sizeof(iwe));
311 iwe.cmd = IWEVQUAL;
312 RFvRSSITodBm(pDevice, (BYTE)(pBSS->uRSSI), &ldBm);
313 iwe.u.qual.level = ldBm;
314 iwe.u.qual.noise = 0;
315
316 if(-ldBm<50){
317 iwe.u.qual.qual = 100;
318 }else if(-ldBm > 90) {
319 iwe.u.qual.qual = 0;
320 }else {
321 iwe.u.qual.qual=(40-(-ldBm-50))*100/40;
322 }
323 iwe.u.qual.updated=7;
324
325
326 current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
327
328 memset(&iwe, 0, sizeof(iwe));
329 iwe.cmd = SIOCGIWENCODE;
330 iwe.u.data.length = 0;
331 if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) {
332 iwe.u.data.flags =IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
333 }else {
334 iwe.u.data.flags = IW_ENCODE_DISABLED;
335 }
336 current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID);
337
338 memset(&iwe, 0, sizeof(iwe));
339 iwe.cmd = SIOCGIWRATE;
340 iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
341 current_val = current_ev + IW_EV_LCP_LEN;
342
343 for (kk = 0 ; kk < 12 ; kk++) {
344 if (pSuppRates->abyRates[kk] == 0)
345 break;
346
347 iwe.u.bitrate.value = ((pSuppRates->abyRates[kk] & 0x7f) * 500000);
348 current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
349 }
350 for (kk = 0 ; kk < 8 ; kk++) {
351 if (pExtSuppRates->abyRates[kk] == 0)
352 break;
353
354 iwe.u.bitrate.value = ((pExtSuppRates->abyRates[kk] & 0x7f) * 500000);
355 current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
356 }
357
358 if((current_val - current_ev) > IW_EV_LCP_LEN)
359 current_ev = current_val;
360
361 memset(&iwe, 0, sizeof(iwe));
362 iwe.cmd = IWEVCUSTOM;
363 sprintf(buf, "bcn_int=%d", pBSS->wBeaconInterval);
364 iwe.u.data.length = strlen(buf);
365 current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, buf);
366
367 if ((pBSS->wWPALen > 0) && (pBSS->wWPALen <= MAX_WPA_IE_LEN)) {
368 memset(&iwe, 0, sizeof(iwe));
369 iwe.cmd = IWEVGENIE;
370 iwe.u.data.length = pBSS->wWPALen;
371 current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byWPAIE);
372 }
373
374 if ((pBSS->wRSNLen > 0) && (pBSS->wRSNLen <= MAX_WPA_IE_LEN)) {
375 memset(&iwe, 0, sizeof(iwe));
376 iwe.cmd = IWEVGENIE;
377 iwe.u.data.length = pBSS->wRSNLen;
378 current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byRSNIE);
379 }
380
381 }
382 }
383
384 wrq->length = current_ev - extra;
385 return 0;
386
387}
388
389
390
391
392
393
394int iwctl_siwfreq(struct net_device *dev,
395 struct iw_request_info *info,
396 struct iw_freq *wrq,
397 char *extra)
398{
399 PSDevice pDevice = (PSDevice)netdev_priv(dev);
400 int rc = 0;
401
402 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n");
403
404
405 if((wrq->e == 1) &&
406 (wrq->m >= (int) 2.412e8) &&
407 (wrq->m <= (int) 2.487e8)) {
408 int f = wrq->m / 100000;
409 int c = 0;
410 while((c < 14) && (f != frequency_list[c]))
411 c++;
412 wrq->e = 0;
413 wrq->m = c + 1;
414 }
415
416 if((wrq->m > 14) || (wrq->e > 0))
417 rc = -EOPNOTSUPP;
418 else {
419 int channel = wrq->m;
420 if((channel < 1) || (channel > 14)) {
421 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m);
422 rc = -EINVAL;
423 } else {
424
425 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set to channel = %d\n", channel);
426 pDevice->uChannel = channel;
427
428
429 pDevice->bCommit = TRUE;
430 }
431 }
432
433 return rc;
434}
435
436
437
438
439
440int iwctl_giwfreq(struct net_device *dev,
441 struct iw_request_info *info,
442 struct iw_freq *wrq,
443 char *extra)
444{
445 PSDevice pDevice = (PSDevice)netdev_priv(dev);
446 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
447
448 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n");
449
450#ifdef WEXT_USECHANNELS
451 wrq->m = (int)pMgmt->uCurrChannel;
452 wrq->e = 0;
453#else
454 {
455 int f = (int)pMgmt->uCurrChannel - 1;
456 if(f < 0)
457 f = 0;
458 wrq->m = frequency_list[f] * 100000;
459 wrq->e = 1;
460 }
461#endif
462
463 return 0;
464}
465
466
467
468
469
470int iwctl_siwmode(struct net_device *dev,
471 struct iw_request_info *info,
472 __u32 *wmode,
473 char *extra)
474{
475 PSDevice pDevice = (PSDevice)netdev_priv(dev);
476 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
477 int rc = 0;
478
479 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE \n");
480
481 if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && pDevice->bEnableHostapd) {
482 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Can't set operation mode, hostapd is running \n");
483 return rc;
484 }
485
486 switch(*wmode) {
487
488 case IW_MODE_ADHOC:
489 if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) {
490 pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
491 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
492 pDevice->bCommit = TRUE;
493 }
494 }
495 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n");
496 break;
497 case IW_MODE_AUTO:
498 case IW_MODE_INFRA:
499 if (pMgmt->eConfigMode != WMAC_CONFIG_ESS_STA) {
500 pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
501 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
502 pDevice->bCommit = TRUE;
503 }
504 }
505 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n");
506 break;
507 case IW_MODE_MASTER:
508
509 pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
510 rc = -EOPNOTSUPP;
511 break;
512
513 if (pMgmt->eConfigMode != WMAC_CONFIG_AP) {
514 pMgmt->eConfigMode = WMAC_CONFIG_AP;
515 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
516 pDevice->bCommit = TRUE;
517 }
518 }
519 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n");
520 break;
521
522 case IW_MODE_REPEAT:
523 pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
524 rc = -EOPNOTSUPP;
525 break;
526 default:
527 rc = -EINVAL;
528 }
529
530 return rc;
531}
532
533
534
535
536
537int iwctl_giwmode(struct net_device *dev,
538 struct iw_request_info *info,
539 __u32 *wmode,
540 char *extra)
541{
542 PSDevice pDevice = (PSDevice)netdev_priv(dev);
543 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
544
545
546 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n");
547
548 switch (pMgmt->eConfigMode) {
549 case WMAC_CONFIG_ESS_STA:
550 *wmode = IW_MODE_INFRA;
551 break;
552 case WMAC_CONFIG_IBSS_STA:
553 *wmode = IW_MODE_ADHOC;
554 break;
555 case WMAC_CONFIG_AUTO:
556 *wmode = IW_MODE_INFRA;
557 break;
558 case WMAC_CONFIG_AP:
559 *wmode = IW_MODE_MASTER;
560 break;
561 default:
562 *wmode = IW_MODE_ADHOC;
563 }
564
565 return 0;
566}
567
568
569
570
571
572
573int iwctl_giwrange(struct net_device *dev,
574 struct iw_request_info *info,
575 struct iw_point *wrq,
576 char *extra)
577{
578 struct iw_range *range = (struct iw_range *) extra;
579 int i,k;
580 BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
581
582
583 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE \n");
584 if (wrq->pointer) {
585 wrq->length = sizeof(struct iw_range);
586 memset(range, 0, sizeof(struct iw_range));
587 range->min_nwid = 0x0000;
588 range->max_nwid = 0x0000;
589 range->num_channels = 14;
590
591
592 k = 0;
593 for(i = 0; i < 14; i++) {
594 range->freq[k].i = i + 1;
595 range->freq[k].m = frequency_list[i] * 100000;
596 range->freq[k++].e = 1;
597 }
598 range->num_frequency = k;
599
600 #ifdef Calcu_LinkQual
601 range->max_qual.qual = 100;
602 #else
603 range->max_qual.qual = 255;
604 #endif
605 range->max_qual.level = 0;
606 range->max_qual.noise = 0;
607 range->sensitivity = 255;
608
609 for(i = 0 ; i < 13 ; i++) {
610 range->bitrate[i] = abySupportedRates[i] * 500000;
611 if(range->bitrate[i] == 0)
612 break;
613 }
614 range->num_bitrates = i;
615
616
617
618
619 if(i > 2)
620 range->throughput = 5 * 1000 * 1000;
621 else
622 range->throughput = 1.5 * 1000 * 1000;
623
624 range->min_rts = 0;
625 range->max_rts = 2312;
626 range->min_frag = 256;
627 range->max_frag = 2312;
628
629
630
631 range->num_encoding_sizes = 3;
632
633 range->encoding_size[0] = 5;
634
635 range->encoding_size[1] = 13;
636
637 range->encoding_size[2] = 32;
638
639 range->max_encoding_tokens = 4;
640
641 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
642 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
643
644 range->min_pmp = 0;
645 range->max_pmp = 1000000;
646 range->min_pmt = 0;
647 range->max_pmt = 1000000;
648 range->pmp_flags = IW_POWER_PERIOD;
649 range->pmt_flags = IW_POWER_TIMEOUT;
650 range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R;
651
652
653
654 range->txpower[0] = 100;
655 range->num_txpower = 1;
656 range->txpower_capa = IW_TXPOW_MWATT;
657 range->we_version_source = SUPPORTED_WIRELESS_EXT;
658 range->we_version_compiled = WIRELESS_EXT;
659 range->retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME;
660 range->retry_flags = IW_RETRY_LIMIT;
661 range->r_time_flags = IW_RETRY_LIFETIME;
662 range->min_retry = 1;
663 range->max_retry = 65535;
664 range->min_r_time = 1024;
665 range->max_r_time = 65535 * 1024;
666
667
668
669 range->avg_qual.qual = 6;
670 range->avg_qual.level = 176;
671 range->avg_qual.noise = 0;
672 }
673
674
675 return 0;
676}
677
678
679
680
681
682
683int iwctl_siwap(struct net_device *dev,
684 struct iw_request_info *info,
685 struct sockaddr *wrq,
686 char *extra)
687{
688 PSDevice pDevice = (PSDevice)netdev_priv(dev);
689 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
690 int rc = 0;
691 BYTE ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00};
692
693 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAP \n");
694if (pMgmt->eScanState == WMAC_IS_SCANNING) {
695
696 printk("SIOCSIWAP(??)-->In scanning...\n");
697
698 }
699 if (wrq->sa_family != ARPHRD_ETHER)
700 rc = -EINVAL;
701 else {
702 memset(pMgmt->abyDesireBSSID, 0xFF, 6);
703 memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6);
704
705 if((pDevice->bLinkPass == TRUE) &&
706 (memcmp(pMgmt->abyDesireBSSID, pMgmt->abyCurrBSSID, 6)== 0)){
707 return rc;
708 }
709
710 if ((IS_BROADCAST_ADDRESS(pMgmt->abyDesireBSSID)) ||
711 (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)){
712 PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n");
713 return rc;
714 }
715
716
717 {
718 UINT ii , uSameBssidNum=0;
719 for (ii = 0; ii < MAX_BSS_NUM; ii++) {
720 if (pMgmt->sBSSList[ii].bActive &&
721 IS_ETH_ADDRESS_EQUAL(pMgmt->sBSSList[ii].abyBSSID,pMgmt->abyDesireBSSID)) {
722 uSameBssidNum++;
723 }
724 }
725 if(uSameBssidNum >= 2) {
726 PRINT_K("SIOCSIWAP:ignore for desired AP in hidden mode\n");
727 return rc;
728 }
729 }
730
731 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
732 pDevice->bCommit = TRUE;
733 }
734 }
735 return rc;
736}
737
738
739
740
741
742int iwctl_giwap(struct net_device *dev,
743 struct iw_request_info *info,
744 struct sockaddr *wrq,
745 char *extra)
746{
747 PSDevice pDevice = (PSDevice)netdev_priv(dev);
748 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
749
750
751 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n");
752
753 memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
754
755 if ((pDevice->bLinkPass == FALSE) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP))
756 memset(wrq->sa_data, 0, 6);
757
758 if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
759 memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
760 }
761
762 wrq->sa_family = ARPHRD_ETHER;
763
764 return 0;
765
766}
767
768
769
770
771
772
773int iwctl_giwaplist(struct net_device *dev,
774 struct iw_request_info *info,
775 struct iw_point *wrq,
776 char *extra)
777{
778 int ii,jj, rc = 0;
779 struct sockaddr sock[IW_MAX_AP];
780 struct iw_quality qual[IW_MAX_AP];
781 PSDevice pDevice = (PSDevice)netdev_priv(dev);
782 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
783
784
785 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST \n");
786
787
788 if (!capable(CAP_NET_ADMIN)) {
789 rc = -EPERM;
790 return rc;
791 }
792
793 if (wrq->pointer) {
794
795 PKnownBSS pBSS = &(pMgmt->sBSSList[0]);
796
797 for (ii = 0, jj= 0; ii < MAX_BSS_NUM; ii++) {
798 pBSS = &(pMgmt->sBSSList[ii]);
799 if (!pBSS->bActive)
800 continue;
801 if ( jj >= IW_MAX_AP)
802 break;
803 memcpy(sock[jj].sa_data, pBSS->abyBSSID, 6);
804 sock[jj].sa_family = ARPHRD_ETHER;
805 qual[jj].level = pBSS->uRSSI;
806 qual[jj].qual = qual[jj].noise = 0;
807 qual[jj].updated = 2;
808 jj++;
809 }
810
811 wrq->flags = 1;
812 wrq->length = jj;
813 memcpy(extra, sock, sizeof(struct sockaddr)*jj);
814 memcpy(extra + sizeof(struct sockaddr)*jj, qual, sizeof(struct iw_quality)*jj);
815 }
816
817 return rc;
818}
819
820
821
822
823
824
825int iwctl_siwessid(struct net_device *dev,
826 struct iw_request_info *info,
827 struct iw_point *wrq,
828 char *extra)
829{
830 PSDevice pDevice = (PSDevice)netdev_priv(dev);
831 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
832 PWLAN_IE_SSID pItemSSID;
833
834 BYTE len;
835
836
837 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID \n");
838 pDevice->fWPA_Authened = FALSE;
839if (pMgmt->eScanState == WMAC_IS_SCANNING) {
840
841 printk("SIOCSIWESSID(??)-->In scanning...\n");
842
843 }
844
845 if(wrq->flags == 0) {
846
847 memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
848 memset(pMgmt->abyDesireBSSID, 0xFF,6);
849 PRINT_K("set essid to 'any' \n");
850 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
851
852
853 return 0;
854
855 #endif
856 } else {
857
858 memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
859 pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
860 pItemSSID->byElementID = WLAN_EID_SSID;
861
862 memcpy(pItemSSID->abySSID, extra, wrq->length);
863 if (pItemSSID->abySSID[wrq->length - 1] == '\0') {
864 if(wrq->length>0)
865 pItemSSID->len = wrq->length - 1;
866 }
867 else
868 pItemSSID->len = wrq->length;
869 printk("set essid to %s \n",pItemSSID->abySSID);
870
871 len=(pItemSSID->len > ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len)?pItemSSID->len:((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len;
872 if((pDevice->bLinkPass == TRUE) &&
873 (memcmp(pItemSSID->abySSID,((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID,len)==0))
874 return 0;
875
876
877 if(pItemSSID->len==0) {
878 memset(pMgmt->abyDesireBSSID, 0xFF,6);
879 return 0;
880 }
881
882#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
883
884
885 if(pDevice->bWPASuppWextEnabled == TRUE) {
886
887 {
888 PKnownBSS pCurr = NULL;
889 BYTE abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
890 UINT ii , uSameBssidNum=0;
891
892 memset(abyTmpDesireSSID,0,sizeof(abyTmpDesireSSID));
893 memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID));
894 pCurr = BSSpSearchBSSList(pDevice,
895 NULL,
896 abyTmpDesireSSID,
897 pMgmt->eConfigPHYMode
898 );
899
900 if (pCurr == NULL){
901 PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n");
902 vResetCommandTimer((HANDLE) pDevice);
903 pMgmt->eScanType = WMAC_SCAN_ACTIVE;
904 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
905 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID);
906 }
907 else {
908
909 for (ii = 0; ii < MAX_BSS_NUM; ii++) {
910 if (pMgmt->sBSSList[ii].bActive &&
911 IS_ETH_ADDRESS_EQUAL(pMgmt->sBSSList[ii].abyBSSID, pCurr->abyBSSID)) {
912 uSameBssidNum++;
913 }
914 }
915 if(uSameBssidNum >= 2) {
916 printk("SIOCSIWESSID:hidden ssid directly associate.......\n");
917 vResetCommandTimer((HANDLE) pDevice);
918 pMgmt->eScanType = WMAC_SCAN_PASSIVE;
919 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
920 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID);
921 }
922 }
923 }
924 return 0;
925 }
926 #endif
927
928 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID);
929 }
930
931 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
932 pDevice->bCommit = TRUE;
933 }
934
935
936 return 0;
937}
938
939
940
941
942
943
944int iwctl_giwessid(struct net_device *dev,
945 struct iw_request_info *info,
946 struct iw_point *wrq,
947 char *extra)
948{
949
950 PSDevice pDevice = (PSDevice)netdev_priv(dev);
951 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
952 PWLAN_IE_SSID pItemSSID;
953
954 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID \n");
955
956
957
958
959
960 pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
961
962 memcpy(extra, pItemSSID->abySSID , pItemSSID->len);
963 extra[pItemSSID->len] = '\0';
964 wrq->length = pItemSSID->len + 1;
965
966 wrq->length = pItemSSID->len;
967 wrq->flags = 1;
968
969
970 return 0;
971}
972
973
974
975
976
977int iwctl_siwrate(struct net_device *dev,
978 struct iw_request_info *info,
979 struct iw_param *wrq,
980 char *extra)
981{
982 PSDevice pDevice = (PSDevice)netdev_priv(dev);
983 int rc = 0;
984 u8 brate = 0;
985 int i;
986 BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
987
988
989 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n");
990 if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
991 rc = -EINVAL;
992 return rc;
993 }
994
995
996
997
998 if((wrq->value < 13) &&
999 (wrq->value >= 0)) {
1000
1001
1002 brate = wrq->value;
1003 } else {
1004
1005 u8 normvalue = (u8) (wrq->value/500000);
1006
1007
1008 for(i = 0 ; i < 13 ; i++) {
1009 if(normvalue == abySupportedRates[i]) {
1010 brate = i;
1011 break;
1012 }
1013 }
1014 }
1015
1016 if(wrq->value == -1) {
1017
1018 for(i = 0 ; i < 13 ; i++) {
1019 if(abySupportedRates[i] == 0)
1020 break;
1021 }
1022 if(i != 0)
1023 brate = i - 1;
1024
1025 }
1026
1027
1028 if(brate > 13 ) {
1029 rc = -EINVAL;
1030 return rc;
1031 }
1032
1033
1034 if(wrq->fixed != 0) {
1035
1036
1037 printk("Rate Fix\n");
1038 pDevice->bFixRate = TRUE;
1039 if ((pDevice->byBBType == BB_TYPE_11B)&& (brate > 3)) {
1040 pDevice->uConnectionRate = 3;
1041 }
1042 else {
1043 pDevice->uConnectionRate = brate;
1044 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate);
1045 }
1046
1047 }
1048 else {
1049 pDevice->bFixRate = FALSE;
1050 pDevice->uConnectionRate = 13;
1051 printk("auto rate:connection_rate is 13\n");
1052 }
1053
1054 return rc;
1055}
1056
1057
1058
1059
1060
1061int iwctl_giwrate(struct net_device *dev,
1062 struct iw_request_info *info,
1063 struct iw_param *wrq,
1064 char *extra)
1065{
1066 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1067
1068
1069
1070
1071 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n");
1072 {
1073 BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
1074 int brate = 0;
1075
1076if(pDevice->bLinkPass){
1077if(pDevice->bFixRate == TRUE){
1078 if (pDevice->uConnectionRate < 13) {
1079 brate = abySupportedRates[pDevice->uConnectionRate];
1080 }else {
1081 if (pDevice->byBBType == BB_TYPE_11B)
1082 brate = 0x16;
1083 if (pDevice->byBBType == BB_TYPE_11G)
1084 brate = 0x6C;
1085 if (pDevice->byBBType == BB_TYPE_11A)
1086 brate = 0x6C;
1087 }
1088}
1089else
1090{
1091
1092 brate = abySupportedRates[TxRate_iwconfig];
1093}
1094}
1095else brate =0;
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111 wrq->value = brate * 500000;
1112
1113 if (pDevice->bFixRate == TRUE)
1114 wrq->fixed = TRUE;
1115 }
1116
1117
1118 return 0;
1119}
1120
1121
1122
1123
1124
1125
1126
1127int iwctl_siwrts(struct net_device *dev,
1128 struct iw_request_info *info,
1129 struct iw_param *wrq,
1130 char *extra)
1131{
1132 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1133 int rc = 0;
1134
1135 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS \n");
1136
1137 {
1138 int rthr = wrq->value;
1139 if(wrq->disabled)
1140 rthr = 2312;
1141 if((rthr < 0) || (rthr > 2312)) {
1142 rc = -EINVAL;
1143 }else {
1144 pDevice->wRTSThreshold = rthr;
1145 }
1146 }
1147
1148 return 0;
1149}
1150
1151
1152
1153
1154
1155int iwctl_giwrts(struct net_device *dev,
1156 struct iw_request_info *info,
1157 struct iw_param *wrq,
1158 char *extra)
1159{
1160 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1161
1162 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n");
1163 wrq->value = pDevice->wRTSThreshold;
1164 wrq->disabled = (wrq->value >= 2312);
1165 wrq->fixed = 1;
1166
1167 return 0;
1168}
1169
1170
1171
1172
1173
1174int iwctl_siwfrag(struct net_device *dev,
1175 struct iw_request_info *info,
1176 struct iw_param *wrq,
1177 char *extra)
1178{
1179 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1180 int rc = 0;
1181 int fthr = wrq->value;
1182
1183
1184 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG \n");
1185
1186
1187 if (wrq->disabled)
1188 fthr = 2312;
1189 if((fthr < 256) || (fthr > 2312)) {
1190 rc = -EINVAL;
1191 }else {
1192 fthr &= ~0x1;
1193 pDevice->wFragmentationThreshold = (u16)fthr;
1194 }
1195
1196 return rc;
1197}
1198
1199
1200
1201
1202
1203int iwctl_giwfrag(struct net_device *dev,
1204 struct iw_request_info *info,
1205 struct iw_param *wrq,
1206 char *extra)
1207{
1208 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1209
1210 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n");
1211 wrq->value = pDevice->wFragmentationThreshold;
1212 wrq->disabled = (wrq->value >= 2312);
1213 wrq->fixed = 1;
1214
1215 return 0;
1216}
1217
1218
1219
1220
1221
1222
1223int iwctl_siwretry(struct net_device *dev,
1224 struct iw_request_info *info,
1225 struct iw_param *wrq,
1226 char *extra)
1227{
1228 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1229 int rc = 0;
1230
1231
1232 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY \n");
1233
1234 if (wrq->disabled) {
1235 rc = -EINVAL;
1236 return rc;
1237 }
1238
1239 if (wrq->flags & IW_RETRY_LIMIT) {
1240 if(wrq->flags & IW_RETRY_MAX)
1241 pDevice->byLongRetryLimit = wrq->value;
1242 else if (wrq->flags & IW_RETRY_MIN)
1243 pDevice->byShortRetryLimit = wrq->value;
1244 else {
1245
1246 pDevice->byShortRetryLimit = wrq->value;
1247 pDevice->byLongRetryLimit = wrq->value;
1248 }
1249 }
1250 if (wrq->flags & IW_RETRY_LIFETIME) {
1251 pDevice->wMaxTransmitMSDULifetime = wrq->value;
1252 }
1253
1254
1255 return rc;
1256}
1257
1258
1259
1260
1261int iwctl_giwretry(struct net_device *dev,
1262 struct iw_request_info *info,
1263 struct iw_param *wrq,
1264 char *extra)
1265{
1266 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1267 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n");
1268 wrq->disabled = 0;
1269
1270
1271 if((wrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
1272 wrq->flags = IW_RETRY_LIFETIME;
1273 wrq->value = (int)pDevice->wMaxTransmitMSDULifetime;
1274 } else if((wrq->flags & IW_RETRY_MAX)) {
1275 wrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
1276 wrq->value = (int)pDevice->byLongRetryLimit;
1277 } else {
1278 wrq->flags = IW_RETRY_LIMIT;
1279 wrq->value = (int)pDevice->byShortRetryLimit;
1280 if((int)pDevice->byShortRetryLimit != (int)pDevice->byLongRetryLimit)
1281 wrq->flags |= IW_RETRY_MIN;
1282 }
1283
1284
1285 return 0;
1286}
1287
1288
1289
1290
1291
1292int iwctl_siwencode(struct net_device *dev,
1293 struct iw_request_info *info,
1294 struct iw_point *wrq,
1295 char *extra)
1296{
1297 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1298 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1299 DWORD dwKeyIndex = (DWORD)(wrq->flags & IW_ENCODE_INDEX);
1300 int ii,uu, rc = 0;
1301 int index = (wrq->flags & IW_ENCODE_INDEX);
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312 PSKeyTable pkeytab;
1313
1314 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n");
1315
1316if((wrq->flags & IW_ENCODE_DISABLED)==0){
1317
1318
1319 if (dwKeyIndex > WLAN_WEP_NKEYS) {
1320 rc = -EINVAL;
1321 return rc;
1322 }
1323
1324 if(dwKeyIndex<1&&((wrq->flags&IW_ENCODE_NOKEY)==0)){
1325 if(pDevice->byKeyIndex<WLAN_WEP_NKEYS){
1326 dwKeyIndex=pDevice->byKeyIndex;
1327 }
1328 else dwKeyIndex=0;
1329 }else dwKeyIndex--;
1330
1331
1332
1333 if (wrq->length > WLAN_WEP232_KEYLEN) {
1334 rc = -EINVAL;
1335 return rc;
1336 }
1337
1338 if(wrq->length>0){
1339
1340 if (wrq->length == WLAN_WEP232_KEYLEN) {
1341 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
1342 }
1343 else if (wrq->length == WLAN_WEP104_KEYLEN) {
1344 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n");
1345 }
1346 else if (wrq->length == WLAN_WEP40_KEYLEN) {
1347 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex);
1348 }else {
1349 rc = -EINVAL;
1350 return rc;
1351 }
1352 memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN);
1353 memcpy(pDevice->abyKey, extra, wrq->length);
1354
1355 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: ");
1356 for (ii = 0; ii < wrq->length; ii++) {
1357 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]);
1358 }
1359
1360 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
1361 spin_lock_irq(&pDevice->lock);
1362 KeybSetDefaultKey(&(pDevice->sKey),
1363 (DWORD)(dwKeyIndex | (1 << 31)),
1364 wrq->length,
1365 NULL,
1366 pDevice->abyKey,
1367 KEY_CTL_WEP,
1368 pDevice->PortOffset,
1369 pDevice->byLocalID
1370 );
1371 spin_unlock_irq(&pDevice->lock);
1372 }
1373 pDevice->byKeyIndex = (BYTE)dwKeyIndex;
1374 pDevice->uKeyLength = wrq->length;
1375 pDevice->bTransmitKey = TRUE;
1376 pDevice->bEncryptionEnable = TRUE;
1377 pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
1378
1379 }else if(index>0){
1380
1381
1382 if(pDevice->bEncryptionEnable==FALSE)
1383 {
1384 rc = -EINVAL;
1385 return rc;
1386 }
1387 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Just set Default key Index:\n");
1388 pkeytab=&(pDevice->sKey.KeyTable[MAX_KEY_TABLE-1]);
1389 if(pkeytab->GroupKey[(BYTE)dwKeyIndex].uKeyLength==0){
1390 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Default key len is 0\n");
1391 rc = -EINVAL;
1392 return rc;
1393 }
1394 pDevice->byKeyIndex =(BYTE)dwKeyIndex;
1395 pkeytab->dwGTKeyIndex =dwKeyIndex | (1 << 31);
1396 pkeytab->GroupKey[(BYTE)dwKeyIndex].dwKeyIndex=dwKeyIndex | (1 << 31);
1397 }
1398
1399}else {
1400 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n");
1401 if(pDevice->bEncryptionEnable==FALSE)
1402 return 0;
1403 pMgmt->bShareKeyAlgorithm = FALSE;
1404 pDevice->bEncryptionEnable = FALSE;
1405 pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
1406 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
1407 spin_lock_irq(&pDevice->lock);
1408 for(uu=0;uu<MAX_KEY_TABLE;uu++)
1409 MACvDisableKeyEntry(pDevice->PortOffset, uu);
1410 spin_unlock_irq(&pDevice->lock);
1411 }
1412}
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496 if(wrq->flags & IW_ENCODE_RESTRICTED) {
1497 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n");
1498 pMgmt->bShareKeyAlgorithm = TRUE;
1499 }
1500 if(wrq->flags & IW_ENCODE_OPEN) {
1501 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n");
1502 pMgmt->bShareKeyAlgorithm = FALSE;
1503 }
1504 return rc;
1505}
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580int iwctl_giwencode(struct net_device *dev,
1581 struct iw_request_info *info,
1582 struct iw_point *wrq,
1583 char *extra)
1584{
1585 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1586 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1587 char abyKey[WLAN_WEP232_KEYLEN];
1588
1589 UINT index = (UINT)(wrq->flags & IW_ENCODE_INDEX);
1590 PSKeyItem pKey = NULL;
1591
1592 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n");
1593
1594 if (index > WLAN_WEP_NKEYS) {
1595 return -EINVAL;
1596 }
1597 if(index<1){
1598 if(pDevice->byKeyIndex<WLAN_WEP_NKEYS){
1599 index=pDevice->byKeyIndex;
1600 } else
1601 index=0;
1602 }else
1603 index--;
1604
1605 memset(abyKey, 0, WLAN_WEP232_KEYLEN);
1606
1607 wrq->flags = IW_ENCODE_NOKEY;
1608
1609 if (pDevice->bEncryptionEnable)
1610 wrq->flags |= IW_ENCODE_ENABLED;
1611 else
1612 wrq->flags |= IW_ENCODE_DISABLED;
1613
1614 if (pMgmt->bShareKeyAlgorithm)
1615 wrq->flags |= IW_ENCODE_RESTRICTED;
1616 else
1617 wrq->flags |= IW_ENCODE_OPEN;
1618 wrq->length=0;
1619
1620 if((index==0)&&(pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled||
1621 pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)){
1622 if (KeybGetKey(&(pDevice->sKey),pMgmt->abyCurrBSSID, 0xffffffff, &pKey)){
1623 wrq->length = pKey->uKeyLength;
1624 memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
1625 memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
1626 }
1627 }else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index , &pKey)){
1628 wrq->length = pKey->uKeyLength;
1629 memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
1630 memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
1631 }
1632
1633 wrq->flags |= index+1;
1634
1635 return 0;
1636}
1637
1638
1639
1640
1641
1642int iwctl_siwpower(struct net_device *dev,
1643 struct iw_request_info *info,
1644 struct iw_param *wrq,
1645 char *extra)
1646{
1647 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1648 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1649 int rc = 0;
1650
1651 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER \n");
1652
1653 if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
1654 rc = -EINVAL;
1655 return rc;
1656 }
1657
1658 if (wrq->disabled) {
1659 pDevice->ePSMode = WMAC_POWER_CAM;
1660 PSvDisablePowerSaving(pDevice);
1661 return rc;
1662 }
1663 if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
1664 pDevice->ePSMode = WMAC_POWER_FAST;
1665 PSvEnablePowerSaving((HANDLE)pDevice, pMgmt->wListenInterval);
1666
1667 } else if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) {
1668 pDevice->ePSMode = WMAC_POWER_FAST;
1669 PSvEnablePowerSaving((HANDLE)pDevice, pMgmt->wListenInterval);
1670 }
1671 switch (wrq->flags & IW_POWER_MODE) {
1672 case IW_POWER_UNICAST_R:
1673 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n");
1674 rc = -EINVAL;
1675 break;
1676 case IW_POWER_ALL_R:
1677 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R \n");
1678 rc = -EINVAL;
1679 case IW_POWER_ON:
1680 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON \n");
1681 break;
1682 default:
1683 rc = -EINVAL;
1684 }
1685
1686 return rc;
1687}
1688
1689
1690
1691
1692int iwctl_giwpower(struct net_device *dev,
1693 struct iw_request_info *info,
1694 struct iw_param *wrq,
1695 char *extra)
1696{
1697 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1698 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1699 int mode = pDevice->ePSMode;
1700
1701
1702 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n");
1703
1704
1705 if ((wrq->disabled = (mode == WMAC_POWER_CAM)))
1706 return 0;
1707
1708 if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
1709 wrq->value = (int)((pMgmt->wListenInterval * pMgmt->wCurrBeaconPeriod) << 10);
1710 wrq->flags = IW_POWER_TIMEOUT;
1711 } else {
1712 wrq->value = (int)((pMgmt->wListenInterval * pMgmt->wCurrBeaconPeriod) << 10);
1713 wrq->flags = IW_POWER_PERIOD;
1714 }
1715 wrq->flags |= IW_POWER_ALL_R;
1716
1717 return 0;
1718}
1719
1720
1721
1722
1723
1724int iwctl_giwsens(struct net_device *dev,
1725 struct iw_request_info *info,
1726 struct iw_param *wrq,
1727 char *extra)
1728{
1729 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1730 long ldBm;
1731
1732 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n");
1733 if (pDevice->bLinkPass == TRUE) {
1734 RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm);
1735 wrq->value = ldBm;
1736 }
1737 else {
1738 wrq->value = 0;
1739 };
1740 wrq->disabled = (wrq->value == 0);
1741 wrq->fixed = 1;
1742
1743
1744 return 0;
1745}
1746
1747
1748#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
1749
1750int iwctl_siwauth(struct net_device *dev,
1751 struct iw_request_info *info,
1752 struct iw_param *wrq,
1753 char *extra)
1754{
1755 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1756 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1757 int ret=0;
1758 static int wpa_version=0;
1759 static int pairwise=0;
1760
1761 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n");
1762 switch (wrq->flags & IW_AUTH_INDEX) {
1763 case IW_AUTH_WPA_VERSION:
1764 wpa_version = wrq->value;
1765 if(wrq->value == IW_AUTH_WPA_VERSION_DISABLED) {
1766 PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n");
1767
1768 }
1769 else if(wrq->value == IW_AUTH_WPA_VERSION_WPA) {
1770 PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n");
1771 }
1772 else {
1773 PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n");
1774 }
1775
1776 break;
1777 case IW_AUTH_CIPHER_PAIRWISE:
1778 pairwise = wrq->value;
1779 if(pairwise == IW_AUTH_CIPHER_CCMP){
1780 pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
1781 }else if(pairwise == IW_AUTH_CIPHER_TKIP){
1782 pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
1783 }else if(pairwise == IW_AUTH_CIPHER_WEP40||pairwise == IW_AUTH_CIPHER_WEP104){
1784 pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
1785 }else if(pairwise == IW_AUTH_CIPHER_NONE){
1786
1787 }else pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
1788
1789 break;
1790 case IW_AUTH_CIPHER_GROUP:
1791 if(wpa_version == IW_AUTH_WPA_VERSION_DISABLED)
1792 break;
1793 if(pairwise == IW_AUTH_CIPHER_NONE){
1794 if(wrq->value == IW_AUTH_CIPHER_CCMP){
1795 pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
1796 }else {
1797 pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
1798 }
1799 }
1800 break;
1801 case IW_AUTH_KEY_MGMT:
1802
1803 if(wpa_version == IW_AUTH_WPA_VERSION_WPA2){
1804 if(wrq->value == IW_AUTH_KEY_MGMT_PSK)
1805 pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK;
1806 else pMgmt->eAuthenMode = WMAC_AUTH_WPA2;
1807 }else if(wpa_version == IW_AUTH_WPA_VERSION_WPA){
1808 if(wrq->value == 0){
1809 pMgmt->eAuthenMode = WMAC_AUTH_WPANONE;
1810 }else if(wrq->value == IW_AUTH_KEY_MGMT_PSK)
1811 pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK;
1812 else pMgmt->eAuthenMode = WMAC_AUTH_WPA;
1813 }
1814
1815 break;
1816 case IW_AUTH_TKIP_COUNTERMEASURES:
1817 break;
1818 case IW_AUTH_DROP_UNENCRYPTED:
1819 break;
1820 case IW_AUTH_80211_AUTH_ALG:
1821 if(wrq->value==IW_AUTH_ALG_OPEN_SYSTEM){
1822 pMgmt->bShareKeyAlgorithm=FALSE;
1823 }else if(wrq->value==IW_AUTH_ALG_SHARED_KEY){
1824 pMgmt->bShareKeyAlgorithm=TRUE;
1825 }
1826 break;
1827 case IW_AUTH_WPA_ENABLED:
1828
1829 break;
1830 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
1831 break;
1832 case IW_AUTH_ROAMING_CONTROL:
1833 ret = -EOPNOTSUPP;
1834 break;
1835 case IW_AUTH_PRIVACY_INVOKED:
1836 pDevice->bEncryptionEnable = !!wrq->value;
1837 if(pDevice->bEncryptionEnable == FALSE){
1838 wpa_version = 0;
1839 pairwise = 0;
1840 pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
1841 pMgmt->bShareKeyAlgorithm = FALSE;
1842 pMgmt->eAuthenMode = FALSE;
1843
1844 }
1845
1846 break;
1847 default:
1848 ret = -EOPNOTSUPP;
1849 break;
1850 }
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860 return ret;
1861}
1862
1863
1864int iwctl_giwauth(struct net_device *dev,
1865 struct iw_request_info *info,
1866 struct iw_param *wrq,
1867 char *extra)
1868{
1869 return -EOPNOTSUPP;
1870}
1871
1872
1873
1874int iwctl_siwgenie(struct net_device *dev,
1875 struct iw_request_info *info,
1876 struct iw_point *wrq,
1877 char *extra)
1878{
1879 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1880 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1881 int ret=0;
1882
1883 if(wrq->length){
1884 if ((wrq->length < 2) || (extra[1]+2 != wrq->length)) {
1885 ret = -EINVAL;
1886 goto out;
1887 }
1888 if(wrq->length > MAX_WPA_IE_LEN){
1889 ret = -ENOMEM;
1890 goto out;
1891 }
1892 memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN);
1893 if(copy_from_user(pMgmt->abyWPAIE, extra, wrq->length)){
1894 ret = -EFAULT;
1895 goto out;
1896 }
1897 pMgmt->wWPAIELen = wrq->length;
1898 }else {
1899 memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN);
1900 pMgmt->wWPAIELen = 0;
1901 }
1902
1903 out:
1904 return 0;
1905}
1906
1907int iwctl_giwgenie(struct net_device *dev,
1908 struct iw_request_info *info,
1909 struct iw_point *wrq,
1910 char *extra)
1911{
1912 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1913 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1914 int ret=0;
1915 int space = wrq->length;
1916
1917 wrq->length = 0;
1918 if(pMgmt->wWPAIELen > 0){
1919 wrq->length = pMgmt->wWPAIELen;
1920 if(pMgmt->wWPAIELen <= space){
1921 if(copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)){
1922 ret = -EFAULT;
1923 }
1924 }else
1925 ret = -E2BIG;
1926 }
1927
1928 return ret;
1929}
1930
1931
1932int iwctl_siwencodeext(struct net_device *dev,
1933 struct iw_request_info *info,
1934 struct iw_point *wrq,
1935 char *extra)
1936{
1937 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1938 struct iw_encode_ext *ext = (struct iw_encode_ext*)extra;
1939 struct viawget_wpa_param *param=NULL;
1940
1941 wpa_alg alg_name;
1942 u8 addr[6];
1943 int key_idx, set_tx=0;
1944 u8 seq[IW_ENCODE_SEQ_MAX_SIZE];
1945 u8 key[64];
1946 size_t seq_len=0,key_len=0;
1947
1948
1949 u8 *buf;
1950 size_t blen;
1951 u8 key_array[64];
1952 int ret=0;
1953
1954PRINT_K("SIOCSIWENCODEEXT...... \n");
1955
1956blen = sizeof(*param);
1957buf = kmalloc((int)blen, (int)GFP_KERNEL);
1958if (buf == NULL)
1959 return -ENOMEM;
1960memset(buf, 0, blen);
1961param = (struct viawget_wpa_param *) buf;
1962
1963
1964switch (ext->alg) {
1965 case IW_ENCODE_ALG_NONE:
1966 alg_name = WPA_ALG_NONE;
1967 break;
1968 case IW_ENCODE_ALG_WEP:
1969 alg_name = WPA_ALG_WEP;
1970 break;
1971 case IW_ENCODE_ALG_TKIP:
1972 alg_name = WPA_ALG_TKIP;
1973 break;
1974 case IW_ENCODE_ALG_CCMP:
1975 alg_name = WPA_ALG_CCMP;
1976 break;
1977 default:
1978 PRINT_K("Unknown alg = %d\n",ext->alg);
1979 ret= -ENOMEM;
1980 goto error;
1981 }
1982
1983 memcpy(addr, ext->addr.sa_data, ETH_ALEN);
1984
1985 key_idx = (wrq->flags&IW_ENCODE_INDEX) - 1;
1986
1987if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
1988 set_tx = 1;
1989
1990 if(ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
1991 seq_len=IW_ENCODE_SEQ_MAX_SIZE;
1992 memcpy(seq, ext->rx_seq, seq_len);
1993 }
1994
1995if(ext->key_len) {
1996 key_len=ext->key_len;
1997 memcpy(key, &ext->key[0], key_len);
1998 }
1999
2000memset(key_array, 0, 64);
2001if ( key_len > 0) {
2002 memcpy(key_array, key, key_len);
2003 if (key_len == 32) {
2004
2005 memcpy(&key_array[16], &key[24], 8);
2006 memcpy(&key_array[24], &key[16], 8);
2007 }
2008 }
2009
2010
2011memcpy(param->addr, addr, ETH_ALEN);
2012param->u.wpa_key.alg_name = (int)alg_name;
2013param->u.wpa_key.set_tx = set_tx;
2014param->u.wpa_key.key_index = key_idx;
2015param->u.wpa_key.key_len = key_len;
2016param->u.wpa_key.key = (u8 *)key_array;
2017param->u.wpa_key.seq = (u8 *)seq;
2018param->u.wpa_key.seq_len = seq_len;
2019
2020#if 0
2021printk("param->u.wpa_key.alg_name =%d\n",param->u.wpa_key.alg_name);
2022printk("param->addr=%02x:%02x:%02x:%02x:%02x:%02x\n",
2023 param->addr[0],param->addr[1],param->addr[2],
2024 param->addr[3],param->addr[4],param->addr[5]);
2025printk("param->u.wpa_key.set_tx =%d\n",param->u.wpa_key.set_tx);
2026printk("param->u.wpa_key.key_index =%d\n",param->u.wpa_key.key_index);
2027printk("param->u.wpa_key.key_len =%d\n",param->u.wpa_key.key_len);
2028printk("param->u.wpa_key.key =");
2029for(ii=0;ii<param->u.wpa_key.key_len;ii++)
2030 printk("%02x:",param->u.wpa_key.key[ii]);
2031 printk("\n");
2032printk("param->u.wpa_key.seq_len =%d\n",param->u.wpa_key.seq_len);
2033printk("param->u.wpa_key.seq =");
2034for(ii=0;ii<param->u.wpa_key.seq_len;ii++)
2035 printk("%02x:",param->u.wpa_key.seq[ii]);
2036 printk("\n");
2037
2038printk("...........\n");
2039#endif
2040
2041
2042if(param->u.wpa_key.alg_name == WPA_ALG_NONE) {
2043 if(param->u.wpa_key.key_index ==0) {
2044 pDevice->bwextcount++;
2045 }
2046 if((pDevice->bwextcount == 1)&&(param->u.wpa_key.key_index ==1)) {
2047 pDevice->bwextcount++;
2048 }
2049 if((pDevice->bwextcount ==2)&&(param->u.wpa_key.key_index ==2)) {
2050 pDevice->bwextcount++;
2051 }
2052 if((pDevice->bwextcount ==3)&&(param->u.wpa_key.key_index ==3)) {
2053 pDevice->bwextcount++;
2054 }
2055 }
2056if( pDevice->bwextcount == 4) {
2057 printk("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n");
2058 pDevice->bwextcount=0;
2059 pDevice->bWPASuppWextEnabled = TRUE;
2060 }
2061
2062
2063 spin_lock_irq(&pDevice->lock);
2064 ret = wpa_set_keys(pDevice, param, TRUE);
2065 spin_unlock_irq(&pDevice->lock);
2066
2067error:
2068kfree(param);
2069 return ret;
2070}
2071
2072
2073
2074int iwctl_giwencodeext(struct net_device *dev,
2075 struct iw_request_info *info,
2076 struct iw_point *wrq,
2077 char *extra)
2078{
2079 return -EOPNOTSUPP;;
2080}
2081
2082int iwctl_siwmlme(struct net_device *dev,
2083 struct iw_request_info * info,
2084 struct iw_point *wrq,
2085 char *extra)
2086{
2087 PSDevice pDevice = (PSDevice)netdev_priv(dev);
2088 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
2089 struct iw_mlme *mlme = (struct iw_mlme *)extra;
2090
2091 int ret = 0;
2092
2093 if(memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)){
2094 ret = -EINVAL;
2095 return ret;
2096 }
2097 switch(mlme->cmd){
2098 case IW_MLME_DEAUTH:
2099
2100
2101 break;
2102 case IW_MLME_DISASSOC:
2103 if(pDevice->bLinkPass == TRUE){
2104 printk("iwctl_siwmlme--->send DISASSOCIATE\n");
2105
2106 memset(pMgmt->abyDesireBSSID, 0xFF,6);
2107 KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
2108 bScheduleCommand((HANDLE)pDevice, WLAN_CMD_DISASSOCIATE, NULL);
2109 }
2110 break;
2111 default:
2112 ret = -EOPNOTSUPP;
2113 }
2114
2115 return ret;
2116
2117}
2118
2119#endif
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191static const iw_handler iwctl_handler[] =
2192{
2193 (iw_handler) iwctl_commit,
2194 (iw_handler) NULL,
2195 (iw_handler) NULL,
2196 (iw_handler) NULL,
2197 (iw_handler) NULL,
2198 (iw_handler) NULL,
2199 (iw_handler) NULL,
2200 (iw_handler) NULL,
2201 (iw_handler) NULL,
2202 (iw_handler) NULL,
2203 (iw_handler) NULL,
2204 (iw_handler) iwctl_giwrange,
2205 (iw_handler) NULL,
2206 (iw_handler) NULL,
2207 (iw_handler) NULL,
2208 (iw_handler) NULL,
2209 (iw_handler) NULL,
2210 (iw_handler) NULL,
2211 (iw_handler) NULL,
2212 (iw_handler) NULL,
2213 (iw_handler) NULL,
2214 (iw_handler) NULL,
2215 (iw_handler) NULL,
2216 (iw_handler) NULL,
2217 (iw_handler) iwctl_siwscan,
2218 (iw_handler) iwctl_giwscan,
2219 (iw_handler) NULL,
2220 (iw_handler) NULL,
2221 (iw_handler) NULL,
2222 (iw_handler) NULL,
2223 (iw_handler) NULL,
2224 (iw_handler) NULL,
2225 (iw_handler) NULL,
2226 (iw_handler) NULL,
2227 (iw_handler) NULL,
2228 (iw_handler) NULL,
2229 (iw_handler) NULL,
2230 (iw_handler) NULL,
2231 (iw_handler) NULL,
2232 (iw_handler) NULL,
2233 (iw_handler) NULL,
2234 (iw_handler) NULL,
2235 (iw_handler) NULL,
2236 (iw_handler) NULL,
2237 (iw_handler) NULL,
2238 (iw_handler) NULL,
2239
2240
2241 (iw_handler) NULL,
2242 (iw_handler) NULL,
2243 (iw_handler) NULL,
2244 (iw_handler) NULL,
2245 (iw_handler) NULL,
2246 (iw_handler) NULL,
2247 (iw_handler) NULL,
2248 (iw_handler) NULL,
2249 (iw_handler) NULL,
2250 (iw_handler) NULL,
2251};
2252
2253
2254static const iw_handler iwctl_private_handler[] =
2255{
2256 NULL,
2257};
2258
2259
2260struct iw_priv_args iwctl_private_args[] = {
2261{ IOCTL_CMD_SET,
2262 IW_PRIV_TYPE_CHAR | 1024, 0,
2263 "set"},
2264};
2265
2266
2267
2268const struct iw_handler_def iwctl_handler_def =
2269{
2270 .get_wireless_stats = &iwctl_get_wireless_stats,
2271 .num_standard = sizeof(iwctl_handler)/sizeof(iw_handler),
2272
2273
2274 .num_private = 0,
2275 .num_private_args = 0,
2276 .standard = (iw_handler *) iwctl_handler,
2277
2278
2279 .private = NULL,
2280 .private_args = NULL,
2281};
2282