aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/hostap/hostap_ioctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/wireless/hostap/hostap_ioctl.c')
-rw-r--r--drivers/net/wireless/hostap/hostap_ioctl.c110
1 files changed, 55 insertions, 55 deletions
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
index 2318c5df7a08..29aebb679099 100644
--- a/drivers/net/wireless/hostap/hostap_ioctl.c
+++ b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -2,7 +2,7 @@
2 2
3#include <linux/types.h> 3#include <linux/types.h>
4#include <linux/ethtool.h> 4#include <linux/ethtool.h>
5#include <net/ieee80211_crypt.h> 5#include <net/lib80211.h>
6 6
7#include "hostap_wlan.h" 7#include "hostap_wlan.h"
8#include "hostap.h" 8#include "hostap.h"
@@ -117,9 +117,9 @@ static int prism2_get_name(struct net_device *dev,
117 117
118 118
119static void prism2_crypt_delayed_deinit(local_info_t *local, 119static void prism2_crypt_delayed_deinit(local_info_t *local,
120 struct ieee80211_crypt_data **crypt) 120 struct lib80211_crypt_data **crypt)
121{ 121{
122 struct ieee80211_crypt_data *tmp; 122 struct lib80211_crypt_data *tmp;
123 unsigned long flags; 123 unsigned long flags;
124 124
125 tmp = *crypt; 125 tmp = *crypt;
@@ -133,10 +133,10 @@ static void prism2_crypt_delayed_deinit(local_info_t *local,
133 * locking. */ 133 * locking. */
134 134
135 spin_lock_irqsave(&local->lock, flags); 135 spin_lock_irqsave(&local->lock, flags);
136 list_add(&tmp->list, &local->crypt_deinit_list); 136 list_add(&tmp->list, &local->crypt_info.crypt_deinit_list);
137 if (!timer_pending(&local->crypt_deinit_timer)) { 137 if (!timer_pending(&local->crypt_info.crypt_deinit_timer)) {
138 local->crypt_deinit_timer.expires = jiffies + HZ; 138 local->crypt_info.crypt_deinit_timer.expires = jiffies + HZ;
139 add_timer(&local->crypt_deinit_timer); 139 add_timer(&local->crypt_info.crypt_deinit_timer);
140 } 140 }
141 spin_unlock_irqrestore(&local->lock, flags); 141 spin_unlock_irqrestore(&local->lock, flags);
142} 142}
@@ -149,20 +149,20 @@ static int prism2_ioctl_siwencode(struct net_device *dev,
149 struct hostap_interface *iface; 149 struct hostap_interface *iface;
150 local_info_t *local; 150 local_info_t *local;
151 int i; 151 int i;
152 struct ieee80211_crypt_data **crypt; 152 struct lib80211_crypt_data **crypt;
153 153
154 iface = netdev_priv(dev); 154 iface = netdev_priv(dev);
155 local = iface->local; 155 local = iface->local;
156 156
157 i = erq->flags & IW_ENCODE_INDEX; 157 i = erq->flags & IW_ENCODE_INDEX;
158 if (i < 1 || i > 4) 158 if (i < 1 || i > 4)
159 i = local->tx_keyidx; 159 i = local->crypt_info.tx_keyidx;
160 else 160 else
161 i--; 161 i--;
162 if (i < 0 || i >= WEP_KEYS) 162 if (i < 0 || i >= WEP_KEYS)
163 return -EINVAL; 163 return -EINVAL;
164 164
165 crypt = &local->crypt[i]; 165 crypt = &local->crypt_info.crypt[i];
166 166
167 if (erq->flags & IW_ENCODE_DISABLED) { 167 if (erq->flags & IW_ENCODE_DISABLED) {
168 if (*crypt) 168 if (*crypt)
@@ -177,17 +177,17 @@ static int prism2_ioctl_siwencode(struct net_device *dev,
177 } 177 }
178 178
179 if (*crypt == NULL) { 179 if (*crypt == NULL) {
180 struct ieee80211_crypt_data *new_crypt; 180 struct lib80211_crypt_data *new_crypt;
181 181
182 /* take WEP into use */ 182 /* take WEP into use */
183 new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), 183 new_crypt = kzalloc(sizeof(struct lib80211_crypt_data),
184 GFP_KERNEL); 184 GFP_KERNEL);
185 if (new_crypt == NULL) 185 if (new_crypt == NULL)
186 return -ENOMEM; 186 return -ENOMEM;
187 new_crypt->ops = ieee80211_get_crypto_ops("WEP"); 187 new_crypt->ops = lib80211_get_crypto_ops("WEP");
188 if (!new_crypt->ops) { 188 if (!new_crypt->ops) {
189 request_module("ieee80211_crypt_wep"); 189 request_module("lib80211_crypt_wep");
190 new_crypt->ops = ieee80211_get_crypto_ops("WEP"); 190 new_crypt->ops = lib80211_get_crypto_ops("WEP");
191 } 191 }
192 if (new_crypt->ops) 192 if (new_crypt->ops)
193 new_crypt->priv = new_crypt->ops->init(i); 193 new_crypt->priv = new_crypt->ops->init(i);
@@ -210,16 +210,16 @@ static int prism2_ioctl_siwencode(struct net_device *dev,
210 memset(keybuf + erq->length, 0, len - erq->length); 210 memset(keybuf + erq->length, 0, len - erq->length);
211 (*crypt)->ops->set_key(keybuf, len, NULL, (*crypt)->priv); 211 (*crypt)->ops->set_key(keybuf, len, NULL, (*crypt)->priv);
212 for (j = 0; j < WEP_KEYS; j++) { 212 for (j = 0; j < WEP_KEYS; j++) {
213 if (j != i && local->crypt[j]) { 213 if (j != i && local->crypt_info.crypt[j]) {
214 first = 0; 214 first = 0;
215 break; 215 break;
216 } 216 }
217 } 217 }
218 if (first) 218 if (first)
219 local->tx_keyidx = i; 219 local->crypt_info.tx_keyidx = i;
220 } else { 220 } else {
221 /* No key data - just set the default TX key index */ 221 /* No key data - just set the default TX key index */
222 local->tx_keyidx = i; 222 local->crypt_info.tx_keyidx = i;
223 } 223 }
224 224
225 done: 225 done:
@@ -252,20 +252,20 @@ static int prism2_ioctl_giwencode(struct net_device *dev,
252 local_info_t *local; 252 local_info_t *local;
253 int i, len; 253 int i, len;
254 u16 val; 254 u16 val;
255 struct ieee80211_crypt_data *crypt; 255 struct lib80211_crypt_data *crypt;
256 256
257 iface = netdev_priv(dev); 257 iface = netdev_priv(dev);
258 local = iface->local; 258 local = iface->local;
259 259
260 i = erq->flags & IW_ENCODE_INDEX; 260 i = erq->flags & IW_ENCODE_INDEX;
261 if (i < 1 || i > 4) 261 if (i < 1 || i > 4)
262 i = local->tx_keyidx; 262 i = local->crypt_info.tx_keyidx;
263 else 263 else
264 i--; 264 i--;
265 if (i < 0 || i >= WEP_KEYS) 265 if (i < 0 || i >= WEP_KEYS)
266 return -EINVAL; 266 return -EINVAL;
267 267
268 crypt = local->crypt[i]; 268 crypt = local->crypt_info.crypt[i];
269 erq->flags = i + 1; 269 erq->flags = i + 1;
270 270
271 if (crypt == NULL || crypt->ops == NULL) { 271 if (crypt == NULL || crypt->ops == NULL) {
@@ -3227,8 +3227,8 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3227 local_info_t *local = iface->local; 3227 local_info_t *local = iface->local;
3228 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; 3228 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
3229 int i, ret = 0; 3229 int i, ret = 0;
3230 struct ieee80211_crypto_ops *ops; 3230 struct lib80211_crypto_ops *ops;
3231 struct ieee80211_crypt_data **crypt; 3231 struct lib80211_crypt_data **crypt;
3232 void *sta_ptr; 3232 void *sta_ptr;
3233 u8 *addr; 3233 u8 *addr;
3234 const char *alg, *module; 3234 const char *alg, *module;
@@ -3237,7 +3237,7 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3237 if (i > WEP_KEYS) 3237 if (i > WEP_KEYS)
3238 return -EINVAL; 3238 return -EINVAL;
3239 if (i < 1 || i > WEP_KEYS) 3239 if (i < 1 || i > WEP_KEYS)
3240 i = local->tx_keyidx; 3240 i = local->crypt_info.tx_keyidx;
3241 else 3241 else
3242 i--; 3242 i--;
3243 if (i < 0 || i >= WEP_KEYS) 3243 if (i < 0 || i >= WEP_KEYS)
@@ -3247,7 +3247,7 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3247 if (addr[0] == 0xff && addr[1] == 0xff && addr[2] == 0xff && 3247 if (addr[0] == 0xff && addr[1] == 0xff && addr[2] == 0xff &&
3248 addr[3] == 0xff && addr[4] == 0xff && addr[5] == 0xff) { 3248 addr[3] == 0xff && addr[4] == 0xff && addr[5] == 0xff) {
3249 sta_ptr = NULL; 3249 sta_ptr = NULL;
3250 crypt = &local->crypt[i]; 3250 crypt = &local->crypt_info.crypt[i];
3251 } else { 3251 } else {
3252 if (i != 0) 3252 if (i != 0)
3253 return -EINVAL; 3253 return -EINVAL;
@@ -3260,7 +3260,7 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3260 * is emulated by using default key idx 0. 3260 * is emulated by using default key idx 0.
3261 */ 3261 */
3262 i = 0; 3262 i = 0;
3263 crypt = &local->crypt[i]; 3263 crypt = &local->crypt_info.crypt[i];
3264 } else 3264 } else
3265 return -EINVAL; 3265 return -EINVAL;
3266 } 3266 }
@@ -3276,15 +3276,15 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3276 switch (ext->alg) { 3276 switch (ext->alg) {
3277 case IW_ENCODE_ALG_WEP: 3277 case IW_ENCODE_ALG_WEP:
3278 alg = "WEP"; 3278 alg = "WEP";
3279 module = "ieee80211_crypt_wep"; 3279 module = "lib80211_crypt_wep";
3280 break; 3280 break;
3281 case IW_ENCODE_ALG_TKIP: 3281 case IW_ENCODE_ALG_TKIP:
3282 alg = "TKIP"; 3282 alg = "TKIP";
3283 module = "ieee80211_crypt_tkip"; 3283 module = "lib80211_crypt_tkip";
3284 break; 3284 break;
3285 case IW_ENCODE_ALG_CCMP: 3285 case IW_ENCODE_ALG_CCMP:
3286 alg = "CCMP"; 3286 alg = "CCMP";
3287 module = "ieee80211_crypt_ccmp"; 3287 module = "lib80211_crypt_ccmp";
3288 break; 3288 break;
3289 default: 3289 default:
3290 printk(KERN_DEBUG "%s: unsupported algorithm %d\n", 3290 printk(KERN_DEBUG "%s: unsupported algorithm %d\n",
@@ -3293,10 +3293,10 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3293 goto done; 3293 goto done;
3294 } 3294 }
3295 3295
3296 ops = ieee80211_get_crypto_ops(alg); 3296 ops = lib80211_get_crypto_ops(alg);
3297 if (ops == NULL) { 3297 if (ops == NULL) {
3298 request_module(module); 3298 request_module(module);
3299 ops = ieee80211_get_crypto_ops(alg); 3299 ops = lib80211_get_crypto_ops(alg);
3300 } 3300 }
3301 if (ops == NULL) { 3301 if (ops == NULL) {
3302 printk(KERN_DEBUG "%s: unknown crypto alg '%s'\n", 3302 printk(KERN_DEBUG "%s: unknown crypto alg '%s'\n",
@@ -3315,11 +3315,11 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3315 } 3315 }
3316 3316
3317 if (*crypt == NULL || (*crypt)->ops != ops) { 3317 if (*crypt == NULL || (*crypt)->ops != ops) {
3318 struct ieee80211_crypt_data *new_crypt; 3318 struct lib80211_crypt_data *new_crypt;
3319 3319
3320 prism2_crypt_delayed_deinit(local, crypt); 3320 prism2_crypt_delayed_deinit(local, crypt);
3321 3321
3322 new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), 3322 new_crypt = kzalloc(sizeof(struct lib80211_crypt_data),
3323 GFP_KERNEL); 3323 GFP_KERNEL);
3324 if (new_crypt == NULL) { 3324 if (new_crypt == NULL) {
3325 ret = -ENOMEM; 3325 ret = -ENOMEM;
@@ -3354,20 +3354,20 @@ static int prism2_ioctl_siwencodeext(struct net_device *dev,
3354 3354
3355 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) { 3355 if (ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY) {
3356 if (!sta_ptr) 3356 if (!sta_ptr)
3357 local->tx_keyidx = i; 3357 local->crypt_info.tx_keyidx = i;
3358 } 3358 }
3359 3359
3360 3360
3361 if (sta_ptr == NULL && ext->key_len > 0) { 3361 if (sta_ptr == NULL && ext->key_len > 0) {
3362 int first = 1, j; 3362 int first = 1, j;
3363 for (j = 0; j < WEP_KEYS; j++) { 3363 for (j = 0; j < WEP_KEYS; j++) {
3364 if (j != i && local->crypt[j]) { 3364 if (j != i && local->crypt_info.crypt[j]) {
3365 first = 0; 3365 first = 0;
3366 break; 3366 break;
3367 } 3367 }
3368 } 3368 }
3369 if (first) 3369 if (first)
3370 local->tx_keyidx = i; 3370 local->crypt_info.tx_keyidx = i;
3371 } 3371 }
3372 3372
3373 done: 3373 done:
@@ -3399,7 +3399,7 @@ static int prism2_ioctl_giwencodeext(struct net_device *dev,
3399{ 3399{
3400 struct hostap_interface *iface = netdev_priv(dev); 3400 struct hostap_interface *iface = netdev_priv(dev);
3401 local_info_t *local = iface->local; 3401 local_info_t *local = iface->local;
3402 struct ieee80211_crypt_data **crypt; 3402 struct lib80211_crypt_data **crypt;
3403 void *sta_ptr; 3403 void *sta_ptr;
3404 int max_key_len, i; 3404 int max_key_len, i;
3405 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; 3405 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
@@ -3411,7 +3411,7 @@ static int prism2_ioctl_giwencodeext(struct net_device *dev,
3411 3411
3412 i = erq->flags & IW_ENCODE_INDEX; 3412 i = erq->flags & IW_ENCODE_INDEX;
3413 if (i < 1 || i > WEP_KEYS) 3413 if (i < 1 || i > WEP_KEYS)
3414 i = local->tx_keyidx; 3414 i = local->crypt_info.tx_keyidx;
3415 else 3415 else
3416 i--; 3416 i--;
3417 3417
@@ -3419,7 +3419,7 @@ static int prism2_ioctl_giwencodeext(struct net_device *dev,
3419 if (addr[0] == 0xff && addr[1] == 0xff && addr[2] == 0xff && 3419 if (addr[0] == 0xff && addr[1] == 0xff && addr[2] == 0xff &&
3420 addr[3] == 0xff && addr[4] == 0xff && addr[5] == 0xff) { 3420 addr[3] == 0xff && addr[4] == 0xff && addr[5] == 0xff) {
3421 sta_ptr = NULL; 3421 sta_ptr = NULL;
3422 crypt = &local->crypt[i]; 3422 crypt = &local->crypt_info.crypt[i];
3423 } else { 3423 } else {
3424 i = 0; 3424 i = 0;
3425 sta_ptr = ap_crypt_get_ptrs(local->ap, addr, 0, &crypt); 3425 sta_ptr = ap_crypt_get_ptrs(local->ap, addr, 0, &crypt);
@@ -3468,8 +3468,8 @@ static int prism2_ioctl_set_encryption(local_info_t *local,
3468 int param_len) 3468 int param_len)
3469{ 3469{
3470 int ret = 0; 3470 int ret = 0;
3471 struct ieee80211_crypto_ops *ops; 3471 struct lib80211_crypto_ops *ops;
3472 struct ieee80211_crypt_data **crypt; 3472 struct lib80211_crypt_data **crypt;
3473 void *sta_ptr; 3473 void *sta_ptr;
3474 3474
3475 param->u.crypt.err = 0; 3475 param->u.crypt.err = 0;
@@ -3486,7 +3486,7 @@ static int prism2_ioctl_set_encryption(local_info_t *local,
3486 if (param->u.crypt.idx >= WEP_KEYS) 3486 if (param->u.crypt.idx >= WEP_KEYS)
3487 return -EINVAL; 3487 return -EINVAL;
3488 sta_ptr = NULL; 3488 sta_ptr = NULL;
3489 crypt = &local->crypt[param->u.crypt.idx]; 3489 crypt = &local->crypt_info.crypt[param->u.crypt.idx];
3490 } else { 3490 } else {
3491 if (param->u.crypt.idx) 3491 if (param->u.crypt.idx)
3492 return -EINVAL; 3492 return -EINVAL;
@@ -3507,16 +3507,16 @@ static int prism2_ioctl_set_encryption(local_info_t *local,
3507 goto done; 3507 goto done;
3508 } 3508 }
3509 3509
3510 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 3510 ops = lib80211_get_crypto_ops(param->u.crypt.alg);
3511 if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) { 3511 if (ops == NULL && strcmp(param->u.crypt.alg, "WEP") == 0) {
3512 request_module("ieee80211_crypt_wep"); 3512 request_module("lib80211_crypt_wep");
3513 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 3513 ops = lib80211_get_crypto_ops(param->u.crypt.alg);
3514 } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) { 3514 } else if (ops == NULL && strcmp(param->u.crypt.alg, "TKIP") == 0) {
3515 request_module("ieee80211_crypt_tkip"); 3515 request_module("lib80211_crypt_tkip");
3516 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 3516 ops = lib80211_get_crypto_ops(param->u.crypt.alg);
3517 } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) { 3517 } else if (ops == NULL && strcmp(param->u.crypt.alg, "CCMP") == 0) {
3518 request_module("ieee80211_crypt_ccmp"); 3518 request_module("lib80211_crypt_ccmp");
3519 ops = ieee80211_get_crypto_ops(param->u.crypt.alg); 3519 ops = lib80211_get_crypto_ops(param->u.crypt.alg);
3520 } 3520 }
3521 if (ops == NULL) { 3521 if (ops == NULL) {
3522 printk(KERN_DEBUG "%s: unknown crypto alg '%s'\n", 3522 printk(KERN_DEBUG "%s: unknown crypto alg '%s'\n",
@@ -3531,11 +3531,11 @@ static int prism2_ioctl_set_encryption(local_info_t *local,
3531 local->host_decrypt = local->host_encrypt = 1; 3531 local->host_decrypt = local->host_encrypt = 1;
3532 3532
3533 if (*crypt == NULL || (*crypt)->ops != ops) { 3533 if (*crypt == NULL || (*crypt)->ops != ops) {
3534 struct ieee80211_crypt_data *new_crypt; 3534 struct lib80211_crypt_data *new_crypt;
3535 3535
3536 prism2_crypt_delayed_deinit(local, crypt); 3536 prism2_crypt_delayed_deinit(local, crypt);
3537 3537
3538 new_crypt = kzalloc(sizeof(struct ieee80211_crypt_data), 3538 new_crypt = kzalloc(sizeof(struct lib80211_crypt_data),
3539 GFP_KERNEL); 3539 GFP_KERNEL);
3540 if (new_crypt == NULL) { 3540 if (new_crypt == NULL) {
3541 ret = -ENOMEM; 3541 ret = -ENOMEM;
@@ -3568,7 +3568,7 @@ static int prism2_ioctl_set_encryption(local_info_t *local,
3568 3568
3569 if (param->u.crypt.flags & HOSTAP_CRYPT_FLAG_SET_TX_KEY) { 3569 if (param->u.crypt.flags & HOSTAP_CRYPT_FLAG_SET_TX_KEY) {
3570 if (!sta_ptr) 3570 if (!sta_ptr)
3571 local->tx_keyidx = param->u.crypt.idx; 3571 local->crypt_info.tx_keyidx = param->u.crypt.idx;
3572 else if (param->u.crypt.idx) { 3572 else if (param->u.crypt.idx) {
3573 printk(KERN_DEBUG "%s: TX key idx setting failed\n", 3573 printk(KERN_DEBUG "%s: TX key idx setting failed\n",
3574 local->dev->name); 3574 local->dev->name);
@@ -3604,7 +3604,7 @@ static int prism2_ioctl_get_encryption(local_info_t *local,
3604 struct prism2_hostapd_param *param, 3604 struct prism2_hostapd_param *param,
3605 int param_len) 3605 int param_len)
3606{ 3606{
3607 struct ieee80211_crypt_data **crypt; 3607 struct lib80211_crypt_data **crypt;
3608 void *sta_ptr; 3608 void *sta_ptr;
3609 int max_key_len; 3609 int max_key_len;
3610 3610
@@ -3620,8 +3620,8 @@ static int prism2_ioctl_get_encryption(local_info_t *local,
3620 param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) { 3620 param->sta_addr[4] == 0xff && param->sta_addr[5] == 0xff) {
3621 sta_ptr = NULL; 3621 sta_ptr = NULL;
3622 if (param->u.crypt.idx >= WEP_KEYS) 3622 if (param->u.crypt.idx >= WEP_KEYS)
3623 param->u.crypt.idx = local->tx_keyidx; 3623 param->u.crypt.idx = local->crypt_info.tx_keyidx;
3624 crypt = &local->crypt[param->u.crypt.idx]; 3624 crypt = &local->crypt_info.crypt[param->u.crypt.idx];
3625 } else { 3625 } else {
3626 param->u.crypt.idx = 0; 3626 param->u.crypt.idx = 0;
3627 sta_ptr = ap_crypt_get_ptrs(local->ap, param->sta_addr, 0, 3627 sta_ptr = ap_crypt_get_ptrs(local->ap, param->sta_addr, 0,