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 unsigned short 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 =(unsigned char) pDevice->scStatistic.LinkQuality;
108 #else
109 pDevice->wstats.qual.qual = pDevice->byCurrSQ;
110 #endif
111 RFvRSSITodBm(pDevice, (unsigned char)(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 = (unsigned long)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 unsigned char 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((void *)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((void *) 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((void *) 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, (unsigned char)(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 unsigned char 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 unsigned char 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 memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6);
703
704 if((pDevice->bLinkPass == true) &&
705 (memcmp(pMgmt->abyDesireBSSID, pMgmt->abyCurrBSSID, 6)== 0)){
706 return rc;
707 }
708
709 if ((is_broadcast_ether_addr(pMgmt->abyDesireBSSID)) ||
710 (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)){
711 PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n");
712 return rc;
713 }
714
715
716 {
717 unsigned int ii , uSameBssidNum=0;
718 for (ii = 0; ii < MAX_BSS_NUM; ii++) {
719 if (pMgmt->sBSSList[ii].bActive &&
720 !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, pMgmt->abyDesireBSSID)) {
721 uSameBssidNum++;
722 }
723 }
724 if(uSameBssidNum >= 2) {
725 PRINT_K("SIOCSIWAP:ignore for desired AP in hidden mode\n");
726 return rc;
727 }
728 }
729
730 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
731 pDevice->bCommit = true;
732 }
733 }
734 return rc;
735}
736
737
738
739
740
741int iwctl_giwap(struct net_device *dev,
742 struct iw_request_info *info,
743 struct sockaddr *wrq,
744 char *extra)
745{
746 PSDevice pDevice = (PSDevice)netdev_priv(dev);
747 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
748
749
750 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n");
751
752 memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
753
754 if ((pDevice->bLinkPass == false) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP))
755 memset(wrq->sa_data, 0, 6);
756
757 if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
758 memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
759 }
760
761 wrq->sa_family = ARPHRD_ETHER;
762
763 return 0;
764
765}
766
767
768
769
770
771
772int iwctl_giwaplist(struct net_device *dev,
773 struct iw_request_info *info,
774 struct iw_point *wrq,
775 char *extra)
776{
777 int ii,jj, rc = 0;
778 struct sockaddr sock[IW_MAX_AP];
779 struct iw_quality qual[IW_MAX_AP];
780 PSDevice pDevice = (PSDevice)netdev_priv(dev);
781 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
782
783
784 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST \n");
785
786
787 if (!capable(CAP_NET_ADMIN)) {
788 rc = -EPERM;
789 return rc;
790 }
791
792 if (wrq->pointer) {
793
794 PKnownBSS pBSS = &(pMgmt->sBSSList[0]);
795
796 for (ii = 0, jj= 0; ii < MAX_BSS_NUM; ii++) {
797 pBSS = &(pMgmt->sBSSList[ii]);
798 if (!pBSS->bActive)
799 continue;
800 if ( jj >= IW_MAX_AP)
801 break;
802 memcpy(sock[jj].sa_data, pBSS->abyBSSID, 6);
803 sock[jj].sa_family = ARPHRD_ETHER;
804 qual[jj].level = pBSS->uRSSI;
805 qual[jj].qual = qual[jj].noise = 0;
806 qual[jj].updated = 2;
807 jj++;
808 }
809
810 wrq->flags = 1;
811 wrq->length = jj;
812 memcpy(extra, sock, sizeof(struct sockaddr)*jj);
813 memcpy(extra + sizeof(struct sockaddr)*jj, qual, sizeof(struct iw_quality)*jj);
814 }
815
816 return rc;
817}
818
819
820
821
822
823
824int iwctl_siwessid(struct net_device *dev,
825 struct iw_request_info *info,
826 struct iw_point *wrq,
827 char *extra)
828{
829 PSDevice pDevice = (PSDevice)netdev_priv(dev);
830 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
831 PWLAN_IE_SSID pItemSSID;
832
833 unsigned char len;
834
835
836 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID \n");
837 pDevice->fWPA_Authened = false;
838if (pMgmt->eScanState == WMAC_IS_SCANNING) {
839
840 printk("SIOCSIWESSID(??)-->In scanning...\n");
841
842 }
843
844 if(wrq->flags == 0) {
845
846 memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
847 memset(pMgmt->abyDesireBSSID, 0xFF,6);
848 PRINT_K("set essid to 'any' \n");
849 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
850
851
852 return 0;
853
854 #endif
855 } else {
856
857 memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
858 pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
859 pItemSSID->byElementID = WLAN_EID_SSID;
860
861 memcpy(pItemSSID->abySSID, extra, wrq->length);
862 if (pItemSSID->abySSID[wrq->length - 1] == '\0') {
863 if(wrq->length>0)
864 pItemSSID->len = wrq->length - 1;
865 }
866 else
867 pItemSSID->len = wrq->length;
868 printk("set essid to %s \n",pItemSSID->abySSID);
869
870 len=(pItemSSID->len > ((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len)?pItemSSID->len:((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->len;
871 if((pDevice->bLinkPass == true) &&
872 (memcmp(pItemSSID->abySSID,((PWLAN_IE_SSID)pMgmt->abyCurrSSID)->abySSID,len)==0))
873 return 0;
874
875
876 if(pItemSSID->len==0) {
877 memset(pMgmt->abyDesireBSSID, 0xFF,6);
878 return 0;
879 }
880
881#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
882
883
884 if(pDevice->bWPASuppWextEnabled == true) {
885
886 {
887 PKnownBSS pCurr = NULL;
888 unsigned char abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
889 unsigned int ii , uSameBssidNum=0;
890
891 memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID));
892 pCurr = BSSpSearchBSSList(pDevice,
893 NULL,
894 abyTmpDesireSSID,
895 pMgmt->eConfigPHYMode
896 );
897
898 if (pCurr == NULL){
899 PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n");
900 vResetCommandTimer((void *) pDevice);
901 pMgmt->eScanType = WMAC_SCAN_ACTIVE;
902 bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
903 bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID);
904 }
905 else {
906
907 for (ii = 0; ii < MAX_BSS_NUM; ii++) {
908 if (pMgmt->sBSSList[ii].bActive &&
909 !compare_ether_addr(pMgmt->sBSSList[ii].abyBSSID, pCurr->abyBSSID)) {
910 uSameBssidNum++;
911 }
912 }
913 if(uSameBssidNum >= 2) {
914 printk("SIOCSIWESSID:hidden ssid directly associate.......\n");
915 vResetCommandTimer((void *) pDevice);
916 pMgmt->eScanType = WMAC_SCAN_PASSIVE;
917 bScheduleCommand((void *) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
918 bScheduleCommand((void *) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID);
919 }
920 }
921 }
922 return 0;
923 }
924 #endif
925
926 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID);
927 }
928
929 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
930 pDevice->bCommit = true;
931 }
932
933
934 return 0;
935}
936
937
938
939
940
941
942int iwctl_giwessid(struct net_device *dev,
943 struct iw_request_info *info,
944 struct iw_point *wrq,
945 char *extra)
946{
947
948 PSDevice pDevice = (PSDevice)netdev_priv(dev);
949 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
950 PWLAN_IE_SSID pItemSSID;
951
952 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID \n");
953
954
955
956
957
958 pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
959
960 memcpy(extra, pItemSSID->abySSID , pItemSSID->len);
961 extra[pItemSSID->len] = '\0';
962 wrq->length = pItemSSID->len + 1;
963
964 wrq->length = pItemSSID->len;
965 wrq->flags = 1;
966
967
968 return 0;
969}
970
971
972
973
974
975int iwctl_siwrate(struct net_device *dev,
976 struct iw_request_info *info,
977 struct iw_param *wrq,
978 char *extra)
979{
980 PSDevice pDevice = (PSDevice)netdev_priv(dev);
981 int rc = 0;
982 u8 brate = 0;
983 int i;
984 unsigned char abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
985
986
987 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n");
988 if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
989 rc = -EINVAL;
990 return rc;
991 }
992
993
994
995
996 if((wrq->value < 13) &&
997 (wrq->value >= 0)) {
998
999
1000 brate = wrq->value;
1001 } else {
1002
1003 u8 normvalue = (u8) (wrq->value/500000);
1004
1005
1006 for(i = 0 ; i < 13 ; i++) {
1007 if(normvalue == abySupportedRates[i]) {
1008 brate = i;
1009 break;
1010 }
1011 }
1012 }
1013
1014 if(wrq->value == -1) {
1015
1016 for(i = 0 ; i < 13 ; i++) {
1017 if(abySupportedRates[i] == 0)
1018 break;
1019 }
1020 if(i != 0)
1021 brate = i - 1;
1022
1023 }
1024
1025
1026 if(brate > 13 ) {
1027 rc = -EINVAL;
1028 return rc;
1029 }
1030
1031
1032 if(wrq->fixed != 0) {
1033
1034
1035 printk("Rate Fix\n");
1036 pDevice->bFixRate = true;
1037 if ((pDevice->byBBType == BB_TYPE_11B)&& (brate > 3)) {
1038 pDevice->uConnectionRate = 3;
1039 }
1040 else {
1041 pDevice->uConnectionRate = brate;
1042 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate);
1043 }
1044
1045 }
1046 else {
1047 pDevice->bFixRate = false;
1048 pDevice->uConnectionRate = 13;
1049 printk("auto rate:connection_rate is 13\n");
1050 }
1051
1052 return rc;
1053}
1054
1055
1056
1057
1058
1059int iwctl_giwrate(struct net_device *dev,
1060 struct iw_request_info *info,
1061 struct iw_param *wrq,
1062 char *extra)
1063{
1064 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1065
1066
1067
1068
1069 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n");
1070 {
1071 unsigned char abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
1072 int brate = 0;
1073
1074if(pDevice->bLinkPass){
1075if(pDevice->bFixRate == true){
1076 if (pDevice->uConnectionRate < 13) {
1077 brate = abySupportedRates[pDevice->uConnectionRate];
1078 }else {
1079 if (pDevice->byBBType == BB_TYPE_11B)
1080 brate = 0x16;
1081 if (pDevice->byBBType == BB_TYPE_11G)
1082 brate = 0x6C;
1083 if (pDevice->byBBType == BB_TYPE_11A)
1084 brate = 0x6C;
1085 }
1086}
1087else
1088{
1089
1090 brate = abySupportedRates[TxRate_iwconfig];
1091}
1092}
1093else brate =0;
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109 wrq->value = brate * 500000;
1110
1111 if (pDevice->bFixRate == true)
1112 wrq->fixed = true;
1113 }
1114
1115
1116 return 0;
1117}
1118
1119
1120
1121
1122
1123
1124
1125int iwctl_siwrts(struct net_device *dev,
1126 struct iw_request_info *info,
1127 struct iw_param *wrq,
1128 char *extra)
1129{
1130 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1131 int rc = 0;
1132
1133 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS \n");
1134
1135 {
1136 int rthr = wrq->value;
1137 if(wrq->disabled)
1138 rthr = 2312;
1139 if((rthr < 0) || (rthr > 2312)) {
1140 rc = -EINVAL;
1141 }else {
1142 pDevice->wRTSThreshold = rthr;
1143 }
1144 }
1145
1146 return 0;
1147}
1148
1149
1150
1151
1152
1153int iwctl_giwrts(struct net_device *dev,
1154 struct iw_request_info *info,
1155 struct iw_param *wrq,
1156 char *extra)
1157{
1158 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1159
1160 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n");
1161 wrq->value = pDevice->wRTSThreshold;
1162 wrq->disabled = (wrq->value >= 2312);
1163 wrq->fixed = 1;
1164
1165 return 0;
1166}
1167
1168
1169
1170
1171
1172int iwctl_siwfrag(struct net_device *dev,
1173 struct iw_request_info *info,
1174 struct iw_param *wrq,
1175 char *extra)
1176{
1177 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1178 int rc = 0;
1179 int fthr = wrq->value;
1180
1181
1182 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG \n");
1183
1184
1185 if (wrq->disabled)
1186 fthr = 2312;
1187 if((fthr < 256) || (fthr > 2312)) {
1188 rc = -EINVAL;
1189 }else {
1190 fthr &= ~0x1;
1191 pDevice->wFragmentationThreshold = (u16)fthr;
1192 }
1193
1194 return rc;
1195}
1196
1197
1198
1199
1200
1201int iwctl_giwfrag(struct net_device *dev,
1202 struct iw_request_info *info,
1203 struct iw_param *wrq,
1204 char *extra)
1205{
1206 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1207
1208 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n");
1209 wrq->value = pDevice->wFragmentationThreshold;
1210 wrq->disabled = (wrq->value >= 2312);
1211 wrq->fixed = 1;
1212
1213 return 0;
1214}
1215
1216
1217
1218
1219
1220
1221int iwctl_siwretry(struct net_device *dev,
1222 struct iw_request_info *info,
1223 struct iw_param *wrq,
1224 char *extra)
1225{
1226 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1227 int rc = 0;
1228
1229
1230 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY \n");
1231
1232 if (wrq->disabled) {
1233 rc = -EINVAL;
1234 return rc;
1235 }
1236
1237 if (wrq->flags & IW_RETRY_LIMIT) {
1238 if(wrq->flags & IW_RETRY_MAX)
1239 pDevice->byLongRetryLimit = wrq->value;
1240 else if (wrq->flags & IW_RETRY_MIN)
1241 pDevice->byShortRetryLimit = wrq->value;
1242 else {
1243
1244 pDevice->byShortRetryLimit = wrq->value;
1245 pDevice->byLongRetryLimit = wrq->value;
1246 }
1247 }
1248 if (wrq->flags & IW_RETRY_LIFETIME) {
1249 pDevice->wMaxTransmitMSDULifetime = wrq->value;
1250 }
1251
1252
1253 return rc;
1254}
1255
1256
1257
1258
1259int iwctl_giwretry(struct net_device *dev,
1260 struct iw_request_info *info,
1261 struct iw_param *wrq,
1262 char *extra)
1263{
1264 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1265 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n");
1266 wrq->disabled = 0;
1267
1268
1269 if((wrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
1270 wrq->flags = IW_RETRY_LIFETIME;
1271 wrq->value = (int)pDevice->wMaxTransmitMSDULifetime;
1272 } else if((wrq->flags & IW_RETRY_MAX)) {
1273 wrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
1274 wrq->value = (int)pDevice->byLongRetryLimit;
1275 } else {
1276 wrq->flags = IW_RETRY_LIMIT;
1277 wrq->value = (int)pDevice->byShortRetryLimit;
1278 if((int)pDevice->byShortRetryLimit != (int)pDevice->byLongRetryLimit)
1279 wrq->flags |= IW_RETRY_MIN;
1280 }
1281
1282
1283 return 0;
1284}
1285
1286
1287
1288
1289
1290int iwctl_siwencode(struct net_device *dev,
1291 struct iw_request_info *info,
1292 struct iw_point *wrq,
1293 char *extra)
1294{
1295 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1296 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1297 unsigned long dwKeyIndex = (unsigned long)(wrq->flags & IW_ENCODE_INDEX);
1298 int ii,uu, rc = 0;
1299 int index = (wrq->flags & IW_ENCODE_INDEX);
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310 PSKeyTable pkeytab;
1311
1312 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n");
1313
1314if((wrq->flags & IW_ENCODE_DISABLED)==0){
1315
1316
1317 if (dwKeyIndex > WLAN_WEP_NKEYS) {
1318 rc = -EINVAL;
1319 return rc;
1320 }
1321
1322 if(dwKeyIndex<1&&((wrq->flags&IW_ENCODE_NOKEY)==0)){
1323 if(pDevice->byKeyIndex<WLAN_WEP_NKEYS){
1324 dwKeyIndex=pDevice->byKeyIndex;
1325 }
1326 else dwKeyIndex=0;
1327 }else dwKeyIndex--;
1328
1329
1330
1331 if (wrq->length > WLAN_WEP232_KEYLEN) {
1332 rc = -EINVAL;
1333 return rc;
1334 }
1335
1336 if(wrq->length>0){
1337
1338 if (wrq->length == WLAN_WEP232_KEYLEN) {
1339 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
1340 }
1341 else if (wrq->length == WLAN_WEP104_KEYLEN) {
1342 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n");
1343 }
1344 else if (wrq->length == WLAN_WEP40_KEYLEN) {
1345 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex);
1346 }else {
1347 rc = -EINVAL;
1348 return rc;
1349 }
1350 memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN);
1351 memcpy(pDevice->abyKey, extra, wrq->length);
1352
1353 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: ");
1354 for (ii = 0; ii < wrq->length; ii++) {
1355 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]);
1356 }
1357
1358 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
1359 spin_lock_irq(&pDevice->lock);
1360 KeybSetDefaultKey(&(pDevice->sKey),
1361 (unsigned long)(dwKeyIndex | (1 << 31)),
1362 wrq->length,
1363 NULL,
1364 pDevice->abyKey,
1365 KEY_CTL_WEP,
1366 pDevice->PortOffset,
1367 pDevice->byLocalID
1368 );
1369 spin_unlock_irq(&pDevice->lock);
1370 }
1371 pDevice->byKeyIndex = (unsigned char)dwKeyIndex;
1372 pDevice->uKeyLength = wrq->length;
1373 pDevice->bTransmitKey = true;
1374 pDevice->bEncryptionEnable = true;
1375 pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
1376
1377 }else if(index>0){
1378
1379
1380 if(pDevice->bEncryptionEnable==false)
1381 {
1382 rc = -EINVAL;
1383 return rc;
1384 }
1385 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Just set Default key Index:\n");
1386 pkeytab=&(pDevice->sKey.KeyTable[MAX_KEY_TABLE-1]);
1387 if(pkeytab->GroupKey[(unsigned char)dwKeyIndex].uKeyLength==0){
1388 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Default key len is 0\n");
1389 rc = -EINVAL;
1390 return rc;
1391 }
1392 pDevice->byKeyIndex =(unsigned char)dwKeyIndex;
1393 pkeytab->dwGTKeyIndex =dwKeyIndex | (1 << 31);
1394 pkeytab->GroupKey[(unsigned char)dwKeyIndex].dwKeyIndex=dwKeyIndex | (1 << 31);
1395 }
1396
1397}else {
1398 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n");
1399 if(pDevice->bEncryptionEnable==false)
1400 return 0;
1401 pMgmt->bShareKeyAlgorithm = false;
1402 pDevice->bEncryptionEnable = false;
1403 pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
1404 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
1405 spin_lock_irq(&pDevice->lock);
1406 for(uu=0;uu<MAX_KEY_TABLE;uu++)
1407 MACvDisableKeyEntry(pDevice->PortOffset, uu);
1408 spin_unlock_irq(&pDevice->lock);
1409 }
1410}
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 if(wrq->flags & IW_ENCODE_RESTRICTED) {
1495 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n");
1496 pMgmt->bShareKeyAlgorithm = true;
1497 }
1498 if(wrq->flags & IW_ENCODE_OPEN) {
1499 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n");
1500 pMgmt->bShareKeyAlgorithm = false;
1501 }
1502 return rc;
1503}
1504
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
1578int iwctl_giwencode(struct net_device *dev,
1579 struct iw_request_info *info,
1580 struct iw_point *wrq,
1581 char *extra)
1582{
1583 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1584 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1585 char abyKey[WLAN_WEP232_KEYLEN];
1586
1587 unsigned int index = (unsigned int)(wrq->flags & IW_ENCODE_INDEX);
1588 PSKeyItem pKey = NULL;
1589
1590 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n");
1591
1592 if (index > WLAN_WEP_NKEYS) {
1593 return -EINVAL;
1594 }
1595 if(index<1){
1596 if(pDevice->byKeyIndex<WLAN_WEP_NKEYS){
1597 index=pDevice->byKeyIndex;
1598 } else
1599 index=0;
1600 }else
1601 index--;
1602
1603 memset(abyKey, 0, WLAN_WEP232_KEYLEN);
1604
1605 wrq->flags = IW_ENCODE_NOKEY;
1606
1607 if (pDevice->bEncryptionEnable)
1608 wrq->flags |= IW_ENCODE_ENABLED;
1609 else
1610 wrq->flags |= IW_ENCODE_DISABLED;
1611
1612 if (pMgmt->bShareKeyAlgorithm)
1613 wrq->flags |= IW_ENCODE_RESTRICTED;
1614 else
1615 wrq->flags |= IW_ENCODE_OPEN;
1616 wrq->length=0;
1617
1618 if((index==0)&&(pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled||
1619 pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)){
1620 if (KeybGetKey(&(pDevice->sKey),pMgmt->abyCurrBSSID, 0xffffffff, &pKey)){
1621 wrq->length = pKey->uKeyLength;
1622 memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
1623 memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
1624 }
1625 }else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (unsigned char)index , &pKey)){
1626 wrq->length = pKey->uKeyLength;
1627 memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
1628 memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
1629 }
1630
1631 wrq->flags |= index+1;
1632
1633 return 0;
1634}
1635
1636
1637
1638
1639
1640int iwctl_siwpower(struct net_device *dev,
1641 struct iw_request_info *info,
1642 struct iw_param *wrq,
1643 char *extra)
1644{
1645 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1646 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1647 int rc = 0;
1648
1649 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER \n");
1650
1651 if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
1652 rc = -EINVAL;
1653 return rc;
1654 }
1655
1656 if (wrq->disabled) {
1657 pDevice->ePSMode = WMAC_POWER_CAM;
1658 PSvDisablePowerSaving(pDevice);
1659 return rc;
1660 }
1661 if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
1662 pDevice->ePSMode = WMAC_POWER_FAST;
1663 PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval);
1664
1665 } else if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) {
1666 pDevice->ePSMode = WMAC_POWER_FAST;
1667 PSvEnablePowerSaving((void *)pDevice, pMgmt->wListenInterval);
1668 }
1669 switch (wrq->flags & IW_POWER_MODE) {
1670 case IW_POWER_UNICAST_R:
1671 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n");
1672 rc = -EINVAL;
1673 break;
1674 case IW_POWER_ALL_R:
1675 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R \n");
1676 rc = -EINVAL;
1677 case IW_POWER_ON:
1678 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON \n");
1679 break;
1680 default:
1681 rc = -EINVAL;
1682 }
1683
1684 return rc;
1685}
1686
1687
1688
1689
1690int iwctl_giwpower(struct net_device *dev,
1691 struct iw_request_info *info,
1692 struct iw_param *wrq,
1693 char *extra)
1694{
1695 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1696 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1697 int mode = pDevice->ePSMode;
1698
1699
1700 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n");
1701
1702
1703 wrq->disabled = (mode == WMAC_POWER_CAM);
1704 if (wrq->disabled)
1705 return 0;
1706
1707 if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
1708 wrq->value = (int)((pMgmt->wListenInterval * pMgmt->wCurrBeaconPeriod) << 10);
1709 wrq->flags = IW_POWER_TIMEOUT;
1710 } else {
1711 wrq->value = (int)((pMgmt->wListenInterval * pMgmt->wCurrBeaconPeriod) << 10);
1712 wrq->flags = IW_POWER_PERIOD;
1713 }
1714 wrq->flags |= IW_POWER_ALL_R;
1715
1716 return 0;
1717}
1718
1719
1720
1721
1722
1723int iwctl_giwsens(struct net_device *dev,
1724 struct iw_request_info *info,
1725 struct iw_param *wrq,
1726 char *extra)
1727{
1728 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1729 long ldBm;
1730
1731 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n");
1732 if (pDevice->bLinkPass == true) {
1733 RFvRSSITodBm(pDevice, (unsigned char)(pDevice->uCurrRSSI), &ldBm);
1734 wrq->value = ldBm;
1735 }
1736 else {
1737 wrq->value = 0;
1738 };
1739 wrq->disabled = (wrq->value == 0);
1740 wrq->fixed = 1;
1741
1742
1743 return 0;
1744}
1745
1746
1747#ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
1748
1749int iwctl_siwauth(struct net_device *dev,
1750 struct iw_request_info *info,
1751 struct iw_param *wrq,
1752 char *extra)
1753{
1754 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1755 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1756 int ret=0;
1757 static int wpa_version=0;
1758 static int pairwise=0;
1759
1760 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n");
1761 switch (wrq->flags & IW_AUTH_INDEX) {
1762 case IW_AUTH_WPA_VERSION:
1763 wpa_version = wrq->value;
1764 if(wrq->value == IW_AUTH_WPA_VERSION_DISABLED) {
1765 PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n");
1766
1767 }
1768 else if(wrq->value == IW_AUTH_WPA_VERSION_WPA) {
1769 PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n");
1770 }
1771 else {
1772 PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n");
1773 }
1774
1775 break;
1776 case IW_AUTH_CIPHER_PAIRWISE:
1777 pairwise = wrq->value;
1778 if(pairwise == IW_AUTH_CIPHER_CCMP){
1779 pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
1780 }else if(pairwise == IW_AUTH_CIPHER_TKIP){
1781 pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
1782 }else if(pairwise == IW_AUTH_CIPHER_WEP40||pairwise == IW_AUTH_CIPHER_WEP104){
1783 pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
1784 }else if(pairwise == IW_AUTH_CIPHER_NONE){
1785
1786 }else pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
1787
1788 break;
1789 case IW_AUTH_CIPHER_GROUP:
1790 if(wpa_version == IW_AUTH_WPA_VERSION_DISABLED)
1791 break;
1792 if(pairwise == IW_AUTH_CIPHER_NONE){
1793 if(wrq->value == IW_AUTH_CIPHER_CCMP){
1794 pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
1795 }else {
1796 pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
1797 }
1798 }
1799 break;
1800 case IW_AUTH_KEY_MGMT:
1801
1802 if(wpa_version == IW_AUTH_WPA_VERSION_WPA2){
1803 if(wrq->value == IW_AUTH_KEY_MGMT_PSK)
1804 pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK;
1805 else pMgmt->eAuthenMode = WMAC_AUTH_WPA2;
1806 }else if(wpa_version == IW_AUTH_WPA_VERSION_WPA){
1807 if(wrq->value == 0){
1808 pMgmt->eAuthenMode = WMAC_AUTH_WPANONE;
1809 }else if(wrq->value == IW_AUTH_KEY_MGMT_PSK)
1810 pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK;
1811 else pMgmt->eAuthenMode = WMAC_AUTH_WPA;
1812 }
1813
1814 break;
1815 case IW_AUTH_TKIP_COUNTERMEASURES:
1816 break;
1817 case IW_AUTH_DROP_UNENCRYPTED:
1818 break;
1819 case IW_AUTH_80211_AUTH_ALG:
1820 if(wrq->value==IW_AUTH_ALG_OPEN_SYSTEM){
1821 pMgmt->bShareKeyAlgorithm=false;
1822 }else if(wrq->value==IW_AUTH_ALG_SHARED_KEY){
1823 pMgmt->bShareKeyAlgorithm=true;
1824 }
1825 break;
1826 case IW_AUTH_WPA_ENABLED:
1827
1828 break;
1829 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
1830 break;
1831 case IW_AUTH_ROAMING_CONTROL:
1832 ret = -EOPNOTSUPP;
1833 break;
1834 case IW_AUTH_PRIVACY_INVOKED:
1835 pDevice->bEncryptionEnable = !!wrq->value;
1836 if(pDevice->bEncryptionEnable == false){
1837 wpa_version = 0;
1838 pairwise = 0;
1839 pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
1840 pMgmt->bShareKeyAlgorithm = false;
1841 pMgmt->eAuthenMode = false;
1842
1843 }
1844
1845 break;
1846 default:
1847 ret = -EOPNOTSUPP;
1848 break;
1849 }
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859 return ret;
1860}
1861
1862
1863int iwctl_giwauth(struct net_device *dev,
1864 struct iw_request_info *info,
1865 struct iw_param *wrq,
1866 char *extra)
1867{
1868 return -EOPNOTSUPP;
1869}
1870
1871
1872
1873int iwctl_siwgenie(struct net_device *dev,
1874 struct iw_request_info *info,
1875 struct iw_point *wrq,
1876 char *extra)
1877{
1878 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1879 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1880 int ret=0;
1881
1882 if(wrq->length){
1883 if ((wrq->length < 2) || (extra[1]+2 != wrq->length)) {
1884 ret = -EINVAL;
1885 goto out;
1886 }
1887 if(wrq->length > MAX_WPA_IE_LEN){
1888 ret = -ENOMEM;
1889 goto out;
1890 }
1891 memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN);
1892 if(copy_from_user(pMgmt->abyWPAIE, extra, wrq->length)){
1893 ret = -EFAULT;
1894 goto out;
1895 }
1896 pMgmt->wWPAIELen = wrq->length;
1897 }else {
1898 memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN);
1899 pMgmt->wWPAIELen = 0;
1900 }
1901
1902 out:
1903 return ret;
1904}
1905
1906int iwctl_giwgenie(struct net_device *dev,
1907 struct iw_request_info *info,
1908 struct iw_point *wrq,
1909 char *extra)
1910{
1911 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1912 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1913 int ret=0;
1914 int space = wrq->length;
1915
1916 wrq->length = 0;
1917 if(pMgmt->wWPAIELen > 0){
1918 wrq->length = pMgmt->wWPAIELen;
1919 if(pMgmt->wWPAIELen <= space){
1920 if(copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)){
1921 ret = -EFAULT;
1922 }
1923 }else
1924 ret = -E2BIG;
1925 }
1926
1927 return ret;
1928}
1929
1930
1931int iwctl_siwencodeext(struct net_device *dev,
1932 struct iw_request_info *info,
1933 struct iw_point *wrq,
1934 char *extra)
1935{
1936 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1937 struct iw_encode_ext *ext = (struct iw_encode_ext*)extra;
1938 struct viawget_wpa_param *param=NULL;
1939
1940 wpa_alg alg_name;
1941 u8 addr[6];
1942 int key_idx, set_tx=0;
1943 u8 seq[IW_ENCODE_SEQ_MAX_SIZE];
1944 u8 key[64];
1945 size_t seq_len=0,key_len=0;
1946
1947
1948 u8 *buf;
1949 size_t blen;
1950 u8 key_array[64];
1951 int ret=0;
1952
1953PRINT_K("SIOCSIWENCODEEXT...... \n");
1954
1955blen = sizeof(*param);
1956buf = kmalloc((int)blen, (int)GFP_KERNEL);
1957if (buf == NULL)
1958 return -ENOMEM;
1959memset(buf, 0, blen);
1960param = (struct viawget_wpa_param *) buf;
1961
1962
1963switch (ext->alg) {
1964 case IW_ENCODE_ALG_NONE:
1965 alg_name = WPA_ALG_NONE;
1966 break;
1967 case IW_ENCODE_ALG_WEP:
1968 alg_name = WPA_ALG_WEP;
1969 break;
1970 case IW_ENCODE_ALG_TKIP:
1971 alg_name = WPA_ALG_TKIP;
1972 break;
1973 case IW_ENCODE_ALG_CCMP:
1974 alg_name = WPA_ALG_CCMP;
1975 break;
1976 default:
1977 PRINT_K("Unknown alg = %d\n",ext->alg);
1978 ret= -ENOMEM;
1979 goto error;
1980 }
1981
1982 memcpy(addr, ext->addr.sa_data, ETH_ALEN);
1983
1984 key_idx = (wrq->flags&IW_ENCODE_INDEX) - 1;
1985
1986if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
1987 set_tx = 1;
1988
1989 if(ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
1990 seq_len=IW_ENCODE_SEQ_MAX_SIZE;
1991 memcpy(seq, ext->rx_seq, seq_len);
1992 }
1993
1994if(ext->key_len) {
1995 key_len=ext->key_len;
1996 memcpy(key, &ext->key[0], key_len);
1997 }
1998
1999memset(key_array, 0, 64);
2000if ( key_len > 0) {
2001 memcpy(key_array, key, key_len);
2002 if (key_len == 32) {
2003
2004 memcpy(&key_array[16], &key[24], 8);
2005 memcpy(&key_array[24], &key[16], 8);
2006 }
2007 }
2008
2009
2010memcpy(param->addr, addr, ETH_ALEN);
2011param->u.wpa_key.alg_name = (int)alg_name;
2012param->u.wpa_key.set_tx = set_tx;
2013param->u.wpa_key.key_index = key_idx;
2014param->u.wpa_key.key_len = key_len;
2015param->u.wpa_key.key = (u8 *)key_array;
2016param->u.wpa_key.seq = (u8 *)seq;
2017param->u.wpa_key.seq_len = seq_len;
2018
2019#if 0
2020printk("param->u.wpa_key.alg_name =%d\n",param->u.wpa_key.alg_name);
2021printk(KERN_DEBUG "param->addr=%pM\n", param->addr);
2022printk("param->u.wpa_key.set_tx =%d\n",param->u.wpa_key.set_tx);
2023printk("param->u.wpa_key.key_index =%d\n",param->u.wpa_key.key_index);
2024printk("param->u.wpa_key.key_len =%d\n",param->u.wpa_key.key_len);
2025printk("param->u.wpa_key.key =");
2026for(ii=0;ii<param->u.wpa_key.key_len;ii++)
2027 printk("%02x:",param->u.wpa_key.key[ii]);
2028 printk("\n");
2029printk("param->u.wpa_key.seq_len =%d\n",param->u.wpa_key.seq_len);
2030printk("param->u.wpa_key.seq =");
2031for(ii=0;ii<param->u.wpa_key.seq_len;ii++)
2032 printk("%02x:",param->u.wpa_key.seq[ii]);
2033 printk("\n");
2034
2035printk("...........\n");
2036#endif
2037
2038
2039if(param->u.wpa_key.alg_name == WPA_ALG_NONE) {
2040 if(param->u.wpa_key.key_index ==0) {
2041 pDevice->bwextcount++;
2042 }
2043 if((pDevice->bwextcount == 1)&&(param->u.wpa_key.key_index ==1)) {
2044 pDevice->bwextcount++;
2045 }
2046 if((pDevice->bwextcount ==2)&&(param->u.wpa_key.key_index ==2)) {
2047 pDevice->bwextcount++;
2048 }
2049 if((pDevice->bwextcount ==3)&&(param->u.wpa_key.key_index ==3)) {
2050 pDevice->bwextcount++;
2051 }
2052 }
2053if( pDevice->bwextcount == 4) {
2054 printk("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n");
2055 pDevice->bwextcount=0;
2056 pDevice->bWPASuppWextEnabled = true;
2057 }
2058
2059
2060 spin_lock_irq(&pDevice->lock);
2061 ret = wpa_set_keys(pDevice, param, true);
2062 spin_unlock_irq(&pDevice->lock);
2063
2064error:
2065kfree(param);
2066 return ret;
2067}
2068
2069
2070
2071int iwctl_giwencodeext(struct net_device *dev,
2072 struct iw_request_info *info,
2073 struct iw_point *wrq,
2074 char *extra)
2075{
2076 return -EOPNOTSUPP;
2077}
2078
2079int iwctl_siwmlme(struct net_device *dev,
2080 struct iw_request_info * info,
2081 struct iw_point *wrq,
2082 char *extra)
2083{
2084 PSDevice pDevice = (PSDevice)netdev_priv(dev);
2085 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
2086 struct iw_mlme *mlme = (struct iw_mlme *)extra;
2087
2088 int ret = 0;
2089
2090 if(memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)){
2091 ret = -EINVAL;
2092 return ret;
2093 }
2094 switch(mlme->cmd){
2095 case IW_MLME_DEAUTH:
2096
2097
2098 break;
2099 case IW_MLME_DISASSOC:
2100 if(pDevice->bLinkPass == true){
2101 printk("iwctl_siwmlme--->send DISASSOCIATE\n");
2102
2103 memset(pMgmt->abyDesireBSSID, 0xFF,6);
2104 KeyvInitTable(&pDevice->sKey, pDevice->PortOffset);
2105 bScheduleCommand((void *)pDevice, WLAN_CMD_DISASSOCIATE, NULL);
2106 }
2107 break;
2108 default:
2109 ret = -EOPNOTSUPP;
2110 }
2111
2112 return ret;
2113
2114}
2115
2116#endif
2117
2118
2119
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
2188static const iw_handler iwctl_handler[] =
2189{
2190 (iw_handler) iwctl_commit,
2191 (iw_handler) NULL,
2192 (iw_handler) NULL,
2193 (iw_handler) NULL,
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) iwctl_giwrange,
2202 (iw_handler) NULL,
2203 (iw_handler) NULL,
2204 (iw_handler) NULL,
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) iwctl_siwscan,
2215 (iw_handler) iwctl_giwscan,
2216 (iw_handler) NULL,
2217 (iw_handler) NULL,
2218 (iw_handler) NULL,
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
2237
2238 (iw_handler) NULL,
2239 (iw_handler) NULL,
2240 (iw_handler) NULL,
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};
2249
2250
2251static const iw_handler iwctl_private_handler[] =
2252{
2253 NULL,
2254};
2255
2256
2257struct iw_priv_args iwctl_private_args[] = {
2258{ IOCTL_CMD_SET,
2259 IW_PRIV_TYPE_CHAR | 1024, 0,
2260 "set"},
2261};
2262
2263
2264
2265const struct iw_handler_def iwctl_handler_def =
2266{
2267 .get_wireless_stats = &iwctl_get_wireless_stats,
2268 .num_standard = sizeof(iwctl_handler)/sizeof(iw_handler),
2269
2270
2271 .num_private = 0,
2272 .num_private_args = 0,
2273 .standard = (iw_handler *) iwctl_handler,
2274
2275
2276 .private = NULL,
2277 .private_args = NULL,
2278};
2279