Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1 | /* |
| 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 Doorn | cdcb006 | 2008-01-07 19:45:24 +0100 | [diff] [blame] | 24 | #include "ieee80211_led.h" |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 25 | #include "ieee80211_rate.h" |
| 26 | #include "wpa.h" |
| 27 | #include "aes_ccm.h" |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 28 | |
Johannes Berg | b708e61 | 2007-09-14 11:10:25 -0400 | [diff] [blame] | 29 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 30 | static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, |
Johannes Berg | 628a140 | 2007-09-26 17:53:17 +0200 | [diff] [blame] | 31 | int idx, int alg, int remove, |
| 32 | int set_tx_key, const u8 *_key, |
| 33 | size_t key_len) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 34 | { |
| 35 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 36 | struct sta_info *sta; |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 37 | struct ieee80211_key *key; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 38 | struct ieee80211_sub_if_data *sdata; |
| 39 | |
| 40 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 41 | |
Volker Braun | 139c3a0 | 2007-09-14 11:10:25 -0400 | [diff] [blame] | 42 | 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 | |
Johannes Berg | 628a140 | 2007-09-26 17:53:17 +0200 | [diff] [blame] | 48 | if (remove) { |
Johannes Berg | db4d116 | 2008-02-25 16:27:45 +0100 | [diff] [blame] | 49 | if (is_broadcast_ether_addr(sta_addr)) { |
| 50 | key = sdata->keys[idx]; |
| 51 | } else { |
| 52 | sta = sta_info_get(local, sta_addr); |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 53 | if (!sta) |
| 54 | return -ENOENT; |
Johannes Berg | db4d116 | 2008-02-25 16:27:45 +0100 | [diff] [blame] | 55 | key = sta->key; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 56 | } |
Johannes Berg | db4d116 | 2008-02-25 16:27:45 +0100 | [diff] [blame] | 57 | |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 58 | ieee80211_key_free(key); |
| 59 | return 0; |
Johannes Berg | db4d116 | 2008-02-25 16:27:45 +0100 | [diff] [blame] | 60 | } else { |
| 61 | key = ieee80211_key_alloc(alg, idx, key_len, _key); |
| 62 | if (!key) |
| 63 | return -ENOMEM; |
| 64 | |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 65 | sta = NULL; |
| 66 | |
Johannes Berg | db4d116 | 2008-02-25 16:27:45 +0100 | [diff] [blame] | 67 | if (!is_broadcast_ether_addr(sta_addr)) { |
| 68 | set_tx_key = 0; |
| 69 | /* |
| 70 | * According to the standard, the key index of a |
| 71 | * pairwise key must be zero. However, some AP are |
| 72 | * broken when it comes to WEP key indices, so we |
| 73 | * work around this. |
| 74 | */ |
| 75 | if (idx != 0 && alg != ALG_WEP) { |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 76 | ieee80211_key_free(key); |
| 77 | return -EINVAL; |
Johannes Berg | db4d116 | 2008-02-25 16:27:45 +0100 | [diff] [blame] | 78 | } |
| 79 | |
| 80 | sta = sta_info_get(local, sta_addr); |
| 81 | if (!sta) { |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 82 | ieee80211_key_free(key); |
| 83 | return -ENOENT; |
Johannes Berg | db4d116 | 2008-02-25 16:27:45 +0100 | [diff] [blame] | 84 | } |
| 85 | } |
| 86 | |
| 87 | ieee80211_key_link(key, sdata, sta); |
| 88 | |
| 89 | if (set_tx_key || (!sta && !sdata->default_key && key)) |
| 90 | ieee80211_set_default_key(sdata, idx); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 91 | } |
| 92 | |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 93 | return 0; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 94 | } |
| 95 | |
| 96 | static int ieee80211_ioctl_siwgenie(struct net_device *dev, |
| 97 | struct iw_request_info *info, |
| 98 | struct iw_point *data, char *extra) |
| 99 | { |
| 100 | struct ieee80211_sub_if_data *sdata; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 101 | |
| 102 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | ddd3d2b | 2007-09-26 17:53:20 +0200 | [diff] [blame] | 103 | |
| 104 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) |
| 105 | return -EOPNOTSUPP; |
| 106 | |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 107 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
| 108 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 109 | int ret = ieee80211_sta_set_extra_ie(dev, extra, data->length); |
| 110 | if (ret) |
| 111 | return ret; |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 112 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 113 | ieee80211_sta_req_auth(dev, &sdata->u.sta); |
| 114 | return 0; |
| 115 | } |
| 116 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 117 | return -EOPNOTSUPP; |
| 118 | } |
| 119 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 120 | static int ieee80211_ioctl_giwname(struct net_device *dev, |
| 121 | struct iw_request_info *info, |
| 122 | char *name, char *extra) |
| 123 | { |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 124 | strcpy(name, "IEEE 802.11"); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 125 | |
| 126 | return 0; |
| 127 | } |
| 128 | |
| 129 | |
| 130 | static int ieee80211_ioctl_giwrange(struct net_device *dev, |
| 131 | struct iw_request_info *info, |
| 132 | struct iw_point *data, char *extra) |
| 133 | { |
| 134 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 135 | struct iw_range *range = (struct iw_range *) extra; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 136 | enum ieee80211_band band; |
Hong Liu | 333af2f | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 137 | int c = 0; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 138 | |
| 139 | data->length = sizeof(struct iw_range); |
| 140 | memset(range, 0, sizeof(struct iw_range)); |
| 141 | |
| 142 | range->we_version_compiled = WIRELESS_EXT; |
| 143 | range->we_version_source = 21; |
| 144 | range->retry_capa = IW_RETRY_LIMIT; |
| 145 | range->retry_flags = IW_RETRY_LIMIT; |
| 146 | range->min_retry = 0; |
| 147 | range->max_retry = 255; |
| 148 | range->min_rts = 0; |
| 149 | range->max_rts = 2347; |
| 150 | range->min_frag = 256; |
| 151 | range->max_frag = 2346; |
| 152 | |
| 153 | range->encoding_size[0] = 5; |
| 154 | range->encoding_size[1] = 13; |
| 155 | range->num_encoding_sizes = 2; |
| 156 | range->max_encoding_tokens = NUM_DEFAULT_KEYS; |
| 157 | |
| 158 | range->max_qual.qual = local->hw.max_signal; |
| 159 | range->max_qual.level = local->hw.max_rssi; |
| 160 | range->max_qual.noise = local->hw.max_noise; |
| 161 | range->max_qual.updated = local->wstats_flags; |
| 162 | |
| 163 | range->avg_qual.qual = local->hw.max_signal/2; |
| 164 | range->avg_qual.level = 0; |
| 165 | range->avg_qual.noise = 0; |
| 166 | range->avg_qual.updated = local->wstats_flags; |
| 167 | |
| 168 | range->enc_capa = IW_ENC_CAPA_WPA | IW_ENC_CAPA_WPA2 | |
| 169 | IW_ENC_CAPA_CIPHER_TKIP | IW_ENC_CAPA_CIPHER_CCMP; |
| 170 | |
Hong Liu | 333af2f | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 171 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 172 | for (band = 0; band < IEEE80211_NUM_BANDS; band ++) { |
| 173 | int i; |
| 174 | struct ieee80211_supported_band *sband; |
| 175 | |
| 176 | sband = local->hw.wiphy->bands[band]; |
| 177 | |
| 178 | if (!sband) |
Hong Liu | 333af2f | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 179 | continue; |
| 180 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 181 | for (i = 0; i < sband->n_channels && c < IW_MAX_FREQUENCIES; i++) { |
| 182 | struct ieee80211_channel *chan = &sband->channels[i]; |
Hong Liu | 333af2f | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 183 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 184 | if (!(chan->flags & IEEE80211_CHAN_DISABLED)) { |
| 185 | range->freq[c].i = |
| 186 | ieee80211_frequency_to_channel( |
| 187 | chan->center_freq); |
| 188 | range->freq[c].m = chan->center_freq; |
| 189 | range->freq[c].e = 6; |
Hong Liu | 333af2f | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 190 | c++; |
| 191 | } |
Hong Liu | 333af2f | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 192 | } |
| 193 | } |
| 194 | range->num_channels = c; |
| 195 | range->num_frequency = c; |
| 196 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 197 | IW_EVENT_CAPA_SET_KERNEL(range->event_capa); |
| 198 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWTHRSPY); |
| 199 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWAP); |
| 200 | IW_EVENT_CAPA_SET(range->event_capa, SIOCGIWSCAN); |
| 201 | |
Dan Williams | 374fdfb | 2007-12-12 10:25:07 -0500 | [diff] [blame] | 202 | range->scan_capa |= IW_SCAN_CAPA_ESSID; |
| 203 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 204 | return 0; |
| 205 | } |
| 206 | |
| 207 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 208 | static int ieee80211_ioctl_siwmode(struct net_device *dev, |
| 209 | struct iw_request_info *info, |
| 210 | __u32 *mode, char *extra) |
| 211 | { |
| 212 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 213 | int type; |
| 214 | |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 215 | if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 216 | return -EOPNOTSUPP; |
| 217 | |
| 218 | switch (*mode) { |
| 219 | case IW_MODE_INFRA: |
| 220 | type = IEEE80211_IF_TYPE_STA; |
| 221 | break; |
| 222 | case IW_MODE_ADHOC: |
| 223 | type = IEEE80211_IF_TYPE_IBSS; |
| 224 | break; |
| 225 | case IW_MODE_MONITOR: |
| 226 | type = IEEE80211_IF_TYPE_MNTR; |
| 227 | break; |
| 228 | default: |
| 229 | return -EINVAL; |
| 230 | } |
| 231 | |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 232 | if (type == sdata->vif.type) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 233 | return 0; |
| 234 | if (netif_running(dev)) |
| 235 | return -EBUSY; |
| 236 | |
| 237 | ieee80211_if_reinit(dev); |
| 238 | ieee80211_if_set_type(dev, type); |
| 239 | |
| 240 | return 0; |
| 241 | } |
| 242 | |
| 243 | |
| 244 | static int ieee80211_ioctl_giwmode(struct net_device *dev, |
| 245 | struct iw_request_info *info, |
| 246 | __u32 *mode, char *extra) |
| 247 | { |
| 248 | struct ieee80211_sub_if_data *sdata; |
| 249 | |
| 250 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 251 | switch (sdata->vif.type) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 252 | case IEEE80211_IF_TYPE_AP: |
| 253 | *mode = IW_MODE_MASTER; |
| 254 | break; |
| 255 | case IEEE80211_IF_TYPE_STA: |
| 256 | *mode = IW_MODE_INFRA; |
| 257 | break; |
| 258 | case IEEE80211_IF_TYPE_IBSS: |
| 259 | *mode = IW_MODE_ADHOC; |
| 260 | break; |
| 261 | case IEEE80211_IF_TYPE_MNTR: |
| 262 | *mode = IW_MODE_MONITOR; |
| 263 | break; |
| 264 | case IEEE80211_IF_TYPE_WDS: |
| 265 | *mode = IW_MODE_REPEAT; |
| 266 | break; |
| 267 | case IEEE80211_IF_TYPE_VLAN: |
| 268 | *mode = IW_MODE_SECOND; /* FIXME */ |
| 269 | break; |
| 270 | default: |
| 271 | *mode = IW_MODE_AUTO; |
| 272 | break; |
| 273 | } |
| 274 | return 0; |
| 275 | } |
| 276 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 277 | int ieee80211_set_freq(struct ieee80211_local *local, int freqMHz) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 278 | { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 279 | int ret = -EINVAL; |
Johannes Berg | e048c6e | 2008-03-16 18:35:56 +0100 | [diff] [blame] | 280 | struct ieee80211_channel *chan; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 281 | |
Johannes Berg | e048c6e | 2008-03-16 18:35:56 +0100 | [diff] [blame] | 282 | chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 283 | |
Johannes Berg | e048c6e | 2008-03-16 18:35:56 +0100 | [diff] [blame] | 284 | if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { |
| 285 | local->oper_channel = chan; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 286 | |
Mohamed Abbas | 675ef58 | 2008-03-20 08:14:29 -0700 | [diff] [blame] | 287 | if (local->sta_sw_scanning || local->sta_hw_scanning) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 288 | ret = 0; |
| 289 | else |
| 290 | ret = ieee80211_hw_config(local); |
| 291 | |
| 292 | rate_control_clear(local); |
| 293 | } |
| 294 | |
| 295 | return ret; |
| 296 | } |
| 297 | |
| 298 | static int ieee80211_ioctl_siwfreq(struct net_device *dev, |
| 299 | struct iw_request_info *info, |
| 300 | struct iw_freq *freq, char *extra) |
| 301 | { |
| 302 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 303 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 304 | |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 305 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 306 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 307 | |
| 308 | /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */ |
| 309 | if (freq->e == 0) { |
| 310 | if (freq->m < 0) { |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 311 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 312 | sdata->u.sta.flags |= |
| 313 | IEEE80211_STA_AUTO_CHANNEL_SEL; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 314 | return 0; |
| 315 | } else |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 316 | return ieee80211_set_freq(local, |
| 317 | ieee80211_channel_to_frequency(freq->m)); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 318 | } else { |
| 319 | int i, div = 1000000; |
| 320 | for (i = 0; i < freq->e; i++) |
| 321 | div /= 10; |
| 322 | if (div > 0) |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 323 | return ieee80211_set_freq(local, freq->m / div); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 324 | else |
| 325 | return -EINVAL; |
| 326 | } |
| 327 | } |
| 328 | |
| 329 | |
| 330 | static int ieee80211_ioctl_giwfreq(struct net_device *dev, |
| 331 | struct iw_request_info *info, |
| 332 | struct iw_freq *freq, char *extra) |
| 333 | { |
| 334 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 335 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 336 | freq->m = local->hw.conf.channel->center_freq; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 337 | freq->e = 6; |
| 338 | |
| 339 | return 0; |
| 340 | } |
| 341 | |
| 342 | |
| 343 | static int ieee80211_ioctl_siwessid(struct net_device *dev, |
| 344 | struct iw_request_info *info, |
| 345 | struct iw_point *data, char *ssid) |
| 346 | { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 347 | struct ieee80211_sub_if_data *sdata; |
| 348 | size_t len = data->length; |
| 349 | |
| 350 | /* iwconfig uses nul termination in SSID.. */ |
| 351 | if (len > 0 && ssid[len - 1] == '\0') |
| 352 | len--; |
| 353 | |
| 354 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 355 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
| 356 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 357 | int ret; |
Johannes Berg | ddd3d2b | 2007-09-26 17:53:20 +0200 | [diff] [blame] | 358 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 359 | if (len > IEEE80211_MAX_SSID_LEN) |
| 360 | return -EINVAL; |
| 361 | memcpy(sdata->u.sta.ssid, ssid, len); |
| 362 | sdata->u.sta.ssid_len = len; |
| 363 | return 0; |
| 364 | } |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 365 | if (data->flags) |
| 366 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_SSID_SEL; |
| 367 | else |
| 368 | sdata->u.sta.flags |= IEEE80211_STA_AUTO_SSID_SEL; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 369 | ret = ieee80211_sta_set_ssid(dev, ssid, len); |
| 370 | if (ret) |
| 371 | return ret; |
| 372 | ieee80211_sta_req_auth(dev, &sdata->u.sta); |
| 373 | return 0; |
| 374 | } |
| 375 | |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 376 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 377 | memcpy(sdata->u.ap.ssid, ssid, len); |
| 378 | memset(sdata->u.ap.ssid + len, 0, |
| 379 | IEEE80211_MAX_SSID_LEN - len); |
| 380 | sdata->u.ap.ssid_len = len; |
| 381 | return ieee80211_if_config(dev); |
| 382 | } |
| 383 | return -EOPNOTSUPP; |
| 384 | } |
| 385 | |
| 386 | |
| 387 | static int ieee80211_ioctl_giwessid(struct net_device *dev, |
| 388 | struct iw_request_info *info, |
| 389 | struct iw_point *data, char *ssid) |
| 390 | { |
| 391 | size_t len; |
| 392 | |
| 393 | struct ieee80211_sub_if_data *sdata; |
| 394 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 395 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
| 396 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 397 | int res = ieee80211_sta_get_ssid(dev, ssid, &len); |
| 398 | if (res == 0) { |
| 399 | data->length = len; |
| 400 | data->flags = 1; |
| 401 | } else |
| 402 | data->flags = 0; |
| 403 | return res; |
| 404 | } |
| 405 | |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 406 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 407 | len = sdata->u.ap.ssid_len; |
| 408 | if (len > IW_ESSID_MAX_SIZE) |
| 409 | len = IW_ESSID_MAX_SIZE; |
| 410 | memcpy(ssid, sdata->u.ap.ssid, len); |
| 411 | data->length = len; |
| 412 | data->flags = 1; |
| 413 | return 0; |
| 414 | } |
| 415 | return -EOPNOTSUPP; |
| 416 | } |
| 417 | |
| 418 | |
| 419 | static int ieee80211_ioctl_siwap(struct net_device *dev, |
| 420 | struct iw_request_info *info, |
| 421 | struct sockaddr *ap_addr, char *extra) |
| 422 | { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 423 | struct ieee80211_sub_if_data *sdata; |
| 424 | |
| 425 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 426 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
| 427 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 428 | int ret; |
Johannes Berg | ddd3d2b | 2007-09-26 17:53:20 +0200 | [diff] [blame] | 429 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 430 | memcpy(sdata->u.sta.bssid, (u8 *) &ap_addr->sa_data, |
| 431 | ETH_ALEN); |
| 432 | return 0; |
| 433 | } |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 434 | if (is_zero_ether_addr((u8 *) &ap_addr->sa_data)) |
| 435 | sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL | |
| 436 | IEEE80211_STA_AUTO_CHANNEL_SEL; |
| 437 | else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data)) |
| 438 | sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 439 | else |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 440 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 441 | ret = ieee80211_sta_set_bssid(dev, (u8 *) &ap_addr->sa_data); |
| 442 | if (ret) |
| 443 | return ret; |
| 444 | ieee80211_sta_req_auth(dev, &sdata->u.sta); |
| 445 | return 0; |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 446 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { |
Johannes Berg | 44213b5 | 2008-02-25 16:27:49 +0100 | [diff] [blame] | 447 | /* |
| 448 | * If it is necessary to update the WDS peer address |
| 449 | * while the interface is running, then we need to do |
| 450 | * more work here, namely if it is running we need to |
| 451 | * add a new and remove the old STA entry, this is |
| 452 | * normally handled by _open() and _stop(). |
| 453 | */ |
| 454 | if (netif_running(dev)) |
| 455 | return -EBUSY; |
| 456 | |
| 457 | memcpy(&sdata->u.wds.remote_addr, (u8 *) &ap_addr->sa_data, |
| 458 | ETH_ALEN); |
| 459 | |
| 460 | return 0; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 461 | } |
| 462 | |
| 463 | return -EOPNOTSUPP; |
| 464 | } |
| 465 | |
| 466 | |
| 467 | static int ieee80211_ioctl_giwap(struct net_device *dev, |
| 468 | struct iw_request_info *info, |
| 469 | struct sockaddr *ap_addr, char *extra) |
| 470 | { |
| 471 | struct ieee80211_sub_if_data *sdata; |
| 472 | |
| 473 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 474 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
| 475 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 476 | ap_addr->sa_family = ARPHRD_ETHER; |
| 477 | memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); |
| 478 | return 0; |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 479 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 480 | ap_addr->sa_family = ARPHRD_ETHER; |
| 481 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); |
| 482 | return 0; |
| 483 | } |
| 484 | |
| 485 | return -EOPNOTSUPP; |
| 486 | } |
| 487 | |
| 488 | |
| 489 | static int ieee80211_ioctl_siwscan(struct net_device *dev, |
| 490 | struct iw_request_info *info, |
Bill Moss | 107acb2 | 2007-10-10 16:23:55 -0400 | [diff] [blame] | 491 | union iwreq_data *wrqu, char *extra) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 492 | { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 493 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Bill Moss | 107acb2 | 2007-10-10 16:23:55 -0400 | [diff] [blame] | 494 | struct iw_scan_req *req = NULL; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 495 | u8 *ssid = NULL; |
| 496 | size_t ssid_len = 0; |
| 497 | |
| 498 | if (!netif_running(dev)) |
| 499 | return -ENETDOWN; |
| 500 | |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 501 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && |
| 502 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS && |
Luis Carlos Cobo | ee38585 | 2008-02-23 15:17:11 +0100 | [diff] [blame] | 503 | sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT && |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 504 | sdata->vif.type != IEEE80211_IF_TYPE_AP) |
John W. Linville | d114f39 | 2007-10-17 21:16:16 -0700 | [diff] [blame] | 505 | return -EOPNOTSUPP; |
John W. Linville | d114f39 | 2007-10-17 21:16:16 -0700 | [diff] [blame] | 506 | |
| 507 | /* if SSID was specified explicitly then use that */ |
Bill Moss | 107acb2 | 2007-10-10 16:23:55 -0400 | [diff] [blame] | 508 | if (wrqu->data.length == sizeof(struct iw_scan_req) && |
| 509 | wrqu->data.flags & IW_SCAN_THIS_ESSID) { |
| 510 | req = (struct iw_scan_req *)extra; |
| 511 | ssid = req->essid; |
| 512 | ssid_len = req->essid_len; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 513 | } |
Daniel Drake | f27b62d | 2007-07-27 15:43:24 +0200 | [diff] [blame] | 514 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 515 | return ieee80211_sta_req_scan(dev, ssid, ssid_len); |
| 516 | } |
| 517 | |
| 518 | |
| 519 | static int ieee80211_ioctl_giwscan(struct net_device *dev, |
| 520 | struct iw_request_info *info, |
| 521 | struct iw_point *data, char *extra) |
| 522 | { |
| 523 | int res; |
| 524 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
Zhu Yi | ece8edd | 2007-11-22 10:53:21 +0800 | [diff] [blame] | 525 | |
| 526 | if (local->sta_sw_scanning || local->sta_hw_scanning) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 527 | return -EAGAIN; |
Zhu Yi | ece8edd | 2007-11-22 10:53:21 +0800 | [diff] [blame] | 528 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 529 | res = ieee80211_sta_scan_results(dev, extra, data->length); |
| 530 | if (res >= 0) { |
| 531 | data->length = res; |
| 532 | return 0; |
| 533 | } |
| 534 | data->length = 0; |
| 535 | return res; |
| 536 | } |
| 537 | |
| 538 | |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 539 | static int ieee80211_ioctl_siwrate(struct net_device *dev, |
| 540 | struct iw_request_info *info, |
| 541 | struct iw_param *rate, char *extra) |
| 542 | { |
| 543 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 544 | int i, err = -EINVAL; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 545 | u32 target_rate = rate->value / 100000; |
| 546 | struct ieee80211_sub_if_data *sdata; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 547 | struct ieee80211_supported_band *sband; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 548 | |
| 549 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 550 | if (!sdata->bss) |
| 551 | return -ENODEV; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 552 | |
| 553 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
| 554 | |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 555 | /* target_rate = -1, rate->fixed = 0 means auto only, so use all rates |
| 556 | * target_rate = X, rate->fixed = 1 means only rate X |
| 557 | * target_rate = X, rate->fixed = 0 means all rates <= X */ |
| 558 | sdata->bss->max_ratectrl_rateidx = -1; |
| 559 | sdata->bss->force_unicast_rateidx = -1; |
| 560 | if (rate->value < 0) |
| 561 | return 0; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 562 | |
| 563 | for (i=0; i< sband->n_bitrates; i++) { |
| 564 | struct ieee80211_rate *brate = &sband->bitrates[i]; |
| 565 | int this_rate = brate->bitrate; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 566 | |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 567 | if (target_rate == this_rate) { |
| 568 | sdata->bss->max_ratectrl_rateidx = i; |
| 569 | if (rate->fixed) |
| 570 | sdata->bss->force_unicast_rateidx = i; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 571 | err = 0; |
| 572 | break; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 573 | } |
| 574 | } |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 575 | return err; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 576 | } |
| 577 | |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 578 | static int ieee80211_ioctl_giwrate(struct net_device *dev, |
| 579 | struct iw_request_info *info, |
| 580 | struct iw_param *rate, char *extra) |
| 581 | { |
| 582 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 583 | struct sta_info *sta; |
| 584 | struct ieee80211_sub_if_data *sdata; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 585 | struct ieee80211_supported_band *sband; |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 586 | |
| 587 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 588 | |
Johannes Berg | 380a942 | 2008-04-04 23:40:35 +0200 | [diff] [blame^] | 589 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 590 | return -EOPNOTSUPP; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 591 | |
| 592 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
| 593 | |
Johannes Berg | 380a942 | 2008-04-04 23:40:35 +0200 | [diff] [blame^] | 594 | rcu_read_lock(); |
| 595 | |
| 596 | sta = sta_info_get(local, sdata->u.sta.bssid); |
| 597 | |
| 598 | if (sta && sta->txrate_idx < sband->n_bitrates) |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 599 | rate->value = sband->bitrates[sta->txrate_idx].bitrate; |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 600 | else |
| 601 | rate->value = 0; |
Johannes Berg | 380a942 | 2008-04-04 23:40:35 +0200 | [diff] [blame^] | 602 | |
| 603 | rcu_read_unlock(); |
| 604 | |
| 605 | if (!sta) |
| 606 | return -ENODEV; |
| 607 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 608 | rate->value *= 100000; |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 609 | |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 610 | return 0; |
| 611 | } |
| 612 | |
Michael Buesch | 61609bc | 2007-09-20 22:06:39 +0200 | [diff] [blame] | 613 | static int ieee80211_ioctl_siwtxpower(struct net_device *dev, |
| 614 | struct iw_request_info *info, |
| 615 | union iwreq_data *data, char *extra) |
| 616 | { |
| 617 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 618 | bool need_reconfig = 0; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 619 | int new_power_level; |
Michael Buesch | 61609bc | 2007-09-20 22:06:39 +0200 | [diff] [blame] | 620 | |
| 621 | if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) |
| 622 | return -EINVAL; |
| 623 | if (data->txpower.flags & IW_TXPOW_RANGE) |
| 624 | return -EINVAL; |
Michael Buesch | 61609bc | 2007-09-20 22:06:39 +0200 | [diff] [blame] | 625 | |
Mattias Nissler | 6a43295 | 2007-10-24 23:30:36 +0200 | [diff] [blame] | 626 | if (data->txpower.fixed) { |
| 627 | new_power_level = data->txpower.value; |
| 628 | } else { |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 629 | /* |
| 630 | * Automatic power level. Use maximum power for the current |
| 631 | * channel. Should be part of rate control. |
| 632 | */ |
| 633 | struct ieee80211_channel* chan = local->hw.conf.channel; |
Mattias Nissler | 6a43295 | 2007-10-24 23:30:36 +0200 | [diff] [blame] | 634 | if (!chan) |
| 635 | return -EINVAL; |
| 636 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 637 | new_power_level = chan->max_power; |
Mattias Nissler | 6a43295 | 2007-10-24 23:30:36 +0200 | [diff] [blame] | 638 | } |
| 639 | |
| 640 | if (local->hw.conf.power_level != new_power_level) { |
| 641 | local->hw.conf.power_level = new_power_level; |
Michael Buesch | 61609bc | 2007-09-20 22:06:39 +0200 | [diff] [blame] | 642 | need_reconfig = 1; |
| 643 | } |
Mattias Nissler | 6a43295 | 2007-10-24 23:30:36 +0200 | [diff] [blame] | 644 | |
Michael Buesch | 61609bc | 2007-09-20 22:06:39 +0200 | [diff] [blame] | 645 | if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) { |
| 646 | local->hw.conf.radio_enabled = !(data->txpower.disabled); |
| 647 | need_reconfig = 1; |
Ivo van Doorn | cdcb006 | 2008-01-07 19:45:24 +0100 | [diff] [blame] | 648 | ieee80211_led_radio(local, local->hw.conf.radio_enabled); |
Michael Buesch | 61609bc | 2007-09-20 22:06:39 +0200 | [diff] [blame] | 649 | } |
Mattias Nissler | 6a43295 | 2007-10-24 23:30:36 +0200 | [diff] [blame] | 650 | |
Michael Buesch | 61609bc | 2007-09-20 22:06:39 +0200 | [diff] [blame] | 651 | if (need_reconfig) { |
| 652 | ieee80211_hw_config(local); |
| 653 | /* The return value of hw_config is not of big interest here, |
| 654 | * as it doesn't say that it failed because of _this_ config |
| 655 | * change or something else. Ignore it. */ |
| 656 | } |
| 657 | |
| 658 | return 0; |
| 659 | } |
| 660 | |
Larry Finger | fe6aa30 | 2007-08-10 11:23:20 -0500 | [diff] [blame] | 661 | static int ieee80211_ioctl_giwtxpower(struct net_device *dev, |
| 662 | struct iw_request_info *info, |
| 663 | union iwreq_data *data, char *extra) |
| 664 | { |
| 665 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 666 | |
| 667 | data->txpower.fixed = 1; |
| 668 | data->txpower.disabled = !(local->hw.conf.radio_enabled); |
| 669 | data->txpower.value = local->hw.conf.power_level; |
| 670 | data->txpower.flags = IW_TXPOW_DBM; |
| 671 | |
| 672 | return 0; |
| 673 | } |
| 674 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 675 | static int ieee80211_ioctl_siwrts(struct net_device *dev, |
| 676 | struct iw_request_info *info, |
| 677 | struct iw_param *rts, char *extra) |
| 678 | { |
| 679 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 680 | |
| 681 | if (rts->disabled) |
| 682 | local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; |
| 683 | else if (rts->value < 0 || rts->value > IEEE80211_MAX_RTS_THRESHOLD) |
| 684 | return -EINVAL; |
| 685 | else |
| 686 | local->rts_threshold = rts->value; |
| 687 | |
| 688 | /* If the wlan card performs RTS/CTS in hardware/firmware, |
| 689 | * configure it here */ |
| 690 | |
| 691 | if (local->ops->set_rts_threshold) |
| 692 | local->ops->set_rts_threshold(local_to_hw(local), |
| 693 | local->rts_threshold); |
| 694 | |
| 695 | return 0; |
| 696 | } |
| 697 | |
| 698 | static int ieee80211_ioctl_giwrts(struct net_device *dev, |
| 699 | struct iw_request_info *info, |
| 700 | struct iw_param *rts, char *extra) |
| 701 | { |
| 702 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 703 | |
| 704 | rts->value = local->rts_threshold; |
| 705 | rts->disabled = (rts->value >= IEEE80211_MAX_RTS_THRESHOLD); |
| 706 | rts->fixed = 1; |
| 707 | |
| 708 | return 0; |
| 709 | } |
| 710 | |
| 711 | |
| 712 | static int ieee80211_ioctl_siwfrag(struct net_device *dev, |
| 713 | struct iw_request_info *info, |
| 714 | struct iw_param *frag, char *extra) |
| 715 | { |
| 716 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 717 | |
| 718 | if (frag->disabled) |
| 719 | local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD; |
| 720 | else if (frag->value < 256 || |
| 721 | frag->value > IEEE80211_MAX_FRAG_THRESHOLD) |
| 722 | return -EINVAL; |
| 723 | else { |
| 724 | /* Fragment length must be even, so strip LSB. */ |
| 725 | local->fragmentation_threshold = frag->value & ~0x1; |
| 726 | } |
| 727 | |
| 728 | /* If the wlan card performs fragmentation in hardware/firmware, |
| 729 | * configure it here */ |
| 730 | |
| 731 | if (local->ops->set_frag_threshold) |
| 732 | local->ops->set_frag_threshold( |
| 733 | local_to_hw(local), |
| 734 | local->fragmentation_threshold); |
| 735 | |
| 736 | return 0; |
| 737 | } |
| 738 | |
| 739 | static int ieee80211_ioctl_giwfrag(struct net_device *dev, |
| 740 | struct iw_request_info *info, |
| 741 | struct iw_param *frag, char *extra) |
| 742 | { |
| 743 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 744 | |
| 745 | frag->value = local->fragmentation_threshold; |
| 746 | frag->disabled = (frag->value >= IEEE80211_MAX_RTS_THRESHOLD); |
| 747 | frag->fixed = 1; |
| 748 | |
| 749 | return 0; |
| 750 | } |
| 751 | |
| 752 | |
| 753 | static int ieee80211_ioctl_siwretry(struct net_device *dev, |
| 754 | struct iw_request_info *info, |
| 755 | struct iw_param *retry, char *extra) |
| 756 | { |
| 757 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 758 | |
| 759 | if (retry->disabled || |
| 760 | (retry->flags & IW_RETRY_TYPE) != IW_RETRY_LIMIT) |
| 761 | return -EINVAL; |
| 762 | |
| 763 | if (retry->flags & IW_RETRY_MAX) |
| 764 | local->long_retry_limit = retry->value; |
| 765 | else if (retry->flags & IW_RETRY_MIN) |
| 766 | local->short_retry_limit = retry->value; |
| 767 | else { |
| 768 | local->long_retry_limit = retry->value; |
| 769 | local->short_retry_limit = retry->value; |
| 770 | } |
| 771 | |
| 772 | if (local->ops->set_retry_limit) { |
| 773 | return local->ops->set_retry_limit( |
| 774 | local_to_hw(local), |
| 775 | local->short_retry_limit, |
| 776 | local->long_retry_limit); |
| 777 | } |
| 778 | |
| 779 | return 0; |
| 780 | } |
| 781 | |
| 782 | |
| 783 | static int ieee80211_ioctl_giwretry(struct net_device *dev, |
| 784 | struct iw_request_info *info, |
| 785 | struct iw_param *retry, char *extra) |
| 786 | { |
| 787 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 788 | |
| 789 | retry->disabled = 0; |
| 790 | if (retry->flags == 0 || retry->flags & IW_RETRY_MIN) { |
| 791 | /* first return min value, iwconfig will ask max value |
| 792 | * later if needed */ |
| 793 | retry->flags |= IW_RETRY_LIMIT; |
| 794 | retry->value = local->short_retry_limit; |
| 795 | if (local->long_retry_limit != local->short_retry_limit) |
| 796 | retry->flags |= IW_RETRY_MIN; |
| 797 | return 0; |
| 798 | } |
| 799 | if (retry->flags & IW_RETRY_MAX) { |
| 800 | retry->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; |
| 801 | retry->value = local->long_retry_limit; |
| 802 | } |
| 803 | |
| 804 | return 0; |
| 805 | } |
| 806 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 807 | static int ieee80211_ioctl_siwmlme(struct net_device *dev, |
| 808 | struct iw_request_info *info, |
| 809 | struct iw_point *data, char *extra) |
| 810 | { |
| 811 | struct ieee80211_sub_if_data *sdata; |
| 812 | struct iw_mlme *mlme = (struct iw_mlme *) extra; |
| 813 | |
| 814 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 815 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && |
| 816 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 817 | return -EINVAL; |
| 818 | |
| 819 | switch (mlme->cmd) { |
| 820 | case IW_MLME_DEAUTH: |
| 821 | /* TODO: mlme->addr.sa_data */ |
| 822 | return ieee80211_sta_deauthenticate(dev, mlme->reason_code); |
| 823 | case IW_MLME_DISASSOC: |
| 824 | /* TODO: mlme->addr.sa_data */ |
| 825 | return ieee80211_sta_disassociate(dev, mlme->reason_code); |
| 826 | default: |
| 827 | return -EOPNOTSUPP; |
| 828 | } |
| 829 | } |
| 830 | |
| 831 | |
| 832 | static int ieee80211_ioctl_siwencode(struct net_device *dev, |
| 833 | struct iw_request_info *info, |
| 834 | struct iw_point *erq, char *keybuf) |
| 835 | { |
| 836 | struct ieee80211_sub_if_data *sdata; |
| 837 | int idx, i, alg = ALG_WEP; |
| 838 | u8 bcaddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
Johannes Berg | 628a140 | 2007-09-26 17:53:17 +0200 | [diff] [blame] | 839 | int remove = 0; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 840 | |
| 841 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 842 | |
| 843 | idx = erq->flags & IW_ENCODE_INDEX; |
| 844 | if (idx == 0) { |
| 845 | if (sdata->default_key) |
| 846 | for (i = 0; i < NUM_DEFAULT_KEYS; i++) { |
| 847 | if (sdata->default_key == sdata->keys[i]) { |
| 848 | idx = i; |
| 849 | break; |
| 850 | } |
| 851 | } |
| 852 | } else if (idx < 1 || idx > 4) |
| 853 | return -EINVAL; |
| 854 | else |
| 855 | idx--; |
| 856 | |
| 857 | if (erq->flags & IW_ENCODE_DISABLED) |
Johannes Berg | 628a140 | 2007-09-26 17:53:17 +0200 | [diff] [blame] | 858 | remove = 1; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 859 | else if (erq->length == 0) { |
| 860 | /* No key data - just set the default TX key index */ |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 861 | ieee80211_set_default_key(sdata, idx); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 862 | return 0; |
| 863 | } |
| 864 | |
| 865 | return ieee80211_set_encryption( |
| 866 | dev, bcaddr, |
Johannes Berg | 628a140 | 2007-09-26 17:53:17 +0200 | [diff] [blame] | 867 | idx, alg, remove, |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 868 | !sdata->default_key, |
| 869 | keybuf, erq->length); |
| 870 | } |
| 871 | |
| 872 | |
| 873 | static int ieee80211_ioctl_giwencode(struct net_device *dev, |
| 874 | struct iw_request_info *info, |
| 875 | struct iw_point *erq, char *key) |
| 876 | { |
| 877 | struct ieee80211_sub_if_data *sdata; |
| 878 | int idx, i; |
| 879 | |
| 880 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 881 | |
| 882 | idx = erq->flags & IW_ENCODE_INDEX; |
| 883 | if (idx < 1 || idx > 4) { |
| 884 | idx = -1; |
| 885 | if (!sdata->default_key) |
| 886 | idx = 0; |
| 887 | else for (i = 0; i < NUM_DEFAULT_KEYS; i++) { |
| 888 | if (sdata->default_key == sdata->keys[i]) { |
| 889 | idx = i; |
| 890 | break; |
| 891 | } |
| 892 | } |
| 893 | if (idx < 0) |
| 894 | return -EINVAL; |
| 895 | } else |
| 896 | idx--; |
| 897 | |
| 898 | erq->flags = idx + 1; |
| 899 | |
| 900 | if (!sdata->keys[idx]) { |
| 901 | erq->length = 0; |
| 902 | erq->flags |= IW_ENCODE_DISABLED; |
| 903 | return 0; |
| 904 | } |
| 905 | |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 906 | memcpy(key, sdata->keys[idx]->conf.key, |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 907 | min_t(int, erq->length, sdata->keys[idx]->conf.keylen)); |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 908 | erq->length = sdata->keys[idx]->conf.keylen; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 909 | erq->flags |= IW_ENCODE_ENABLED; |
| 910 | |
| 911 | return 0; |
| 912 | } |
| 913 | |
| 914 | static int ieee80211_ioctl_siwauth(struct net_device *dev, |
| 915 | struct iw_request_info *info, |
| 916 | struct iw_param *data, char *extra) |
| 917 | { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 918 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 919 | int ret = 0; |
| 920 | |
| 921 | switch (data->flags & IW_AUTH_INDEX) { |
| 922 | case IW_AUTH_WPA_VERSION: |
| 923 | case IW_AUTH_CIPHER_PAIRWISE: |
| 924 | case IW_AUTH_CIPHER_GROUP: |
| 925 | case IW_AUTH_WPA_ENABLED: |
| 926 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 927 | case IW_AUTH_KEY_MGMT: |
Johannes Berg | 5b98b1f | 2007-11-03 13:11:10 +0000 | [diff] [blame] | 928 | break; |
Johannes Berg | b1357a8 | 2007-11-28 11:04:21 +0100 | [diff] [blame] | 929 | case IW_AUTH_DROP_UNENCRYPTED: |
| 930 | sdata->drop_unencrypted = !!data->value; |
| 931 | break; |
Johannes Berg | 5b98b1f | 2007-11-03 13:11:10 +0000 | [diff] [blame] | 932 | case IW_AUTH_PRIVACY_INVOKED: |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 933 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 934 | ret = -EINVAL; |
| 935 | else { |
Johannes Berg | 5b98b1f | 2007-11-03 13:11:10 +0000 | [diff] [blame] | 936 | sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 937 | /* |
Johannes Berg | 5b98b1f | 2007-11-03 13:11:10 +0000 | [diff] [blame] | 938 | * Privacy invoked by wpa_supplicant, store the |
| 939 | * value and allow associating to a protected |
| 940 | * network without having a key up front. |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 941 | */ |
Johannes Berg | 5b98b1f | 2007-11-03 13:11:10 +0000 | [diff] [blame] | 942 | if (data->value) |
| 943 | sdata->u.sta.flags |= |
| 944 | IEEE80211_STA_PRIVACY_INVOKED; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 945 | } |
| 946 | break; |
| 947 | case IW_AUTH_80211_AUTH_ALG: |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 948 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
| 949 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 950 | sdata->u.sta.auth_algs = data->value; |
| 951 | else |
| 952 | ret = -EOPNOTSUPP; |
| 953 | break; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 954 | default: |
| 955 | ret = -EOPNOTSUPP; |
| 956 | break; |
| 957 | } |
| 958 | return ret; |
| 959 | } |
| 960 | |
| 961 | /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */ |
| 962 | static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev) |
| 963 | { |
| 964 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 965 | struct iw_statistics *wstats = &local->wstats; |
| 966 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 967 | struct sta_info *sta = NULL; |
| 968 | |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 969 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
| 970 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 971 | sta = sta_info_get(local, sdata->u.sta.bssid); |
| 972 | if (!sta) { |
| 973 | wstats->discard.fragment = 0; |
| 974 | wstats->discard.misc = 0; |
| 975 | wstats->qual.qual = 0; |
| 976 | wstats->qual.level = 0; |
| 977 | wstats->qual.noise = 0; |
| 978 | wstats->qual.updated = IW_QUAL_ALL_INVALID; |
| 979 | } else { |
| 980 | wstats->qual.level = sta->last_rssi; |
| 981 | wstats->qual.qual = sta->last_signal; |
| 982 | wstats->qual.noise = sta->last_noise; |
| 983 | wstats->qual.updated = local->wstats_flags; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 984 | } |
| 985 | return wstats; |
| 986 | } |
| 987 | |
| 988 | static int ieee80211_ioctl_giwauth(struct net_device *dev, |
| 989 | struct iw_request_info *info, |
| 990 | struct iw_param *data, char *extra) |
| 991 | { |
| 992 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 993 | int ret = 0; |
| 994 | |
| 995 | switch (data->flags & IW_AUTH_INDEX) { |
| 996 | case IW_AUTH_80211_AUTH_ALG: |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame] | 997 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
| 998 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 999 | data->value = sdata->u.sta.auth_algs; |
| 1000 | else |
| 1001 | ret = -EOPNOTSUPP; |
| 1002 | break; |
| 1003 | default: |
| 1004 | ret = -EOPNOTSUPP; |
| 1005 | break; |
| 1006 | } |
| 1007 | return ret; |
| 1008 | } |
| 1009 | |
| 1010 | |
| 1011 | static int ieee80211_ioctl_siwencodeext(struct net_device *dev, |
| 1012 | struct iw_request_info *info, |
| 1013 | struct iw_point *erq, char *extra) |
| 1014 | { |
| 1015 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 1016 | struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; |
Johannes Berg | 628a140 | 2007-09-26 17:53:17 +0200 | [diff] [blame] | 1017 | int uninitialized_var(alg), idx, i, remove = 0; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1018 | |
| 1019 | switch (ext->alg) { |
| 1020 | case IW_ENCODE_ALG_NONE: |
Johannes Berg | 628a140 | 2007-09-26 17:53:17 +0200 | [diff] [blame] | 1021 | remove = 1; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1022 | break; |
| 1023 | case IW_ENCODE_ALG_WEP: |
| 1024 | alg = ALG_WEP; |
| 1025 | break; |
| 1026 | case IW_ENCODE_ALG_TKIP: |
| 1027 | alg = ALG_TKIP; |
| 1028 | break; |
| 1029 | case IW_ENCODE_ALG_CCMP: |
| 1030 | alg = ALG_CCMP; |
| 1031 | break; |
| 1032 | default: |
| 1033 | return -EOPNOTSUPP; |
| 1034 | } |
| 1035 | |
| 1036 | if (erq->flags & IW_ENCODE_DISABLED) |
Johannes Berg | 628a140 | 2007-09-26 17:53:17 +0200 | [diff] [blame] | 1037 | remove = 1; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1038 | |
| 1039 | idx = erq->flags & IW_ENCODE_INDEX; |
| 1040 | if (idx < 1 || idx > 4) { |
| 1041 | idx = -1; |
| 1042 | if (!sdata->default_key) |
| 1043 | idx = 0; |
| 1044 | else for (i = 0; i < NUM_DEFAULT_KEYS; i++) { |
| 1045 | if (sdata->default_key == sdata->keys[i]) { |
| 1046 | idx = i; |
| 1047 | break; |
| 1048 | } |
| 1049 | } |
| 1050 | if (idx < 0) |
| 1051 | return -EINVAL; |
| 1052 | } else |
| 1053 | idx--; |
| 1054 | |
| 1055 | return ieee80211_set_encryption(dev, ext->addr.sa_data, idx, alg, |
Johannes Berg | 628a140 | 2007-09-26 17:53:17 +0200 | [diff] [blame] | 1056 | remove, |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1057 | ext->ext_flags & |
| 1058 | IW_ENCODE_EXT_SET_TX_KEY, |
| 1059 | ext->key, ext->key_len); |
| 1060 | } |
| 1061 | |
| 1062 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1063 | /* Structures to export the Wireless Handlers */ |
| 1064 | |
| 1065 | static const iw_handler ieee80211_handler[] = |
| 1066 | { |
| 1067 | (iw_handler) NULL, /* SIOCSIWCOMMIT */ |
| 1068 | (iw_handler) ieee80211_ioctl_giwname, /* SIOCGIWNAME */ |
| 1069 | (iw_handler) NULL, /* SIOCSIWNWID */ |
| 1070 | (iw_handler) NULL, /* SIOCGIWNWID */ |
| 1071 | (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */ |
| 1072 | (iw_handler) ieee80211_ioctl_giwfreq, /* SIOCGIWFREQ */ |
| 1073 | (iw_handler) ieee80211_ioctl_siwmode, /* SIOCSIWMODE */ |
| 1074 | (iw_handler) ieee80211_ioctl_giwmode, /* SIOCGIWMODE */ |
| 1075 | (iw_handler) NULL, /* SIOCSIWSENS */ |
| 1076 | (iw_handler) NULL, /* SIOCGIWSENS */ |
| 1077 | (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */ |
| 1078 | (iw_handler) ieee80211_ioctl_giwrange, /* SIOCGIWRANGE */ |
| 1079 | (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */ |
| 1080 | (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */ |
| 1081 | (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */ |
| 1082 | (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */ |
Johannes Berg | 5d4ecd9 | 2007-09-14 11:10:24 -0400 | [diff] [blame] | 1083 | (iw_handler) NULL, /* SIOCSIWSPY */ |
| 1084 | (iw_handler) NULL, /* SIOCGIWSPY */ |
| 1085 | (iw_handler) NULL, /* SIOCSIWTHRSPY */ |
| 1086 | (iw_handler) NULL, /* SIOCGIWTHRSPY */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1087 | (iw_handler) ieee80211_ioctl_siwap, /* SIOCSIWAP */ |
| 1088 | (iw_handler) ieee80211_ioctl_giwap, /* SIOCGIWAP */ |
| 1089 | (iw_handler) ieee80211_ioctl_siwmlme, /* SIOCSIWMLME */ |
| 1090 | (iw_handler) NULL, /* SIOCGIWAPLIST */ |
| 1091 | (iw_handler) ieee80211_ioctl_siwscan, /* SIOCSIWSCAN */ |
| 1092 | (iw_handler) ieee80211_ioctl_giwscan, /* SIOCGIWSCAN */ |
| 1093 | (iw_handler) ieee80211_ioctl_siwessid, /* SIOCSIWESSID */ |
| 1094 | (iw_handler) ieee80211_ioctl_giwessid, /* SIOCGIWESSID */ |
| 1095 | (iw_handler) NULL, /* SIOCSIWNICKN */ |
| 1096 | (iw_handler) NULL, /* SIOCGIWNICKN */ |
| 1097 | (iw_handler) NULL, /* -- hole -- */ |
| 1098 | (iw_handler) NULL, /* -- hole -- */ |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 1099 | (iw_handler) ieee80211_ioctl_siwrate, /* SIOCSIWRATE */ |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 1100 | (iw_handler) ieee80211_ioctl_giwrate, /* SIOCGIWRATE */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1101 | (iw_handler) ieee80211_ioctl_siwrts, /* SIOCSIWRTS */ |
| 1102 | (iw_handler) ieee80211_ioctl_giwrts, /* SIOCGIWRTS */ |
| 1103 | (iw_handler) ieee80211_ioctl_siwfrag, /* SIOCSIWFRAG */ |
| 1104 | (iw_handler) ieee80211_ioctl_giwfrag, /* SIOCGIWFRAG */ |
Michael Buesch | 61609bc | 2007-09-20 22:06:39 +0200 | [diff] [blame] | 1105 | (iw_handler) ieee80211_ioctl_siwtxpower, /* SIOCSIWTXPOW */ |
Larry Finger | fe6aa30 | 2007-08-10 11:23:20 -0500 | [diff] [blame] | 1106 | (iw_handler) ieee80211_ioctl_giwtxpower, /* SIOCGIWTXPOW */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1107 | (iw_handler) ieee80211_ioctl_siwretry, /* SIOCSIWRETRY */ |
| 1108 | (iw_handler) ieee80211_ioctl_giwretry, /* SIOCGIWRETRY */ |
| 1109 | (iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */ |
| 1110 | (iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */ |
| 1111 | (iw_handler) NULL, /* SIOCSIWPOWER */ |
| 1112 | (iw_handler) NULL, /* SIOCGIWPOWER */ |
| 1113 | (iw_handler) NULL, /* -- hole -- */ |
| 1114 | (iw_handler) NULL, /* -- hole -- */ |
| 1115 | (iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */ |
| 1116 | (iw_handler) NULL, /* SIOCGIWGENIE */ |
| 1117 | (iw_handler) ieee80211_ioctl_siwauth, /* SIOCSIWAUTH */ |
| 1118 | (iw_handler) ieee80211_ioctl_giwauth, /* SIOCGIWAUTH */ |
| 1119 | (iw_handler) ieee80211_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */ |
| 1120 | (iw_handler) NULL, /* SIOCGIWENCODEEXT */ |
| 1121 | (iw_handler) NULL, /* SIOCSIWPMKSA */ |
| 1122 | (iw_handler) NULL, /* -- hole -- */ |
| 1123 | }; |
| 1124 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1125 | const struct iw_handler_def ieee80211_iw_handler_def = |
| 1126 | { |
| 1127 | .num_standard = ARRAY_SIZE(ieee80211_handler), |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1128 | .standard = (iw_handler *) ieee80211_handler, |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1129 | .get_wireless_stats = ieee80211_get_wireless_stats, |
| 1130 | }; |