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