blob: 6c8e73e0d29d3516fe58c29ab245d3ad34d35333 [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;
108 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
109
110 if (local->user_space_mlme)
111 return -EOPNOTSUPP;
112
113 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
114 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;
309 set++;
310 }
311 }
312 }
313
314 if (set) {
315 if (local->sta_scanning)
316 ret = 0;
317 else
318 ret = ieee80211_hw_config(local);
319
320 rate_control_clear(local);
321 }
322
323 return ret;
324}
325
326static int ieee80211_ioctl_siwfreq(struct net_device *dev,
327 struct iw_request_info *info,
328 struct iw_freq *freq, char *extra)
329{
330 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
331 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
332
333 if (sdata->type == IEEE80211_IF_TYPE_STA)
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400334 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700335
336 /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */
337 if (freq->e == 0) {
338 if (freq->m < 0) {
339 if (sdata->type == IEEE80211_IF_TYPE_STA)
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400340 sdata->u.sta.flags |=
341 IEEE80211_STA_AUTO_CHANNEL_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700342 return 0;
343 } else
344 return ieee80211_set_channel(local, freq->m, -1);
345 } else {
346 int i, div = 1000000;
347 for (i = 0; i < freq->e; i++)
348 div /= 10;
349 if (div > 0)
350 return ieee80211_set_channel(local, -1, freq->m / div);
351 else
352 return -EINVAL;
353 }
354}
355
356
357static int ieee80211_ioctl_giwfreq(struct net_device *dev,
358 struct iw_request_info *info,
359 struct iw_freq *freq, char *extra)
360{
361 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
362
363 /* TODO: in station mode (Managed/Ad-hoc) might need to poll low-level
364 * driver for the current channel with firmware-based management */
365
366 freq->m = local->hw.conf.freq;
367 freq->e = 6;
368
369 return 0;
370}
371
372
373static int ieee80211_ioctl_siwessid(struct net_device *dev,
374 struct iw_request_info *info,
375 struct iw_point *data, char *ssid)
376{
377 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
378 struct ieee80211_sub_if_data *sdata;
379 size_t len = data->length;
380
381 /* iwconfig uses nul termination in SSID.. */
382 if (len > 0 && ssid[len - 1] == '\0')
383 len--;
384
385 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
386 if (sdata->type == IEEE80211_IF_TYPE_STA ||
387 sdata->type == IEEE80211_IF_TYPE_IBSS) {
388 int ret;
389 if (local->user_space_mlme) {
390 if (len > IEEE80211_MAX_SSID_LEN)
391 return -EINVAL;
392 memcpy(sdata->u.sta.ssid, ssid, len);
393 sdata->u.sta.ssid_len = len;
394 return 0;
395 }
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400396 if (data->flags)
397 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_SSID_SEL;
398 else
399 sdata->u.sta.flags |= IEEE80211_STA_AUTO_SSID_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700400 ret = ieee80211_sta_set_ssid(dev, ssid, len);
401 if (ret)
402 return ret;
403 ieee80211_sta_req_auth(dev, &sdata->u.sta);
404 return 0;
405 }
406
407 if (sdata->type == IEEE80211_IF_TYPE_AP) {
408 memcpy(sdata->u.ap.ssid, ssid, len);
409 memset(sdata->u.ap.ssid + len, 0,
410 IEEE80211_MAX_SSID_LEN - len);
411 sdata->u.ap.ssid_len = len;
412 return ieee80211_if_config(dev);
413 }
414 return -EOPNOTSUPP;
415}
416
417
418static int ieee80211_ioctl_giwessid(struct net_device *dev,
419 struct iw_request_info *info,
420 struct iw_point *data, char *ssid)
421{
422 size_t len;
423
424 struct ieee80211_sub_if_data *sdata;
425 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
426 if (sdata->type == IEEE80211_IF_TYPE_STA ||
427 sdata->type == IEEE80211_IF_TYPE_IBSS) {
428 int res = ieee80211_sta_get_ssid(dev, ssid, &len);
429 if (res == 0) {
430 data->length = len;
431 data->flags = 1;
432 } else
433 data->flags = 0;
434 return res;
435 }
436
437 if (sdata->type == IEEE80211_IF_TYPE_AP) {
438 len = sdata->u.ap.ssid_len;
439 if (len > IW_ESSID_MAX_SIZE)
440 len = IW_ESSID_MAX_SIZE;
441 memcpy(ssid, sdata->u.ap.ssid, len);
442 data->length = len;
443 data->flags = 1;
444 return 0;
445 }
446 return -EOPNOTSUPP;
447}
448
449
450static int ieee80211_ioctl_siwap(struct net_device *dev,
451 struct iw_request_info *info,
452 struct sockaddr *ap_addr, char *extra)
453{
454 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
455 struct ieee80211_sub_if_data *sdata;
456
457 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
458 if (sdata->type == IEEE80211_IF_TYPE_STA ||
459 sdata->type == IEEE80211_IF_TYPE_IBSS) {
460 int ret;
461 if (local->user_space_mlme) {
462 memcpy(sdata->u.sta.bssid, (u8 *) &ap_addr->sa_data,
463 ETH_ALEN);
464 return 0;
465 }
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400466 if (is_zero_ether_addr((u8 *) &ap_addr->sa_data))
467 sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL |
468 IEEE80211_STA_AUTO_CHANNEL_SEL;
469 else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data))
470 sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700471 else
Jiri Slabyd6f2da52007-08-28 17:01:54 -0400472 sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL;
Jiri Bencf0706e82007-05-05 11:45:53 -0700473 ret = ieee80211_sta_set_bssid(dev, (u8 *) &ap_addr->sa_data);
474 if (ret)
475 return ret;
476 ieee80211_sta_req_auth(dev, &sdata->u.sta);
477 return 0;
478 } else if (sdata->type == IEEE80211_IF_TYPE_WDS) {
479 if (memcmp(sdata->u.wds.remote_addr, (u8 *) &ap_addr->sa_data,
480 ETH_ALEN) == 0)
481 return 0;
482 return ieee80211_if_update_wds(dev, (u8 *) &ap_addr->sa_data);
483 }
484
485 return -EOPNOTSUPP;
486}
487
488
489static int ieee80211_ioctl_giwap(struct net_device *dev,
490 struct iw_request_info *info,
491 struct sockaddr *ap_addr, char *extra)
492{
493 struct ieee80211_sub_if_data *sdata;
494
495 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
496 if (sdata->type == IEEE80211_IF_TYPE_STA ||
497 sdata->type == IEEE80211_IF_TYPE_IBSS) {
498 ap_addr->sa_family = ARPHRD_ETHER;
499 memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN);
500 return 0;
501 } else if (sdata->type == IEEE80211_IF_TYPE_WDS) {
502 ap_addr->sa_family = ARPHRD_ETHER;
503 memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN);
504 return 0;
505 }
506
507 return -EOPNOTSUPP;
508}
509
510
511static int ieee80211_ioctl_siwscan(struct net_device *dev,
512 struct iw_request_info *info,
513 struct iw_point *data, char *extra)
514{
515 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
516 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
517 u8 *ssid = NULL;
518 size_t ssid_len = 0;
519
520 if (!netif_running(dev))
521 return -ENETDOWN;
522
Daniel Drakef27b62d2007-07-27 15:43:24 +0200523 switch (sdata->type) {
524 case IEEE80211_IF_TYPE_STA:
525 case IEEE80211_IF_TYPE_IBSS:
526 if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
Jiri Bencf0706e82007-05-05 11:45:53 -0700527 ssid = sdata->u.sta.ssid;
528 ssid_len = sdata->u.sta.ssid_len;
Daniel Drakef27b62d2007-07-27 15:43:24 +0200529 }
530 break;
531 case IEEE80211_IF_TYPE_AP:
532 if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
Jiri Bencf0706e82007-05-05 11:45:53 -0700533 ssid = sdata->u.ap.ssid;
534 ssid_len = sdata->u.ap.ssid_len;
Daniel Drakef27b62d2007-07-27 15:43:24 +0200535 }
536 break;
537 default:
538 return -EOPNOTSUPP;
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);
551 if (local->sta_scanning)
552 return -EAGAIN;
553 res = ieee80211_sta_scan_results(dev, extra, data->length);
554 if (res >= 0) {
555 data->length = res;
556 return 0;
557 }
558 data->length = 0;
559 return res;
560}
561
562
Larry Finger1fd5e582007-07-10 19:32:10 +0200563static int ieee80211_ioctl_siwrate(struct net_device *dev,
564 struct iw_request_info *info,
565 struct iw_param *rate, char *extra)
566{
567 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
568 struct ieee80211_hw_mode *mode;
569 int i;
570 u32 target_rate = rate->value / 100000;
571 struct ieee80211_sub_if_data *sdata;
572
573 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
574 if (!sdata->bss)
575 return -ENODEV;
576 mode = local->oper_hw_mode;
577 /* target_rate = -1, rate->fixed = 0 means auto only, so use all rates
578 * target_rate = X, rate->fixed = 1 means only rate X
579 * target_rate = X, rate->fixed = 0 means all rates <= X */
580 sdata->bss->max_ratectrl_rateidx = -1;
581 sdata->bss->force_unicast_rateidx = -1;
582 if (rate->value < 0)
583 return 0;
584 for (i=0; i< mode->num_rates; i++) {
585 struct ieee80211_rate *rates = &mode->rates[i];
586 int this_rate = rates->rate;
587
Larry Finger1fd5e582007-07-10 19:32:10 +0200588 if (target_rate == this_rate) {
589 sdata->bss->max_ratectrl_rateidx = i;
590 if (rate->fixed)
591 sdata->bss->force_unicast_rateidx = i;
592 break;
593 }
594 }
595 return 0;
596}
597
Larry Fingerb3d88ad2007-06-10 17:57:33 -0700598static int ieee80211_ioctl_giwrate(struct net_device *dev,
599 struct iw_request_info *info,
600 struct iw_param *rate, char *extra)
601{
602 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
603 struct sta_info *sta;
604 struct ieee80211_sub_if_data *sdata;
605
606 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
607 if (sdata->type == IEEE80211_IF_TYPE_STA)
608 sta = sta_info_get(local, sdata->u.sta.bssid);
609 else
610 return -EOPNOTSUPP;
611 if (!sta)
612 return -ENODEV;
613 if (sta->txrate < local->oper_hw_mode->num_rates)
614 rate->value = local->oper_hw_mode->rates[sta->txrate].rate * 100000;
615 else
616 rate->value = 0;
617 sta_info_put(sta);
618 return 0;
619}
620
Michael Buesch61609bc2007-09-20 22:06:39 +0200621static int ieee80211_ioctl_siwtxpower(struct net_device *dev,
622 struct iw_request_info *info,
623 union iwreq_data *data, char *extra)
624{
625 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
626 bool need_reconfig = 0;
627
628 if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM)
629 return -EINVAL;
630 if (data->txpower.flags & IW_TXPOW_RANGE)
631 return -EINVAL;
632 if (!data->txpower.fixed)
633 return -EINVAL;
634
635 if (local->hw.conf.power_level != data->txpower.value) {
636 local->hw.conf.power_level = data->txpower.value;
637 need_reconfig = 1;
638 }
639 if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) {
640 local->hw.conf.radio_enabled = !(data->txpower.disabled);
641 need_reconfig = 1;
642 }
643 if (need_reconfig) {
644 ieee80211_hw_config(local);
645 /* The return value of hw_config is not of big interest here,
646 * as it doesn't say that it failed because of _this_ config
647 * change or something else. Ignore it. */
648 }
649
650 return 0;
651}
652
Larry Fingerfe6aa302007-08-10 11:23:20 -0500653static int ieee80211_ioctl_giwtxpower(struct net_device *dev,
654 struct iw_request_info *info,
655 union iwreq_data *data, char *extra)
656{
657 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
658
659 data->txpower.fixed = 1;
660 data->txpower.disabled = !(local->hw.conf.radio_enabled);
661 data->txpower.value = local->hw.conf.power_level;
662 data->txpower.flags = IW_TXPOW_DBM;
663
664 return 0;
665}
666
Jiri Bencf0706e82007-05-05 11:45:53 -0700667static int ieee80211_ioctl_siwrts(struct net_device *dev,
668 struct iw_request_info *info,
669 struct iw_param *rts, char *extra)
670{
671 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
672
673 if (rts->disabled)
674 local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
675 else if (rts->value < 0 || rts->value > IEEE80211_MAX_RTS_THRESHOLD)
676 return -EINVAL;
677 else
678 local->rts_threshold = rts->value;
679
680 /* If the wlan card performs RTS/CTS in hardware/firmware,
681 * configure it here */
682
683 if (local->ops->set_rts_threshold)
684 local->ops->set_rts_threshold(local_to_hw(local),
685 local->rts_threshold);
686
687 return 0;
688}
689
690static int ieee80211_ioctl_giwrts(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 rts->value = local->rts_threshold;
697 rts->disabled = (rts->value >= IEEE80211_MAX_RTS_THRESHOLD);
698 rts->fixed = 1;
699
700 return 0;
701}
702
703
704static int ieee80211_ioctl_siwfrag(struct net_device *dev,
705 struct iw_request_info *info,
706 struct iw_param *frag, char *extra)
707{
708 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
709
710 if (frag->disabled)
711 local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
712 else if (frag->value < 256 ||
713 frag->value > IEEE80211_MAX_FRAG_THRESHOLD)
714 return -EINVAL;
715 else {
716 /* Fragment length must be even, so strip LSB. */
717 local->fragmentation_threshold = frag->value & ~0x1;
718 }
719
720 /* If the wlan card performs fragmentation in hardware/firmware,
721 * configure it here */
722
723 if (local->ops->set_frag_threshold)
724 local->ops->set_frag_threshold(
725 local_to_hw(local),
726 local->fragmentation_threshold);
727
728 return 0;
729}
730
731static int ieee80211_ioctl_giwfrag(struct net_device *dev,
732 struct iw_request_info *info,
733 struct iw_param *frag, char *extra)
734{
735 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
736
737 frag->value = local->fragmentation_threshold;
738 frag->disabled = (frag->value >= IEEE80211_MAX_RTS_THRESHOLD);
739 frag->fixed = 1;
740
741 return 0;
742}
743
744
745static int ieee80211_ioctl_siwretry(struct net_device *dev,
746 struct iw_request_info *info,
747 struct iw_param *retry, char *extra)
748{
749 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
750
751 if (retry->disabled ||
752 (retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT)
753 return -EINVAL;
754
755 if (retry->flags & IW_RETRY_MAX)
756 local->long_retry_limit = retry->value;
757 else if (retry->flags & IW_RETRY_MIN)
758 local->short_retry_limit = retry->value;
759 else {
760 local->long_retry_limit = retry->value;
761 local->short_retry_limit = retry->value;
762 }
763
764 if (local->ops->set_retry_limit) {
765 return local->ops->set_retry_limit(
766 local_to_hw(local),
767 local->short_retry_limit,
768 local->long_retry_limit);
769 }
770
771 return 0;
772}
773
774
775static int ieee80211_ioctl_giwretry(struct net_device *dev,
776 struct iw_request_info *info,
777 struct iw_param *retry, char *extra)
778{
779 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
780
781 retry->disabled = 0;
782 if (retry->flags == 0 || retry->flags & IW_RETRY_MIN) {
783 /* first return min value, iwconfig will ask max value
784 * later if needed */
785 retry->flags |= IW_RETRY_LIMIT;
786 retry->value = local->short_retry_limit;
787 if (local->long_retry_limit != local->short_retry_limit)
788 retry->flags |= IW_RETRY_MIN;
789 return 0;
790 }
791 if (retry->flags & IW_RETRY_MAX) {
792 retry->flags = IW_RETRY_LIMIT | IW_RETRY_MAX;
793 retry->value = local->long_retry_limit;
794 }
795
796 return 0;
797}
798
Jiri Bencf0706e82007-05-05 11:45:53 -0700799static int ieee80211_ioctl_siwmlme(struct net_device *dev,
800 struct iw_request_info *info,
801 struct iw_point *data, char *extra)
802{
803 struct ieee80211_sub_if_data *sdata;
804 struct iw_mlme *mlme = (struct iw_mlme *) extra;
805
806 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
807 if (sdata->type != IEEE80211_IF_TYPE_STA &&
808 sdata->type != IEEE80211_IF_TYPE_IBSS)
809 return -EINVAL;
810
811 switch (mlme->cmd) {
812 case IW_MLME_DEAUTH:
813 /* TODO: mlme->addr.sa_data */
814 return ieee80211_sta_deauthenticate(dev, mlme->reason_code);
815 case IW_MLME_DISASSOC:
816 /* TODO: mlme->addr.sa_data */
817 return ieee80211_sta_disassociate(dev, mlme->reason_code);
818 default:
819 return -EOPNOTSUPP;
820 }
821}
822
823
824static int ieee80211_ioctl_siwencode(struct net_device *dev,
825 struct iw_request_info *info,
826 struct iw_point *erq, char *keybuf)
827{
828 struct ieee80211_sub_if_data *sdata;
829 int idx, i, alg = ALG_WEP;
830 u8 bcaddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
Johannes Berg628a1402007-09-26 17:53:17 +0200831 int remove = 0;
Jiri Bencf0706e82007-05-05 11:45:53 -0700832
833 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
834
835 idx = erq->flags & IW_ENCODE_INDEX;
836 if (idx == 0) {
837 if (sdata->default_key)
838 for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
839 if (sdata->default_key == sdata->keys[i]) {
840 idx = i;
841 break;
842 }
843 }
844 } else if (idx < 1 || idx > 4)
845 return -EINVAL;
846 else
847 idx--;
848
849 if (erq->flags & IW_ENCODE_DISABLED)
Johannes Berg628a1402007-09-26 17:53:17 +0200850 remove = 1;
Jiri Bencf0706e82007-05-05 11:45:53 -0700851 else if (erq->length == 0) {
852 /* No key data - just set the default TX key index */
Johannes Berg11a843b2007-08-28 17:01:55 -0400853 ieee80211_set_default_key(sdata, idx);
Jiri Bencf0706e82007-05-05 11:45:53 -0700854 return 0;
855 }
856
857 return ieee80211_set_encryption(
858 dev, bcaddr,
Johannes Berg628a1402007-09-26 17:53:17 +0200859 idx, alg, remove,
Jiri Bencf0706e82007-05-05 11:45:53 -0700860 !sdata->default_key,
861 keybuf, erq->length);
862}
863
864
865static int ieee80211_ioctl_giwencode(struct net_device *dev,
866 struct iw_request_info *info,
867 struct iw_point *erq, char *key)
868{
869 struct ieee80211_sub_if_data *sdata;
870 int idx, i;
871
872 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
873
874 idx = erq->flags & IW_ENCODE_INDEX;
875 if (idx < 1 || idx > 4) {
876 idx = -1;
877 if (!sdata->default_key)
878 idx = 0;
879 else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
880 if (sdata->default_key == sdata->keys[i]) {
881 idx = i;
882 break;
883 }
884 }
885 if (idx < 0)
886 return -EINVAL;
887 } else
888 idx--;
889
890 erq->flags = idx + 1;
891
892 if (!sdata->keys[idx]) {
893 erq->length = 0;
894 erq->flags |= IW_ENCODE_DISABLED;
895 return 0;
896 }
897
Johannes Berg8f20fc22007-08-28 17:01:54 -0400898 memcpy(key, sdata->keys[idx]->conf.key,
Johannes Berg11a843b2007-08-28 17:01:55 -0400899 min_t(int, erq->length, sdata->keys[idx]->conf.keylen));
Johannes Berg8f20fc22007-08-28 17:01:54 -0400900 erq->length = sdata->keys[idx]->conf.keylen;
Jiri Bencf0706e82007-05-05 11:45:53 -0700901 erq->flags |= IW_ENCODE_ENABLED;
902
903 return 0;
904}
905
906static int ieee80211_ioctl_siwauth(struct net_device *dev,
907 struct iw_request_info *info,
908 struct iw_param *data, char *extra)
909{
910 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
911 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
912 int ret = 0;
913
914 switch (data->flags & IW_AUTH_INDEX) {
915 case IW_AUTH_WPA_VERSION:
916 case IW_AUTH_CIPHER_PAIRWISE:
917 case IW_AUTH_CIPHER_GROUP:
918 case IW_AUTH_WPA_ENABLED:
919 case IW_AUTH_RX_UNENCRYPTED_EAPOL:
920 break;
921 case IW_AUTH_KEY_MGMT:
922 if (sdata->type != IEEE80211_IF_TYPE_STA)
923 ret = -EINVAL;
924 else {
925 /*
Johannes Berg808718c2007-08-28 17:01:53 -0400926 * Key management was set by wpa_supplicant,
927 * we only need this to associate to a network
928 * that has privacy enabled regardless of not
929 * having a key.
Jiri Bencf0706e82007-05-05 11:45:53 -0700930 */
Johannes Berg808718c2007-08-28 17:01:53 -0400931 sdata->u.sta.key_management_enabled = !!data->value;
Jiri Bencf0706e82007-05-05 11:45:53 -0700932 }
933 break;
934 case IW_AUTH_80211_AUTH_ALG:
935 if (sdata->type == IEEE80211_IF_TYPE_STA ||
936 sdata->type == IEEE80211_IF_TYPE_IBSS)
937 sdata->u.sta.auth_algs = data->value;
938 else
939 ret = -EOPNOTSUPP;
940 break;
941 case IW_AUTH_PRIVACY_INVOKED:
942 if (local->ops->set_privacy_invoked)
943 ret = local->ops->set_privacy_invoked(
944 local_to_hw(local), data->value);
945 break;
946 default:
947 ret = -EOPNOTSUPP;
948 break;
949 }
950 return ret;
951}
952
953/* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */
954static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev)
955{
956 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
957 struct iw_statistics *wstats = &local->wstats;
958 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
959 struct sta_info *sta = NULL;
960
961 if (sdata->type == IEEE80211_IF_TYPE_STA ||
962 sdata->type == IEEE80211_IF_TYPE_IBSS)
963 sta = sta_info_get(local, sdata->u.sta.bssid);
964 if (!sta) {
965 wstats->discard.fragment = 0;
966 wstats->discard.misc = 0;
967 wstats->qual.qual = 0;
968 wstats->qual.level = 0;
969 wstats->qual.noise = 0;
970 wstats->qual.updated = IW_QUAL_ALL_INVALID;
971 } else {
972 wstats->qual.level = sta->last_rssi;
973 wstats->qual.qual = sta->last_signal;
974 wstats->qual.noise = sta->last_noise;
975 wstats->qual.updated = local->wstats_flags;
976 sta_info_put(sta);
977 }
978 return wstats;
979}
980
981static int ieee80211_ioctl_giwauth(struct net_device *dev,
982 struct iw_request_info *info,
983 struct iw_param *data, char *extra)
984{
985 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
986 int ret = 0;
987
988 switch (data->flags & IW_AUTH_INDEX) {
989 case IW_AUTH_80211_AUTH_ALG:
990 if (sdata->type == IEEE80211_IF_TYPE_STA ||
991 sdata->type == IEEE80211_IF_TYPE_IBSS)
992 data->value = sdata->u.sta.auth_algs;
993 else
994 ret = -EOPNOTSUPP;
995 break;
996 default:
997 ret = -EOPNOTSUPP;
998 break;
999 }
1000 return ret;
1001}
1002
1003
1004static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
1005 struct iw_request_info *info,
1006 struct iw_point *erq, char *extra)
1007{
1008 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1009 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
Johannes Berg628a1402007-09-26 17:53:17 +02001010 int uninitialized_var(alg), idx, i, remove = 0;
Jiri Bencf0706e82007-05-05 11:45:53 -07001011
1012 switch (ext->alg) {
1013 case IW_ENCODE_ALG_NONE:
Johannes Berg628a1402007-09-26 17:53:17 +02001014 remove = 1;
Jiri Bencf0706e82007-05-05 11:45:53 -07001015 break;
1016 case IW_ENCODE_ALG_WEP:
1017 alg = ALG_WEP;
1018 break;
1019 case IW_ENCODE_ALG_TKIP:
1020 alg = ALG_TKIP;
1021 break;
1022 case IW_ENCODE_ALG_CCMP:
1023 alg = ALG_CCMP;
1024 break;
1025 default:
1026 return -EOPNOTSUPP;
1027 }
1028
1029 if (erq->flags & IW_ENCODE_DISABLED)
Johannes Berg628a1402007-09-26 17:53:17 +02001030 remove = 1;
Jiri Bencf0706e82007-05-05 11:45:53 -07001031
1032 idx = erq->flags & IW_ENCODE_INDEX;
1033 if (idx < 1 || idx > 4) {
1034 idx = -1;
1035 if (!sdata->default_key)
1036 idx = 0;
1037 else for (i = 0; i < NUM_DEFAULT_KEYS; i++) {
1038 if (sdata->default_key == sdata->keys[i]) {
1039 idx = i;
1040 break;
1041 }
1042 }
1043 if (idx < 0)
1044 return -EINVAL;
1045 } else
1046 idx--;
1047
1048 return ieee80211_set_encryption(dev, ext->addr.sa_data, idx, alg,
Johannes Berg628a1402007-09-26 17:53:17 +02001049 remove,
Jiri Bencf0706e82007-05-05 11:45:53 -07001050 ext->ext_flags &
1051 IW_ENCODE_EXT_SET_TX_KEY,
1052 ext->key, ext->key_len);
1053}
1054
1055
Jiri Bencf0706e82007-05-05 11:45:53 -07001056/* Structures to export the Wireless Handlers */
1057
1058static const iw_handler ieee80211_handler[] =
1059{
1060 (iw_handler) NULL, /* SIOCSIWCOMMIT */
1061 (iw_handler) ieee80211_ioctl_giwname, /* SIOCGIWNAME */
1062 (iw_handler) NULL, /* SIOCSIWNWID */
1063 (iw_handler) NULL, /* SIOCGIWNWID */
1064 (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */
1065 (iw_handler) ieee80211_ioctl_giwfreq, /* SIOCGIWFREQ */
1066 (iw_handler) ieee80211_ioctl_siwmode, /* SIOCSIWMODE */
1067 (iw_handler) ieee80211_ioctl_giwmode, /* SIOCGIWMODE */
1068 (iw_handler) NULL, /* SIOCSIWSENS */
1069 (iw_handler) NULL, /* SIOCGIWSENS */
1070 (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */
1071 (iw_handler) ieee80211_ioctl_giwrange, /* SIOCGIWRANGE */
1072 (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */
1073 (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */
1074 (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */
1075 (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */
Johannes Berg5d4ecd92007-09-14 11:10:24 -04001076 (iw_handler) NULL, /* SIOCSIWSPY */
1077 (iw_handler) NULL, /* SIOCGIWSPY */
1078 (iw_handler) NULL, /* SIOCSIWTHRSPY */
1079 (iw_handler) NULL, /* SIOCGIWTHRSPY */
Jiri Bencf0706e82007-05-05 11:45:53 -07001080 (iw_handler) ieee80211_ioctl_siwap, /* SIOCSIWAP */
1081 (iw_handler) ieee80211_ioctl_giwap, /* SIOCGIWAP */
1082 (iw_handler) ieee80211_ioctl_siwmlme, /* SIOCSIWMLME */
1083 (iw_handler) NULL, /* SIOCGIWAPLIST */
1084 (iw_handler) ieee80211_ioctl_siwscan, /* SIOCSIWSCAN */
1085 (iw_handler) ieee80211_ioctl_giwscan, /* SIOCGIWSCAN */
1086 (iw_handler) ieee80211_ioctl_siwessid, /* SIOCSIWESSID */
1087 (iw_handler) ieee80211_ioctl_giwessid, /* SIOCGIWESSID */
1088 (iw_handler) NULL, /* SIOCSIWNICKN */
1089 (iw_handler) NULL, /* SIOCGIWNICKN */
1090 (iw_handler) NULL, /* -- hole -- */
1091 (iw_handler) NULL, /* -- hole -- */
Larry Finger1fd5e582007-07-10 19:32:10 +02001092 (iw_handler) ieee80211_ioctl_siwrate, /* SIOCSIWRATE */
Larry Fingerb3d88ad2007-06-10 17:57:33 -07001093 (iw_handler) ieee80211_ioctl_giwrate, /* SIOCGIWRATE */
Jiri Bencf0706e82007-05-05 11:45:53 -07001094 (iw_handler) ieee80211_ioctl_siwrts, /* SIOCSIWRTS */
1095 (iw_handler) ieee80211_ioctl_giwrts, /* SIOCGIWRTS */
1096 (iw_handler) ieee80211_ioctl_siwfrag, /* SIOCSIWFRAG */
1097 (iw_handler) ieee80211_ioctl_giwfrag, /* SIOCGIWFRAG */
Michael Buesch61609bc2007-09-20 22:06:39 +02001098 (iw_handler) ieee80211_ioctl_siwtxpower, /* SIOCSIWTXPOW */
Larry Fingerfe6aa302007-08-10 11:23:20 -05001099 (iw_handler) ieee80211_ioctl_giwtxpower, /* SIOCGIWTXPOW */
Jiri Bencf0706e82007-05-05 11:45:53 -07001100 (iw_handler) ieee80211_ioctl_siwretry, /* SIOCSIWRETRY */
1101 (iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */
1102 (iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */
1103 (iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */
1104 (iw_handler) NULL, /* SIOCSIWPOWER */
1105 (iw_handler) NULL, /* SIOCGIWPOWER */
1106 (iw_handler) NULL, /* -- hole -- */
1107 (iw_handler) NULL, /* -- hole -- */
1108 (iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */
1109 (iw_handler) NULL, /* SIOCGIWGENIE */
1110 (iw_handler) ieee80211_ioctl_siwauth, /* SIOCSIWAUTH */
1111 (iw_handler) ieee80211_ioctl_giwauth, /* SIOCGIWAUTH */
1112 (iw_handler) ieee80211_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */
1113 (iw_handler) NULL, /* SIOCGIWENCODEEXT */
1114 (iw_handler) NULL, /* SIOCSIWPMKSA */
1115 (iw_handler) NULL, /* -- hole -- */
1116};
1117
Jiri Bencf0706e82007-05-05 11:45:53 -07001118const struct iw_handler_def ieee80211_iw_handler_def =
1119{
1120 .num_standard = ARRAY_SIZE(ieee80211_handler),
Jiri Bencf0706e82007-05-05 11:45:53 -07001121 .standard = (iw_handler *) ieee80211_handler,
Jiri Bencf0706e82007-05-05 11:45:53 -07001122 .get_wireless_stats = ieee80211_get_wireless_stats,
1123};