2 * Copyright (c) 1996, 2003 VIA Networking Technologies, Inc.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 * Purpose: wireless ext & ioctl functions
34 #if !defined(__DEVICE_H__)
37 #if !defined(__IOCTL_H__)
40 #if !defined(__IOCMD_H__)
43 #if !defined(__MAC_H__)
46 #if !defined(__CARD_H__)
49 #if !defined(__HOSTAP_H__)
52 #if !defined(__UMEM_H__)
55 #if !defined(__POWER_H__)
58 #if !defined(__RF_H__)
62 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
63 #if !defined(__IOWPA_H__)
66 #if !defined(__WPACTL_H__)
71 #include <net/iw_handler.h>
74 /*--------------------- Static Definitions -------------------------*/
76 //2008-0409-07, <Add> by Einsn Liu
77 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
78 #define SUPPORTED_WIRELESS_EXT 18
80 #define SUPPORTED_WIRELESS_EXT 17
83 static const long frequency_list[] = {
84 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484,
85 4915, 4920, 4925, 4935, 4940, 4945, 4960, 4980,
86 5035, 5040, 5045, 5055, 5060, 5080, 5170, 5180, 5190, 5200, 5210, 5220, 5230, 5240,
87 5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680,
88 5700, 5745, 5765, 5785, 5805, 5825
92 /*--------------------- Static Classes ----------------------------*/
95 //static int msglevel =MSG_LEVEL_DEBUG;
96 static int msglevel =MSG_LEVEL_INFO;
99 /*--------------------- Static Variables --------------------------*/
100 /*--------------------- Static Functions --------------------------*/
102 /*--------------------- Export Variables --------------------------*/
104 struct iw_statistics *iwctl_get_wireless_stats(struct net_device *dev)
106 PSDevice pDevice = netdev_priv(dev);
109 pDevice->wstats.status = pDevice->eOPMode;
110 #ifdef Calcu_LinkQual
112 if(pDevice->byBBType == BB_TYPE_11B) {
113 if(pDevice->byCurrSQ > 120)
114 pDevice->scStatistic.LinkQuality = 100;
116 pDevice->scStatistic.LinkQuality = pDevice->byCurrSQ*100/120;
118 else if(pDevice->byBBType == BB_TYPE_11G) {
119 if(pDevice->byCurrSQ < 20)
120 pDevice->scStatistic.LinkQuality = 100;
121 else if(pDevice->byCurrSQ >96)
122 pDevice->scStatistic.LinkQuality = 0;
124 pDevice->scStatistic.LinkQuality = (96-pDevice->byCurrSQ)*100/76;
126 if(pDevice->bLinkPass !=TRUE)
127 pDevice->scStatistic.LinkQuality = 0;
129 if(pDevice->scStatistic.LinkQuality > 100)
130 pDevice->scStatistic.LinkQuality = 100;
131 pDevice->wstats.qual.qual =(BYTE) pDevice->scStatistic.LinkQuality;
133 pDevice->wstats.qual.qual = pDevice->byCurrSQ;
135 RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm);
136 pDevice->wstats.qual.level = ldBm;
137 //pDevice->wstats.qual.level = 0x100 - pDevice->uCurrRSSI;
138 pDevice->wstats.qual.noise = 0;
139 pDevice->wstats.qual.updated = 1;
140 pDevice->wstats.discard.nwid = 0;
141 pDevice->wstats.discard.code = 0;
142 pDevice->wstats.discard.fragment = 0;
143 pDevice->wstats.discard.retries = pDevice->scStatistic.dwTsrErr;
144 pDevice->wstats.discard.misc = 0;
145 pDevice->wstats.miss.beacon = 0;
147 return &pDevice->wstats;
152 /*------------------------------------------------------------------*/
155 static int iwctl_commit(struct net_device *dev,
156 struct iw_request_info *info,
160 //2008-0409-02, <Mark> by Einsn Liu
163 PSDevice pDevice = (PSDevice)netdev_priv(dev);
164 if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
168 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWCOMMIT \n");
175 * Wireless Handler : get protocol name
178 int iwctl_giwname(struct net_device *dev,
179 struct iw_request_info *info,
183 strcpy(wrq, "802.11-a/b/g");
187 int iwctl_giwnwid(struct net_device *dev,
188 struct iw_request_info *info,
189 struct iw_param *wrq,
192 //wrq->value = 0x100;
199 * Wireless Handler : set scan
202 int iwctl_siwscan(struct net_device *dev,
203 struct iw_request_info *info,
204 struct iw_point *wrq,
207 PSDevice pDevice = (PSDevice)netdev_priv(dev);
208 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
209 struct iw_scan_req *req = (struct iw_scan_req *)extra;
210 BYTE abyScanSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
211 PWLAN_IE_SSID pItemSSID=NULL;
213 //2008-0920-01<Add>by MikeLiu
214 if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
217 PRINT_K(" SIOCSIWSCAN \n");
219 if (pMgmt->eScanState == WMAC_IS_SCANNING) {
221 PRINT_K("SIOCSIWSCAN(overlap??)-->In scanning...\n");
225 if(pDevice->byReAssocCount > 0) { //reject scan when re-associating!
226 //send scan event to wpa_Supplicant
227 union iwreq_data wrqu;
228 PRINT_K("wireless_send_event--->SIOCGIWSCAN(scan done)\n");
229 memset(&wrqu, 0, sizeof(wrqu));
230 wireless_send_event(pDevice->dev, SIOCGIWSCAN, &wrqu, NULL);
234 spin_lock_irq(&pDevice->lock);
236 #ifdef update_BssList
237 BSSvClearBSSList((HANDLE)pDevice, pDevice->bLinkPass);
240 //mike add: active scan OR passive scan OR desire_ssid scan
241 if(wrq->length == sizeof(struct iw_scan_req)) {
242 if (wrq->flags & IW_SCAN_THIS_ESSID) { //desire_ssid scan
243 memset(abyScanSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
244 pItemSSID = (PWLAN_IE_SSID)abyScanSSID;
245 pItemSSID->byElementID = WLAN_EID_SSID;
246 memcpy(pItemSSID->abySSID, req->essid, (int)req->essid_len);
247 if (pItemSSID->abySSID[req->essid_len - 1] == '\0') {
249 pItemSSID->len = req->essid_len - 1;
252 pItemSSID->len = req->essid_len;
253 pMgmt->eScanType = WMAC_SCAN_PASSIVE;
254 PRINT_K("SIOCSIWSCAN:[desired_ssid=%s,len=%d]\n",((PWLAN_IE_SSID)abyScanSSID)->abySSID,
255 ((PWLAN_IE_SSID)abyScanSSID)->len);
256 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, abyScanSSID);
257 spin_unlock_irq(&pDevice->lock);
261 else if(req->scan_type == IW_SCAN_TYPE_PASSIVE) { //passive scan
262 pMgmt->eScanType = WMAC_SCAN_PASSIVE;
266 pMgmt->eScanType = WMAC_SCAN_ACTIVE;
269 pMgmt->eScanType = WMAC_SCAN_PASSIVE;
270 //printk("SIOCSIWSCAN:WLAN_CMD_BSSID_SCAN\n");
271 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, NULL);
272 spin_unlock_irq(&pDevice->lock);
279 * Wireless Handler : get scan results
282 int iwctl_giwscan(struct net_device *dev,
283 struct iw_request_info *info,
284 struct iw_point *wrq,
288 PSDevice pDevice = (PSDevice)netdev_priv(dev);
289 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
291 PWLAN_IE_SSID pItemSSID;
292 PWLAN_IE_SUPP_RATES pSuppRates, pExtSuppRates;
293 char *current_ev = extra;
294 char *end_buf = extra + IW_SCAN_MAX_DATA;
295 char *current_val = NULL;
298 char buf[MAX_WPA_IE_LEN * 2 + 30];
300 //2008-0409-02, <Mark> by Einsn Liu
303 if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
307 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSCAN \n");
309 if (pMgmt->eScanState == WMAC_IS_SCANNING) {
313 pBSS = &(pMgmt->sBSSList[0]);
314 for (ii = 0, jj = 0; jj < MAX_BSS_NUM ; jj++) {
315 if (current_ev >= end_buf)
317 pBSS = &(pMgmt->sBSSList[jj]);
320 memset(&iwe, 0, sizeof(iwe));
322 iwe.u.ap_addr.sa_family = ARPHRD_ETHER;
323 memcpy(iwe.u.ap_addr.sa_data, pBSS->abyBSSID, WLAN_BSSID_LEN);
324 current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_ADDR_LEN);
326 memset(&iwe, 0, sizeof(iwe));
327 iwe.cmd = SIOCGIWESSID;
328 pItemSSID = (PWLAN_IE_SSID)pBSS->abySSID;
329 iwe.u.data.length = pItemSSID->len;
330 iwe.u.data.flags = 1;
331 current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID);
333 memset(&iwe, 0, sizeof(iwe));
334 iwe.cmd = SIOCGIWMODE;
335 if (WLAN_GET_CAP_INFO_ESS(pBSS->wCapInfo)) {
336 iwe.u.mode = IW_MODE_INFRA;
339 iwe.u.mode = IW_MODE_ADHOC;
341 iwe.len = IW_EV_UINT_LEN;
342 current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_UINT_LEN);
344 pSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abySuppRates;
345 pExtSuppRates = (PWLAN_IE_SUPP_RATES)pBSS->abyExtSuppRates;
346 memset(&iwe, 0, sizeof(iwe));
347 iwe.cmd = SIOCGIWFREQ;
348 iwe.u.freq.m = pBSS->uChannel;
351 current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN);
352 //2008-0409-04, <Add> by Einsn Liu
354 int f = (int)pBSS->uChannel - 1;
356 iwe.u.freq.m = frequency_list[f] * 100000;
359 current_ev = iwe_stream_add_event(info,current_ev,end_buf, &iwe, IW_EV_FREQ_LEN);
361 memset(&iwe, 0, sizeof(iwe));
363 RFvRSSITodBm(pDevice, (BYTE)(pBSS->uRSSI), &ldBm);
364 iwe.u.qual.level = ldBm;
365 iwe.u.qual.noise = 0;
366 //2008-0409-01, <Add> by Einsn Liu
368 iwe.u.qual.qual = 100;
369 }else if(-ldBm > 90) {
372 iwe.u.qual.qual=(40-(-ldBm-50))*100/40;
374 iwe.u.qual.updated=7;
376 //2008-0409-01, <Mark> by Einsn Liu
378 //2008-0220-03, <Modify> by Einsn Liu
379 if(pDevice->bLinkPass== TRUE && IS_ETH_ADDRESS_EQUAL(pBSS->abyBSSID, pMgmt->abyCurrBSSID)){
380 #ifdef Calcu_LinkQual
382 if(pDevice->byBBType == BB_TYPE_11B) {
383 if(pDevice->byCurrSQ > 120)
384 pDevice->scStatistic.LinkQuality = 100;
386 pDevice->scStatistic.LinkQuality = pDevice->byCurrSQ*100/120;
388 else if(pDevice->byBBType == BB_TYPE_11G) {
389 if(pDevice->byCurrSQ < 20)
390 pDevice->scStatistic.LinkQuality = 100;
391 else if(pDevice->byCurrSQ >96)
392 pDevice->scStatistic.LinkQuality = 0;
394 pDevice->scStatistic.LinkQuality = (96-pDevice->byCurrSQ)*100/76;
396 if(pDevice->bLinkPass !=TRUE)
397 pDevice->scStatistic.LinkQuality = 0;
399 if(pDevice->scStatistic.LinkQuality > 100)
400 pDevice->scStatistic.LinkQuality = 100;
401 iwe.u.qual.qual =(BYTE) pDevice->scStatistic.LinkQuality;
403 iwe.u.qual.qual = pDevice->byCurrSQ;
409 current_ev = iwe_stream_add_event(info,current_ev, end_buf, &iwe, IW_EV_QUAL_LEN);
411 memset(&iwe, 0, sizeof(iwe));
412 iwe.cmd = SIOCGIWENCODE;
413 iwe.u.data.length = 0;
414 if (WLAN_GET_CAP_INFO_PRIVACY(pBSS->wCapInfo)) {
415 iwe.u.data.flags =IW_ENCODE_ENABLED | IW_ENCODE_NOKEY;
417 iwe.u.data.flags = IW_ENCODE_DISABLED;
419 current_ev = iwe_stream_add_point(info,current_ev,end_buf, &iwe, pItemSSID->abySSID);
421 memset(&iwe, 0, sizeof(iwe));
422 iwe.cmd = SIOCGIWRATE;
423 iwe.u.bitrate.fixed = iwe.u.bitrate.disabled = 0;
424 current_val = current_ev + IW_EV_LCP_LEN;
426 for (kk = 0 ; kk < 12 ; kk++) {
427 if (pSuppRates->abyRates[kk] == 0)
429 // Bit rate given in 500 kb/s units (+ 0x80)
430 iwe.u.bitrate.value = ((pSuppRates->abyRates[kk] & 0x7f) * 500000);
431 current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
433 for (kk = 0 ; kk < 8 ; kk++) {
434 if (pExtSuppRates->abyRates[kk] == 0)
436 // Bit rate given in 500 kb/s units (+ 0x80)
437 iwe.u.bitrate.value = ((pExtSuppRates->abyRates[kk] & 0x7f) * 500000);
438 current_val = iwe_stream_add_value(info,current_ev, current_val, end_buf, &iwe, IW_EV_PARAM_LEN);
441 if((current_val - current_ev) > IW_EV_LCP_LEN)
442 current_ev = current_val;
444 memset(&iwe, 0, sizeof(iwe));
445 iwe.cmd = IWEVCUSTOM;
446 sprintf(buf, "bcn_int=%d", pBSS->wBeaconInterval);
447 iwe.u.data.length = strlen(buf);
448 current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, buf);
450 if ((pBSS->wWPALen > 0) && (pBSS->wWPALen <= MAX_WPA_IE_LEN)) {
451 memset(&iwe, 0, sizeof(iwe));
453 iwe.u.data.length = pBSS->wWPALen;
454 current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byWPAIE);
457 if ((pBSS->wRSNLen > 0) && (pBSS->wRSNLen <= MAX_WPA_IE_LEN)) {
458 memset(&iwe, 0, sizeof(iwe));
460 iwe.u.data.length = pBSS->wRSNLen;
461 current_ev = iwe_stream_add_point(info,current_ev, end_buf, &iwe, pBSS->byRSNIE);
467 wrq->length = current_ev - extra;
474 * Wireless Handler : set frequence or channel
477 int iwctl_siwfreq(struct net_device *dev,
478 struct iw_request_info *info,
482 PSDevice pDevice = (PSDevice)netdev_priv(dev);
485 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFREQ \n");
487 // If setting by frequency, convert to a channel
489 (wrq->m >= (int) 2.412e8) &&
490 (wrq->m <= (int) 2.487e8)) {
491 int f = wrq->m / 100000;
493 while((c < 14) && (f != frequency_list[c]))
498 // Setting by channel number
499 if((wrq->m > 14) || (wrq->e > 0))
502 int channel = wrq->m;
503 if((channel < 1) || (channel > 14)) {
504 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%s: New channel value of %d is invalid!\n", dev->name, wrq->m);
507 // Yes ! We can set it !!!
508 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " Set to channel = %d\n", channel);
509 pDevice->uChannel = channel;
517 * Wireless Handler : get frequence or channel
520 int iwctl_giwfreq(struct net_device *dev,
521 struct iw_request_info *info,
525 PSDevice pDevice = (PSDevice)netdev_priv(dev);
526 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
528 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFREQ \n");
530 #ifdef WEXT_USECHANNELS
531 wrq->m = (int)pMgmt->uCurrChannel;
535 int f = (int)pMgmt->uCurrChannel - 1;
538 wrq->m = frequency_list[f] * 100000;
547 * Wireless Handler : set operation mode
550 int iwctl_siwmode(struct net_device *dev,
551 struct iw_request_info *info,
555 PSDevice pDevice = (PSDevice)netdev_priv(dev);
556 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
559 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWMODE \n");
561 if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP && pDevice->bEnableHostapd) {
562 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"Can't set operation mode, hostapd is running \n");
569 if (pMgmt->eConfigMode != WMAC_CONFIG_IBSS_STA) {
570 pMgmt->eConfigMode = WMAC_CONFIG_IBSS_STA;
571 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
572 pDevice->bCommit = TRUE;
575 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to ad-hoc \n");
579 if (pMgmt->eConfigMode != WMAC_CONFIG_ESS_STA) {
580 pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
581 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
582 pDevice->bCommit = TRUE;
585 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to infrastructure \n");
589 pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
593 if (pMgmt->eConfigMode != WMAC_CONFIG_AP) {
594 pMgmt->eConfigMode = WMAC_CONFIG_AP;
595 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
596 pDevice->bCommit = TRUE;
599 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set mode to Access Point \n");
603 pMgmt->eConfigMode = WMAC_CONFIG_ESS_STA;
614 * Wireless Handler : get operation mode
617 int iwctl_giwmode(struct net_device *dev,
618 struct iw_request_info *info,
622 PSDevice pDevice = (PSDevice)netdev_priv(dev);
623 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
626 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWMODE \n");
627 // If not managed, assume it's ad-hoc
628 switch (pMgmt->eConfigMode) {
629 case WMAC_CONFIG_ESS_STA:
630 *wmode = IW_MODE_INFRA;
632 case WMAC_CONFIG_IBSS_STA:
633 *wmode = IW_MODE_ADHOC;
635 case WMAC_CONFIG_AUTO:
636 *wmode = IW_MODE_INFRA;
639 *wmode = IW_MODE_MASTER;
642 *wmode = IW_MODE_ADHOC;
650 * Wireless Handler : get capability range
653 int iwctl_giwrange(struct net_device *dev,
654 struct iw_request_info *info,
655 struct iw_point *wrq,
658 struct iw_range *range = (struct iw_range *) extra;
660 BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
661 //2008-0409-02, <Mark> by Einsn Liu
664 PSDevice pDevice = (PSDevice)netdev_priv(dev);
665 if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
670 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRANGE \n");
672 wrq->length = sizeof(struct iw_range);
673 memset(range, 0, sizeof(struct iw_range));
674 range->min_nwid = 0x0000;
675 range->max_nwid = 0x0000;
676 range->num_channels = 14;
677 // Should be based on cap_rid.country to give only
678 // what the current card support
680 for(i = 0; i < 14; i++) {
681 range->freq[k].i = i + 1; // List index
682 range->freq[k].m = frequency_list[i] * 100000;
683 range->freq[k++].e = 1; // Values in table in MHz -> * 10^5 * 10
685 range->num_frequency = k;
686 // Hum... Should put the right values there
687 #ifdef Calcu_LinkQual
688 range->max_qual.qual = 100;
690 range->max_qual.qual = 255;
692 range->max_qual.level = 0;
693 range->max_qual.noise = 0;
694 range->sensitivity = 255;
696 for(i = 0 ; i < 13 ; i++) {
697 range->bitrate[i] = abySupportedRates[i] * 500000;
698 if(range->bitrate[i] == 0)
701 range->num_bitrates = i;
703 // Set an indication of the max TCP throughput
704 // in bit/s that we can expect using this interface.
705 // May be use for QoS stuff... Jean II
707 range->throughput = 5 * 1000 * 1000;
709 range->throughput = 1.5 * 1000 * 1000;
712 range->max_rts = 2312;
713 range->min_frag = 256;
714 range->max_frag = 2312;
717 // the encoding capabilities
718 range->num_encoding_sizes = 3;
720 range->encoding_size[0] = 5;
722 range->encoding_size[1] = 13;
723 // 256 bits for WPA-PSK
724 range->encoding_size[2] = 32;
725 // 4 keys are allowed
726 range->max_encoding_tokens = 4;
728 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
729 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
732 range->max_pmp = 1000000;// 1 secs
734 range->max_pmt = 1000000;// 1 secs
735 range->pmp_flags = IW_POWER_PERIOD;
736 range->pmt_flags = IW_POWER_TIMEOUT;
737 range->pm_capa = IW_POWER_PERIOD | IW_POWER_TIMEOUT | IW_POWER_ALL_R;
739 // Transmit Power - values are in mW
741 range->txpower[0] = 100;
742 range->num_txpower = 1;
743 range->txpower_capa = IW_TXPOW_MWATT;
744 range->we_version_source = SUPPORTED_WIRELESS_EXT;
745 range->we_version_compiled = WIRELESS_EXT;
746 range->retry_capa = IW_RETRY_LIMIT | IW_RETRY_LIFETIME;
747 range->retry_flags = IW_RETRY_LIMIT;
748 range->r_time_flags = IW_RETRY_LIFETIME;
749 range->min_retry = 1;
750 range->max_retry = 65535;
751 range->min_r_time = 1024;
752 range->max_r_time = 65535 * 1024;
753 // Experimental measurements - boundary 11/5.5 Mb/s
754 // Note : with or without the (local->rssi), results
755 // are somewhat different. - Jean II
756 range->avg_qual.qual = 6;
757 range->avg_qual.level = 176; // -80 dBm
758 range->avg_qual.noise = 0;
767 * Wireless Handler : set ap mac address
770 int iwctl_siwap(struct net_device *dev,
771 struct iw_request_info *info,
772 struct sockaddr *wrq,
775 PSDevice pDevice = (PSDevice)netdev_priv(dev);
776 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
778 BYTE ZeroBSSID[WLAN_BSSID_LEN]={0x00,0x00,0x00,0x00,0x00,0x00};
780 PRINT_K(" SIOCSIWAP \n");
782 if (wrq->sa_family != ARPHRD_ETHER)
785 memset(pMgmt->abyDesireBSSID, 0xFF, 6);
786 memcpy(pMgmt->abyDesireBSSID, wrq->sa_data, 6);
789 if ((IS_BROADCAST_ADDRESS(pMgmt->abyDesireBSSID)) ||
790 (memcmp(pMgmt->abyDesireBSSID, ZeroBSSID, 6) == 0)){
791 PRINT_K("SIOCSIWAP:invalid desired BSSID return!\n");
794 //mike add: if desired AP is hidden ssid(there are two same BSSID in list),
795 // then ignore,because you don't known which one to be connect with??
797 UINT ii , uSameBssidNum=0;
798 for (ii = 0; ii < MAX_BSS_NUM; ii++) {
799 if (pMgmt->sBSSList[ii].bActive &&
800 IS_ETH_ADDRESS_EQUAL(pMgmt->sBSSList[ii].abyBSSID,pMgmt->abyDesireBSSID)) {
804 if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!!
805 PRINT_K("SIOCSIWAP:ignore for desired AP in hidden mode\n");
810 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
811 pDevice->bCommit = TRUE;
818 * Wireless Handler : get ap mac address
821 int iwctl_giwap(struct net_device *dev,
822 struct iw_request_info *info,
823 struct sockaddr *wrq,
826 PSDevice pDevice = (PSDevice)netdev_priv(dev);
827 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
830 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAP \n");
832 memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
834 //20080123-02,<Modify> by Einsn Liu
835 if ((pDevice->bLinkPass == FALSE) && (pMgmt->eCurrMode != WMAC_MODE_ESS_AP))
836 // if ((pDevice->bLinkPass == FALSE) && (pMgmt->eCurrMode == WMAC_MODE_ESS_STA))
837 memset(wrq->sa_data, 0, 6);
839 if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
840 memcpy(wrq->sa_data, pMgmt->abyCurrBSSID, 6);
843 wrq->sa_family = ARPHRD_ETHER;
851 * Wireless Handler : get ap list
854 int iwctl_giwaplist(struct net_device *dev,
855 struct iw_request_info *info,
856 struct iw_point *wrq,
860 struct sockaddr sock[IW_MAX_AP];
861 struct iw_quality qual[IW_MAX_AP];
862 PSDevice pDevice = (PSDevice)netdev_priv(dev);
863 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
866 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWAPLIST \n");
867 // Only super-user can see AP list
869 if (!capable(CAP_NET_ADMIN)) {
876 PKnownBSS pBSS = &(pMgmt->sBSSList[0]);
878 for (ii = 0, jj= 0; ii < MAX_BSS_NUM; ii++) {
879 pBSS = &(pMgmt->sBSSList[ii]);
882 if ( jj >= IW_MAX_AP)
884 memcpy(sock[jj].sa_data, pBSS->abyBSSID, 6);
885 sock[jj].sa_family = ARPHRD_ETHER;
886 qual[jj].level = pBSS->uRSSI;
887 qual[jj].qual = qual[jj].noise = 0;
888 qual[jj].updated = 2;
892 wrq->flags = 1; // Should be define'd
894 memcpy(extra, sock, sizeof(struct sockaddr)*jj);
895 memcpy(extra + sizeof(struct sockaddr)*jj, qual, sizeof(struct iw_quality)*jj);
903 * Wireless Handler : set essid
906 int iwctl_siwessid(struct net_device *dev,
907 struct iw_request_info *info,
908 struct iw_point *wrq,
911 PSDevice pDevice = (PSDevice)netdev_priv(dev);
912 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
913 PWLAN_IE_SSID pItemSSID;
915 //2008-0920-01<Add>by MikeLiu
916 if (!(pDevice->flags & DEVICE_FLAGS_OPENED))
919 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWESSID :\n");
921 pDevice->fWPA_Authened = FALSE;
922 // Check if we asked for `any'
923 if(wrq->flags == 0) {
924 // Just send an empty SSID list
925 memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
926 memset(pMgmt->abyDesireBSSID, 0xFF,6);
927 PRINT_K("set essid to 'any' \n");
928 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
929 //Unknown desired AP,so here need not associate??
934 memset(pMgmt->abyDesireSSID, 0, WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1);
935 pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
936 pItemSSID->byElementID = WLAN_EID_SSID;
938 memcpy(pItemSSID->abySSID, extra, wrq->length);
939 if (pItemSSID->abySSID[wrq->length - 1] == '\0') {
941 pItemSSID->len = wrq->length - 1;
944 pItemSSID->len = wrq->length;
945 PRINT_K("set essid to %s \n",pItemSSID->abySSID);
947 //mike:need clear desiredBSSID
948 if(pItemSSID->len==0) {
949 memset(pMgmt->abyDesireBSSID, 0xFF,6);
953 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
954 //Wext wil order another command of siwap to link with desired AP,
955 //so here need not associate??
956 if(pDevice->bWPASuppWextEnabled == TRUE) {
957 /*******search if in hidden ssid mode ****/
959 PKnownBSS pCurr = NULL;
960 BYTE abyTmpDesireSSID[WLAN_IEHDR_LEN + WLAN_SSID_MAXLEN + 1];
961 UINT ii , uSameBssidNum=0;
963 memset(abyTmpDesireSSID,0,sizeof(abyTmpDesireSSID));
964 memcpy(abyTmpDesireSSID,pMgmt->abyDesireSSID,sizeof(abyTmpDesireSSID));
965 pCurr = BSSpSearchBSSList(pDevice,
968 pDevice->eConfigPHYMode
972 PRINT_K("SIOCSIWESSID:hidden ssid site survey before associate.......\n");
973 vResetCommandTimer((HANDLE) pDevice);
974 pMgmt->eScanType = WMAC_SCAN_ACTIVE;
975 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
976 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID);
978 else { //mike:to find out if that desired SSID is a hidden-ssid AP ,
979 // by means of judging if there are two same BSSID exist in list ?
980 for (ii = 0; ii < MAX_BSS_NUM; ii++) {
981 if (pMgmt->sBSSList[ii].bActive &&
982 IS_ETH_ADDRESS_EQUAL(pMgmt->sBSSList[ii].abyBSSID, pCurr->abyBSSID)) {
986 if(uSameBssidNum >= 2) { //hit: desired AP is in hidden ssid mode!!!
987 PRINT_K("SIOCSIWESSID:hidden ssid directly associate.......\n");
988 vResetCommandTimer((HANDLE) pDevice);
989 pMgmt->eScanType = WMAC_SCAN_PASSIVE; //this scan type,you'll submit scan result!
990 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_BSSID_SCAN, pMgmt->abyDesireSSID);
991 bScheduleCommand((HANDLE) pDevice, WLAN_CMD_SSID, pMgmt->abyDesireSSID);
999 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "set essid = %s \n", pItemSSID->abySSID);
1002 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
1003 pDevice->bCommit = TRUE;
1012 * Wireless Handler : get essid
1015 int iwctl_giwessid(struct net_device *dev,
1016 struct iw_request_info *info,
1017 struct iw_point *wrq,
1021 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1022 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1023 PWLAN_IE_SSID pItemSSID;
1025 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWESSID \n");
1027 // Note : if wrq->u.data.flags != 0, we should
1028 // get the relevant SSID from the SSID list...
1030 // Get the current SSID
1031 pItemSSID = (PWLAN_IE_SSID)pMgmt->abyCurrSSID;
1032 //pItemSSID = (PWLAN_IE_SSID)pMgmt->abyDesireSSID;
1033 memcpy(extra, pItemSSID->abySSID , pItemSSID->len);
1034 extra[pItemSSID->len] = '\0';
1035 //2008-0409-03, <Add> by Einsn Liu
1036 wrq->length = pItemSSID->len;
1037 wrq->flags = 1; // active
1044 * Wireless Handler : set data rate
1047 int iwctl_siwrate(struct net_device *dev,
1048 struct iw_request_info *info,
1049 struct iw_param *wrq,
1052 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1056 BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
1059 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRATE \n");
1060 if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
1065 // First : get a valid bit rate value
1067 // Which type of value
1068 if((wrq->value < 13) &&
1069 (wrq->value >= 0)) {
1070 // Setting by rate index
1071 // Find value in the magic rate table
1074 // Setting by frequency value
1075 u8 normvalue = (u8) (wrq->value/500000);
1077 // Check if rate is valid
1078 for(i = 0 ; i < 13 ; i++) {
1079 if(normvalue == abySupportedRates[i]) {
1085 // -1 designed the max rate (mostly auto mode)
1086 if(wrq->value == -1) {
1087 // Get the highest available rate
1088 for(i = 0 ; i < 13 ; i++) {
1089 if(abySupportedRates[i] == 0)
1096 // Check that it is valid
1097 // brate is index of abySupportedRates[]
1103 // Now, check if we want a fixed or auto value
1104 if(wrq->fixed != 0) {
1107 pDevice->bFixRate = TRUE;
1108 if ((pDevice->byBBType == BB_TYPE_11B)&& (brate > 3)) {
1109 pDevice->uConnectionRate = 3;
1112 pDevice->uConnectionRate = brate;
1113 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Fixed to Rate %d \n", pDevice->uConnectionRate);
1118 pDevice->bFixRate = FALSE;
1119 pDevice->uConnectionRate = 13;
1126 * Wireless Handler : get data rate
1129 int iwctl_giwrate(struct net_device *dev,
1130 struct iw_request_info *info,
1131 struct iw_param *wrq,
1134 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1135 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1137 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRATE \n");
1139 BYTE abySupportedRates[13]= {0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48, 0x60, 0x6C, 0x90};
1141 if (pDevice->uConnectionRate < 13) {
1142 brate = abySupportedRates[pDevice->uConnectionRate];
1144 if (pDevice->byBBType == BB_TYPE_11B)
1146 if (pDevice->byBBType == BB_TYPE_11G)
1148 if (pDevice->byBBType == BB_TYPE_11A)
1152 if (pMgmt->eCurrMode == WMAC_MODE_ESS_AP) {
1153 if (pDevice->byBBType == BB_TYPE_11B)
1155 if (pDevice->byBBType == BB_TYPE_11G)
1157 if (pDevice->byBBType == BB_TYPE_11A)
1160 if (pDevice->uConnectionRate == 13)
1161 brate = abySupportedRates[pDevice->wCurrentRate];
1162 wrq->value = brate * 500000;
1163 // If more than one rate, set auto
1164 if (pDevice->bFixRate == TRUE)
1175 * Wireless Handler : set rts threshold
1178 int iwctl_siwrts(struct net_device *dev,
1179 struct iw_request_info *info,
1180 struct iw_param *wrq,
1183 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1186 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRTS \n");
1189 int rthr = wrq->value;
1192 if((rthr < 0) || (rthr > 2312)) {
1195 pDevice->wRTSThreshold = rthr;
1203 * Wireless Handler : get rts
1206 int iwctl_giwrts(struct net_device *dev,
1207 struct iw_request_info *info,
1208 struct iw_param *wrq,
1211 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1213 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRTS \n");
1214 wrq->value = pDevice->wRTSThreshold;
1215 wrq->disabled = (wrq->value >= 2312);
1222 * Wireless Handler : set fragment threshold
1225 int iwctl_siwfrag(struct net_device *dev,
1226 struct iw_request_info *info,
1227 struct iw_param *wrq,
1230 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1232 int fthr = wrq->value;
1235 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWFRAG \n");
1240 if((fthr < 256) || (fthr > 2312)) {
1243 fthr &= ~0x1; // Get an even value
1244 pDevice->wFragmentationThreshold = (u16)fthr;
1251 * Wireless Handler : get fragment threshold
1254 int iwctl_giwfrag(struct net_device *dev,
1255 struct iw_request_info *info,
1256 struct iw_param *wrq,
1259 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1261 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWFRAG \n");
1262 wrq->value = pDevice->wFragmentationThreshold;
1263 wrq->disabled = (wrq->value >= 2312);
1272 * Wireless Handler : set retry threshold
1274 int iwctl_siwretry(struct net_device *dev,
1275 struct iw_request_info *info,
1276 struct iw_param *wrq,
1279 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1283 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWRETRY \n");
1285 if (wrq->disabled) {
1290 if (wrq->flags & IW_RETRY_LIMIT) {
1291 if(wrq->flags & IW_RETRY_MAX)
1292 pDevice->byLongRetryLimit = wrq->value;
1293 else if (wrq->flags & IW_RETRY_MIN)
1294 pDevice->byShortRetryLimit = wrq->value;
1296 // No modifier : set both
1297 pDevice->byShortRetryLimit = wrq->value;
1298 pDevice->byLongRetryLimit = wrq->value;
1301 if (wrq->flags & IW_RETRY_LIFETIME) {
1302 pDevice->wMaxTransmitMSDULifetime = wrq->value;
1310 * Wireless Handler : get retry threshold
1312 int iwctl_giwretry(struct net_device *dev,
1313 struct iw_request_info *info,
1314 struct iw_param *wrq,
1317 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1318 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWRETRY \n");
1319 wrq->disabled = 0; // Can't be disabled
1321 // Note : by default, display the min retry number
1322 if((wrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
1323 wrq->flags = IW_RETRY_LIFETIME;
1324 wrq->value = (int)pDevice->wMaxTransmitMSDULifetime; //ms
1325 } else if((wrq->flags & IW_RETRY_MAX)) {
1326 wrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
1327 wrq->value = (int)pDevice->byLongRetryLimit;
1329 wrq->flags = IW_RETRY_LIMIT;
1330 wrq->value = (int)pDevice->byShortRetryLimit;
1331 if((int)pDevice->byShortRetryLimit != (int)pDevice->byLongRetryLimit)
1332 wrq->flags |= IW_RETRY_MIN;
1341 * Wireless Handler : set encode mode
1343 int iwctl_siwencode(struct net_device *dev,
1344 struct iw_request_info *info,
1345 struct iw_point *wrq,
1348 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1349 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1350 DWORD dwKeyIndex = (DWORD)(wrq->flags & IW_ENCODE_INDEX);
1352 int index = (wrq->flags & IW_ENCODE_INDEX);
1355 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWENCODE \n");
1357 // Check the size of the key
1358 if (wrq->length > WLAN_WEP232_KEYLEN) {
1363 if (dwKeyIndex > WLAN_WEP_NKEYS) {
1371 // Send the key to the card
1372 if (wrq->length > 0) {
1374 if (wrq->length == WLAN_WEP232_KEYLEN) {
1375 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 232 bit wep key\n");
1377 else if (wrq->length == WLAN_WEP104_KEYLEN) {
1378 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 104 bit wep key\n");
1380 else if (wrq->length == WLAN_WEP40_KEYLEN) {
1381 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Set 40 bit wep key, index= %d\n", (int)dwKeyIndex);
1383 memset(pDevice->abyKey, 0, WLAN_WEP232_KEYLEN);
1384 memcpy(pDevice->abyKey, extra, wrq->length);
1386 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO"abyKey: ");
1387 for (ii = 0; ii < wrq->length; ii++) {
1388 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "%02x ", pDevice->abyKey[ii]);
1391 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
1392 spin_lock_irq(&pDevice->lock);
1393 KeybSetDefaultKey( pDevice,
1395 dwKeyIndex | (1 << 31),
1401 spin_unlock_irq(&pDevice->lock);
1403 pDevice->byKeyIndex = (BYTE)dwKeyIndex;
1404 pDevice->uKeyLength = wrq->length;
1405 pDevice->bTransmitKey = TRUE;
1406 pDevice->bEncryptionEnable = TRUE;
1407 pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
1409 // Do we want to just set the transmit key index ?
1411 pDevice->byKeyIndex = index;
1412 } else if (!(wrq->flags & IW_ENCODE_MODE)) {
1418 if(wrq->flags & IW_ENCODE_DISABLED){
1420 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Disable WEP function\n");
1421 pMgmt->bShareKeyAlgorithm = FALSE;
1422 pDevice->bEncryptionEnable = FALSE;
1423 pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
1424 if (pDevice->flags & DEVICE_FLAGS_OPENED) {
1425 spin_lock_irq(&pDevice->lock);
1426 for(uu=0;uu<MAX_KEY_TABLE;uu++)
1427 MACvDisableKeyEntry(pDevice,uu);
1428 spin_unlock_irq(&pDevice->lock);
1431 if(wrq->flags & IW_ENCODE_RESTRICTED) {
1432 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & ShareKey System\n");
1433 pMgmt->bShareKeyAlgorithm = TRUE;
1435 if(wrq->flags & IW_ENCODE_OPEN) {
1436 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "Enable WEP & Open System\n");
1437 pMgmt->bShareKeyAlgorithm = FALSE;
1440 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
1441 memset(pMgmt->abyDesireBSSID, 0xFF,6);
1448 * Wireless Handler : get encode mode
1450 //2008-0409-06, <Mark> by Einsn Liu
1452 int iwctl_giwencode(struct net_device *dev,
1453 struct iw_request_info *info,
1454 struct iw_point *wrq,
1457 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1458 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1460 char abyKey[WLAN_WEP232_KEYLEN];
1461 UINT index = (UINT)(wrq->flags & IW_ENCODE_INDEX);
1462 PSKeyItem pKey = NULL;
1464 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n");
1467 memset(abyKey, 0, sizeof(abyKey));
1468 // Check encryption mode
1469 wrq->flags = IW_ENCODE_NOKEY;
1470 // Is WEP enabled ???
1471 if (pDevice->bEncryptionEnable)
1472 wrq->flags |= IW_ENCODE_ENABLED;
1474 wrq->flags |= IW_ENCODE_DISABLED;
1476 if (pMgmt->bShareKeyAlgorithm)
1477 wrq->flags |= IW_ENCODE_RESTRICTED;
1479 wrq->flags |= IW_ENCODE_OPEN;
1481 if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index , &pKey)){
1482 wrq->length = pKey->uKeyLength;
1483 memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
1489 wrq->flags |= index;
1490 // Copy the key to the user buffer
1491 memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
1496 //2008-0409-06, <Add> by Einsn Liu
1498 int iwctl_giwencode(struct net_device *dev,
1499 struct iw_request_info *info,
1500 struct iw_point *wrq,
1503 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1504 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1505 char abyKey[WLAN_WEP232_KEYLEN];
1507 UINT index = (UINT)(wrq->flags & IW_ENCODE_INDEX);
1508 PSKeyItem pKey = NULL;
1510 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWENCODE\n");
1512 if (index > WLAN_WEP_NKEYS) {
1515 if(index<1){//get default key
1516 if(pDevice->byKeyIndex<WLAN_WEP_NKEYS){
1517 index=pDevice->byKeyIndex;
1523 memset(abyKey, 0, WLAN_WEP232_KEYLEN);
1524 // Check encryption mode
1525 wrq->flags = IW_ENCODE_NOKEY;
1526 // Is WEP enabled ???
1527 if (pDevice->bEncryptionEnable)
1528 wrq->flags |= IW_ENCODE_ENABLED;
1530 wrq->flags |= IW_ENCODE_DISABLED;
1532 if (pMgmt->bShareKeyAlgorithm)
1533 wrq->flags |= IW_ENCODE_RESTRICTED;
1535 wrq->flags |= IW_ENCODE_OPEN;
1538 if((index==0)&&(pDevice->eEncryptionStatus == Ndis802_11Encryption2Enabled||
1539 pDevice->eEncryptionStatus == Ndis802_11Encryption3Enabled)){//get wpa pairwise key
1540 if (KeybGetKey(&(pDevice->sKey),pMgmt->abyCurrBSSID, 0xffffffff, &pKey)){
1541 wrq->length = pKey->uKeyLength;
1542 memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
1543 memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
1545 }else if (KeybGetKey(&(pDevice->sKey), pDevice->abyBroadcastAddr, (BYTE)index , &pKey)){
1546 wrq->length = pKey->uKeyLength;
1547 memcpy(abyKey, pKey->abyKey, pKey->uKeyLength);
1548 memcpy(extra, abyKey, WLAN_WEP232_KEYLEN);
1551 wrq->flags |= index+1;
1558 * Wireless Handler : set power mode
1560 int iwctl_siwpower(struct net_device *dev,
1561 struct iw_request_info *info,
1562 struct iw_param *wrq,
1565 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1566 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1569 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER \n");
1571 if (!(pDevice->flags & DEVICE_FLAGS_OPENED)) {
1576 if (wrq->disabled) {
1577 pDevice->ePSMode = WMAC_POWER_CAM;
1578 PSvDisablePowerSaving(pDevice);
1581 if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
1582 pDevice->ePSMode = WMAC_POWER_FAST;
1583 PSvEnablePowerSaving((HANDLE)pDevice, pMgmt->wListenInterval);
1585 } else if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_PERIOD) {
1586 pDevice->ePSMode = WMAC_POWER_FAST;
1587 PSvEnablePowerSaving((HANDLE)pDevice, pMgmt->wListenInterval);
1589 switch (wrq->flags & IW_POWER_MODE) {
1590 case IW_POWER_UNICAST_R:
1591 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_UNICAST_R \n");
1594 case IW_POWER_ALL_R:
1595 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ALL_R \n");
1598 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWPOWER: IW_POWER_ON \n");
1608 * Wireless Handler : get power mode
1610 int iwctl_giwpower(struct net_device *dev,
1611 struct iw_request_info *info,
1612 struct iw_param *wrq,
1615 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1616 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1617 int mode = pDevice->ePSMode;
1620 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWPOWER \n");
1623 if ((wrq->disabled = (mode == WMAC_POWER_CAM)))
1626 if ((wrq->flags & IW_POWER_TYPE) == IW_POWER_TIMEOUT) {
1627 wrq->value = (int)((pMgmt->wListenInterval * pMgmt->wCurrBeaconPeriod) << 10);
1628 wrq->flags = IW_POWER_TIMEOUT;
1630 wrq->value = (int)((pMgmt->wListenInterval * pMgmt->wCurrBeaconPeriod) << 10);
1631 wrq->flags = IW_POWER_PERIOD;
1633 wrq->flags |= IW_POWER_ALL_R;
1640 * Wireless Handler : get Sensitivity
1642 int iwctl_giwsens(struct net_device *dev,
1643 struct iw_request_info *info,
1644 struct iw_param *wrq,
1647 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1650 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCGIWSENS \n");
1651 if (pDevice->bLinkPass == TRUE) {
1652 RFvRSSITodBm(pDevice, (BYTE)(pDevice->uCurrRSSI), &ldBm);
1658 wrq->disabled = (wrq->value == 0);
1665 //2008-0409-07, <Add> by Einsn Liu
1666 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
1668 int iwctl_siwauth(struct net_device *dev,
1669 struct iw_request_info *info,
1670 struct iw_param *wrq,
1673 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1674 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1676 static int wpa_version=0; //must be static to save the last value,einsn liu
1677 static int pairwise=0;
1679 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO " SIOCSIWAUTH \n");
1680 switch (wrq->flags & IW_AUTH_INDEX) {
1681 case IW_AUTH_WPA_VERSION:
1682 wpa_version = wrq->value;
1683 if(wrq->value == IW_AUTH_WPA_VERSION_DISABLED) {
1684 PRINT_K("iwctl_siwauth:set WPADEV to disable at 1??????\n");
1685 //pDevice->bWPADEVUp = FALSE;
1687 else if(wrq->value == IW_AUTH_WPA_VERSION_WPA) {
1688 PRINT_K("iwctl_siwauth:set WPADEV to WPA1******\n");
1691 PRINT_K("iwctl_siwauth:set WPADEV to WPA2******\n");
1693 //pDevice->bWPASuppWextEnabled =TRUE;
1695 case IW_AUTH_CIPHER_PAIRWISE:
1696 pairwise = wrq->value;
1697 PRINT_K("iwctl_siwauth:set pairwise=%d\n",pairwise);
1698 if(pairwise == IW_AUTH_CIPHER_CCMP){
1699 pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
1700 }else if(pairwise == IW_AUTH_CIPHER_TKIP){
1701 pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
1702 }else if(pairwise == IW_AUTH_CIPHER_WEP40||pairwise == IW_AUTH_CIPHER_WEP104){
1703 pDevice->eEncryptionStatus = Ndis802_11Encryption1Enabled;
1704 }else if(pairwise == IW_AUTH_CIPHER_NONE){
1705 //do nothing,einsn liu
1706 }else pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
1709 case IW_AUTH_CIPHER_GROUP:
1710 PRINT_K("iwctl_siwauth:set GROUP=%d\n",wrq->value);
1711 if(wpa_version == IW_AUTH_WPA_VERSION_DISABLED)
1713 if(pairwise == IW_AUTH_CIPHER_NONE){
1714 if(wrq->value == IW_AUTH_CIPHER_CCMP){
1715 pDevice->eEncryptionStatus = Ndis802_11Encryption3Enabled;
1717 pDevice->eEncryptionStatus = Ndis802_11Encryption2Enabled;
1721 case IW_AUTH_KEY_MGMT:
1722 PRINT_K("iwctl_siwauth(wpa_version=%d):set KEY_MGMT=%d\n",wpa_version,wrq->value);
1723 if(wpa_version == IW_AUTH_WPA_VERSION_WPA2){
1724 if(wrq->value == IW_AUTH_KEY_MGMT_PSK)
1725 pMgmt->eAuthenMode = WMAC_AUTH_WPA2PSK;
1726 else pMgmt->eAuthenMode = WMAC_AUTH_WPA2;
1727 }else if(wpa_version == IW_AUTH_WPA_VERSION_WPA){
1728 if(wrq->value == 0){
1729 pMgmt->eAuthenMode = WMAC_AUTH_WPANONE;
1730 }else if(wrq->value == IW_AUTH_KEY_MGMT_PSK)
1731 pMgmt->eAuthenMode = WMAC_AUTH_WPAPSK;
1732 else pMgmt->eAuthenMode = WMAC_AUTH_WPA;
1736 case IW_AUTH_TKIP_COUNTERMEASURES:
1738 case IW_AUTH_DROP_UNENCRYPTED:
1740 case IW_AUTH_80211_AUTH_ALG:
1741 PRINT_K("iwctl_siwauth:set AUTH_ALG=%d\n",wrq->value);
1742 if(wrq->value==IW_AUTH_ALG_OPEN_SYSTEM){
1743 pMgmt->bShareKeyAlgorithm=FALSE;
1744 }else if(wrq->value==IW_AUTH_ALG_SHARED_KEY){
1745 pMgmt->bShareKeyAlgorithm=TRUE;
1748 case IW_AUTH_WPA_ENABLED:
1749 //pDevice->bWPADEVUp = !! wrq->value;
1750 //if(pDevice->bWPADEVUp==TRUE)
1751 // printk("iwctl_siwauth:set WPADEV to enable sucessful*******\n");
1753 // printk("iwctl_siwauth:set WPADEV to enable fail?????\n");
1755 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
1757 case IW_AUTH_ROAMING_CONTROL:
1760 case IW_AUTH_PRIVACY_INVOKED:
1761 pDevice->bEncryptionEnable = !!wrq->value;
1762 if(pDevice->bEncryptionEnable == FALSE){
1765 pDevice->eEncryptionStatus = Ndis802_11EncryptionDisabled;
1766 pMgmt->bShareKeyAlgorithm = FALSE;
1767 pMgmt->eAuthenMode = WMAC_AUTH_OPEN;
1768 //pDevice->bWPADEVUp = FALSE;
1769 PRINT_K("iwctl_siwauth:set WPADEV to disaable at 2?????\n");
1778 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "wpa_version = %d\n",wpa_version);
1779 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pairwise = %d\n",pairwise);
1780 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->eEncryptionStatus = %d\n",pDevice->eEncryptionStatus);
1781 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->eAuthenMode = %d\n",pMgmt->eAuthenMode);
1782 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pMgmt->bShareKeyAlgorithm = %s\n",pMgmt->bShareKeyAlgorithm?"TRUE":"FALSE");
1783 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->bEncryptionEnable = %s\n",pDevice->bEncryptionEnable?"TRUE":"FALSE");
1784 DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO "pDevice->bWPADEVUp = %s\n",pDevice->bWPADEVUp?"TRUE":"FALSE");
1790 int iwctl_giwauth(struct net_device *dev,
1791 struct iw_request_info *info,
1792 struct iw_param *wrq,
1800 int iwctl_siwgenie(struct net_device *dev,
1801 struct iw_request_info *info,
1802 struct iw_point *wrq,
1805 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1806 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1810 if ((wrq->length < 2) || (extra[1]+2 != wrq->length)) {
1814 if(wrq->length > MAX_WPA_IE_LEN){
1818 memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN);
1819 if(copy_from_user(pMgmt->abyWPAIE, extra, wrq->length)){
1823 pMgmt->wWPAIELen = wrq->length;
1825 memset(pMgmt->abyWPAIE, 0, MAX_WPA_IE_LEN);
1826 pMgmt->wWPAIELen = 0;
1829 out://not completely ...not necessary in wpa_supplicant 0.5.8
1833 int iwctl_giwgenie(struct net_device *dev,
1834 struct iw_request_info *info,
1835 struct iw_point *wrq,
1838 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1839 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1841 int space = wrq->length;
1844 if(pMgmt->wWPAIELen > 0){
1845 wrq->length = pMgmt->wWPAIELen;
1846 if(pMgmt->wWPAIELen <= space){
1847 if(copy_to_user(extra, pMgmt->abyWPAIE, pMgmt->wWPAIELen)){
1858 int iwctl_siwencodeext(struct net_device *dev,
1859 struct iw_request_info *info,
1860 struct iw_point *wrq,
1863 PSDevice pDevice = (PSDevice)netdev_priv(dev);
1864 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
1865 struct iw_encode_ext *ext = (struct iw_encode_ext*)extra;
1866 struct viawget_wpa_param *param=NULL;
1870 int key_idx, set_tx=0;
1871 u8 seq[IW_ENCODE_SEQ_MAX_SIZE];
1873 size_t seq_len=0,key_len=0;
1881 PRINT_K("SIOCSIWENCODEEXT...... \n");
1883 blen = sizeof(*param);
1884 buf = kmalloc((int)blen, (int)GFP_KERNEL);
1887 memset(buf, 0, blen);
1888 param = (struct viawget_wpa_param *) buf;
1892 case IW_ENCODE_ALG_NONE:
1893 alg_name = WPA_ALG_NONE;
1895 case IW_ENCODE_ALG_WEP:
1896 alg_name = WPA_ALG_WEP;
1898 case IW_ENCODE_ALG_TKIP:
1899 alg_name = WPA_ALG_TKIP;
1901 case IW_ENCODE_ALG_CCMP:
1902 alg_name = WPA_ALG_CCMP;
1905 PRINT_K("Unknown alg = %d\n",ext->alg);
1910 memcpy(addr, ext->addr.sa_data, ETH_ALEN);
1912 key_idx = (wrq->flags&IW_ENCODE_INDEX) - 1;
1914 if(ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY)
1916 //recover seq,seq_len
1917 if(ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) {
1918 seq_len=IW_ENCODE_SEQ_MAX_SIZE;
1919 memcpy(seq, ext->rx_seq, seq_len);
1921 //recover key,key_len
1923 key_len=ext->key_len;
1924 memcpy(key, &ext->key[0], key_len);
1927 memset(key_array, 0, 64);
1929 memcpy(key_array, key, key_len);
1930 if (key_len == 32) {
1931 // notice ! the oder
1932 memcpy(&key_array[16], &key[24], 8);
1933 memcpy(&key_array[24], &key[16], 8);
1937 /**************Translate iw_encode_ext to viawget_wpa_param****************/
1938 memcpy(param->addr, addr, ETH_ALEN);
1939 param->u.wpa_key.alg_name = (int)alg_name;
1940 param->u.wpa_key.set_tx = set_tx;
1941 param->u.wpa_key.key_index = key_idx;
1942 param->u.wpa_key.key_len = key_len;
1943 param->u.wpa_key.key = (u8 *)key_array;
1944 param->u.wpa_key.seq = (u8 *)seq;
1945 param->u.wpa_key.seq_len = seq_len;
1948 printk("param->u.wpa_key.alg_name =%d\n",param->u.wpa_key.alg_name);
1949 printk("param->addr=%02x:%02x:%02x:%02x:%02x:%02x\n",
1950 param->addr[0],param->addr[1],param->addr[2],
1951 param->addr[3],param->addr[4],param->addr[5]);
1952 printk("param->u.wpa_key.set_tx =%d\n",param->u.wpa_key.set_tx);
1953 printk("param->u.wpa_key.key_index =%d\n",param->u.wpa_key.key_index);
1954 printk("param->u.wpa_key.key_len =%d\n",param->u.wpa_key.key_len);
1955 printk("param->u.wpa_key.key =");
1956 for(ii=0;ii<param->u.wpa_key.key_len;ii++)
1957 printk("%02x:",param->u.wpa_key.key[ii]);
1959 printk("param->u.wpa_key.seq_len =%d\n",param->u.wpa_key.seq_len);
1960 printk("param->u.wpa_key.seq =");
1961 for(ii=0;ii<param->u.wpa_key.seq_len;ii++)
1962 printk("%02x:",param->u.wpa_key.seq[ii]);
1965 printk("...........\n");
1967 //****set if current action is Network Manager count??
1968 //****this method is so foolish,but there is no other way???
1969 if(param->u.wpa_key.alg_name == WPA_ALG_NONE) {
1970 if(param->u.wpa_key.key_index ==0) {
1971 pDevice->bwextstep0 = TRUE;
1973 if((pDevice->bwextstep0 = TRUE)&&(param->u.wpa_key.key_index ==1)) {
1974 pDevice->bwextstep0 = FALSE;
1975 pDevice->bwextstep1 = TRUE;
1977 if((pDevice->bwextstep1 = TRUE)&&(param->u.wpa_key.key_index ==2)) {
1978 pDevice->bwextstep1 = FALSE;
1979 pDevice->bwextstep2 = TRUE;
1981 if((pDevice->bwextstep2 = TRUE)&&(param->u.wpa_key.key_index ==3)) {
1982 pDevice->bwextstep2 = FALSE;
1983 pDevice->bwextstep3 = TRUE;
1986 if(pDevice->bwextstep3 == TRUE) {
1987 PRINT_K("SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n");
1988 pDevice->bwextstep0 = FALSE;
1989 pDevice->bwextstep1 = FALSE;
1990 pDevice->bwextstep2 = FALSE;
1991 pDevice->bwextstep3 = FALSE;
1992 pDevice->bWPASuppWextEnabled = TRUE;
1993 memset(pMgmt->abyDesireBSSID, 0xFF,6);
1994 KeyvInitTable(pDevice,&pDevice->sKey);
1998 spin_lock_irq(&pDevice->lock);
1999 ret = wpa_set_keys(pDevice, param, TRUE);
2000 spin_unlock_irq(&pDevice->lock);
2009 int iwctl_giwencodeext(struct net_device *dev,
2010 struct iw_request_info *info,
2011 struct iw_point *wrq,
2014 return -EOPNOTSUPP;;
2017 int iwctl_siwmlme(struct net_device *dev,
2018 struct iw_request_info * info,
2019 struct iw_point *wrq,
2022 PSDevice pDevice = (PSDevice)netdev_priv(dev);
2023 PSMgmtObject pMgmt = &(pDevice->sMgmtObj);
2024 struct iw_mlme *mlme = (struct iw_mlme *)extra;
2025 //u16 reason = cpu_to_le16(mlme->reason_code);
2028 if(memcmp(pMgmt->abyCurrBSSID, mlme->addr.sa_data, ETH_ALEN)){
2033 case IW_MLME_DEAUTH:
2034 //this command seems to be not complete,please test it --einsnliu
2035 //printk("iwctl_siwmlme--->send DEAUTH\n");
2036 //bScheduleCommand((HANDLE) pDevice, WLAN_CMD_DEAUTH, (PBYTE)&reason);
2038 case IW_MLME_DISASSOC:
2039 if(pDevice->bLinkPass == TRUE){
2040 PRINT_K("iwctl_siwmlme--->send DISASSOCIATE\n");
2041 bScheduleCommand((HANDLE)pDevice, WLAN_CMD_DISASSOCIATE, NULL);
2053 //End Add --//2008-0409-07, <Add> by Einsn Liu
2057 /*------------------------------------------------------------------*/
2059 * Structures to export the Wireless Handlers
2064 static const iw_handler iwctl_handler[] =
2066 (iw_handler) iwctl_commit, // SIOCSIWCOMMIT
2067 (iw_handler) iwctl_giwname, // SIOCGIWNAME
2068 (iw_handler) NULL, // SIOCSIWNWID
2069 (iw_handler) NULL, // SIOCGIWNWID
2070 (iw_handler) iwctl_siwfreq, // SIOCSIWFREQ
2071 (iw_handler) iwctl_giwfreq, // SIOCGIWFREQ
2072 (iw_handler) iwctl_siwmode, // SIOCSIWMODE
2073 (iw_handler) iwctl_giwmode, // SIOCGIWMODE
2074 (iw_handler) NULL, // SIOCSIWSENS
2075 (iw_handler) iwctl_giwsens, // SIOCGIWSENS
2076 (iw_handler) NULL, // SIOCSIWRANGE
2077 (iw_handler) iwctl_giwrange, // SIOCGIWRANGE
2078 (iw_handler) NULL, // SIOCSIWPRIV
2079 (iw_handler) NULL, // SIOCGIWPRIV
2080 (iw_handler) NULL, // SIOCSIWSTATS
2081 (iw_handler) NULL, // SIOCGIWSTATS
2082 (iw_handler) NULL, // SIOCSIWSPY
2083 (iw_handler) NULL, // SIOCGIWSPY
2084 (iw_handler) NULL, // -- hole --
2085 (iw_handler) NULL, // -- hole --
2086 (iw_handler) iwctl_siwap, // SIOCSIWAP
2087 (iw_handler) iwctl_giwap, // SIOCGIWAP
2088 (iw_handler) NULL, // -- hole -- 0x16
2089 (iw_handler) iwctl_giwaplist, // SIOCGIWAPLIST
2090 (iw_handler) iwctl_siwscan, // SIOCSIWSCAN
2091 (iw_handler) iwctl_giwscan, // SIOCGIWSCAN
2092 (iw_handler) iwctl_siwessid, // SIOCSIWESSID
2093 (iw_handler) iwctl_giwessid, // SIOCGIWESSID
2094 (iw_handler) NULL, // SIOCSIWNICKN
2095 (iw_handler) NULL, // SIOCGIWNICKN
2096 (iw_handler) NULL, // -- hole --
2097 (iw_handler) NULL, // -- hole --
2098 (iw_handler) iwctl_siwrate, // SIOCSIWRATE 0x20
2099 (iw_handler) iwctl_giwrate, // SIOCGIWRATE
2100 (iw_handler) iwctl_siwrts, // SIOCSIWRTS
2101 (iw_handler) iwctl_giwrts, // SIOCGIWRTS
2102 (iw_handler) iwctl_siwfrag, // SIOCSIWFRAG
2103 (iw_handler) iwctl_giwfrag, // SIOCGIWFRAG
2104 (iw_handler) NULL, // SIOCSIWTXPOW
2105 (iw_handler) NULL, // SIOCGIWTXPOW
2106 (iw_handler) iwctl_siwretry, // SIOCSIWRETRY
2107 (iw_handler) iwctl_giwretry, // SIOCGIWRETRY
2108 (iw_handler) iwctl_siwencode, // SIOCSIWENCODE
2109 (iw_handler) iwctl_giwencode, // SIOCGIWENCODE
2110 (iw_handler) iwctl_siwpower, // SIOCSIWPOWER
2111 (iw_handler) iwctl_giwpower, // SIOCGIWPOWER
2112 (iw_handler) NULL, // -- hole --
2113 (iw_handler) NULL, // -- hole --
2114 (iw_handler) iwctl_siwgenie, // SIOCSIWGENIE
2115 (iw_handler) iwctl_giwgenie, // SIOCGIWGENIE
2116 (iw_handler) iwctl_siwauth, // SIOCSIWAUTH
2117 (iw_handler) iwctl_giwauth, // SIOCGIWAUTH
2118 (iw_handler) iwctl_siwencodeext, // SIOCSIWENCODEEXT
2119 (iw_handler) iwctl_giwencodeext, // SIOCGIWENCODEEXT
2120 (iw_handler) NULL, // SIOCSIWPMKSA
2121 (iw_handler) NULL, // -- hole --
2126 static const iw_handler iwctl_handler[] =
2128 (iw_handler) iwctl_commit, // SIOCSIWCOMMIT
2129 (iw_handler) NULL, // SIOCGIWNAME
2130 (iw_handler) NULL, // SIOCSIWNWID
2131 (iw_handler) NULL, // SIOCGIWNWID
2132 (iw_handler) NULL, // SIOCSIWFREQ
2133 (iw_handler) NULL, // SIOCGIWFREQ
2134 (iw_handler) NULL, // SIOCSIWMODE
2135 (iw_handler) NULL, // SIOCGIWMODE
2136 (iw_handler) NULL, // SIOCSIWSENS
2137 (iw_handler) NULL, // SIOCGIWSENS
2138 (iw_handler) NULL, // SIOCSIWRANGE
2139 (iw_handler) iwctl_giwrange, // SIOCGIWRANGE
2140 (iw_handler) NULL, // SIOCSIWPRIV
2141 (iw_handler) NULL, // SIOCGIWPRIV
2142 (iw_handler) NULL, // SIOCSIWSTATS
2143 (iw_handler) NULL, // SIOCGIWSTATS
2144 (iw_handler) NULL, // SIOCSIWSPY
2145 (iw_handler) NULL, // SIOCGIWSPY
2146 (iw_handler) NULL, // -- hole --
2147 (iw_handler) NULL, // -- hole --
2148 (iw_handler) NULL, // SIOCSIWAP
2149 (iw_handler) NULL, // SIOCGIWAP
2150 (iw_handler) NULL, // -- hole -- 0x16
2151 (iw_handler) NULL, // SIOCGIWAPLIST
2152 (iw_handler) iwctl_siwscan, // SIOCSIWSCAN
2153 (iw_handler) iwctl_giwscan, // SIOCGIWSCAN
2154 (iw_handler) NULL, // SIOCSIWESSID
2155 (iw_handler) NULL, // SIOCGIWESSID
2156 (iw_handler) NULL, // SIOCSIWNICKN
2157 (iw_handler) NULL, // SIOCGIWNICKN
2158 (iw_handler) NULL, // -- hole --
2159 (iw_handler) NULL, // -- hole --
2160 (iw_handler) NULL, // SIOCSIWRATE 0x20
2161 (iw_handler) NULL, // SIOCGIWRATE
2162 (iw_handler) NULL, // SIOCSIWRTS
2163 (iw_handler) NULL, // SIOCGIWRTS
2164 (iw_handler) NULL, // SIOCSIWFRAG
2165 (iw_handler) NULL, // SIOCGIWFRAG
2166 (iw_handler) NULL, // SIOCSIWTXPOW
2167 (iw_handler) NULL, // SIOCGIWTXPOW
2168 (iw_handler) NULL, // SIOCSIWRETRY
2169 (iw_handler) NULL, // SIOCGIWRETRY
2170 (iw_handler) NULL, // SIOCSIWENCODE
2171 (iw_handler) NULL, // SIOCGIWENCODE
2172 (iw_handler) NULL, // SIOCSIWPOWER
2173 (iw_handler) NULL, // SIOCGIWPOWER
2174 (iw_handler) NULL, // -- hole --
2175 (iw_handler) NULL, // -- hole --
2176 (iw_handler) NULL, // SIOCSIWGENIE
2177 (iw_handler) NULL, // SIOCGIWGENIE
2178 (iw_handler) NULL, // SIOCSIWAUTH
2179 (iw_handler) NULL, // SIOCGIWAUTH
2180 (iw_handler) NULL, // SIOCSIWENCODEEXT
2181 (iw_handler) NULL, // SIOCGIWENCODEEXT
2182 (iw_handler) NULL, // SIOCSIWPMKSA
2183 (iw_handler) NULL, // -- hole --
2187 static const iw_handler iwctl_private_handler[] =
2189 NULL, // SIOCIWFIRSTPRIV
2193 struct iw_priv_args iwctl_private_args[] = {
2195 IW_PRIV_TYPE_CHAR | 1024, 0,
2201 const struct iw_handler_def iwctl_handler_def =
2203 .get_wireless_stats = &iwctl_get_wireless_stats,
2204 .num_standard = sizeof(iwctl_handler)/sizeof(iw_handler),
2205 // .num_private = sizeof(iwctl_private_handler)/sizeof(iw_handler),
2206 // .num_private_args = sizeof(iwctl_private_args)/sizeof(struct iw_priv_args),
2208 .num_private_args = 0,
2209 .standard = (iw_handler *) iwctl_handler,
2210 // .private = (iw_handler *) iwctl_private_handler,
2211 // .private_args = (struct iw_priv_args *)iwctl_private_args,
2213 .private_args = NULL,