blob: 2604e21c05a8f18322910e154b04cc2fa0c29305 [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"
Ivo van Doorncdcb0062008-01-07 19:45:24 +010024#include "ieee80211_led.h"
Jiri Bencf0706e82007-05-05 11:45:53 -070025#include "ieee80211_rate.h"
26#include "wpa.h"
27#include "aes_ccm.h"
Jiri Bencf0706e82007-05-05 11:45:53 -070028
Johannes Bergb708e612007-09-14 11:10:25 -040029
Jiri Bencf0706e82007-05-05 11:45:53 -070030static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
Johannes Berg628a1402007-09-26 17:53:17 +020031 int idx, int alg, int remove,
32 int set_tx_key, const u8 *_key,
33 size_t key_len)
Jiri Bencf0706e82007-05-05 11:45:53 -070034{
35 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
36 int ret = 0;
37 struct sta_info *sta;
Johannes Berg11a843b2007-08-28 17:01:55 -040038 struct ieee80211_key *key;
Jiri Bencf0706e82007-05-05 11:45:53 -070039 struct ieee80211_sub_if_data *sdata;
40
41 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
42
Volker Braun139c3a02007-09-14 11:10:25 -040043 if (idx < 0 || idx >= NUM_DEFAULT_KEYS) {
44 printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d\n",
45 dev->name, idx);
46 return -EINVAL;
47 }
48
Jiri Bencf0706e82007-05-05 11:45:53 -070049 if (is_broadcast_ether_addr(sta_addr)) {
50 sta = NULL;
Jiri Bencf0706e82007-05-05 11:45:53 -070051 key = sdata->keys[idx];
Jiri Bencf0706e82007-05-05 11:45:53 -070052 } else {
53 set_tx_key = 0;
Volker Braun139c3a02007-09-14 11:10:25 -040054 /*
55 * According to the standard, the key index of a pairwise
56 * key must be zero. However, some AP are broken when it
57 * comes to WEP key indices, so we work around this.
58 */
59 if (idx != 0 && alg != ALG_WEP) {
Jiri Bencf0706e82007-05-05 11:45:53 -070060 printk(KERN_DEBUG "%s: set_encrypt - non-zero idx for "
61 "individual key\n", dev->name);
62 return -EINVAL;
63 }
64
65 sta = sta_info_get(local, sta_addr);
66 if (!sta) {
67#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
Joe Perches0795af52007-10-03 17:59:30 -070068 DECLARE_MAC_BUF(mac);
Jiri Bencf0706e82007-05-05 11:45:53 -070069 printk(KERN_DEBUG "%s: set_encrypt - unknown addr "
Joe Perches0795af52007-10-03 17:59:30 -070070 "%s\n",
71 dev->name, print_mac(mac, sta_addr));
Jiri Bencf0706e82007-05-05 11:45:53 -070072#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
73
74 return -ENOENT;
75 }
76
77 key = sta->key;
78 }
79
Johannes Berg628a1402007-09-26 17:53:17 +020080 if (remove) {
Jiri Bencf0706e82007-05-05 11:45:53 -070081 ieee80211_key_free(key);
82 key = NULL;
83 } else {
Johannes Berg11a843b2007-08-28 17:01:55 -040084 /*
Johannes Bergd4e46a32007-09-14 11:10:24 -040085 * Automatically frees any old key if present.
Johannes Berg11a843b2007-08-28 17:01:55 -040086 */
Johannes Berg11a843b2007-08-28 17:01:55 -040087 key = ieee80211_key_alloc(sdata, sta, alg, idx, key_len, _key);
Jiri Bencf0706e82007-05-05 11:45:53 -070088 if (!key) {
89 ret = -ENOMEM;
90 goto err_out;
91 }
Jiri Bencf0706e82007-05-05 11:45:53 -070092 }
93
Johannes Berg11a843b2007-08-28 17:01:55 -040094 if (set_tx_key || (!sta && !sdata->default_key && key))
95 ieee80211_set_default_key(sdata, idx);
Jiri Bencf0706e82007-05-05 11:45:53 -070096
Johannes Berg11a843b2007-08-28 17:01:55 -040097 ret = 0;
98 err_out:
Jiri Bencf0706e82007-05-05 11:45:53 -070099 if (sta)
100 sta_info_put(sta);
101 return ret;
102}
103
104static int ieee80211_ioctl_siwgenie(struct net_device *dev,
105 struct iw_request_info *info,
106 struct iw_point *data, char *extra)
107{
108 struct ieee80211_sub_if_data *sdata;
Jiri Bencf0706e82007-05-05 11:45:53 -0700109
110 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
Johannes Bergddd3d2b2007-09-26 17:53:20 +0200111
112 if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME)
113 return -EOPNOTSUPP;
114
Jiri Bencf0706e82007-05-05 11:45:53 -0700115 if (sdata->type == IEEE80211_IF_TYPE_STA ||
116 sdata->type == IEEE80211_IF_TYPE_IBSS) {
117 int ret = ieee80211_sta_set_extra_ie(dev, extra, data->length);
118 if (ret)
119 return ret;
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400120 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700121 ieee80211_sta_req_auth(dev, &sdata->u.sta);
122 return 0;
123 }
124
Jiri Bencf0706e82007-05-05 11:45:53 -0700125 return -EOPNOTSUPP;
126}
127
Jiri Bencf0706e82007-05-05 11:45:53 -0700128static int ieee80211_ioctl_giwname(struct net_device *dev,
129 struct iw_request_info *info,
130 char *name, char *extra)
131{
132 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
133
134 switch (local->hw.conf.phymode) {
135 case MODE_IEEE80211A:
136 strcpy(name, "IEEE 802.11a");
137 break;
138 case MODE_IEEE80211B:
139 strcpy(name, "IEEE 802.11b");
140 break;
141 case MODE_IEEE80211G:
142 strcpy(name, "IEEE 802.11g");
143 break;
Jiri Bencf0706e82007-05-05 11:45:53 -0700144 default:
145 strcpy(name, "IEEE 802.11");
146 break;
147 }
148
149 return 0;
150}
151
152
153static int ieee80211_ioctl_giwrange(struct net_device *dev,
154 struct iw_request_info *info,
155 struct iw_point *data, char *extra)
156{
157 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
158 struct iw_range *range = (struct iw_range *) extra;
Hong Liu333af2f2007-07-10 19:32:08 +0200159 struct ieee80211_hw_mode *mode = NULL;
160 int c = 0;
Jiri Bencf0706e82007-05-05 11:45:53 -0700161
162 data->length = sizeof(struct iw_range);
163 memset(range, 0, sizeof(struct iw_range));
164
165 range->we_version_compiled = WIRELESS_EXT;
166 range->we_version_source = 21;
167 range->retry_capa = IW_RETRY_LIMIT;
168 range->retry_flags = IW_RETRY_LIMIT;
169 range->min_retry = 0;
170 range->max_retry = 255;
171 range->min_rts = 0;
172 range->max_rts = 2347;
173 range->min_frag = 256;
174 range->max_frag = 2346;
175
176 range->encoding_size[0] = 5;
177 range->encoding_size[1] = 13;
178 range->num_encoding_sizes = 2;
179 range->max_encoding_tokens = NUM_DEFAULT_KEYS;
180
181 range->max_qual.qual = local->hw.max_signal;
182 range->max_qual.level = local->hw.max_rssi;
183 range->max_qual.noise = local->hw.max_noise;
184 range->max_qual.updated = local->wstats_flags;
185
186 range->avg_qual.qual = local->hw.max_signal/2;
187 range->avg_qual.level = 0;
188 range->avg_qual.noise = 0;
189 range->avg_qual.updated = local->wstats_flags;
190
191 range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 |
192 IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP;
193
Hong Liu333af2f2007-07-10 19:32:08 +0200194 list_for_each_entry(mode, &local->modes_list, list) {
195 int i = 0;
196
197 if (!(local->enabled_modes & (1 << mode->mode)) ||
198 (local->hw_modes & local->enabled_modes &
199 (1 << MODE_IEEE80211G) && mode->mode == MODE_IEEE80211B))
200 continue;
201
202 while (i < mode->num_channels && c < IW_MAX_FREQUENCIES) {
203 struct ieee80211_channel *chan = &mode->channels[i];
204
205 if (chan->flag & IEEE80211_CHAN_W_SCAN) {
206 range->freq[c].i = chan->chan;
207 range->freq[c].m = chan->freq * 100000;
208 range->freq[c].e = 1;
209 c++;
210 }
211 i++;
212 }
213 }
214 range->num_channels = c;
215 range->num_frequency = c;
216
Jiri Bencf0706e82007-05-05 11:45:53 -0700217 IW_EVENT_CAPA_SET_KERNEL(range->event_capa);
218 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWTHRSPY);
219 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP);
220 IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN);
221
Dan Williams374fdfb2007-12-12 10:25:07 -0500222 range->scan_capa |= IW_SCAN_CAPA_ESSID;
223
Jiri Bencf0706e82007-05-05 11:45:53 -0700224 return 0;
225}
226
227
Jiri Bencf0706e82007-05-05 11:45:53 -0700228static int ieee80211_ioctl_siwmode(struct net_device *dev,
229 struct iw_request_info *info,
230 __u32 *mode, char *extra)
231{
232 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
233 int type;
234
235 if (sdata->type == IEEE80211_IF_TYPE_VLAN)
236 return -EOPNOTSUPP;
237
238 switch (*mode) {
239 case IW_MODE_INFRA:
240 type = IEEE80211_IF_TYPE_STA;
241 break;
242 case IW_MODE_ADHOC:
243 type = IEEE80211_IF_TYPE_IBSS;
244 break;
245 case IW_MODE_MONITOR:
246 type = IEEE80211_IF_TYPE_MNTR;
247 break;
248 default:
249 return -EINVAL;
250 }
251
252 if (type == sdata->type)
253 return 0;
254 if (netif_running(dev))
255 return -EBUSY;
256
257 ieee80211_if_reinit(dev);
258 ieee80211_if_set_type(dev, type);
259
260 return 0;
261}
262
263
264static int ieee80211_ioctl_giwmode(struct net_device *dev,
265 struct iw_request_info *info,
266 __u32 *mode, char *extra)
267{
268 struct ieee80211_sub_if_data *sdata;
269
270 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
271 switch (sdata->type) {
272 case IEEE80211_IF_TYPE_AP:
273 *mode = IW_MODE_MASTER;
274 break;
275 case IEEE80211_IF_TYPE_STA:
276 *mode = IW_MODE_INFRA;
277 break;
278 case IEEE80211_IF_TYPE_IBSS:
279 *mode = IW_MODE_ADHOC;
280 break;
281 case IEEE80211_IF_TYPE_MNTR:
282 *mode = IW_MODE_MONITOR;
283 break;
284 case IEEE80211_IF_TYPE_WDS:
285 *mode = IW_MODE_REPEAT;
286 break;
287 case IEEE80211_IF_TYPE_VLAN:
288 *mode = IW_MODE_SECOND; /* FIXME */
289 break;
290 default:
291 *mode = IW_MODE_AUTO;
292 break;
293 }
294 return 0;
295}
296
297int ieee80211_set_channel(struct ieee80211_local *local, int channel, int freq)
298{
299 struct ieee80211_hw_mode *mode;
300 int c, set = 0;
301 int ret = -EINVAL;
302
303 list_for_each_entry(mode, &local->modes_list, list) {
304 if (!(local->enabled_modes & (1 << mode->mode)))
305 continue;
306 for (c = 0; c < mode->num_channels; c++) {
307 struct ieee80211_channel *chan = &mode->channels[c];
308 if (chan->flag & IEEE80211_CHAN_W_SCAN &&
309 ((chan->chan == channel) || (chan->freq == freq))) {
Jiri Bencf0706e82007-05-05 11:45:53 -0700310 local->oper_channel = chan;
311 local->oper_hw_mode = mode;
Johannes Berg58a9ac12007-10-12 21:24:07 +0200312 set = 1;
313 break;
Jiri Bencf0706e82007-05-05 11:45:53 -0700314 }
315 }
Johannes Berg58a9ac12007-10-12 21:24:07 +0200316 if (set)
317 break;
Jiri Bencf0706e82007-05-05 11:45:53 -0700318 }
319
320 if (set) {
Zhu Yiece8edd2007-11-22 10:53:21 +0800321 if (local->sta_sw_scanning)
Jiri Bencf0706e82007-05-05 11:45:53 -0700322 ret = 0;
323 else
324 ret = ieee80211_hw_config(local);
325
326 rate_control_clear(local);
327 }
328
329 return ret;
330}
331
332static int ieee80211_ioctl_siwfreq(struct net_device *dev,
333 struct iw_request_info *info,
334 struct iw_freq *freq, char *extra)
335{
336 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
337 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
338
339 if (sdata->type == IEEE80211_IF_TYPE_STA)
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400340 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700341
342 /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */
343 if (freq->e == 0) {
344 if (freq->m < 0) {
345 if (sdata->type == IEEE80211_IF_TYPE_STA)
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400346 sdata->u.sta.flags |=
347 IEEE80211_STA_AUTO_CHANNEL_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700348 return 0;
349 } else
350 return ieee80211_set_channel(local, freq->m, -1);
351 } else {
352 int i, div = 1000000;
353 for (i = 0; i < freq->e; i++)
354 div /= 10;
355 if (div > 0)
356 return ieee80211_set_channel(local, -1, freq->m / div);
357 else
358 return -EINVAL;
359 }
360}
361
362
363static int ieee80211_ioctl_giwfreq(struct net_device *dev,
364 struct iw_request_info *info,
365 struct iw_freq *freq, char *extra)
366{
367 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
368
369 /* TODO: in station mode (Managed/Ad-hoc) might need to poll low-level
370 * driver for the current channel with firmware-based management */
371
372 freq->m = local->hw.conf.freq;
373 freq->e = 6;
374
375 return 0;
376}
377
378
379static int ieee80211_ioctl_siwessid(struct net_device *dev,
380 struct iw_request_info *info,
381 struct iw_point *data, char *ssid)
382{
Jiri Bencf0706e82007-05-05 11:45:53 -0700383 struct ieee80211_sub_if_data *sdata;
384 size_t len = data->length;
385
386 /* iwconfig uses nul termination in SSID.. */
387 if (len > 0 && ssid[len - 1] == '\0')
388 len--;
389
390 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
391 if (sdata->type == IEEE80211_IF_TYPE_STA ||
392 sdata->type == IEEE80211_IF_TYPE_IBSS) {
393 int ret;
Johannes Bergddd3d2b2007-09-26 17:53:20 +0200394 if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) {
Jiri Bencf0706e82007-05-05 11:45:53 -0700395 if (len > IEEE80211_MAX_SSID_LEN)
396 return -EINVAL;
397 memcpy(sdata->u.sta.ssid, ssid, len);
398 sdata->u.sta.ssid_len = len;
399 return 0;
400 }
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400401 if (data->flags)
402 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_SSID_SEL;
403 else
404 sdata->u.sta.flags |= IEEE80211_STA_AUTO_SSID_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700405 ret = ieee80211_sta_set_ssid(dev, ssid, len);
406 if (ret)
407 return ret;
408 ieee80211_sta_req_auth(dev, &sdata->u.sta);
409 return 0;
410 }
411
412 if (sdata->type == IEEE80211_IF_TYPE_AP) {
413 memcpy(sdata->u.ap.ssid, ssid, len);
414 memset(sdata->u.ap.ssid + len, 0,
415 IEEE80211_MAX_SSID_LEN - len);
416 sdata->u.ap.ssid_len = len;
417 return ieee80211_if_config(dev);
418 }
419 return -EOPNOTSUPP;
420}
421
422
423static int ieee80211_ioctl_giwessid(struct net_device *dev,
424 struct iw_request_info *info,
425 struct iw_point *data, char *ssid)
426{
427 size_t len;
428
429 struct ieee80211_sub_if_data *sdata;
430 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
431 if (sdata->type == IEEE80211_IF_TYPE_STA ||
432 sdata->type == IEEE80211_IF_TYPE_IBSS) {
433 int res = ieee80211_sta_get_ssid(dev, ssid, &len);
434 if (res == 0) {
435 data->length = len;
436 data->flags = 1;
437 } else
438 data->flags = 0;
439 return res;
440 }
441
442 if (sdata->type == IEEE80211_IF_TYPE_AP) {
443 len = sdata->u.ap.ssid_len;
444 if (len > IW_ESSID_MAX_SIZE)
445 len = IW_ESSID_MAX_SIZE;
446 memcpy(ssid, sdata->u.ap.ssid, len);
447 data->length = len;
448 data->flags = 1;
449 return 0;
450 }
451 return -EOPNOTSUPP;
452}
453
454
455static int ieee80211_ioctl_siwap(struct net_device *dev,
456 struct iw_request_info *info,
457 struct sockaddr *ap_addr, char *extra)
458{
Jiri Bencf0706e82007-05-05 11:45:53 -0700459 struct ieee80211_sub_if_data *sdata;
460
461 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
462 if (sdata->type == IEEE80211_IF_TYPE_STA ||
463 sdata->type == IEEE80211_IF_TYPE_IBSS) {
464 int ret;
Johannes Bergddd3d2b2007-09-26 17:53:20 +0200465 if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) {
Jiri Bencf0706e82007-05-05 11:45:53 -0700466 memcpy(sdata->u.sta.bssid, (u8 *) &ap_addr->sa_data,
467 ETH_ALEN);
468 return 0;
469 }
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400470 if (is_zero_ether_addr((u8 *) &ap_addr->sa_data))
471 sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL |
472 IEEE80211_STA_AUTO_CHANNEL_SEL;
473 else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data))
474 sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700475 else
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400476 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700477 ret = ieee80211_sta_set_bssid(dev, (u8 *) &ap_addr->sa_data);
478 if (ret)
479 return ret;
480 ieee80211_sta_req_auth(dev, &sdata->u.sta);
481 return 0;
482 } else if (sdata->type == IEEE80211_IF_TYPE_WDS) {
483 if (memcmp(sdata->u.wds.remote_addr, (u8 *) &ap_addr->sa_data,
484 ETH_ALEN) == 0)
485 return 0;
486 return ieee80211_if_update_wds(dev, (u8 *) &ap_addr->sa_data);
487 }
488
489 return -EOPNOTSUPP;
490}
491
492
493static int ieee80211_ioctl_giwap(struct net_device *dev,
494 struct iw_request_info *info,
495 struct sockaddr *ap_addr, char *extra)
496{
497 struct ieee80211_sub_if_data *sdata;
498
499 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
500 if (sdata->type == IEEE80211_IF_TYPE_STA ||
501 sdata->type == IEEE80211_IF_TYPE_IBSS) {
502 ap_addr->sa_family = ARPHRD_ETHER;
503 memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN);
504 return 0;
505 } else if (sdata->type == IEEE80211_IF_TYPE_WDS) {
506 ap_addr->sa_family = ARPHRD_ETHER;
507 memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN);
508 return 0;
509 }
510
511 return -EOPNOTSUPP;
512}
513
514
515static int ieee80211_ioctl_siwscan(struct net_device *dev,
516 struct iw_request_info *info,
Bill Moss107acb22007-10-10 16:23:55 -0400517 union iwreq_data *wrqu, char *extra)
Jiri Bencf0706e82007-05-05 11:45:53 -0700518{
Jiri Bencf0706e82007-05-05 11:45:53 -0700519 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
Bill Moss107acb22007-10-10 16:23:55 -0400520 struct iw_scan_req *req = NULL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700521 u8 *ssid = NULL;
522 size_t ssid_len = 0;
523
524 if (!netif_running(dev))
525 return -ENETDOWN;
526
Helmut Schaa48933dea2007-11-09 16:26:09 +0100527 if (sdata->type != IEEE80211_IF_TYPE_STA &&
528 sdata->type != IEEE80211_IF_TYPE_IBSS &&
529 sdata->type != IEEE80211_IF_TYPE_AP) {
John W. Linvilled114f392007-10-17 21:16:16 -0700530 return -EOPNOTSUPP;
531 }
532
533 /* if SSID was specified explicitly then use that */
Bill Moss107acb22007-10-10 16:23:55 -0400534 if (wrqu->data.length == sizeof(struct iw_scan_req) &&
535 wrqu->data.flags & IW_SCAN_THIS_ESSID) {
536 req = (struct iw_scan_req *)extra;
537 ssid = req->essid;
538 ssid_len = req->essid_len;
Jiri Bencf0706e82007-05-05 11:45:53 -0700539 }
Daniel Drakef27b62d2007-07-27 15:43:24 +0200540
Jiri Bencf0706e82007-05-05 11:45:53 -0700541 return ieee80211_sta_req_scan(dev, ssid, ssid_len);
542}
543
544
545static int ieee80211_ioctl_giwscan(struct net_device *dev,
546 struct iw_request_info *info,
547 struct iw_point *data, char *extra)
548{
549 int res;
550 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
Zhu Yiece8edd2007-11-22 10:53:21 +0800551
552 if (local->sta_sw_scanning || local->sta_hw_scanning)
Jiri Bencf0706e82007-05-05 11:45:53 -0700553 return -EAGAIN;
Zhu Yiece8edd2007-11-22 10:53:21 +0800554
Jiri Bencf0706e82007-05-05 11:45:53 -0700555 res = ieee80211_sta_scan_results(dev, extra, data->length);
556 if (res >= 0) {
557 data->length = res;
558 return 0;
559 }
560 data->length = 0;
561 return res;
562}
563
564
Larry Finger1fd5e582007-07-10 19:32:10 +0200565static int ieee80211_ioctl_siwrate(struct net_device *dev,
566 struct iw_request_info *info,
567 struct iw_param *rate, char *extra)
568{
569 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
570 struct ieee80211_hw_mode *mode;
571 int i;
572 u32 target_rate = rate->value / 100000;
573 struct ieee80211_sub_if_data *sdata;
574
575 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
576 if (!sdata->bss)
577 return -ENODEV;
578 mode = local->oper_hw_mode;
579 /* target_rate = -1, rate->fixed = 0 means auto only, so use all rates
580 * target_rate = X, rate->fixed = 1 means only rate X
581 * target_rate = X, rate->fixed = 0 means all rates <= X */
582 sdata->bss->max_ratectrl_rateidx = -1;
583 sdata->bss->force_unicast_rateidx = -1;
584 if (rate->value < 0)
585 return 0;
Andrew Lutomirski5cdfed52008-01-03 21:03:19 -0800586 for (i=0; i < mode->num_rates; i++) {
Larry Finger1fd5e582007-07-10 19:32:10 +0200587 struct ieee80211_rate *rates = &mode->rates[i];
588 int this_rate = rates->rate;
589
Larry Finger1fd5e582007-07-10 19:32:10 +0200590 if (target_rate == this_rate) {
591 sdata->bss->max_ratectrl_rateidx = i;
592 if (rate->fixed)
593 sdata->bss->force_unicast_rateidx = i;
Andrew Lutomirski5cdfed52008-01-03 21:03:19 -0800594 return 0;
Larry Finger1fd5e582007-07-10 19:32:10 +0200595 }
596 }
Andrew Lutomirski5cdfed52008-01-03 21:03:19 -0800597 return -EINVAL;
Larry Finger1fd5e582007-07-10 19:32:10 +0200598}
599
Larry Fingerb3d88ad2007-06-10 17:57:33 -0700600static int ieee80211_ioctl_giwrate(struct net_device *dev,
601 struct iw_request_info *info,
602 struct iw_param *rate, char *extra)
603{
604 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
605 struct sta_info *sta;
606 struct ieee80211_sub_if_data *sdata;
607
608 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
609 if (sdata->type == IEEE80211_IF_TYPE_STA)
610 sta = sta_info_get(local, sdata->u.sta.bssid);
611 else
612 return -EOPNOTSUPP;
613 if (!sta)
614 return -ENODEV;
615 if (sta->txrate < local->oper_hw_mode->num_rates)
616 rate->value = local->oper_hw_mode->rates[sta->txrate].rate * 100000;
617 else
618 rate->value = 0;
619 sta_info_put(sta);
620 return 0;
621}
622
Michael Buesch61609bc2007-09-20 22:06:39 +0200623static int ieee80211_ioctl_siwtxpower(struct net_device *dev,
624 struct iw_request_info *info,
625 union iwreq_data *data, char *extra)
626{
627 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
628 bool need_reconfig = 0;
Mattias Nissler6a432952007-10-24 23:30:36 +0200629 u8 new_power_level;
Michael Buesch61609bc2007-09-20 22:06:39 +0200630
631 if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM)
632 return -EINVAL;
633 if (data->txpower.flags & IW_TXPOW_RANGE)
634 return -EINVAL;
Michael Buesch61609bc2007-09-20 22:06:39 +0200635
Mattias Nissler6a432952007-10-24 23:30:36 +0200636 if (data->txpower.fixed) {
637 new_power_level = data->txpower.value;
638 } else {
639 /* Automatic power level. Get the px power from the current
640 * channel. */
641 struct ieee80211_channel* chan = local->oper_channel;
642 if (!chan)
643 return -EINVAL;
644
645 new_power_level = chan->power_level;
646 }
647
648 if (local->hw.conf.power_level != new_power_level) {
649 local->hw.conf.power_level = new_power_level;
Michael Buesch61609bc2007-09-20 22:06:39 +0200650 need_reconfig = 1;
651 }
Mattias Nissler6a432952007-10-24 23:30:36 +0200652
Michael Buesch61609bc2007-09-20 22:06:39 +0200653 if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) {
654 local->hw.conf.radio_enabled = !(data->txpower.disabled);
655 need_reconfig = 1;
Ivo van Doorncdcb0062008-01-07 19:45:24 +0100656 ieee80211_led_radio(local, local->hw.conf.radio_enabled);
Michael Buesch61609bc2007-09-20 22:06:39 +0200657 }
Mattias Nissler6a432952007-10-24 23:30:36 +0200658
Michael Buesch61609bc2007-09-20 22:06:39 +0200659 if (need_reconfig) {
660 ieee80211_hw_config(local);
661 /* The return value of hw_config is not of big interest here,
662 * as it doesn't say that it failed because of _this_ config
663 * change or something else. Ignore it. */
664 }
665
666 return 0;
667}
668
Larry Fingerfe6aa302007-08-10 11:23:20 -0500669static int ieee80211_ioctl_giwtxpower(struct net_device *dev,
670 struct iw_request_info *info,
671 union iwreq_data *data, char *extra)
672{
673 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
674
675 data->txpower.fixed = 1;
676 data->txpower.disabled = !(local->hw.conf.radio_enabled);
677 data->txpower.value = local->hw.conf.power_level;
678 data->txpower.flags = IW_TXPOW_DBM;
679
680 return 0;
681}
682
Jiri Bencf0706e82007-05-05 11:45:53 -0700683static int ieee80211_ioctl_siwrts(struct net_device *dev,
684 struct iw_request_info *info,
685 struct iw_param *rts, char *extra)
686{
687 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
688
689 if (rts->disabled)
690 local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
691 else if (rts->value < 0 || rts->value > IEEE80211_MAX_RTS_THRESHOLD)
692 return -EINVAL;
693 else
694 local->rts_threshold = rts->value;
695
696 /* If the wlan card performs RTS/CTS in hardware/firmware,
697 * configure it here */
698
699 if (local->ops->set_rts_threshold)
700 local->ops->set_rts_threshold(local_to_hw(local),
701 local->rts_threshold);
702
703 return 0;
704}
705
706static int ieee80211_ioctl_giwrts(struct net_device *dev,
707 struct iw_request_info *info,
708 struct iw_param *rts, char *extra)
709{
710 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
711
712 rts->value = local->rts_threshold;
713 rts->disabled = (rts->value >= IEEE80211_MAX_RTS_THRESHOLD);
714 rts->fixed = 1;
715
716 return 0;
717}
718
719
720static int ieee80211_ioctl_siwfrag(struct net_device *dev,
721 struct iw_request_info *info,
722 struct iw_param *frag, char *extra)
723{
724 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
725
726 if (frag->disabled)
727 local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
728 else if (frag->value < 256 ||
729 frag->value > IEEE80211_MAX_FRAG_THRESHOLD)
730 return -EINVAL;
731 else {
732 /* Fragment length must be even, so strip LSB. */
733 local->fragmentation_threshold = frag->value & ~0x1;
734 }
735
736 /* If the wlan card performs fragmentation in hardware/firmware,
737 * configure it here */
738
739 if (local->ops->set_frag_threshold)
740 local->ops->set_frag_threshold(
741 local_to_hw(local),
742 local->fragmentation_threshold);
743
744 return 0;
745}
746
747static int ieee80211_ioctl_giwfrag(struct net_device *dev,
748 struct iw_request_info *info,
749 struct iw_param *frag, char *extra)
750{
751 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
752
753 frag->value = local->fragmentation_threshold;
754 frag->disabled = (frag->value >= IEEE80211_MAX_RTS_THRESHOLD);
755 frag->fixed = 1;
756
757 return 0;
758}
759
760
761static int ieee80211_ioctl_siwretry(struct net_device *dev,
762 struct iw_request_info *info,
763 struct iw_param *retry, char *extra)
764{
765 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
766
767 if (retry->disabled ||
768 (retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT)
769 return -EINVAL;
770
771 if (retry->flags & IW_RETRY_MAX)
772 local->long_retry_limit = retry->value;
773 else if (retry->flags & IW_RETRY_MIN)
774 local->short_retry_limit = retry->value;
775 else {
776 local->long_retry_limit = retry->value;
777 local->short_retry_limit = retry->value;
778 }
779
780 if (local->ops->set_retry_limit) {
781 return local->ops->set_retry_limit(
782 local_to_hw(local),
783 local->short_retry_limit,
784 local->long_retry_limit);
785 }
786
787 return 0;
788}
789
790
791static int ieee80211_ioctl_giwretry(struct net_device *dev,
792 struct iw_request_info *info,
793 struct iw_param *retry, char *extra)
794{
795 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
796
797 retry->disabled = 0;
798 if (retry->flags == 0 || retry->flags & IW_RETRY_MIN) {
799 /* first return min value, iwconfig will ask max value
800 * later if needed */
801 retry->flags |= IW_RETRY_LIMIT;
802 retry->value = local->short_retry_limit;
803 if (local->long_retry_limit != local->short_retry_limit)
804 retry->flags |= IW_RETRY_MIN;
805 return 0;
806 }
807 if (retry->flags & IW_RETRY_MAX) {
808 retry->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
809 retry->value = local->long_retry_limit;
810 }
811
812 return 0;
813}
814
Jiri Bencf0706e82007-05-05 11:45:53 -0700815static int ieee80211_ioctl_siwmlme(struct net_device *dev,
816 struct iw_request_info *info,
817 struct iw_point *data, char *extra)
818{
819 struct ieee80211_sub_if_data *sdata;
820 struct iw_mlme *mlme = (struct iw_mlme *) extra;
821
822 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
823 if (sdata->type != IEEE80211_IF_TYPE_STA &&
824 sdata->type != IEEE80211_IF_TYPE_IBSS)
825 return -EINVAL;
826
827 switch (mlme->cmd) {
828 case IW_MLME_DEAUTH:
829 /* TODO: mlme->addr.sa_data */
830 return ieee80211_sta_deauthenticate(dev, mlme->reason_code);
831 case IW_MLME_DISASSOC:
832 /* TODO: mlme->addr.sa_data */
833 return ieee80211_sta_disassociate(dev, mlme->reason_code);
834 default:
835 return -EOPNOTSUPP;
836 }
837}
838
839
840static int ieee80211_ioctl_siwencode(struct net_device *dev,
841 struct iw_request_info *info,
842 struct iw_point *erq, char *keybuf)
843{
844 struct ieee80211_sub_if_data *sdata;
845 int idx, i, alg = ALG_WEP;
846 u8 bcaddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
Johannes Berg628a1402007-09-26 17:53:17 +0200847 int remove = 0;
Jiri Bencf0706e82007-05-05 11:45:53 -0700848
849 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
850
851 idx = erq->flags & IW_ENCODE_INDEX;
852 if (idx == 0) {
853 if (sdata->default_key)
854 for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
855 if (sdata->default_key == sdata->keys[i]) {
856 idx = i;
857 break;
858 }
859 }
860 } else if (idx < 1 || idx > 4)
861 return -EINVAL;
862 else
863 idx--;
864
865 if (erq->flags & IW_ENCODE_DISABLED)
Johannes Berg628a1402007-09-26 17:53:17 +0200866 remove = 1;
Jiri Bencf0706e82007-05-05 11:45:53 -0700867 else if (erq->length == 0) {
868 /* No key data - just set the default TX key index */
Johannes Berg11a843b2007-08-28 17:01:55 -0400869 ieee80211_set_default_key(sdata, idx);
Jiri Bencf0706e82007-05-05 11:45:53 -0700870 return 0;
871 }
872
873 return ieee80211_set_encryption(
874 dev, bcaddr,
Johannes Berg628a1402007-09-26 17:53:17 +0200875 idx, alg, remove,
Jiri Bencf0706e82007-05-05 11:45:53 -0700876 !sdata->default_key,
877 keybuf, erq->length);
878}
879
880
881static int ieee80211_ioctl_giwencode(struct net_device *dev,
882 struct iw_request_info *info,
883 struct iw_point *erq, char *key)
884{
885 struct ieee80211_sub_if_data *sdata;
886 int idx, i;
887
888 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
889
890 idx = erq->flags & IW_ENCODE_INDEX;
891 if (idx < 1 || idx > 4) {
892 idx = -1;
893 if (!sdata->default_key)
894 idx = 0;
895 else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
896 if (sdata->default_key == sdata->keys[i]) {
897 idx = i;
898 break;
899 }
900 }
901 if (idx < 0)
902 return -EINVAL;
903 } else
904 idx--;
905
906 erq->flags = idx + 1;
907
908 if (!sdata->keys[idx]) {
909 erq->length = 0;
910 erq->flags |= IW_ENCODE_DISABLED;
911 return 0;
912 }
913
Johannes Berg8f20fc22007-08-28 17:01:54 -0400914 memcpy(key, sdata->keys[idx]->conf.key,
Johannes Berg11a843b2007-08-28 17:01:55 -0400915 min_t(int, erq->length, sdata->keys[idx]->conf.keylen));
Johannes Berg8f20fc22007-08-28 17:01:54 -0400916 erq->length = sdata->keys[idx]->conf.keylen;
Jiri Bencf0706e82007-05-05 11:45:53 -0700917 erq->flags |= IW_ENCODE_ENABLED;
918
919 return 0;
920}
921
922static int ieee80211_ioctl_siwauth(struct net_device *dev,
923 struct iw_request_info *info,
924 struct iw_param *data, char *extra)
925{
Jiri Bencf0706e82007-05-05 11:45:53 -0700926 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
927 int ret = 0;
928
929 switch (data->flags & IW_AUTH_INDEX) {
930 case IW_AUTH_WPA_VERSION:
931 case IW_AUTH_CIPHER_PAIRWISE:
932 case IW_AUTH_CIPHER_GROUP:
933 case IW_AUTH_WPA_ENABLED:
934 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
Jiri Bencf0706e82007-05-05 11:45:53 -0700935 case IW_AUTH_KEY_MGMT:
Johannes Berg5b98b1f2007-11-03 13:11:10 +0000936 break;
Johannes Bergb1357a82007-11-28 11:04:21 +0100937 case IW_AUTH_DROP_UNENCRYPTED:
938 sdata->drop_unencrypted = !!data->value;
939 break;
Johannes Berg5b98b1f2007-11-03 13:11:10 +0000940 case IW_AUTH_PRIVACY_INVOKED:
Jiri Bencf0706e82007-05-05 11:45:53 -0700941 if (sdata->type != IEEE80211_IF_TYPE_STA)
942 ret = -EINVAL;
943 else {
Johannes Berg5b98b1f2007-11-03 13:11:10 +0000944 sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED;
Jiri Bencf0706e82007-05-05 11:45:53 -0700945 /*
Johannes Berg5b98b1f2007-11-03 13:11:10 +0000946 * Privacy invoked by wpa_supplicant, store the
947 * value and allow associating to a protected
948 * network without having a key up front.
Jiri Bencf0706e82007-05-05 11:45:53 -0700949 */
Johannes Berg5b98b1f2007-11-03 13:11:10 +0000950 if (data->value)
951 sdata->u.sta.flags |=
952 IEEE80211_STA_PRIVACY_INVOKED;
Jiri Bencf0706e82007-05-05 11:45:53 -0700953 }
954 break;
955 case IW_AUTH_80211_AUTH_ALG:
956 if (sdata->type == IEEE80211_IF_TYPE_STA ||
957 sdata->type == IEEE80211_IF_TYPE_IBSS)
958 sdata->u.sta.auth_algs = data->value;
959 else
960 ret = -EOPNOTSUPP;
961 break;
Jiri Bencf0706e82007-05-05 11:45:53 -0700962 default:
963 ret = -EOPNOTSUPP;
964 break;
965 }
966 return ret;
967}
968
969/* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
970static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev)
971{
972 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
973 struct iw_statistics *wstats = &local->wstats;
974 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
975 struct sta_info *sta = NULL;
976
977 if (sdata->type == IEEE80211_IF_TYPE_STA ||
978 sdata->type == IEEE80211_IF_TYPE_IBSS)
979 sta = sta_info_get(local, sdata->u.sta.bssid);
980 if (!sta) {
981 wstats->discard.fragment = 0;
982 wstats->discard.misc = 0;
983 wstats->qual.qual = 0;
984 wstats->qual.level = 0;
985 wstats->qual.noise = 0;
986 wstats->qual.updated = IW_QUAL_ALL_INVALID;
987 } else {
988 wstats->qual.level = sta->last_rssi;
989 wstats->qual.qual = sta->last_signal;
990 wstats->qual.noise = sta->last_noise;
991 wstats->qual.updated = local->wstats_flags;
992 sta_info_put(sta);
993 }
994 return wstats;
995}
996
997static int ieee80211_ioctl_giwauth(struct net_device *dev,
998 struct iw_request_info *info,
999 struct iw_param *data, char *extra)
1000{
1001 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1002 int ret = 0;
1003
1004 switch (data->flags & IW_AUTH_INDEX) {
1005 case IW_AUTH_80211_AUTH_ALG:
1006 if (sdata->type == IEEE80211_IF_TYPE_STA ||
1007 sdata->type == IEEE80211_IF_TYPE_IBSS)
1008 data->value = sdata->u.sta.auth_algs;
1009 else
1010 ret = -EOPNOTSUPP;
1011 break;
1012 default:
1013 ret = -EOPNOTSUPP;
1014 break;
1015 }
1016 return ret;
1017}
1018
1019
1020static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
1021 struct iw_request_info *info,
1022 struct iw_point *erq, char *extra)
1023{
1024 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1025 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
Johannes Berg628a1402007-09-26 17:53:17 +02001026 int uninitialized_var(alg), idx, i, remove = 0;
Jiri Bencf0706e82007-05-05 11:45:53 -07001027
1028 switch (ext->alg) {
1029 case IW_ENCODE_ALG_NONE:
Johannes Berg628a1402007-09-26 17:53:17 +02001030 remove = 1;
Jiri Bencf0706e82007-05-05 11:45:53 -07001031 break;
1032 case IW_ENCODE_ALG_WEP:
1033 alg = ALG_WEP;
1034 break;
1035 case IW_ENCODE_ALG_TKIP:
1036 alg = ALG_TKIP;
1037 break;
1038 case IW_ENCODE_ALG_CCMP:
1039 alg = ALG_CCMP;
1040 break;
1041 default:
1042 return -EOPNOTSUPP;
1043 }
1044
1045 if (erq->flags & IW_ENCODE_DISABLED)
Johannes Berg628a1402007-09-26 17:53:17 +02001046 remove = 1;
Jiri Bencf0706e82007-05-05 11:45:53 -07001047
1048 idx = erq->flags & IW_ENCODE_INDEX;
1049 if (idx < 1 || idx > 4) {
1050 idx = -1;
1051 if (!sdata->default_key)
1052 idx = 0;
1053 else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
1054 if (sdata->default_key == sdata->keys[i]) {
1055 idx = i;
1056 break;
1057 }
1058 }
1059 if (idx < 0)
1060 return -EINVAL;
1061 } else
1062 idx--;
1063
1064 return ieee80211_set_encryption(dev, ext->addr.sa_data, idx, alg,
Johannes Berg628a1402007-09-26 17:53:17 +02001065 remove,
Jiri Bencf0706e82007-05-05 11:45:53 -07001066 ext->ext_flags &
1067 IW_ENCODE_EXT_SET_TX_KEY,
1068 ext->key, ext->key_len);
1069}
1070
1071
Jiri Bencf0706e82007-05-05 11:45:53 -07001072/* Structures to export the Wireless Handlers */
1073
1074static const iw_handler ieee80211_handler[] =
1075{
1076 (iw_handler) NULL, /* SIOCSIWCOMMIT */
1077 (iw_handler) ieee80211_ioctl_giwname, /* SIOCGIWNAME */
1078 (iw_handler) NULL, /* SIOCSIWNWID */
1079 (iw_handler) NULL, /* SIOCGIWNWID */
1080 (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */
1081 (iw_handler) ieee80211_ioctl_giwfreq, /* SIOCGIWFREQ */
1082 (iw_handler) ieee80211_ioctl_siwmode, /* SIOCSIWMODE */
1083 (iw_handler) ieee80211_ioctl_giwmode, /* SIOCGIWMODE */
1084 (iw_handler) NULL, /* SIOCSIWSENS */
1085 (iw_handler) NULL, /* SIOCGIWSENS */
1086 (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */
1087 (iw_handler) ieee80211_ioctl_giwrange, /* SIOCGIWRANGE */
1088 (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */
1089 (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */
1090 (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */
1091 (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */
Johannes Berg5d4ecd92007-09-14 11:10:24 -04001092 (iw_handler) NULL, /* SIOCSIWSPY */
1093 (iw_handler) NULL, /* SIOCGIWSPY */
1094 (iw_handler) NULL, /* SIOCSIWTHRSPY */
1095 (iw_handler) NULL, /* SIOCGIWTHRSPY */
Jiri Bencf0706e82007-05-05 11:45:53 -07001096 (iw_handler) ieee80211_ioctl_siwap, /* SIOCSIWAP */
1097 (iw_handler) ieee80211_ioctl_giwap, /* SIOCGIWAP */
1098 (iw_handler) ieee80211_ioctl_siwmlme, /* SIOCSIWMLME */
1099 (iw_handler) NULL, /* SIOCGIWAPLIST */
1100 (iw_handler) ieee80211_ioctl_siwscan, /* SIOCSIWSCAN */
1101 (iw_handler) ieee80211_ioctl_giwscan, /* SIOCGIWSCAN */
1102 (iw_handler) ieee80211_ioctl_siwessid, /* SIOCSIWESSID */
1103 (iw_handler) ieee80211_ioctl_giwessid, /* SIOCGIWESSID */
1104 (iw_handler) NULL, /* SIOCSIWNICKN */
1105 (iw_handler) NULL, /* SIOCGIWNICKN */
1106 (iw_handler) NULL, /* -- hole -- */
1107 (iw_handler) NULL, /* -- hole -- */
Larry Finger1fd5e582007-07-10 19:32:10 +02001108 (iw_handler) ieee80211_ioctl_siwrate, /* SIOCSIWRATE */
Larry Fingerb3d88ad2007-06-10 17:57:33 -07001109 (iw_handler) ieee80211_ioctl_giwrate, /* SIOCGIWRATE */
Jiri Bencf0706e82007-05-05 11:45:53 -07001110 (iw_handler) ieee80211_ioctl_siwrts, /* SIOCSIWRTS */
1111 (iw_handler) ieee80211_ioctl_giwrts, /* SIOCGIWRTS */
1112 (iw_handler) ieee80211_ioctl_siwfrag, /* SIOCSIWFRAG */
1113 (iw_handler) ieee80211_ioctl_giwfrag, /* SIOCGIWFRAG */
Michael Buesch61609bc2007-09-20 22:06:39 +02001114 (iw_handler) ieee80211_ioctl_siwtxpower, /* SIOCSIWTXPOW */
Larry Fingerfe6aa302007-08-10 11:23:20 -05001115 (iw_handler) ieee80211_ioctl_giwtxpower, /* SIOCGIWTXPOW */
Jiri Bencf0706e82007-05-05 11:45:53 -07001116 (iw_handler) ieee80211_ioctl_siwretry, /* SIOCSIWRETRY */
1117 (iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */
1118 (iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */
1119 (iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */
1120 (iw_handler) NULL, /* SIOCSIWPOWER */
1121 (iw_handler) NULL, /* SIOCGIWPOWER */
1122 (iw_handler) NULL, /* -- hole -- */
1123 (iw_handler) NULL, /* -- hole -- */
1124 (iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */
1125 (iw_handler) NULL, /* SIOCGIWGENIE */
1126 (iw_handler) ieee80211_ioctl_siwauth, /* SIOCSIWAUTH */
1127 (iw_handler) ieee80211_ioctl_giwauth, /* SIOCGIWAUTH */
1128 (iw_handler) ieee80211_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */
1129 (iw_handler) NULL, /* SIOCGIWENCODEEXT */
1130 (iw_handler) NULL, /* SIOCSIWPMKSA */
1131 (iw_handler) NULL, /* -- hole -- */
1132};
1133
Jiri Bencf0706e82007-05-05 11:45:53 -07001134const struct iw_handler_def ieee80211_iw_handler_def =
1135{
1136 .num_standard = ARRAY_SIZE(ieee80211_handler),
Jiri Bencf0706e82007-05-05 11:45:53 -07001137 .standard = (iw_handler *) ieee80211_handler,
Jiri Bencf0706e82007-05-05 11:45:53 -07001138 .get_wireless_stats = ieee80211_get_wireless_stats,
1139};