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