blob: da3350d44da10c052f9403268908488f36fbcc41 [file] [log] [blame]
Jiri Bencf0706e82007-05-05 11:45:53 -07001/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2005-2006, Devicescape Software, Inc.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */
9
10#include <linux/module.h>
11#include <linux/init.h>
12#include <linux/netdevice.h>
13#include <linux/types.h>
14#include <linux/slab.h>
15#include <linux/skbuff.h>
16#include <linux/etherdevice.h>
17#include <linux/if_arp.h>
18#include <linux/wireless.h>
19#include <net/iw_handler.h>
20#include <asm/uaccess.h>
21
22#include <net/mac80211.h>
23#include "ieee80211_i.h"
Jiri Bencf0706e82007-05-05 11:45:53 -070024#include "ieee80211_rate.h"
25#include "wpa.h"
26#include "aes_ccm.h"
Jiri Bencf0706e82007-05-05 11:45:53 -070027
Johannes Bergb708e612007-09-14 11:10:25 -040028
Jiri Bencf0706e82007-05-05 11:45:53 -070029static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
Johannes Berg628a1402007-09-26 17:53:17 +020030 int idx, int alg, int remove,
31 int set_tx_key, const u8 *_key,
32 size_t key_len)
Jiri Bencf0706e82007-05-05 11:45:53 -070033{
34 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
35 int ret = 0;
36 struct sta_info *sta;
Johannes Berg11a843b2007-08-28 17:01:55 -040037 struct ieee80211_key *key;
Jiri Bencf0706e82007-05-05 11:45:53 -070038 struct ieee80211_sub_if_data *sdata;
39
40 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
41
Volker Braun139c3a02007-09-14 11:10:25 -040042 if (idx < 0 || idx >= NUM_DEFAULT_KEYS) {
43 printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d\n",
44 dev->name, idx);
45 return -EINVAL;
46 }
47
Jiri Bencf0706e82007-05-05 11:45:53 -070048 if (is_broadcast_ether_addr(sta_addr)) {
49 sta = NULL;
Jiri Bencf0706e82007-05-05 11:45:53 -070050 key = sdata->keys[idx];
Jiri Bencf0706e82007-05-05 11:45:53 -070051 } else {
52 set_tx_key = 0;
Volker Braun139c3a02007-09-14 11:10:25 -040053 /*
54 * According to the standard, the key index of a pairwise
55 * key must be zero. However, some AP are broken when it
56 * comes to WEP key indices, so we work around this.
57 */
58 if (idx != 0 && alg != ALG_WEP) {
Jiri Bencf0706e82007-05-05 11:45:53 -070059 printk(KERN_DEBUG "%s: set_encrypt - non-zero idx for "
60 "individual key\n", dev->name);
61 return -EINVAL;
62 }
63
64 sta = sta_info_get(local, sta_addr);
65 if (!sta) {
66#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
Joe Perches0795af52007-10-03 17:59:30 -070067 DECLARE_MAC_BUF(mac);
Jiri Bencf0706e82007-05-05 11:45:53 -070068 printk(KERN_DEBUG "%s: set_encrypt - unknown addr "
Joe Perches0795af52007-10-03 17:59:30 -070069 "%s\n",
70 dev->name, print_mac(mac, sta_addr));
Jiri Bencf0706e82007-05-05 11:45:53 -070071#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
72
73 return -ENOENT;
74 }
75
76 key = sta->key;
77 }
78
Johannes Berg628a1402007-09-26 17:53:17 +020079 if (remove) {
Jiri Bencf0706e82007-05-05 11:45:53 -070080 ieee80211_key_free(key);
81 key = NULL;
82 } else {
Johannes Berg11a843b2007-08-28 17:01:55 -040083 /*
Johannes Bergd4e46a32007-09-14 11:10:24 -040084 * Automatically frees any old key if present.
Johannes Berg11a843b2007-08-28 17:01:55 -040085 */
Johannes Berg11a843b2007-08-28 17:01:55 -040086 key = ieee80211_key_alloc(sdata, sta, alg, idx, key_len, _key);
Jiri Bencf0706e82007-05-05 11:45:53 -070087 if (!key) {
88 ret = -ENOMEM;
89 goto err_out;
90 }
Jiri Bencf0706e82007-05-05 11:45:53 -070091 }
92
Johannes Berg11a843b2007-08-28 17:01:55 -040093 if (set_tx_key || (!sta && !sdata->default_key && key))
94 ieee80211_set_default_key(sdata, idx);
Jiri Bencf0706e82007-05-05 11:45:53 -070095
Johannes Berg11a843b2007-08-28 17:01:55 -040096 ret = 0;
97 err_out:
Jiri Bencf0706e82007-05-05 11:45:53 -070098 if (sta)
99 sta_info_put(sta);
100 return ret;
101}
102
103static int ieee80211_ioctl_siwgenie(struct net_device *dev,
104 struct iw_request_info *info,
105 struct iw_point *data, char *extra)
106{
107 struct ieee80211_sub_if_data *sdata;
Jiri Bencf0706e82007-05-05 11:45:53 -0700108
109 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
Johannes Bergddd3d2b2007-09-26 17:53:20 +0200110
111 if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME)
112 return -EOPNOTSUPP;
113
Jiri Bencf0706e82007-05-05 11:45:53 -0700114 if (sdata->type == IEEE80211_IF_TYPE_STA ||
115 sdata->type == IEEE80211_IF_TYPE_IBSS) {
116 int ret = ieee80211_sta_set_extra_ie(dev, extra, data->length);
117 if (ret)
118 return ret;
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400119 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700120 ieee80211_sta_req_auth(dev, &sdata->u.sta);
121 return 0;
122 }
123
Jiri Bencf0706e82007-05-05 11:45:53 -0700124 return -EOPNOTSUPP;
125}
126
Jiri Bencf0706e82007-05-05 11:45:53 -0700127static int ieee80211_ioctl_giwname(struct net_device *dev,
128 struct iw_request_info *info,
129 char *name, char *extra)
130{
131 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
132
133 switch (local->hw.conf.phymode) {
134 case MODE_IEEE80211A:
135 strcpy(name, "IEEE 802.11a");
136 break;
137 case MODE_IEEE80211B:
138 strcpy(name, "IEEE 802.11b");
139 break;
140 case MODE_IEEE80211G:
141 strcpy(name, "IEEE 802.11g");
142 break;
Jiri Bencf0706e82007-05-05 11:45:53 -0700143 default:
144 strcpy(name, "IEEE 802.11");
145 break;
146 }
147
148 return 0;
149}
150
151
152static int ieee80211_ioctl_giwrange(struct net_device *dev,
153 struct iw_request_info *info,
154 struct iw_point *data, char *extra)
155{
156 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
157 struct iw_range *range = (struct iw_range *) extra;
Hong Liu333af2f2007-07-10 19:32:08 +0200158 struct ieee80211_hw_mode *mode = NULL;
159 int c = 0;
Jiri Bencf0706e82007-05-05 11:45:53 -0700160
161 data->length = sizeof(struct iw_range);
162 memset(range, 0, sizeof(struct iw_range));
163
164 range->we_version_compiled = WIRELESS_EXT;
165 range->we_version_source = 21;
166 range->retry_capa = IW_RETRY_LIMIT;
167 range->retry_flags = IW_RETRY_LIMIT;
168 range->min_retry = 0;
169 range->max_retry = 255;
170 range->min_rts = 0;
171 range->max_rts = 2347;
172 range->min_frag = 256;
173 range->max_frag = 2346;
174
175 range->encoding_size[0] = 5;
176 range->encoding_size[1] = 13;
177 range->num_encoding_sizes = 2;
178 range->max_encoding_tokens = NUM_DEFAULT_KEYS;
179
180 range->max_qual.qual = local->hw.max_signal;
181 range->max_qual.level = local->hw.max_rssi;
182 range->max_qual.noise = local->hw.max_noise;
183 range->max_qual.updated = local->wstats_flags;
184
185 range->avg_qual.qual = local->hw.max_signal/2;
186 range->avg_qual.level = 0;
187 range->avg_qual.noise = 0;
188 range->avg_qual.updated = local->wstats_flags;
189
190 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
191 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
192
Hong Liu333af2f2007-07-10 19:32:08 +0200193 list_for_each_entry(mode, &local->modes_list, list) {
194 int i = 0;
195
196 if (!(local->enabled_modes & (1 << mode->mode)) ||
197 (local->hw_modes & local->enabled_modes &
198 (1 << MODE_IEEE80211G) && mode->mode == MODE_IEEE80211B))
199 continue;
200
201 while (i < mode->num_channels && c < IW_MAX_FREQUENCIES) {
202 struct ieee80211_channel *chan = &mode->channels[i];
203
204 if (chan->flag & IEEE80211_CHAN_W_SCAN) {
205 range->freq[c].i = chan->chan;
206 range->freq[c].m = chan->freq * 100000;
207 range->freq[c].e = 1;
208 c++;
209 }
210 i++;
211 }
212 }
213 range->num_channels = c;
214 range->num_frequency = c;
215
Jiri Bencf0706e82007-05-05 11:45:53 -0700216 IW_EVENT_CAPA_SET_KERNEL(range->event_capa);
217 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWTHRSPY);
218 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP);
219 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN);
220
221 return 0;
222}
223
224
Jiri Bencf0706e82007-05-05 11:45:53 -0700225static int ieee80211_ioctl_siwmode(struct net_device *dev,
226 struct iw_request_info *info,
227 __u32 *mode, char *extra)
228{
229 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
230 int type;
231
232 if (sdata->type == IEEE80211_IF_TYPE_VLAN)
233 return -EOPNOTSUPP;
234
235 switch (*mode) {
236 case IW_MODE_INFRA:
237 type = IEEE80211_IF_TYPE_STA;
238 break;
239 case IW_MODE_ADHOC:
240 type = IEEE80211_IF_TYPE_IBSS;
241 break;
242 case IW_MODE_MONITOR:
243 type = IEEE80211_IF_TYPE_MNTR;
244 break;
245 default:
246 return -EINVAL;
247 }
248
249 if (type == sdata->type)
250 return 0;
251 if (netif_running(dev))
252 return -EBUSY;
253
254 ieee80211_if_reinit(dev);
255 ieee80211_if_set_type(dev, type);
256
257 return 0;
258}
259
260
261static int ieee80211_ioctl_giwmode(struct net_device *dev,
262 struct iw_request_info *info,
263 __u32 *mode, char *extra)
264{
265 struct ieee80211_sub_if_data *sdata;
266
267 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
268 switch (sdata->type) {
269 case IEEE80211_IF_TYPE_AP:
270 *mode = IW_MODE_MASTER;
271 break;
272 case IEEE80211_IF_TYPE_STA:
273 *mode = IW_MODE_INFRA;
274 break;
275 case IEEE80211_IF_TYPE_IBSS:
276 *mode = IW_MODE_ADHOC;
277 break;
278 case IEEE80211_IF_TYPE_MNTR:
279 *mode = IW_MODE_MONITOR;
280 break;
281 case IEEE80211_IF_TYPE_WDS:
282 *mode = IW_MODE_REPEAT;
283 break;
284 case IEEE80211_IF_TYPE_VLAN:
285 *mode = IW_MODE_SECOND; /* FIXME */
286 break;
287 default:
288 *mode = IW_MODE_AUTO;
289 break;
290 }
291 return 0;
292}
293
294int ieee80211_set_channel(struct ieee80211_local *local, int channel, int freq)
295{
296 struct ieee80211_hw_mode *mode;
297 int c, set = 0;
298 int ret = -EINVAL;
299
300 list_for_each_entry(mode, &local->modes_list, list) {
301 if (!(local->enabled_modes & (1 << mode->mode)))
302 continue;
303 for (c = 0; c < mode->num_channels; c++) {
304 struct ieee80211_channel *chan = &mode->channels[c];
305 if (chan->flag & IEEE80211_CHAN_W_SCAN &&
306 ((chan->chan == channel) || (chan->freq == freq))) {
Jiri Bencf0706e82007-05-05 11:45:53 -0700307 local->oper_channel = chan;
308 local->oper_hw_mode = mode;
Johannes Berg58a9ac12007-10-12 21:24:07 +0200309 set = 1;
310 break;
Jiri Bencf0706e82007-05-05 11:45:53 -0700311 }
312 }
Johannes Berg58a9ac12007-10-12 21:24:07 +0200313 if (set)
314 break;
Jiri Bencf0706e82007-05-05 11:45:53 -0700315 }
316
317 if (set) {
318 if (local->sta_scanning)
319 ret = 0;
320 else
321 ret = ieee80211_hw_config(local);
322
323 rate_control_clear(local);
324 }
325
326 return ret;
327}
328
329static int ieee80211_ioctl_siwfreq(struct net_device *dev,
330 struct iw_request_info *info,
331 struct iw_freq *freq, char *extra)
332{
333 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
334 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
335
336 if (sdata->type == IEEE80211_IF_TYPE_STA)
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400337 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700338
339 /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */
340 if (freq->e == 0) {
341 if (freq->m < 0) {
342 if (sdata->type == IEEE80211_IF_TYPE_STA)
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400343 sdata->u.sta.flags |=
344 IEEE80211_STA_AUTO_CHANNEL_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700345 return 0;
346 } else
347 return ieee80211_set_channel(local, freq->m, -1);
348 } else {
349 int i, div = 1000000;
350 for (i = 0; i < freq->e; i++)
351 div /= 10;
352 if (div > 0)
353 return ieee80211_set_channel(local, -1, freq->m / div);
354 else
355 return -EINVAL;
356 }
357}
358
359
360static int ieee80211_ioctl_giwfreq(struct net_device *dev,
361 struct iw_request_info *info,
362 struct iw_freq *freq, char *extra)
363{
364 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
365
366 /* TODO: in station mode (Managed/Ad-hoc) might need to poll low-level
367 * driver for the current channel with firmware-based management */
368
369 freq->m = local->hw.conf.freq;
370 freq->e = 6;
371
372 return 0;
373}
374
375
376static int ieee80211_ioctl_siwessid(struct net_device *dev,
377 struct iw_request_info *info,
378 struct iw_point *data, char *ssid)
379{
Jiri Bencf0706e82007-05-05 11:45:53 -0700380 struct ieee80211_sub_if_data *sdata;
381 size_t len = data->length;
382
383 /* iwconfig uses nul termination in SSID.. */
384 if (len > 0 && ssid[len - 1] == '\0')
385 len--;
386
387 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
388 if (sdata->type == IEEE80211_IF_TYPE_STA ||
389 sdata->type == IEEE80211_IF_TYPE_IBSS) {
390 int ret;
Johannes Bergddd3d2b2007-09-26 17:53:20 +0200391 if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) {
Jiri Bencf0706e82007-05-05 11:45:53 -0700392 if (len > IEEE80211_MAX_SSID_LEN)
393 return -EINVAL;
394 memcpy(sdata->u.sta.ssid, ssid, len);
395 sdata->u.sta.ssid_len = len;
396 return 0;
397 }
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400398 if (data->flags)
399 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_SSID_SEL;
400 else
401 sdata->u.sta.flags |= IEEE80211_STA_AUTO_SSID_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700402 ret = ieee80211_sta_set_ssid(dev, ssid, len);
403 if (ret)
404 return ret;
405 ieee80211_sta_req_auth(dev, &sdata->u.sta);
406 return 0;
407 }
408
409 if (sdata->type == IEEE80211_IF_TYPE_AP) {
410 memcpy(sdata->u.ap.ssid, ssid, len);
411 memset(sdata->u.ap.ssid + len, 0,
412 IEEE80211_MAX_SSID_LEN - len);
413 sdata->u.ap.ssid_len = len;
414 return ieee80211_if_config(dev);
415 }
416 return -EOPNOTSUPP;
417}
418
419
420static int ieee80211_ioctl_giwessid(struct net_device *dev,
421 struct iw_request_info *info,
422 struct iw_point *data, char *ssid)
423{
424 size_t len;
425
426 struct ieee80211_sub_if_data *sdata;
427 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
428 if (sdata->type == IEEE80211_IF_TYPE_STA ||
429 sdata->type == IEEE80211_IF_TYPE_IBSS) {
430 int res = ieee80211_sta_get_ssid(dev, ssid, &len);
431 if (res == 0) {
432 data->length = len;
433 data->flags = 1;
434 } else
435 data->flags = 0;
436 return res;
437 }
438
439 if (sdata->type == IEEE80211_IF_TYPE_AP) {
440 len = sdata->u.ap.ssid_len;
441 if (len > IW_ESSID_MAX_SIZE)
442 len = IW_ESSID_MAX_SIZE;
443 memcpy(ssid, sdata->u.ap.ssid, len);
444 data->length = len;
445 data->flags = 1;
446 return 0;
447 }
448 return -EOPNOTSUPP;
449}
450
451
452static int ieee80211_ioctl_siwap(struct net_device *dev,
453 struct iw_request_info *info,
454 struct sockaddr *ap_addr, char *extra)
455{
Jiri Bencf0706e82007-05-05 11:45:53 -0700456 struct ieee80211_sub_if_data *sdata;
457
458 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
459 if (sdata->type == IEEE80211_IF_TYPE_STA ||
460 sdata->type == IEEE80211_IF_TYPE_IBSS) {
461 int ret;
Johannes Bergddd3d2b2007-09-26 17:53:20 +0200462 if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) {
Jiri Bencf0706e82007-05-05 11:45:53 -0700463 memcpy(sdata->u.sta.bssid, (u8 *) &ap_addr->sa_data,
464 ETH_ALEN);
465 return 0;
466 }
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400467 if (is_zero_ether_addr((u8 *) &ap_addr->sa_data))
468 sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL |
469 IEEE80211_STA_AUTO_CHANNEL_SEL;
470 else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data))
471 sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700472 else
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400473 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700474 ret = ieee80211_sta_set_bssid(dev, (u8 *) &ap_addr->sa_data);
475 if (ret)
476 return ret;
477 ieee80211_sta_req_auth(dev, &sdata->u.sta);
478 return 0;
479 } else if (sdata->type == IEEE80211_IF_TYPE_WDS) {
480 if (memcmp(sdata->u.wds.remote_addr, (u8 *) &ap_addr->sa_data,
481 ETH_ALEN) == 0)
482 return 0;
483 return ieee80211_if_update_wds(dev, (u8 *) &ap_addr->sa_data);
484 }
485
486 return -EOPNOTSUPP;
487}
488
489
490static int ieee80211_ioctl_giwap(struct net_device *dev,
491 struct iw_request_info *info,
492 struct sockaddr *ap_addr, char *extra)
493{
494 struct ieee80211_sub_if_data *sdata;
495
496 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
497 if (sdata->type == IEEE80211_IF_TYPE_STA ||
498 sdata->type == IEEE80211_IF_TYPE_IBSS) {
499 ap_addr->sa_family = ARPHRD_ETHER;
500 memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN);
501 return 0;
502 } else if (sdata->type == IEEE80211_IF_TYPE_WDS) {
503 ap_addr->sa_family = ARPHRD_ETHER;
504 memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN);
505 return 0;
506 }
507
508 return -EOPNOTSUPP;
509}
510
511
512static int ieee80211_ioctl_siwscan(struct net_device *dev,
513 struct iw_request_info *info,
Bill Moss107acb22007-10-10 16:23:55 -0400514 union iwreq_data *wrqu, char *extra)
Jiri Bencf0706e82007-05-05 11:45:53 -0700515{
516 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
517 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
Bill Moss107acb22007-10-10 16:23:55 -0400518 struct iw_scan_req *req = NULL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700519 u8 *ssid = NULL;
520 size_t ssid_len = 0;
521
522 if (!netif_running(dev))
523 return -ENETDOWN;
524
John W. Linvilled114f392007-10-17 21:16:16 -0700525 switch (sdata->type) {
526 case IEEE80211_IF_TYPE_STA:
527 case IEEE80211_IF_TYPE_IBSS:
528 if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
529 ssid = sdata->u.sta.ssid;
530 ssid_len = sdata->u.sta.ssid_len;
531 }
532 break;
533 case IEEE80211_IF_TYPE_AP:
534 if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
535 ssid = sdata->u.ap.ssid;
536 ssid_len = sdata->u.ap.ssid_len;
537 }
538 break;
539 default:
540 return -EOPNOTSUPP;
541 }
542
543 /* if SSID was specified explicitly then use that */
Bill Moss107acb22007-10-10 16:23:55 -0400544 if (wrqu->data.length == sizeof(struct iw_scan_req) &&
545 wrqu->data.flags & IW_SCAN_THIS_ESSID) {
546 req = (struct iw_scan_req *)extra;
547 ssid = req->essid;
548 ssid_len = req->essid_len;
Jiri Bencf0706e82007-05-05 11:45:53 -0700549 }
Daniel Drakef27b62d2007-07-27 15:43:24 +0200550
Jiri Bencf0706e82007-05-05 11:45:53 -0700551 return ieee80211_sta_req_scan(dev, ssid, ssid_len);
552}
553
554
555static int ieee80211_ioctl_giwscan(struct net_device *dev,
556 struct iw_request_info *info,
557 struct iw_point *data, char *extra)
558{
559 int res;
560 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
561 if (local->sta_scanning)
562 return -EAGAIN;
563 res = ieee80211_sta_scan_results(dev, extra, data->length);
564 if (res >= 0) {
565 data->length = res;
566 return 0;
567 }
568 data->length = 0;
569 return res;
570}
571
572
Larry Finger1fd5e582007-07-10 19:32:10 +0200573static int ieee80211_ioctl_siwrate(struct net_device *dev,
574 struct iw_request_info *info,
575 struct iw_param *rate, char *extra)
576{
577 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
578 struct ieee80211_hw_mode *mode;
579 int i;
580 u32 target_rate = rate->value / 100000;
581 struct ieee80211_sub_if_data *sdata;
582
583 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
584 if (!sdata->bss)
585 return -ENODEV;
586 mode = local->oper_hw_mode;
587 /* target_rate = -1, rate->fixed = 0 means auto only, so use all rates
588 * target_rate = X, rate->fixed = 1 means only rate X
589 * target_rate = X, rate->fixed = 0 means all rates <= X */
590 sdata->bss->max_ratectrl_rateidx = -1;
591 sdata->bss->force_unicast_rateidx = -1;
592 if (rate->value < 0)
593 return 0;
Andrew Lutomirski5cdfed52008-01-03 21:03:19 -0800594 for (i=0; i < mode->num_rates; i++) {
Larry Finger1fd5e582007-07-10 19:32:10 +0200595 struct ieee80211_rate *rates = &mode->rates[i];
596 int this_rate = rates->rate;
597
Larry Finger1fd5e582007-07-10 19:32:10 +0200598 if (target_rate == this_rate) {
599 sdata->bss->max_ratectrl_rateidx = i;
600 if (rate->fixed)
601 sdata->bss->force_unicast_rateidx = i;
Andrew Lutomirski5cdfed52008-01-03 21:03:19 -0800602 return 0;
Larry Finger1fd5e582007-07-10 19:32:10 +0200603 }
604 }
Andrew Lutomirski5cdfed52008-01-03 21:03:19 -0800605 return -EINVAL;
Larry Finger1fd5e582007-07-10 19:32:10 +0200606}
607
Larry Fingerb3d88ad2007-06-10 17:57:33 -0700608static int ieee80211_ioctl_giwrate(struct net_device *dev,
609 struct iw_request_info *info,
610 struct iw_param *rate, char *extra)
611{
612 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
613 struct sta_info *sta;
614 struct ieee80211_sub_if_data *sdata;
615
616 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
617 if (sdata->type == IEEE80211_IF_TYPE_STA)
618 sta = sta_info_get(local, sdata->u.sta.bssid);
619 else
620 return -EOPNOTSUPP;
621 if (!sta)
622 return -ENODEV;
623 if (sta->txrate < local->oper_hw_mode->num_rates)
624 rate->value = local->oper_hw_mode->rates[sta->txrate].rate * 100000;
625 else
626 rate->value = 0;
627 sta_info_put(sta);
628 return 0;
629}
630
Michael Buesch61609bc2007-09-20 22:06:39 +0200631static int ieee80211_ioctl_siwtxpower(struct net_device *dev,
632 struct iw_request_info *info,
633 union iwreq_data *data, char *extra)
634{
635 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
636 bool need_reconfig = 0;
Mattias Nissler6a432952007-10-24 23:30:36 +0200637 u8 new_power_level;
Michael Buesch61609bc2007-09-20 22:06:39 +0200638
639 if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM)
640 return -EINVAL;
641 if (data->txpower.flags & IW_TXPOW_RANGE)
642 return -EINVAL;
Michael Buesch61609bc2007-09-20 22:06:39 +0200643
Mattias Nissler6a432952007-10-24 23:30:36 +0200644 if (data->txpower.fixed) {
645 new_power_level = data->txpower.value;
646 } else {
647 /* Automatic power level. Get the px power from the current
648 * channel. */
649 struct ieee80211_channel* chan = local->oper_channel;
650 if (!chan)
651 return -EINVAL;
652
653 new_power_level = chan->power_level;
654 }
655
656 if (local->hw.conf.power_level != new_power_level) {
657 local->hw.conf.power_level = new_power_level;
Michael Buesch61609bc2007-09-20 22:06:39 +0200658 need_reconfig = 1;
659 }
Mattias Nissler6a432952007-10-24 23:30:36 +0200660
Michael Buesch61609bc2007-09-20 22:06:39 +0200661 if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) {
662 local->hw.conf.radio_enabled = !(data->txpower.disabled);
663 need_reconfig = 1;
664 }
Mattias Nissler6a432952007-10-24 23:30:36 +0200665
Michael Buesch61609bc2007-09-20 22:06:39 +0200666 if (need_reconfig) {
667 ieee80211_hw_config(local);
668 /* The return value of hw_config is not of big interest here,
669 * as it doesn't say that it failed because of _this_ config
670 * change or something else. Ignore it. */
671 }
672
673 return 0;
674}
675
Larry Fingerfe6aa302007-08-10 11:23:20 -0500676static int ieee80211_ioctl_giwtxpower(struct net_device *dev,
677 struct iw_request_info *info,
678 union iwreq_data *data, char *extra)
679{
680 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
681
682 data->txpower.fixed = 1;
683 data->txpower.disabled = !(local->hw.conf.radio_enabled);
684 data->txpower.value = local->hw.conf.power_level;
685 data->txpower.flags = IW_TXPOW_DBM;
686
687 return 0;
688}
689
Jiri Bencf0706e82007-05-05 11:45:53 -0700690static int ieee80211_ioctl_siwrts(struct net_device *dev,
691 struct iw_request_info *info,
692 struct iw_param *rts, char *extra)
693{
694 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
695
696 if (rts->disabled)
697 local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
698 else if (rts->value < 0 || rts->value > IEEE80211_MAX_RTS_THRESHOLD)
699 return -EINVAL;
700 else
701 local->rts_threshold = rts->value;
702
703 /* If the wlan card performs RTS/CTS in hardware/firmware,
704 * configure it here */
705
706 if (local->ops->set_rts_threshold)
707 local->ops->set_rts_threshold(local_to_hw(local),
708 local->rts_threshold);
709
710 return 0;
711}
712
713static int ieee80211_ioctl_giwrts(struct net_device *dev,
714 struct iw_request_info *info,
715 struct iw_param *rts, char *extra)
716{
717 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
718
719 rts->value = local->rts_threshold;
720 rts->disabled = (rts->value >= IEEE80211_MAX_RTS_THRESHOLD);
721 rts->fixed = 1;
722
723 return 0;
724}
725
726
727static int ieee80211_ioctl_siwfrag(struct net_device *dev,
728 struct iw_request_info *info,
729 struct iw_param *frag, char *extra)
730{
731 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
732
733 if (frag->disabled)
734 local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
735 else if (frag->value < 256 ||
736 frag->value > IEEE80211_MAX_FRAG_THRESHOLD)
737 return -EINVAL;
738 else {
739 /* Fragment length must be even, so strip LSB. */
740 local->fragmentation_threshold = frag->value & ~0x1;
741 }
742
743 /* If the wlan card performs fragmentation in hardware/firmware,
744 * configure it here */
745
746 if (local->ops->set_frag_threshold)
747 local->ops->set_frag_threshold(
748 local_to_hw(local),
749 local->fragmentation_threshold);
750
751 return 0;
752}
753
754static int ieee80211_ioctl_giwfrag(struct net_device *dev,
755 struct iw_request_info *info,
756 struct iw_param *frag, char *extra)
757{
758 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
759
760 frag->value = local->fragmentation_threshold;
761 frag->disabled = (frag->value >= IEEE80211_MAX_RTS_THRESHOLD);
762 frag->fixed = 1;
763
764 return 0;
765}
766
767
768static int ieee80211_ioctl_siwretry(struct net_device *dev,
769 struct iw_request_info *info,
770 struct iw_param *retry, char *extra)
771{
772 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
773
774 if (retry->disabled ||
775 (retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT)
776 return -EINVAL;
777
778 if (retry->flags & IW_RETRY_MAX)
779 local->long_retry_limit = retry->value;
780 else if (retry->flags & IW_RETRY_MIN)
781 local->short_retry_limit = retry->value;
782 else {
783 local->long_retry_limit = retry->value;
784 local->short_retry_limit = retry->value;
785 }
786
787 if (local->ops->set_retry_limit) {
788 return local->ops->set_retry_limit(
789 local_to_hw(local),
790 local->short_retry_limit,
791 local->long_retry_limit);
792 }
793
794 return 0;
795}
796
797
798static int ieee80211_ioctl_giwretry(struct net_device *dev,
799 struct iw_request_info *info,
800 struct iw_param *retry, char *extra)
801{
802 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
803
804 retry->disabled = 0;
805 if (retry->flags == 0 || retry->flags & IW_RETRY_MIN) {
806 /* first return min value, iwconfig will ask max value
807 * later if needed */
808 retry->flags |= IW_RETRY_LIMIT;
809 retry->value = local->short_retry_limit;
810 if (local->long_retry_limit != local->short_retry_limit)
811 retry->flags |= IW_RETRY_MIN;
812 return 0;
813 }
814 if (retry->flags & IW_RETRY_MAX) {
815 retry->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
816 retry->value = local->long_retry_limit;
817 }
818
819 return 0;
820}
821
Jiri Bencf0706e82007-05-05 11:45:53 -0700822static int ieee80211_ioctl_siwmlme(struct net_device *dev,
823 struct iw_request_info *info,
824 struct iw_point *data, char *extra)
825{
826 struct ieee80211_sub_if_data *sdata;
827 struct iw_mlme *mlme = (struct iw_mlme *) extra;
828
829 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
830 if (sdata->type != IEEE80211_IF_TYPE_STA &&
831 sdata->type != IEEE80211_IF_TYPE_IBSS)
832 return -EINVAL;
833
834 switch (mlme->cmd) {
835 case IW_MLME_DEAUTH:
836 /* TODO: mlme->addr.sa_data */
837 return ieee80211_sta_deauthenticate(dev, mlme->reason_code);
838 case IW_MLME_DISASSOC:
839 /* TODO: mlme->addr.sa_data */
840 return ieee80211_sta_disassociate(dev, mlme->reason_code);
841 default:
842 return -EOPNOTSUPP;
843 }
844}
845
846
847static int ieee80211_ioctl_siwencode(struct net_device *dev,
848 struct iw_request_info *info,
849 struct iw_point *erq, char *keybuf)
850{
851 struct ieee80211_sub_if_data *sdata;
852 int idx, i, alg = ALG_WEP;
853 u8 bcaddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
Johannes Berg628a1402007-09-26 17:53:17 +0200854 int remove = 0;
Jiri Bencf0706e82007-05-05 11:45:53 -0700855
856 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
857
858 idx = erq->flags & IW_ENCODE_INDEX;
859 if (idx == 0) {
860 if (sdata->default_key)
861 for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
862 if (sdata->default_key == sdata->keys[i]) {
863 idx = i;
864 break;
865 }
866 }
867 } else if (idx < 1 || idx > 4)
868 return -EINVAL;
869 else
870 idx--;
871
872 if (erq->flags & IW_ENCODE_DISABLED)
Johannes Berg628a1402007-09-26 17:53:17 +0200873 remove = 1;
Jiri Bencf0706e82007-05-05 11:45:53 -0700874 else if (erq->length == 0) {
875 /* No key data - just set the default TX key index */
Johannes Berg11a843b2007-08-28 17:01:55 -0400876 ieee80211_set_default_key(sdata, idx);
Jiri Bencf0706e82007-05-05 11:45:53 -0700877 return 0;
878 }
879
880 return ieee80211_set_encryption(
881 dev, bcaddr,
Johannes Berg628a1402007-09-26 17:53:17 +0200882 idx, alg, remove,
Jiri Bencf0706e82007-05-05 11:45:53 -0700883 !sdata->default_key,
884 keybuf, erq->length);
885}
886
887
888static int ieee80211_ioctl_giwencode(struct net_device *dev,
889 struct iw_request_info *info,
890 struct iw_point *erq, char *key)
891{
892 struct ieee80211_sub_if_data *sdata;
893 int idx, i;
894
895 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
896
897 idx = erq->flags & IW_ENCODE_INDEX;
898 if (idx < 1 || idx > 4) {
899 idx = -1;
900 if (!sdata->default_key)
901 idx = 0;
902 else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
903 if (sdata->default_key == sdata->keys[i]) {
904 idx = i;
905 break;
906 }
907 }
908 if (idx < 0)
909 return -EINVAL;
910 } else
911 idx--;
912
913 erq->flags = idx + 1;
914
915 if (!sdata->keys[idx]) {
916 erq->length = 0;
917 erq->flags |= IW_ENCODE_DISABLED;
918 return 0;
919 }
920
Johannes Berg8f20fc22007-08-28 17:01:54 -0400921 memcpy(key, sdata->keys[idx]->conf.key,
Johannes Berg11a843b2007-08-28 17:01:55 -0400922 min_t(int, erq->length, sdata->keys[idx]->conf.keylen));
Johannes Berg8f20fc22007-08-28 17:01:54 -0400923 erq->length = sdata->keys[idx]->conf.keylen;
Jiri Bencf0706e82007-05-05 11:45:53 -0700924 erq->flags |= IW_ENCODE_ENABLED;
925
926 return 0;
927}
928
929static int ieee80211_ioctl_siwauth(struct net_device *dev,
930 struct iw_request_info *info,
931 struct iw_param *data, char *extra)
932{
Jiri Bencf0706e82007-05-05 11:45:53 -0700933 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
934 int ret = 0;
935
936 switch (data->flags & IW_AUTH_INDEX) {
937 case IW_AUTH_WPA_VERSION:
938 case IW_AUTH_CIPHER_PAIRWISE:
939 case IW_AUTH_CIPHER_GROUP:
940 case IW_AUTH_WPA_ENABLED:
941 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
Jiri Bencf0706e82007-05-05 11:45:53 -0700942 case IW_AUTH_KEY_MGMT:
Johannes Berg5b98b1f2007-11-03 13:11:10 +0000943 break;
944 case IW_AUTH_PRIVACY_INVOKED:
Jiri Bencf0706e82007-05-05 11:45:53 -0700945 if (sdata->type != IEEE80211_IF_TYPE_STA)
946 ret = -EINVAL;
947 else {
Johannes Berg5b98b1f2007-11-03 13:11:10 +0000948 sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED;
Jiri Bencf0706e82007-05-05 11:45:53 -0700949 /*
Johannes Berg5b98b1f2007-11-03 13:11:10 +0000950 * Privacy invoked by wpa_supplicant, store the
951 * value and allow associating to a protected
952 * network without having a key up front.
Jiri Bencf0706e82007-05-05 11:45:53 -0700953 */
Johannes Berg5b98b1f2007-11-03 13:11:10 +0000954 if (data->value)
955 sdata->u.sta.flags |=
956 IEEE80211_STA_PRIVACY_INVOKED;
Jiri Bencf0706e82007-05-05 11:45:53 -0700957 }
958 break;
959 case IW_AUTH_80211_AUTH_ALG:
960 if (sdata->type == IEEE80211_IF_TYPE_STA ||
961 sdata->type == IEEE80211_IF_TYPE_IBSS)
962 sdata->u.sta.auth_algs = data->value;
963 else
964 ret = -EOPNOTSUPP;
965 break;
Jiri Bencf0706e82007-05-05 11:45:53 -0700966 default:
967 ret = -EOPNOTSUPP;
968 break;
969 }
970 return ret;
971}
972
973/* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
974static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev)
975{
976 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
977 struct iw_statistics *wstats = &local->wstats;
978 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
979 struct sta_info *sta = NULL;
980
981 if (sdata->type == IEEE80211_IF_TYPE_STA ||
982 sdata->type == IEEE80211_IF_TYPE_IBSS)
983 sta = sta_info_get(local, sdata->u.sta.bssid);
984 if (!sta) {
985 wstats->discard.fragment = 0;
986 wstats->discard.misc = 0;
987 wstats->qual.qual = 0;
988 wstats->qual.level = 0;
989 wstats->qual.noise = 0;
990 wstats->qual.updated = IW_QUAL_ALL_INVALID;
991 } else {
992 wstats->qual.level = sta->last_rssi;
993 wstats->qual.qual = sta->last_signal;
994 wstats->qual.noise = sta->last_noise;
995 wstats->qual.updated = local->wstats_flags;
996 sta_info_put(sta);
997 }
998 return wstats;
999}
1000
1001static int ieee80211_ioctl_giwauth(struct net_device *dev,
1002 struct iw_request_info *info,
1003 struct iw_param *data, char *extra)
1004{
1005 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1006 int ret = 0;
1007
1008 switch (data->flags & IW_AUTH_INDEX) {
1009 case IW_AUTH_80211_AUTH_ALG:
1010 if (sdata->type == IEEE80211_IF_TYPE_STA ||
1011 sdata->type == IEEE80211_IF_TYPE_IBSS)
1012 data->value = sdata->u.sta.auth_algs;
1013 else
1014 ret = -EOPNOTSUPP;
1015 break;
1016 default:
1017 ret = -EOPNOTSUPP;
1018 break;
1019 }
1020 return ret;
1021}
1022
1023
1024static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
1025 struct iw_request_info *info,
1026 struct iw_point *erq, char *extra)
1027{
1028 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1029 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
Johannes Berg628a1402007-09-26 17:53:17 +02001030 int uninitialized_var(alg), idx, i, remove = 0;
Jiri Bencf0706e82007-05-05 11:45:53 -07001031
1032 switch (ext->alg) {
1033 case IW_ENCODE_ALG_NONE:
Johannes Berg628a1402007-09-26 17:53:17 +02001034 remove = 1;
Jiri Bencf0706e82007-05-05 11:45:53 -07001035 break;
1036 case IW_ENCODE_ALG_WEP:
1037 alg = ALG_WEP;
1038 break;
1039 case IW_ENCODE_ALG_TKIP:
1040 alg = ALG_TKIP;
1041 break;
1042 case IW_ENCODE_ALG_CCMP:
1043 alg = ALG_CCMP;
1044 break;
1045 default:
1046 return -EOPNOTSUPP;
1047 }
1048
1049 if (erq->flags & IW_ENCODE_DISABLED)
Johannes Berg628a1402007-09-26 17:53:17 +02001050 remove = 1;
Jiri Bencf0706e82007-05-05 11:45:53 -07001051
1052 idx = erq->flags & IW_ENCODE_INDEX;
1053 if (idx < 1 || idx > 4) {
1054 idx = -1;
1055 if (!sdata->default_key)
1056 idx = 0;
1057 else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
1058 if (sdata->default_key == sdata->keys[i]) {
1059 idx = i;
1060 break;
1061 }
1062 }
1063 if (idx < 0)
1064 return -EINVAL;
1065 } else
1066 idx--;
1067
1068 return ieee80211_set_encryption(dev, ext->addr.sa_data, idx, alg,
Johannes Berg628a1402007-09-26 17:53:17 +02001069 remove,
Jiri Bencf0706e82007-05-05 11:45:53 -07001070 ext->ext_flags &
1071 IW_ENCODE_EXT_SET_TX_KEY,
1072 ext->key, ext->key_len);
1073}
1074
1075
Jiri Bencf0706e82007-05-05 11:45:53 -07001076/* Structures to export the Wireless Handlers */
1077
1078static const iw_handler ieee80211_handler[] =
1079{
1080 (iw_handler) NULL, /* SIOCSIWCOMMIT */
1081 (iw_handler) ieee80211_ioctl_giwname, /* SIOCGIWNAME */
1082 (iw_handler) NULL, /* SIOCSIWNWID */
1083 (iw_handler) NULL, /* SIOCGIWNWID */
1084 (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */
1085 (iw_handler) ieee80211_ioctl_giwfreq, /* SIOCGIWFREQ */
1086 (iw_handler) ieee80211_ioctl_siwmode, /* SIOCSIWMODE */
1087 (iw_handler) ieee80211_ioctl_giwmode, /* SIOCGIWMODE */
1088 (iw_handler) NULL, /* SIOCSIWSENS */
1089 (iw_handler) NULL, /* SIOCGIWSENS */
1090 (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */
1091 (iw_handler) ieee80211_ioctl_giwrange, /* SIOCGIWRANGE */
1092 (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */
1093 (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */
1094 (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */
1095 (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */
Johannes Berg5d4ecd92007-09-14 11:10:24 -04001096 (iw_handler) NULL, /* SIOCSIWSPY */
1097 (iw_handler) NULL, /* SIOCGIWSPY */
1098 (iw_handler) NULL, /* SIOCSIWTHRSPY */
1099 (iw_handler) NULL, /* SIOCGIWTHRSPY */
Jiri Bencf0706e82007-05-05 11:45:53 -07001100 (iw_handler) ieee80211_ioctl_siwap, /* SIOCSIWAP */
1101 (iw_handler) ieee80211_ioctl_giwap, /* SIOCGIWAP */
1102 (iw_handler) ieee80211_ioctl_siwmlme, /* SIOCSIWMLME */
1103 (iw_handler) NULL, /* SIOCGIWAPLIST */
1104 (iw_handler) ieee80211_ioctl_siwscan, /* SIOCSIWSCAN */
1105 (iw_handler) ieee80211_ioctl_giwscan, /* SIOCGIWSCAN */
1106 (iw_handler) ieee80211_ioctl_siwessid, /* SIOCSIWESSID */
1107 (iw_handler) ieee80211_ioctl_giwessid, /* SIOCGIWESSID */
1108 (iw_handler) NULL, /* SIOCSIWNICKN */
1109 (iw_handler) NULL, /* SIOCGIWNICKN */
1110 (iw_handler) NULL, /* -- hole -- */
1111 (iw_handler) NULL, /* -- hole -- */
Larry Finger1fd5e582007-07-10 19:32:10 +02001112 (iw_handler) ieee80211_ioctl_siwrate, /* SIOCSIWRATE */
Larry Fingerb3d88ad2007-06-10 17:57:33 -07001113 (iw_handler) ieee80211_ioctl_giwrate, /* SIOCGIWRATE */
Jiri Bencf0706e82007-05-05 11:45:53 -07001114 (iw_handler) ieee80211_ioctl_siwrts, /* SIOCSIWRTS */
1115 (iw_handler) ieee80211_ioctl_giwrts, /* SIOCGIWRTS */
1116 (iw_handler) ieee80211_ioctl_siwfrag, /* SIOCSIWFRAG */
1117 (iw_handler) ieee80211_ioctl_giwfrag, /* SIOCGIWFRAG */
Michael Buesch61609bc2007-09-20 22:06:39 +02001118 (iw_handler) ieee80211_ioctl_siwtxpower, /* SIOCSIWTXPOW */
Larry Fingerfe6aa302007-08-10 11:23:20 -05001119 (iw_handler) ieee80211_ioctl_giwtxpower, /* SIOCGIWTXPOW */
Jiri Bencf0706e82007-05-05 11:45:53 -07001120 (iw_handler) ieee80211_ioctl_siwretry, /* SIOCSIWRETRY */
1121 (iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */
1122 (iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */
1123 (iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */
1124 (iw_handler) NULL, /* SIOCSIWPOWER */
1125 (iw_handler) NULL, /* SIOCGIWPOWER */
1126 (iw_handler) NULL, /* -- hole -- */
1127 (iw_handler) NULL, /* -- hole -- */
1128 (iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */
1129 (iw_handler) NULL, /* SIOCGIWGENIE */
1130 (iw_handler) ieee80211_ioctl_siwauth, /* SIOCSIWAUTH */
1131 (iw_handler) ieee80211_ioctl_giwauth, /* SIOCGIWAUTH */
1132 (iw_handler) ieee80211_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */
1133 (iw_handler) NULL, /* SIOCGIWENCODEEXT */
1134 (iw_handler) NULL, /* SIOCSIWPMKSA */
1135 (iw_handler) NULL, /* -- hole -- */
1136};
1137
Jiri Bencf0706e82007-05-05 11:45:53 -07001138const struct iw_handler_def ieee80211_iw_handler_def =
1139{
1140 .num_standard = ARRAY_SIZE(ieee80211_handler),
Jiri Bencf0706e82007-05-05 11:45:53 -07001141 .standard = (iw_handler *) ieee80211_handler,
Jiri Bencf0706e82007-05-05 11:45:53 -07001142 .get_wireless_stats = ieee80211_get_wireless_stats,
1143};