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