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