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 | |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 30 | static int ieee80211_set_encryption(struct ieee80211_sub_if_data *sdata, 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 | { |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 35 | struct ieee80211_local *local = sdata->local; |
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; |
Johannes Berg | 3b96766 | 2008-04-08 17:56:52 +0200 | [diff] [blame] | 38 | int err; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 39 | |
Jouni Malinen | 22787dba | 2009-01-08 13:32:04 +0200 | [diff] [blame] | 40 | if (alg == ALG_AES_CMAC) { |
| 41 | if (idx < NUM_DEFAULT_KEYS || |
| 42 | idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS) { |
| 43 | printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d " |
| 44 | "(BIP)\n", sdata->dev->name, idx); |
| 45 | return -EINVAL; |
| 46 | } |
| 47 | } else if (idx < 0 || idx >= NUM_DEFAULT_KEYS) { |
Volker Braun | 139c3a0 | 2007-09-14 11:10:25 -0400 | [diff] [blame] | 48 | printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d\n", |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 49 | sdata->dev->name, idx); |
Volker Braun | 139c3a0 | 2007-09-14 11:10:25 -0400 | [diff] [blame] | 50 | return -EINVAL; |
| 51 | } |
| 52 | |
Johannes Berg | 628a140 | 2007-09-26 17:53:17 +0200 | [diff] [blame] | 53 | if (remove) { |
Johannes Berg | 3b96766 | 2008-04-08 17:56:52 +0200 | [diff] [blame] | 54 | rcu_read_lock(); |
| 55 | |
| 56 | err = 0; |
| 57 | |
Johannes Berg | db4d116 | 2008-02-25 16:27:45 +0100 | [diff] [blame] | 58 | if (is_broadcast_ether_addr(sta_addr)) { |
| 59 | key = sdata->keys[idx]; |
| 60 | } else { |
| 61 | sta = sta_info_get(local, sta_addr); |
Johannes Berg | 3b96766 | 2008-04-08 17:56:52 +0200 | [diff] [blame] | 62 | if (!sta) { |
| 63 | err = -ENOENT; |
| 64 | goto out_unlock; |
| 65 | } |
Johannes Berg | db4d116 | 2008-02-25 16:27:45 +0100 | [diff] [blame] | 66 | key = sta->key; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 67 | } |
Johannes Berg | db4d116 | 2008-02-25 16:27:45 +0100 | [diff] [blame] | 68 | |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 69 | ieee80211_key_free(key); |
Johannes Berg | db4d116 | 2008-02-25 16:27:45 +0100 | [diff] [blame] | 70 | } else { |
| 71 | key = ieee80211_key_alloc(alg, idx, key_len, _key); |
| 72 | if (!key) |
| 73 | return -ENOMEM; |
| 74 | |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 75 | sta = NULL; |
Johannes Berg | 3b96766 | 2008-04-08 17:56:52 +0200 | [diff] [blame] | 76 | err = 0; |
| 77 | |
| 78 | rcu_read_lock(); |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 79 | |
Johannes Berg | db4d116 | 2008-02-25 16:27:45 +0100 | [diff] [blame] | 80 | if (!is_broadcast_ether_addr(sta_addr)) { |
| 81 | set_tx_key = 0; |
| 82 | /* |
| 83 | * According to the standard, the key index of a |
| 84 | * pairwise key must be zero. However, some AP are |
| 85 | * broken when it comes to WEP key indices, so we |
| 86 | * work around this. |
| 87 | */ |
| 88 | if (idx != 0 && alg != ALG_WEP) { |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 89 | ieee80211_key_free(key); |
Johannes Berg | 3b96766 | 2008-04-08 17:56:52 +0200 | [diff] [blame] | 90 | err = -EINVAL; |
| 91 | goto out_unlock; |
Johannes Berg | db4d116 | 2008-02-25 16:27:45 +0100 | [diff] [blame] | 92 | } |
| 93 | |
| 94 | sta = sta_info_get(local, sta_addr); |
| 95 | if (!sta) { |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 96 | ieee80211_key_free(key); |
Johannes Berg | 3b96766 | 2008-04-08 17:56:52 +0200 | [diff] [blame] | 97 | err = -ENOENT; |
| 98 | goto out_unlock; |
Johannes Berg | db4d116 | 2008-02-25 16:27:45 +0100 | [diff] [blame] | 99 | } |
| 100 | } |
| 101 | |
Emmanuel Grumbach | 23976ef | 2008-06-28 02:50:13 +0300 | [diff] [blame] | 102 | if (alg == ALG_WEP && |
| 103 | key_len != LEN_WEP40 && key_len != LEN_WEP104) { |
| 104 | ieee80211_key_free(key); |
| 105 | err = -EINVAL; |
| 106 | goto out_unlock; |
| 107 | } |
| 108 | |
Johannes Berg | db4d116 | 2008-02-25 16:27:45 +0100 | [diff] [blame] | 109 | ieee80211_key_link(key, sdata, sta); |
| 110 | |
| 111 | if (set_tx_key || (!sta && !sdata->default_key && key)) |
| 112 | ieee80211_set_default_key(sdata, idx); |
Jouni Malinen | 22787dba | 2009-01-08 13:32:04 +0200 | [diff] [blame] | 113 | if (alg == ALG_AES_CMAC && |
| 114 | (set_tx_key || (!sta && !sdata->default_mgmt_key && key))) |
| 115 | ieee80211_set_default_mgmt_key(sdata, idx); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 116 | } |
| 117 | |
Johannes Berg | 3b96766 | 2008-04-08 17:56:52 +0200 | [diff] [blame] | 118 | out_unlock: |
| 119 | rcu_read_unlock(); |
| 120 | |
| 121 | return err; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 122 | } |
| 123 | |
| 124 | static int ieee80211_ioctl_siwgenie(struct net_device *dev, |
| 125 | struct iw_request_info *info, |
| 126 | struct iw_point *data, char *extra) |
| 127 | { |
| 128 | struct ieee80211_sub_if_data *sdata; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 129 | |
| 130 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | ddd3d2b | 2007-09-26 17:53:20 +0200 | [diff] [blame] | 131 | |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 132 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 133 | int ret = ieee80211_sta_set_extra_ie(sdata, extra, data->length); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 134 | if (ret) |
| 135 | return ret; |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 136 | sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; |
Jouni Malinen | 636a5d3 | 2009-03-19 13:39:22 +0200 | [diff] [blame] | 137 | sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME; |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 138 | ieee80211_sta_req_auth(sdata); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 139 | return 0; |
| 140 | } |
| 141 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 142 | return -EOPNOTSUPP; |
| 143 | } |
| 144 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 145 | static int ieee80211_ioctl_siwfreq(struct net_device *dev, |
| 146 | struct iw_request_info *info, |
| 147 | struct iw_freq *freq, char *extra) |
| 148 | { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 149 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 150 | |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 151 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 152 | return cfg80211_ibss_wext_siwfreq(dev, info, freq, extra); |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 153 | else if (sdata->vif.type == NL80211_IFTYPE_STATION) |
| 154 | sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 155 | |
| 156 | /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */ |
| 157 | if (freq->e == 0) { |
| 158 | if (freq->m < 0) { |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 159 | if (sdata->vif.type == NL80211_IFTYPE_STATION) |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 160 | sdata->u.mgd.flags |= |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 161 | IEEE80211_STA_AUTO_CHANNEL_SEL; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 162 | return 0; |
| 163 | } else |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 164 | return ieee80211_set_freq(sdata, |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 165 | ieee80211_channel_to_frequency(freq->m)); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 166 | } else { |
| 167 | int i, div = 1000000; |
| 168 | for (i = 0; i < freq->e; i++) |
| 169 | div /= 10; |
| 170 | if (div > 0) |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 171 | return ieee80211_set_freq(sdata, freq->m / div); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 172 | else |
| 173 | return -EINVAL; |
| 174 | } |
| 175 | } |
| 176 | |
| 177 | |
| 178 | static int ieee80211_ioctl_giwfreq(struct net_device *dev, |
| 179 | struct iw_request_info *info, |
| 180 | struct iw_freq *freq, char *extra) |
| 181 | { |
| 182 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 183 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 184 | |
| 185 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) |
| 186 | return cfg80211_ibss_wext_giwfreq(dev, info, freq, extra); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 187 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 188 | freq->m = local->hw.conf.channel->center_freq; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 189 | freq->e = 6; |
| 190 | |
| 191 | return 0; |
| 192 | } |
| 193 | |
| 194 | |
| 195 | static int ieee80211_ioctl_siwessid(struct net_device *dev, |
| 196 | struct iw_request_info *info, |
| 197 | struct iw_point *data, char *ssid) |
| 198 | { |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 199 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 200 | size_t len = data->length; |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 201 | int ret; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 202 | |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 203 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) |
| 204 | return cfg80211_ibss_wext_siwessid(dev, info, data, ssid); |
| 205 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 206 | /* iwconfig uses nul termination in SSID.. */ |
| 207 | if (len > 0 && ssid[len - 1] == '\0') |
| 208 | len--; |
| 209 | |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 210 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 211 | if (data->flags) |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 212 | sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_SSID_SEL; |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 213 | else |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 214 | sdata->u.mgd.flags |= IEEE80211_STA_AUTO_SSID_SEL; |
| 215 | |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 216 | ret = ieee80211_sta_set_ssid(sdata, ssid, len); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 217 | if (ret) |
| 218 | return ret; |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 219 | |
Jouni Malinen | 636a5d3 | 2009-03-19 13:39:22 +0200 | [diff] [blame] | 220 | sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME; |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 221 | ieee80211_sta_req_auth(sdata); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 222 | return 0; |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 223 | } |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 224 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 225 | return -EOPNOTSUPP; |
| 226 | } |
| 227 | |
| 228 | |
| 229 | static int ieee80211_ioctl_giwessid(struct net_device *dev, |
| 230 | struct iw_request_info *info, |
| 231 | struct iw_point *data, char *ssid) |
| 232 | { |
| 233 | size_t len; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 234 | struct ieee80211_sub_if_data *sdata; |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 235 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 236 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 237 | |
| 238 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) |
| 239 | return cfg80211_ibss_wext_giwessid(dev, info, data, ssid); |
| 240 | |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 241 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 242 | int res = ieee80211_sta_get_ssid(sdata, ssid, &len); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 243 | if (res == 0) { |
| 244 | data->length = len; |
| 245 | data->flags = 1; |
| 246 | } else |
| 247 | data->flags = 0; |
| 248 | return res; |
| 249 | } |
| 250 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 251 | return -EOPNOTSUPP; |
| 252 | } |
| 253 | |
| 254 | |
| 255 | static int ieee80211_ioctl_siwap(struct net_device *dev, |
| 256 | struct iw_request_info *info, |
| 257 | struct sockaddr *ap_addr, char *extra) |
| 258 | { |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 259 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 260 | |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 261 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) |
| 262 | return cfg80211_ibss_wext_siwap(dev, info, ap_addr, extra); |
| 263 | |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 264 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 265 | int ret; |
Johannes Berg | 7986cf9 | 2009-03-21 17:08:43 +0100 | [diff] [blame] | 266 | |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 267 | if (is_zero_ether_addr((u8 *) &ap_addr->sa_data)) |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 268 | sdata->u.mgd.flags |= IEEE80211_STA_AUTO_BSSID_SEL | |
Jiri Slaby | d6f2da5 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 269 | IEEE80211_STA_AUTO_CHANNEL_SEL; |
| 270 | else if (is_broadcast_ether_addr((u8 *) &ap_addr->sa_data)) |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 271 | sdata->u.mgd.flags |= IEEE80211_STA_AUTO_BSSID_SEL; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 272 | else |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 273 | sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 274 | ret = ieee80211_sta_set_bssid(sdata, (u8 *) &ap_addr->sa_data); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 275 | if (ret) |
| 276 | return ret; |
Jouni Malinen | 636a5d3 | 2009-03-19 13:39:22 +0200 | [diff] [blame] | 277 | sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME; |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 278 | ieee80211_sta_req_auth(sdata); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 279 | return 0; |
Johannes Berg | 05c914f | 2008-09-11 00:01:58 +0200 | [diff] [blame] | 280 | } else if (sdata->vif.type == NL80211_IFTYPE_WDS) { |
Johannes Berg | 44213b5 | 2008-02-25 16:27:49 +0100 | [diff] [blame] | 281 | /* |
| 282 | * If it is necessary to update the WDS peer address |
| 283 | * while the interface is running, then we need to do |
| 284 | * more work here, namely if it is running we need to |
| 285 | * add a new and remove the old STA entry, this is |
| 286 | * normally handled by _open() and _stop(). |
| 287 | */ |
| 288 | if (netif_running(dev)) |
| 289 | return -EBUSY; |
| 290 | |
| 291 | memcpy(&sdata->u.wds.remote_addr, (u8 *) &ap_addr->sa_data, |
| 292 | ETH_ALEN); |
| 293 | |
| 294 | return 0; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 295 | } |
| 296 | |
| 297 | return -EOPNOTSUPP; |
| 298 | } |
| 299 | |
| 300 | |
| 301 | static int ieee80211_ioctl_giwap(struct net_device *dev, |
| 302 | struct iw_request_info *info, |
| 303 | struct sockaddr *ap_addr, char *extra) |
| 304 | { |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 305 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 306 | |
Johannes Berg | af8cdcd | 2009-04-19 21:25:43 +0200 | [diff] [blame] | 307 | if (sdata->vif.type == NL80211_IFTYPE_ADHOC) |
| 308 | return cfg80211_ibss_wext_giwap(dev, info, ap_addr, extra); |
| 309 | |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 310 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
| 311 | if (sdata->u.mgd.state == IEEE80211_STA_MLME_ASSOCIATED) { |
Abhijeet Kolekar | d4231ca | 2008-05-23 10:15:26 -0700 | [diff] [blame] | 312 | ap_addr->sa_family = ARPHRD_ETHER; |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 313 | memcpy(&ap_addr->sa_data, sdata->u.mgd.bssid, ETH_ALEN); |
| 314 | } else |
Abhijeet Kolekar | d4231ca | 2008-05-23 10:15:26 -0700 | [diff] [blame] | 315 | memset(&ap_addr->sa_data, 0, ETH_ALEN); |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 316 | return 0; |
Johannes Berg | 05c914f | 2008-09-11 00:01:58 +0200 | [diff] [blame] | 317 | } else if (sdata->vif.type == NL80211_IFTYPE_WDS) { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 318 | ap_addr->sa_family = ARPHRD_ETHER; |
| 319 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); |
| 320 | return 0; |
| 321 | } |
| 322 | |
| 323 | return -EOPNOTSUPP; |
| 324 | } |
| 325 | |
| 326 | |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 327 | static int ieee80211_ioctl_siwrate(struct net_device *dev, |
| 328 | struct iw_request_info *info, |
| 329 | struct iw_param *rate, char *extra) |
| 330 | { |
| 331 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 332 | int i, err = -EINVAL; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 333 | u32 target_rate = rate->value / 100000; |
| 334 | struct ieee80211_sub_if_data *sdata; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 335 | struct ieee80211_supported_band *sband; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 336 | |
| 337 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 338 | |
| 339 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
| 340 | |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 341 | /* target_rate = -1, rate->fixed = 0 means auto only, so use all rates |
| 342 | * target_rate = X, rate->fixed = 1 means only rate X |
| 343 | * target_rate = X, rate->fixed = 0 means all rates <= X */ |
Johannes Berg | 3e122be | 2008-07-09 14:40:34 +0200 | [diff] [blame] | 344 | sdata->max_ratectrl_rateidx = -1; |
| 345 | sdata->force_unicast_rateidx = -1; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 346 | if (rate->value < 0) |
| 347 | return 0; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 348 | |
| 349 | for (i=0; i< sband->n_bitrates; i++) { |
| 350 | struct ieee80211_rate *brate = &sband->bitrates[i]; |
| 351 | int this_rate = brate->bitrate; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 352 | |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 353 | if (target_rate == this_rate) { |
Johannes Berg | 3e122be | 2008-07-09 14:40:34 +0200 | [diff] [blame] | 354 | sdata->max_ratectrl_rateidx = i; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 355 | if (rate->fixed) |
Johannes Berg | 3e122be | 2008-07-09 14:40:34 +0200 | [diff] [blame] | 356 | sdata->force_unicast_rateidx = i; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 357 | err = 0; |
| 358 | break; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 359 | } |
| 360 | } |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 361 | return err; |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 362 | } |
| 363 | |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 364 | static int ieee80211_ioctl_giwrate(struct net_device *dev, |
| 365 | struct iw_request_info *info, |
| 366 | struct iw_param *rate, char *extra) |
| 367 | { |
| 368 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 369 | struct sta_info *sta; |
| 370 | struct ieee80211_sub_if_data *sdata; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 371 | struct ieee80211_supported_band *sband; |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 372 | |
| 373 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 374 | |
Johannes Berg | 05c914f | 2008-09-11 00:01:58 +0200 | [diff] [blame] | 375 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 376 | return -EOPNOTSUPP; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 377 | |
| 378 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
| 379 | |
Johannes Berg | 380a942 | 2008-04-04 23:40:35 +0200 | [diff] [blame] | 380 | rcu_read_lock(); |
| 381 | |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 382 | sta = sta_info_get(local, sdata->u.mgd.bssid); |
Johannes Berg | 380a942 | 2008-04-04 23:40:35 +0200 | [diff] [blame] | 383 | |
Johannes Berg | e6a9854 | 2008-10-21 12:40:02 +0200 | [diff] [blame] | 384 | if (sta && !(sta->last_tx_rate.flags & IEEE80211_TX_RC_MCS)) |
| 385 | rate->value = sband->bitrates[sta->last_tx_rate.idx].bitrate; |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 386 | else |
| 387 | rate->value = 0; |
Johannes Berg | 380a942 | 2008-04-04 23:40:35 +0200 | [diff] [blame] | 388 | |
| 389 | rcu_read_unlock(); |
| 390 | |
| 391 | if (!sta) |
| 392 | return -ENODEV; |
| 393 | |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 394 | rate->value *= 100000; |
Johannes Berg | d0709a6 | 2008-02-25 16:27:46 +0100 | [diff] [blame] | 395 | |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 396 | return 0; |
| 397 | } |
| 398 | |
Michael Buesch | 61609bc | 2007-09-20 22:06:39 +0200 | [diff] [blame] | 399 | static int ieee80211_ioctl_siwtxpower(struct net_device *dev, |
| 400 | struct iw_request_info *info, |
| 401 | union iwreq_data *data, char *extra) |
| 402 | { |
| 403 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
Luis R. Rodriguez | d9d2925 | 2008-10-22 13:13:53 -0700 | [diff] [blame] | 404 | struct ieee80211_channel* chan = local->hw.conf.channel; |
Johannes Berg | 47afbaf | 2009-04-07 15:22:28 +0200 | [diff] [blame] | 405 | bool reconf = false; |
Johannes Berg | e897558 | 2008-10-09 12:18:51 +0200 | [diff] [blame] | 406 | u32 reconf_flags = 0; |
Johannes Berg | 8318d78 | 2008-01-24 19:38:38 +0100 | [diff] [blame] | 407 | int new_power_level; |
Michael Buesch | 61609bc | 2007-09-20 22:06:39 +0200 | [diff] [blame] | 408 | |
| 409 | if ((data->txpower.flags & IW_TXPOW_TYPE) != IW_TXPOW_DBM) |
| 410 | return -EINVAL; |
| 411 | if (data->txpower.flags & IW_TXPOW_RANGE) |
| 412 | return -EINVAL; |
Luis R. Rodriguez | d9d2925 | 2008-10-22 13:13:53 -0700 | [diff] [blame] | 413 | if (!chan) |
| 414 | return -EINVAL; |
Michael Buesch | 61609bc | 2007-09-20 22:06:39 +0200 | [diff] [blame] | 415 | |
Johannes Berg | 47afbaf | 2009-04-07 15:22:28 +0200 | [diff] [blame] | 416 | /* only change when not disabling */ |
| 417 | if (!data->txpower.disabled) { |
| 418 | if (data->txpower.fixed) { |
| 419 | if (data->txpower.value < 0) |
| 420 | return -EINVAL; |
| 421 | new_power_level = data->txpower.value; |
| 422 | /* |
| 423 | * Debatable, but we cannot do a fixed power |
| 424 | * level above the regulatory constraint. |
| 425 | * Use "iwconfig wlan0 txpower 15dBm" instead. |
| 426 | */ |
| 427 | if (new_power_level > chan->max_power) |
| 428 | return -EINVAL; |
| 429 | } else { |
| 430 | /* |
| 431 | * Automatic power level setting, max being the value |
| 432 | * passed in from userland. |
| 433 | */ |
| 434 | if (data->txpower.value < 0) |
| 435 | new_power_level = -1; |
| 436 | else |
| 437 | new_power_level = data->txpower.value; |
| 438 | } |
Mattias Nissler | 6a43295 | 2007-10-24 23:30:36 +0200 | [diff] [blame] | 439 | |
Johannes Berg | 47afbaf | 2009-04-07 15:22:28 +0200 | [diff] [blame] | 440 | reconf = true; |
| 441 | |
| 442 | /* |
| 443 | * ieee80211_hw_config() will limit to the channel's |
| 444 | * max power and possibly power constraint from AP. |
| 445 | */ |
| 446 | local->user_power_level = new_power_level; |
| 447 | } |
Mattias Nissler | 6a43295 | 2007-10-24 23:30:36 +0200 | [diff] [blame] | 448 | |
Michael Buesch | 61609bc | 2007-09-20 22:06:39 +0200 | [diff] [blame] | 449 | if (local->hw.conf.radio_enabled != !(data->txpower.disabled)) { |
| 450 | local->hw.conf.radio_enabled = !(data->txpower.disabled); |
Johannes Berg | e897558 | 2008-10-09 12:18:51 +0200 | [diff] [blame] | 451 | reconf_flags |= IEEE80211_CONF_CHANGE_RADIO_ENABLED; |
Ivo van Doorn | cdcb006 | 2008-01-07 19:45:24 +0100 | [diff] [blame] | 452 | ieee80211_led_radio(local, local->hw.conf.radio_enabled); |
Michael Buesch | 61609bc | 2007-09-20 22:06:39 +0200 | [diff] [blame] | 453 | } |
Mattias Nissler | 6a43295 | 2007-10-24 23:30:36 +0200 | [diff] [blame] | 454 | |
Johannes Berg | 47afbaf | 2009-04-07 15:22:28 +0200 | [diff] [blame] | 455 | if (reconf || reconf_flags) |
Johannes Berg | e897558 | 2008-10-09 12:18:51 +0200 | [diff] [blame] | 456 | ieee80211_hw_config(local, reconf_flags); |
Michael Buesch | 61609bc | 2007-09-20 22:06:39 +0200 | [diff] [blame] | 457 | |
| 458 | return 0; |
| 459 | } |
| 460 | |
Larry Finger | fe6aa30 | 2007-08-10 11:23:20 -0500 | [diff] [blame] | 461 | static int ieee80211_ioctl_giwtxpower(struct net_device *dev, |
| 462 | struct iw_request_info *info, |
| 463 | union iwreq_data *data, char *extra) |
| 464 | { |
| 465 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 466 | |
| 467 | data->txpower.fixed = 1; |
| 468 | data->txpower.disabled = !(local->hw.conf.radio_enabled); |
| 469 | data->txpower.value = local->hw.conf.power_level; |
| 470 | data->txpower.flags = IW_TXPOW_DBM; |
| 471 | |
| 472 | return 0; |
| 473 | } |
| 474 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 475 | static int ieee80211_ioctl_siwencode(struct net_device *dev, |
| 476 | struct iw_request_info *info, |
| 477 | struct iw_point *erq, char *keybuf) |
| 478 | { |
| 479 | struct ieee80211_sub_if_data *sdata; |
| 480 | int idx, i, alg = ALG_WEP; |
| 481 | u8 bcaddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
Vasanthakumar Thiagarajan | ec30415 | 2009-03-13 20:26:52 +0530 | [diff] [blame] | 482 | int remove = 0, ret; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 483 | |
| 484 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 485 | |
| 486 | idx = erq->flags & IW_ENCODE_INDEX; |
| 487 | if (idx == 0) { |
| 488 | if (sdata->default_key) |
| 489 | for (i = 0; i < NUM_DEFAULT_KEYS; i++) { |
| 490 | if (sdata->default_key == sdata->keys[i]) { |
| 491 | idx = i; |
| 492 | break; |
| 493 | } |
| 494 | } |
| 495 | } else if (idx < 1 || idx > 4) |
| 496 | return -EINVAL; |
| 497 | else |
| 498 | idx--; |
| 499 | |
| 500 | if (erq->flags & IW_ENCODE_DISABLED) |
Johannes Berg | 628a140 | 2007-09-26 17:53:17 +0200 | [diff] [blame] | 501 | remove = 1; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 502 | else if (erq->length == 0) { |
| 503 | /* No key data - just set the default TX key index */ |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 504 | ieee80211_set_default_key(sdata, idx); |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 505 | return 0; |
| 506 | } |
| 507 | |
Vasanthakumar Thiagarajan | ec30415 | 2009-03-13 20:26:52 +0530 | [diff] [blame] | 508 | ret = ieee80211_set_encryption( |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 509 | sdata, bcaddr, |
Johannes Berg | 628a140 | 2007-09-26 17:53:17 +0200 | [diff] [blame] | 510 | idx, alg, remove, |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 511 | !sdata->default_key, |
| 512 | keybuf, erq->length); |
Vasanthakumar Thiagarajan | ec30415 | 2009-03-13 20:26:52 +0530 | [diff] [blame] | 513 | |
Vasanthakumar Thiagarajan | b0741a1 | 2009-03-27 13:08:45 +0530 | [diff] [blame] | 514 | if (!ret && sdata->vif.type == NL80211_IFTYPE_STATION) { |
Vasanthakumar Thiagarajan | ec30415 | 2009-03-13 20:26:52 +0530 | [diff] [blame] | 515 | if (remove) |
| 516 | sdata->u.mgd.flags &= ~IEEE80211_STA_TKIP_WEP_USED; |
| 517 | else |
| 518 | sdata->u.mgd.flags |= IEEE80211_STA_TKIP_WEP_USED; |
| 519 | } |
| 520 | |
| 521 | return ret; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 522 | } |
| 523 | |
| 524 | |
| 525 | static int ieee80211_ioctl_giwencode(struct net_device *dev, |
| 526 | struct iw_request_info *info, |
| 527 | struct iw_point *erq, char *key) |
| 528 | { |
| 529 | struct ieee80211_sub_if_data *sdata; |
| 530 | int idx, i; |
| 531 | |
| 532 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 533 | |
| 534 | idx = erq->flags & IW_ENCODE_INDEX; |
| 535 | if (idx < 1 || idx > 4) { |
| 536 | idx = -1; |
| 537 | if (!sdata->default_key) |
| 538 | idx = 0; |
| 539 | else for (i = 0; i < NUM_DEFAULT_KEYS; i++) { |
| 540 | if (sdata->default_key == sdata->keys[i]) { |
| 541 | idx = i; |
| 542 | break; |
| 543 | } |
| 544 | } |
| 545 | if (idx < 0) |
| 546 | return -EINVAL; |
| 547 | } else |
| 548 | idx--; |
| 549 | |
| 550 | erq->flags = idx + 1; |
| 551 | |
| 552 | if (!sdata->keys[idx]) { |
| 553 | erq->length = 0; |
| 554 | erq->flags |= IW_ENCODE_DISABLED; |
| 555 | return 0; |
| 556 | } |
| 557 | |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 558 | memcpy(key, sdata->keys[idx]->conf.key, |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 559 | min_t(int, erq->length, sdata->keys[idx]->conf.keylen)); |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 560 | erq->length = sdata->keys[idx]->conf.keylen; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 561 | erq->flags |= IW_ENCODE_ENABLED; |
| 562 | |
Johannes Berg | 05c914f | 2008-09-11 00:01:58 +0200 | [diff] [blame] | 563 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 564 | switch (sdata->u.mgd.auth_alg) { |
Emmanuel Grumbach | b9fcc4f | 2008-06-24 13:37:59 +0300 | [diff] [blame] | 565 | case WLAN_AUTH_OPEN: |
| 566 | case WLAN_AUTH_LEAP: |
| 567 | erq->flags |= IW_ENCODE_OPEN; |
| 568 | break; |
| 569 | case WLAN_AUTH_SHARED_KEY: |
| 570 | erq->flags |= IW_ENCODE_RESTRICTED; |
| 571 | break; |
| 572 | } |
| 573 | } |
| 574 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 575 | return 0; |
| 576 | } |
| 577 | |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 578 | static int ieee80211_ioctl_siwpower(struct net_device *dev, |
| 579 | struct iw_request_info *info, |
| 580 | struct iw_param *wrq, |
| 581 | char *extra) |
| 582 | { |
Kalle Valo | e0cb686 | 2008-12-18 23:35:13 +0200 | [diff] [blame] | 583 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 584 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 585 | struct ieee80211_conf *conf = &local->hw.conf; |
Johannes Berg | 965beda | 2009-04-16 13:17:24 +0200 | [diff] [blame] | 586 | int timeout = 0; |
Kalle Valo | e0cb686 | 2008-12-18 23:35:13 +0200 | [diff] [blame] | 587 | bool ps; |
| 588 | |
Johannes Berg | 4be8c38 | 2009-01-07 18:28:20 +0100 | [diff] [blame] | 589 | if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_PS)) |
| 590 | return -EOPNOTSUPP; |
| 591 | |
Kalle Valo | e0cb686 | 2008-12-18 23:35:13 +0200 | [diff] [blame] | 592 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
| 593 | return -EINVAL; |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 594 | |
| 595 | if (wrq->disabled) { |
Kalle Valo | e0cb686 | 2008-12-18 23:35:13 +0200 | [diff] [blame] | 596 | ps = false; |
Kalle Valo | 520eb82 | 2008-12-18 23:35:27 +0200 | [diff] [blame] | 597 | timeout = 0; |
Kalle Valo | e0cb686 | 2008-12-18 23:35:13 +0200 | [diff] [blame] | 598 | goto set; |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 599 | } |
| 600 | |
| 601 | switch (wrq->flags & IW_POWER_MODE) { |
| 602 | case IW_POWER_ON: /* If not specified */ |
| 603 | case IW_POWER_MODE: /* If set all mask */ |
| 604 | case IW_POWER_ALL_R: /* If explicitely state all */ |
Kalle Valo | e0cb686 | 2008-12-18 23:35:13 +0200 | [diff] [blame] | 605 | ps = true; |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 606 | break; |
Kalle Valo | 520eb82 | 2008-12-18 23:35:27 +0200 | [diff] [blame] | 607 | default: /* Otherwise we ignore */ |
Johannes Berg | e9aeaba | 2009-01-06 18:12:35 +0100 | [diff] [blame] | 608 | return -EINVAL; |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 609 | } |
| 610 | |
Johannes Berg | e9aeaba | 2009-01-06 18:12:35 +0100 | [diff] [blame] | 611 | if (wrq->flags & ~(IW_POWER_MODE | IW_POWER_TIMEOUT)) |
| 612 | return -EINVAL; |
| 613 | |
Kalle Valo | 520eb82 | 2008-12-18 23:35:27 +0200 | [diff] [blame] | 614 | if (wrq->flags & IW_POWER_TIMEOUT) |
| 615 | timeout = wrq->value / 1000; |
Kalle Valo | e0cb686 | 2008-12-18 23:35:13 +0200 | [diff] [blame] | 616 | |
Johannes Berg | 4be8c38 | 2009-01-07 18:28:20 +0100 | [diff] [blame] | 617 | set: |
Johannes Berg | 965beda | 2009-04-16 13:17:24 +0200 | [diff] [blame] | 618 | if (ps == sdata->u.mgd.powersave && timeout == conf->dynamic_ps_timeout) |
| 619 | return 0; |
Kalle Valo | 520eb82 | 2008-12-18 23:35:27 +0200 | [diff] [blame] | 620 | |
Johannes Berg | 965beda | 2009-04-16 13:17:24 +0200 | [diff] [blame] | 621 | sdata->u.mgd.powersave = ps; |
Johannes Berg | 46f2c4b | 2009-01-06 18:13:18 +0100 | [diff] [blame] | 622 | conf->dynamic_ps_timeout = timeout; |
Kalle Valo | e0cb686 | 2008-12-18 23:35:13 +0200 | [diff] [blame] | 623 | |
Johannes Berg | 4be8c38 | 2009-01-07 18:28:20 +0100 | [diff] [blame] | 624 | if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) |
Johannes Berg | 965beda | 2009-04-16 13:17:24 +0200 | [diff] [blame] | 625 | ieee80211_hw_config(local, |
| 626 | IEEE80211_CONF_CHANGE_DYNPS_TIMEOUT); |
Johannes Berg | 4be8c38 | 2009-01-07 18:28:20 +0100 | [diff] [blame] | 627 | |
Johannes Berg | 10f644a | 2009-04-16 13:17:25 +0200 | [diff] [blame] | 628 | ieee80211_recalc_ps(local, -1); |
Johannes Berg | 4be8c38 | 2009-01-07 18:28:20 +0100 | [diff] [blame] | 629 | |
Johannes Berg | 965beda | 2009-04-16 13:17:24 +0200 | [diff] [blame] | 630 | return 0; |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 631 | } |
| 632 | |
| 633 | static int ieee80211_ioctl_giwpower(struct net_device *dev, |
| 634 | struct iw_request_info *info, |
| 635 | union iwreq_data *wrqu, |
| 636 | char *extra) |
| 637 | { |
Johannes Berg | 965beda | 2009-04-16 13:17:24 +0200 | [diff] [blame] | 638 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 639 | |
Johannes Berg | 965beda | 2009-04-16 13:17:24 +0200 | [diff] [blame] | 640 | wrqu->power.disabled = !sdata->u.mgd.powersave; |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 641 | |
| 642 | return 0; |
| 643 | } |
| 644 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 645 | static int ieee80211_ioctl_siwauth(struct net_device *dev, |
| 646 | struct iw_request_info *info, |
| 647 | struct iw_param *data, char *extra) |
| 648 | { |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 649 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 650 | int ret = 0; |
| 651 | |
| 652 | switch (data->flags & IW_AUTH_INDEX) { |
| 653 | case IW_AUTH_WPA_VERSION: |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 654 | case IW_AUTH_CIPHER_GROUP: |
| 655 | case IW_AUTH_WPA_ENABLED: |
| 656 | case IW_AUTH_RX_UNENCRYPTED_EAPOL: |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 657 | case IW_AUTH_KEY_MGMT: |
Jouni Malinen | 54604d3 | 2009-01-08 13:32:03 +0200 | [diff] [blame] | 658 | case IW_AUTH_CIPHER_GROUP_MGMT: |
Johannes Berg | 5b98b1f | 2007-11-03 13:11:10 +0000 | [diff] [blame] | 659 | break; |
Vasanthakumar Thiagarajan | eb46936 | 2008-12-23 21:30:50 +0530 | [diff] [blame] | 660 | case IW_AUTH_CIPHER_PAIRWISE: |
| 661 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
| 662 | if (data->value & (IW_AUTH_CIPHER_WEP40 | |
| 663 | IW_AUTH_CIPHER_WEP104 | IW_AUTH_CIPHER_TKIP)) |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 664 | sdata->u.mgd.flags |= |
Vasanthakumar Thiagarajan | eb46936 | 2008-12-23 21:30:50 +0530 | [diff] [blame] | 665 | IEEE80211_STA_TKIP_WEP_USED; |
| 666 | else |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 667 | sdata->u.mgd.flags &= |
Vasanthakumar Thiagarajan | eb46936 | 2008-12-23 21:30:50 +0530 | [diff] [blame] | 668 | ~IEEE80211_STA_TKIP_WEP_USED; |
| 669 | } |
| 670 | break; |
Johannes Berg | b1357a8 | 2007-11-28 11:04:21 +0100 | [diff] [blame] | 671 | case IW_AUTH_DROP_UNENCRYPTED: |
| 672 | sdata->drop_unencrypted = !!data->value; |
| 673 | break; |
Johannes Berg | 5b98b1f | 2007-11-03 13:11:10 +0000 | [diff] [blame] | 674 | case IW_AUTH_PRIVACY_INVOKED: |
Johannes Berg | 05c914f | 2008-09-11 00:01:58 +0200 | [diff] [blame] | 675 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 676 | ret = -EINVAL; |
| 677 | else { |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 678 | sdata->u.mgd.flags &= ~IEEE80211_STA_PRIVACY_INVOKED; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 679 | /* |
Johannes Berg | 5b98b1f | 2007-11-03 13:11:10 +0000 | [diff] [blame] | 680 | * Privacy invoked by wpa_supplicant, store the |
| 681 | * value and allow associating to a protected |
| 682 | * network without having a key up front. |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 683 | */ |
Johannes Berg | 5b98b1f | 2007-11-03 13:11:10 +0000 | [diff] [blame] | 684 | if (data->value) |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 685 | sdata->u.mgd.flags |= |
Johannes Berg | 5b98b1f | 2007-11-03 13:11:10 +0000 | [diff] [blame] | 686 | IEEE80211_STA_PRIVACY_INVOKED; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 687 | } |
| 688 | break; |
| 689 | case IW_AUTH_80211_AUTH_ALG: |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 690 | if (sdata->vif.type == NL80211_IFTYPE_STATION) |
| 691 | sdata->u.mgd.auth_algs = data->value; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 692 | else |
| 693 | ret = -EOPNOTSUPP; |
| 694 | break; |
Jouni Malinen | fdfacf0 | 2009-01-08 13:32:05 +0200 | [diff] [blame] | 695 | case IW_AUTH_MFP: |
Jouni Malinen | 4375d08 | 2009-01-08 13:32:11 +0200 | [diff] [blame] | 696 | if (!(sdata->local->hw.flags & IEEE80211_HW_MFP_CAPABLE)) { |
| 697 | ret = -EOPNOTSUPP; |
| 698 | break; |
| 699 | } |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 700 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
Johannes Berg | e4e5e2b | 2009-02-10 21:25:40 +0100 | [diff] [blame] | 701 | switch (data->value) { |
| 702 | case IW_AUTH_MFP_DISABLED: |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 703 | sdata->u.mgd.mfp = IEEE80211_MFP_DISABLED; |
Johannes Berg | e4e5e2b | 2009-02-10 21:25:40 +0100 | [diff] [blame] | 704 | break; |
| 705 | case IW_AUTH_MFP_OPTIONAL: |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 706 | sdata->u.mgd.mfp = IEEE80211_MFP_OPTIONAL; |
Johannes Berg | e4e5e2b | 2009-02-10 21:25:40 +0100 | [diff] [blame] | 707 | break; |
| 708 | case IW_AUTH_MFP_REQUIRED: |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 709 | sdata->u.mgd.mfp = IEEE80211_MFP_REQUIRED; |
Johannes Berg | e4e5e2b | 2009-02-10 21:25:40 +0100 | [diff] [blame] | 710 | break; |
| 711 | default: |
| 712 | ret = -EINVAL; |
| 713 | } |
| 714 | } else |
Jouni Malinen | fdfacf0 | 2009-01-08 13:32:05 +0200 | [diff] [blame] | 715 | ret = -EOPNOTSUPP; |
| 716 | break; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 717 | default: |
| 718 | ret = -EOPNOTSUPP; |
| 719 | break; |
| 720 | } |
| 721 | return ret; |
| 722 | } |
| 723 | |
| 724 | /* Get wireless statistics. Called by /proc/net/wireless and by SIOCGIWSTATS */ |
| 725 | static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev) |
| 726 | { |
| 727 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 728 | struct iw_statistics *wstats = &local->wstats; |
| 729 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 730 | struct sta_info *sta = NULL; |
| 731 | |
Johannes Berg | 98dd6a5 | 2008-04-10 15:36:09 +0200 | [diff] [blame] | 732 | rcu_read_lock(); |
| 733 | |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 734 | if (sdata->vif.type == NL80211_IFTYPE_STATION) |
| 735 | sta = sta_info_get(local, sdata->u.mgd.bssid); |
| 736 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 737 | if (!sta) { |
| 738 | wstats->discard.fragment = 0; |
| 739 | wstats->discard.misc = 0; |
| 740 | wstats->qual.qual = 0; |
| 741 | wstats->qual.level = 0; |
| 742 | wstats->qual.noise = 0; |
| 743 | wstats->qual.updated = IW_QUAL_ALL_INVALID; |
| 744 | } else { |
Johannes Berg | 24776cf | 2009-02-27 16:33:55 -0600 | [diff] [blame] | 745 | wstats->qual.updated = 0; |
| 746 | /* |
| 747 | * mirror what cfg80211 does for iwrange/scan results, |
| 748 | * otherwise userspace gets confused. |
| 749 | */ |
| 750 | if (local->hw.flags & (IEEE80211_HW_SIGNAL_UNSPEC | |
| 751 | IEEE80211_HW_SIGNAL_DBM)) { |
| 752 | wstats->qual.updated |= IW_QUAL_LEVEL_UPDATED; |
| 753 | wstats->qual.updated |= IW_QUAL_QUAL_UPDATED; |
| 754 | } else { |
| 755 | wstats->qual.updated |= IW_QUAL_LEVEL_INVALID; |
| 756 | wstats->qual.updated |= IW_QUAL_QUAL_INVALID; |
| 757 | } |
| 758 | |
| 759 | if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC) { |
| 760 | wstats->qual.level = sta->last_signal; |
| 761 | wstats->qual.qual = sta->last_signal; |
| 762 | } else if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM) { |
| 763 | int sig = sta->last_signal; |
| 764 | |
| 765 | wstats->qual.updated |= IW_QUAL_DBM; |
| 766 | wstats->qual.level = sig; |
| 767 | if (sig < -110) |
| 768 | sig = -110; |
| 769 | else if (sig > -40) |
| 770 | sig = -40; |
| 771 | wstats->qual.qual = sig + 110; |
| 772 | } |
| 773 | |
| 774 | if (local->hw.flags & IEEE80211_HW_NOISE_DBM) { |
| 775 | /* |
| 776 | * This assumes that if driver reports noise, it also |
| 777 | * reports signal in dBm. |
| 778 | */ |
| 779 | wstats->qual.noise = sta->last_noise; |
| 780 | wstats->qual.updated |= IW_QUAL_NOISE_UPDATED; |
| 781 | } else { |
| 782 | wstats->qual.updated |= IW_QUAL_NOISE_INVALID; |
| 783 | } |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 784 | } |
Johannes Berg | 98dd6a5 | 2008-04-10 15:36:09 +0200 | [diff] [blame] | 785 | |
| 786 | rcu_read_unlock(); |
| 787 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 788 | return wstats; |
| 789 | } |
| 790 | |
| 791 | static int ieee80211_ioctl_giwauth(struct net_device *dev, |
| 792 | struct iw_request_info *info, |
| 793 | struct iw_param *data, char *extra) |
| 794 | { |
| 795 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 796 | int ret = 0; |
| 797 | |
| 798 | switch (data->flags & IW_AUTH_INDEX) { |
| 799 | case IW_AUTH_80211_AUTH_ALG: |
Johannes Berg | 4690029 | 2009-02-15 12:44:28 +0100 | [diff] [blame] | 800 | if (sdata->vif.type == NL80211_IFTYPE_STATION) |
| 801 | data->value = sdata->u.mgd.auth_algs; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 802 | else |
| 803 | ret = -EOPNOTSUPP; |
| 804 | break; |
| 805 | default: |
| 806 | ret = -EOPNOTSUPP; |
| 807 | break; |
| 808 | } |
| 809 | return ret; |
| 810 | } |
| 811 | |
| 812 | |
| 813 | static int ieee80211_ioctl_siwencodeext(struct net_device *dev, |
| 814 | struct iw_request_info *info, |
| 815 | struct iw_point *erq, char *extra) |
| 816 | { |
| 817 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 818 | struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; |
Johannes Berg | 628a140 | 2007-09-26 17:53:17 +0200 | [diff] [blame] | 819 | int uninitialized_var(alg), idx, i, remove = 0; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 820 | |
| 821 | switch (ext->alg) { |
| 822 | case IW_ENCODE_ALG_NONE: |
Johannes Berg | 628a140 | 2007-09-26 17:53:17 +0200 | [diff] [blame] | 823 | remove = 1; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 824 | break; |
| 825 | case IW_ENCODE_ALG_WEP: |
| 826 | alg = ALG_WEP; |
| 827 | break; |
| 828 | case IW_ENCODE_ALG_TKIP: |
| 829 | alg = ALG_TKIP; |
| 830 | break; |
| 831 | case IW_ENCODE_ALG_CCMP: |
| 832 | alg = ALG_CCMP; |
| 833 | break; |
Jouni Malinen | 22787dba | 2009-01-08 13:32:04 +0200 | [diff] [blame] | 834 | case IW_ENCODE_ALG_AES_CMAC: |
| 835 | alg = ALG_AES_CMAC; |
| 836 | break; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 837 | default: |
| 838 | return -EOPNOTSUPP; |
| 839 | } |
| 840 | |
| 841 | if (erq->flags & IW_ENCODE_DISABLED) |
Johannes Berg | 628a140 | 2007-09-26 17:53:17 +0200 | [diff] [blame] | 842 | remove = 1; |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 843 | |
| 844 | idx = erq->flags & IW_ENCODE_INDEX; |
Jouni Malinen | 22787dba | 2009-01-08 13:32:04 +0200 | [diff] [blame] | 845 | if (alg == ALG_AES_CMAC) { |
| 846 | if (idx < NUM_DEFAULT_KEYS + 1 || |
| 847 | idx > NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS) { |
| 848 | idx = -1; |
| 849 | if (!sdata->default_mgmt_key) |
| 850 | idx = 0; |
| 851 | else for (i = NUM_DEFAULT_KEYS; |
| 852 | i < NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS; |
| 853 | i++) { |
| 854 | if (sdata->default_mgmt_key == sdata->keys[i]) |
| 855 | { |
| 856 | idx = i; |
| 857 | break; |
| 858 | } |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 859 | } |
Jouni Malinen | 22787dba | 2009-01-08 13:32:04 +0200 | [diff] [blame] | 860 | if (idx < 0) |
| 861 | return -EINVAL; |
| 862 | } else |
| 863 | idx--; |
| 864 | } else { |
| 865 | if (idx < 1 || idx > 4) { |
| 866 | idx = -1; |
| 867 | if (!sdata->default_key) |
| 868 | idx = 0; |
| 869 | else for (i = 0; i < NUM_DEFAULT_KEYS; i++) { |
| 870 | if (sdata->default_key == sdata->keys[i]) { |
| 871 | idx = i; |
| 872 | break; |
| 873 | } |
| 874 | } |
| 875 | if (idx < 0) |
| 876 | return -EINVAL; |
| 877 | } else |
| 878 | idx--; |
| 879 | } |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 880 | |
Jasper Bryant-Greene | f698d85 | 2008-08-03 12:04:37 +1200 | [diff] [blame] | 881 | return ieee80211_set_encryption(sdata, ext->addr.sa_data, idx, alg, |
Johannes Berg | 628a140 | 2007-09-26 17:53:17 +0200 | [diff] [blame] | 882 | remove, |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 883 | ext->ext_flags & |
| 884 | IW_ENCODE_EXT_SET_TX_KEY, |
| 885 | ext->key, ext->key_len); |
| 886 | } |
| 887 | |
| 888 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 889 | /* Structures to export the Wireless Handlers */ |
| 890 | |
| 891 | static const iw_handler ieee80211_handler[] = |
| 892 | { |
| 893 | (iw_handler) NULL, /* SIOCSIWCOMMIT */ |
Johannes Berg | fee5267 | 2008-11-26 22:36:31 +0100 | [diff] [blame] | 894 | (iw_handler) cfg80211_wext_giwname, /* SIOCGIWNAME */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 895 | (iw_handler) NULL, /* SIOCSIWNWID */ |
| 896 | (iw_handler) NULL, /* SIOCGIWNWID */ |
| 897 | (iw_handler) ieee80211_ioctl_siwfreq, /* SIOCSIWFREQ */ |
| 898 | (iw_handler) ieee80211_ioctl_giwfreq, /* SIOCGIWFREQ */ |
Johannes Berg | e60c774 | 2008-11-26 23:31:40 +0100 | [diff] [blame] | 899 | (iw_handler) cfg80211_wext_siwmode, /* SIOCSIWMODE */ |
| 900 | (iw_handler) cfg80211_wext_giwmode, /* SIOCGIWMODE */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 901 | (iw_handler) NULL, /* SIOCSIWSENS */ |
| 902 | (iw_handler) NULL, /* SIOCGIWSENS */ |
| 903 | (iw_handler) NULL /* not used */, /* SIOCSIWRANGE */ |
Johannes Berg | 4aa188e | 2009-02-18 19:32:08 +0100 | [diff] [blame] | 904 | (iw_handler) cfg80211_wext_giwrange, /* SIOCGIWRANGE */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 905 | (iw_handler) NULL /* not used */, /* SIOCSIWPRIV */ |
| 906 | (iw_handler) NULL /* kernel code */, /* SIOCGIWPRIV */ |
| 907 | (iw_handler) NULL /* not used */, /* SIOCSIWSTATS */ |
| 908 | (iw_handler) NULL /* kernel code */, /* SIOCGIWSTATS */ |
Johannes Berg | 5d4ecd9 | 2007-09-14 11:10:24 -0400 | [diff] [blame] | 909 | (iw_handler) NULL, /* SIOCSIWSPY */ |
| 910 | (iw_handler) NULL, /* SIOCGIWSPY */ |
| 911 | (iw_handler) NULL, /* SIOCSIWTHRSPY */ |
| 912 | (iw_handler) NULL, /* SIOCGIWTHRSPY */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 913 | (iw_handler) ieee80211_ioctl_siwap, /* SIOCSIWAP */ |
| 914 | (iw_handler) ieee80211_ioctl_giwap, /* SIOCGIWAP */ |
Johannes Berg | 691597c | 2009-04-19 19:57:45 +0200 | [diff] [blame] | 915 | (iw_handler) cfg80211_wext_siwmlme, /* SIOCSIWMLME */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 916 | (iw_handler) NULL, /* SIOCGIWAPLIST */ |
Johannes Berg | 2a51931 | 2009-02-10 21:25:55 +0100 | [diff] [blame] | 917 | (iw_handler) cfg80211_wext_siwscan, /* SIOCSIWSCAN */ |
| 918 | (iw_handler) cfg80211_wext_giwscan, /* SIOCGIWSCAN */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 919 | (iw_handler) ieee80211_ioctl_siwessid, /* SIOCSIWESSID */ |
| 920 | (iw_handler) ieee80211_ioctl_giwessid, /* SIOCGIWESSID */ |
| 921 | (iw_handler) NULL, /* SIOCSIWNICKN */ |
| 922 | (iw_handler) NULL, /* SIOCGIWNICKN */ |
| 923 | (iw_handler) NULL, /* -- hole -- */ |
| 924 | (iw_handler) NULL, /* -- hole -- */ |
Larry Finger | 1fd5e58 | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 925 | (iw_handler) ieee80211_ioctl_siwrate, /* SIOCSIWRATE */ |
Larry Finger | b3d88ad | 2007-06-10 17:57:33 -0700 | [diff] [blame] | 926 | (iw_handler) ieee80211_ioctl_giwrate, /* SIOCGIWRATE */ |
Jouni Malinen | b9a5f8ca | 2009-04-20 18:39:05 +0200 | [diff] [blame^] | 927 | (iw_handler) cfg80211_wext_siwrts, /* SIOCSIWRTS */ |
| 928 | (iw_handler) cfg80211_wext_giwrts, /* SIOCGIWRTS */ |
| 929 | (iw_handler) cfg80211_wext_siwfrag, /* SIOCSIWFRAG */ |
| 930 | (iw_handler) cfg80211_wext_giwfrag, /* SIOCGIWFRAG */ |
Michael Buesch | 61609bc | 2007-09-20 22:06:39 +0200 | [diff] [blame] | 931 | (iw_handler) ieee80211_ioctl_siwtxpower, /* SIOCSIWTXPOW */ |
Larry Finger | fe6aa30 | 2007-08-10 11:23:20 -0500 | [diff] [blame] | 932 | (iw_handler) ieee80211_ioctl_giwtxpower, /* SIOCGIWTXPOW */ |
Jouni Malinen | b9a5f8ca | 2009-04-20 18:39:05 +0200 | [diff] [blame^] | 933 | (iw_handler) cfg80211_wext_siwretry, /* SIOCSIWRETRY */ |
| 934 | (iw_handler) cfg80211_wext_giwretry, /* SIOCGIWRETRY */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 935 | (iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */ |
| 936 | (iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */ |
Samuel Ortiz | 49292d5 | 2008-07-04 10:49:31 +0200 | [diff] [blame] | 937 | (iw_handler) ieee80211_ioctl_siwpower, /* SIOCSIWPOWER */ |
| 938 | (iw_handler) ieee80211_ioctl_giwpower, /* SIOCGIWPOWER */ |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 939 | (iw_handler) NULL, /* -- hole -- */ |
| 940 | (iw_handler) NULL, /* -- hole -- */ |
| 941 | (iw_handler) ieee80211_ioctl_siwgenie, /* SIOCSIWGENIE */ |
| 942 | (iw_handler) NULL, /* SIOCGIWGENIE */ |
| 943 | (iw_handler) ieee80211_ioctl_siwauth, /* SIOCSIWAUTH */ |
| 944 | (iw_handler) ieee80211_ioctl_giwauth, /* SIOCGIWAUTH */ |
| 945 | (iw_handler) ieee80211_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */ |
| 946 | (iw_handler) NULL, /* SIOCGIWENCODEEXT */ |
| 947 | (iw_handler) NULL, /* SIOCSIWPMKSA */ |
| 948 | (iw_handler) NULL, /* -- hole -- */ |
| 949 | }; |
| 950 | |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 951 | const struct iw_handler_def ieee80211_iw_handler_def = |
| 952 | { |
| 953 | .num_standard = ARRAY_SIZE(ieee80211_handler), |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 954 | .standard = (iw_handler *) ieee80211_handler, |
Jiri Benc | f0706e8 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 955 | .get_wireless_stats = ieee80211_get_wireless_stats, |
| 956 | }; |