42 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
49 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
50 #define SUPPORTED_WIRELESS_EXT 18
52 #define SUPPORTED_WIRELESS_EXT 17
55 static const long frequency_list[] = {
56 2412, 2417, 2422, 2427, 2432, 2437, 2442, 2447, 2452, 2457, 2462, 2467, 2472, 2484,
57 4915, 4920, 4925, 4935, 4940, 4945, 4960, 4980,
58 5035, 5040, 5045, 5055, 5060, 5080, 5170, 5180, 5190, 5200, 5210, 5220, 5230, 5240,
59 5260, 5280, 5300, 5320, 5500, 5520, 5540, 5560, 5580, 5600, 5620, 5640, 5660, 5680,
60 5700, 5745, 5765, 5785, 5805, 5825
75 pDevice->
wstats.qual.level = ldBm;
76 pDevice->
wstats.qual.noise = 0;
77 pDevice->
wstats.qual.updated = 1;
78 pDevice->
wstats.discard.nwid = 0;
79 pDevice->
wstats.discard.code = 0;
80 pDevice->
wstats.discard.fragment = 0;
82 pDevice->
wstats.discard.misc = 0;
83 pDevice->
wstats.miss.beacon = 0;
91 char *wrq,
char *
extra)
93 strcpy(wrq,
"802.11-a/b/g");
103 PSDevice pDevice = netdev_priv(dev);
116 PRINT_K(
"SIOCSIWSCAN(overlap??)-->In scanning...\n");
123 PRINT_K(
"wireless_send_event--->SIOCGIWSCAN(scan done)\n");
124 memset(&wrqu, 0,
sizeof(wrqu));
129 spin_lock_irq(&pDevice->
lock);
140 if (pItemSSID->abySSID[req->
essid_len - 1] ==
'\0') {
150 spin_unlock_irq(&pDevice->
lock);
162 spin_unlock_irq(&pDevice->
lock);
176 PSDevice pDevice = netdev_priv(dev);
182 char *current_ev =
extra;
184 char *current_val =
NULL;
197 if (current_ev >= end_buf)
202 memset(&iwe, 0,
sizeof(iwe));
206 current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe,
IW_EV_ADDR_LEN);
208 memset(&iwe, 0,
sizeof(iwe));
211 iwe.
u.
data.length = pItemSSID->len;
212 iwe.
u.
data.flags = 1;
213 current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID);
215 memset(&iwe, 0,
sizeof(iwe));
222 current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe,
IW_EV_UINT_LEN);
226 memset(&iwe, 0,
sizeof(iwe));
228 iwe.
u.
freq.m = pBSS->uChannel;
231 current_ev = iwe_stream_add_event(info, current_ev,end_buf, &iwe,
IW_EV_FREQ_LEN);
233 int f = (
int)pBSS->uChannel - 1;
236 iwe.
u.
freq.m = frequency_list[
f] * 100000;
239 current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe,
IW_EV_FREQ_LEN);
241 memset(&iwe, 0,
sizeof(iwe));
244 iwe.
u.
qual.level = ldBm;
245 iwe.
u.
qual.noise = 0;
248 iwe.
u.
qual.qual = 100;
252 iwe.
u.
qual.qual = (40 - (-ldBm - 50)) * 100 / 40;
253 iwe.
u.
qual.updated = 7;
255 current_ev = iwe_stream_add_event(info, current_ev, end_buf, &iwe,
IW_EV_QUAL_LEN);
257 memset(&iwe, 0,
sizeof(iwe));
259 iwe.
u.
data.length = 0;
264 current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pItemSSID->abySSID);
266 memset(&iwe, 0,
sizeof(iwe));
271 for (kk = 0; kk < 12; kk++) {
272 if (pSuppRates->abyRates[kk] == 0)
275 iwe.
u.
bitrate.value = ((pSuppRates->abyRates[kk] & 0x7f) * 500000);
276 current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe,
IW_EV_PARAM_LEN);
278 for (kk = 0; kk < 8; kk++) {
279 if (pExtSuppRates->abyRates[kk] == 0)
282 iwe.
u.
bitrate.value = ((pExtSuppRates->abyRates[kk] & 0x7f) * 500000);
283 current_val = iwe_stream_add_value(info, current_ev, current_val, end_buf, &iwe,
IW_EV_PARAM_LEN);
286 if ((current_val - current_ev) > IW_EV_LCP_LEN)
287 current_ev = current_val;
289 memset(&iwe, 0,
sizeof(iwe));
291 sprintf(buf,
"bcn_int=%d", pBSS->wBeaconInterval);
293 current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, buf);
296 memset(&iwe, 0,
sizeof(iwe));
298 iwe.
u.
data.length = pBSS->wWPALen;
299 current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pBSS->byWPAIE);
303 memset(&iwe, 0,
sizeof(iwe));
305 iwe.
u.
data.length = pBSS->wRSNLen;
306 current_ev = iwe_stream_add_point(info, current_ev, end_buf, &iwe, pBSS->byRSNIE);
320 PSDevice pDevice = netdev_priv(dev);
326 if ((wrq->
e == 1) && (wrq->
m >= (
int)2.412e8) &&
327 (wrq->
m <= (
int)2.487e8)) {
328 int f = wrq->
m / 100000;
330 while ((c < 14) && (f != frequency_list[c]))
336 if ((wrq->
m > 14) || (wrq->
e > 0)) {
340 if ((channel < 1) || (channel > 14)) {
358 PSDevice pDevice = netdev_priv(dev);
363 #ifdef WEXT_USECHANNELS
371 wrq->
m = frequency_list[
f] * 100000;
384 PSDevice pDevice = netdev_priv(dev);
444 PSDevice pDevice = netdev_priv(dev);
476 BYTE abySupportedRates[13] = {
477 0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48,
491 for (i = 0; i < 14; i++) {
492 range->
freq[
k].i = i + 1;
493 range->
freq[
k].m = frequency_list[
i] * 100000;
494 range->
freq[k++].e = 1;
503 for (i = 0; i < 13; i++) {
504 range->
bitrate[
i] = abySupportedRates[
i] * 500000;
573 PSDevice pDevice = netdev_priv(dev);
587 PRINT_K(
"SIOCSIWAP:invalid desired BSSID return!\n");
595 unsigned uSameBssidNum = 0;
598 !compare_ether_addr(pMgmt->
sBSSList[ii].abyBSSID,
603 if (uSameBssidNum >= 2) {
604 PRINT_K(
"SIOCSIWAP:ignore for desired AP in hidden mode\n");
621 PSDevice pDevice = netdev_priv(dev);
649 PSDevice pDevice = netdev_priv(dev);
669 memcpy(sock[jj].sa_data, pBSS->abyBSSID, 6);
671 qual[jj].
level = pBSS->uRSSI;
691 PSDevice pDevice = netdev_priv(dev);
702 if (wrq->
flags == 0) {
706 PRINT_K(
"set essid to 'any' \n");
707 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
718 if (pItemSSID->abySSID[wrq->
length - 1] ==
'\0') {
720 pItemSSID->len = wrq->
length - 1;
722 pItemSSID->len = wrq->
length;
724 PRINT_K(
"set essid to %s \n", pItemSSID->abySSID);
727 if (pItemSSID->len==0) {
732 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
740 unsigned uSameBssidNum = 0;
748 PRINT_K(
"SIOCSIWESSID:hidden ssid site survey before associate.......\n");
762 !compare_ether_addr(pMgmt->
sBSSList[ii].abyBSSID,
767 if (uSameBssidNum >= 2) {
768 PRINT_K(
"SIOCSIWESSID:hidden ssid directly associate.......\n");
798 PSDevice pDevice = netdev_priv(dev);
809 memcpy(extra, pItemSSID->abySSID, pItemSSID->len);
810 extra[pItemSSID->len] =
'\0';
812 wrq->
length = pItemSSID->len;
822 PSDevice pDevice = netdev_priv(dev);
826 BYTE abySupportedRates[13] = {
827 0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30, 0x48,
849 for (i = 0; i < 13; i++) {
850 if (normvalue == abySupportedRates[i]) {
857 if (wrq->
value == -1) {
859 for (i = 0; i < 13; i++) {
860 if (abySupportedRates[i] == 0)
875 if (wrq->
fixed != 0) {
899 PSDevice pDevice = netdev_priv(dev);
904 BYTE abySupportedRates[13] = {
905 0x02, 0x04, 0x0B, 0x16, 0x0c, 0x12, 0x18, 0x24, 0x30,
906 0x48, 0x60, 0x6C, 0x90
930 wrq->
value = brate * 500000;
942 PSDevice pDevice = netdev_priv(dev);
961 PSDevice pDevice = netdev_priv(dev);
976 PSDevice pDevice = netdev_priv(dev);
978 int fthr = wrq->
value;
984 if ((fthr < 256) || (fthr > 2312)) {
999 PSDevice pDevice = netdev_priv(dev);
1014 PSDevice pDevice = netdev_priv(dev);
1046 PSDevice pDevice = netdev_priv(dev);
1072 PSDevice pDevice = netdev_priv(dev);
1109 for (ii = 0; ii < wrq->
length; ii++)
1113 spin_lock_irq(&pDevice->
lock);
1116 dwKeyIndex | (1 << 31),
1120 spin_unlock_irq(&pDevice->
lock);
1143 spin_lock_irq(&pDevice->
lock);
1146 spin_unlock_irq(&pDevice->
lock);
1158 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
1167 PSDevice pDevice = netdev_priv(dev);
1215 wrq->
flags |= index + 1;
1225 PSDevice pDevice = netdev_priv(dev);
1273 PSDevice pDevice = netdev_priv(dev);
1299 PSDevice pDevice = netdev_priv(dev);
1314 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
1319 PSDevice pDevice = netdev_priv(dev);
1322 static int wpa_version = 0;
1323 static int pairwise = 0;
1328 wpa_version = wrq->
value;
1330 PRINT_K(
"iwctl_siwauth:set WPADEV to disable at 1??????\n");
1332 PRINT_K(
"iwctl_siwauth:set WPADEV to WPA1******\n");
1334 PRINT_K(
"iwctl_siwauth:set WPADEV to WPA2******\n");
1338 pairwise = wrq->
value;
1339 PRINT_K(
"iwctl_siwauth:set pairwise=%d\n", pairwise);
1365 PRINT_K(
"iwctl_siwauth(wpa_version=%d):set KEY_MGMT=%d\n", wpa_version,wrq->
value);
1371 if (wrq->
value == 0){
1384 PRINT_K(
"iwctl_siwauth:set AUTH_ALG=%d\n", wrq->
value);
1405 PRINT_K(
"iwctl_siwauth:set WPADEV to disaable at 2?????\n");
1424 PSDevice pDevice = netdev_priv(dev);
1429 if ((wrq->
length < 2) || (extra[1] + 2 != wrq->
length)) {
1455 PSDevice pDevice = netdev_priv(dev);
1477 PSDevice pDevice = netdev_priv(dev);
1495 PRINT_K(
"SIOCSIWENCODEEXT...... \n");
1497 blen =
sizeof(*param);
1540 memset(key_array, 0, 64);
1542 memcpy(key_array, key, key_len);
1543 if (key_len == 32) {
1545 memcpy(&key_array[16], &key[24], 8);
1546 memcpy(&key_array[24], &key[16], 8);
1554 param->
u.
wpa_key.key_index = key_idx;
1563 if (param->
u.
wpa_key.key_index ==0) {
1580 PRINT_K(
"SIOCSIWENCODEEXT:Enable WPA WEXT SUPPORT!!!!!\n");
1590 spin_lock_irq(&pDevice->
lock);
1592 spin_unlock_irq(&pDevice->
lock);
1608 PSDevice pDevice = netdev_priv(dev);
1621 PRINT_K(
"iwctl_siwmlme--->send DISASSOCIATE\n");
1703 .num_standard =
sizeof(iwctl_handler) /
sizeof(
iw_handler),
1705 .num_private_args = 0,
1708 .private_args =
NULL,