diff options
Diffstat (limited to 'net/mac80211/wext.c')
-rw-r--r-- | net/mac80211/wext.c | 165 |
1 files changed, 68 insertions, 97 deletions
diff --git a/net/mac80211/wext.c b/net/mac80211/wext.c index 34fa8ed1e784..7e0d53abde24 100644 --- a/net/mac80211/wext.c +++ b/net/mac80211/wext.c | |||
@@ -27,22 +27,19 @@ | |||
27 | #include "aes_ccm.h" | 27 | #include "aes_ccm.h" |
28 | 28 | ||
29 | 29 | ||
30 | static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, | 30 | static int ieee80211_set_encryption(struct ieee80211_sub_if_data *sdata, u8 *sta_addr, |
31 | int idx, int alg, int remove, | 31 | int idx, int alg, int remove, |
32 | int set_tx_key, const u8 *_key, | 32 | int set_tx_key, const u8 *_key, |
33 | size_t key_len) | 33 | size_t key_len) |
34 | { | 34 | { |
35 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 35 | struct ieee80211_local *local = sdata->local; |
36 | struct sta_info *sta; | 36 | struct sta_info *sta; |
37 | struct ieee80211_key *key; | 37 | struct ieee80211_key *key; |
38 | struct ieee80211_sub_if_data *sdata; | ||
39 | int err; | 38 | int err; |
40 | 39 | ||
41 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
42 | |||
43 | if (idx < 0 || idx >= NUM_DEFAULT_KEYS) { | 40 | if (idx < 0 || idx >= NUM_DEFAULT_KEYS) { |
44 | printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d\n", | 41 | printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d\n", |
45 | dev->name, idx); | 42 | sdata->dev->name, idx); |
46 | return -EINVAL; | 43 | return -EINVAL; |
47 | } | 44 | } |
48 | 45 | ||
@@ -125,13 +122,13 @@ static int ieee80211_ioctl_siwgenie(struct net_device *dev, | |||
125 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) | 122 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) |
126 | return -EOPNOTSUPP; | 123 | return -EOPNOTSUPP; |
127 | 124 | ||
128 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 125 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
129 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 126 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
130 | int ret = ieee80211_sta_set_extra_ie(dev, extra, data->length); | 127 | int ret = ieee80211_sta_set_extra_ie(sdata, extra, data->length); |
131 | if (ret) | 128 | if (ret) |
132 | return ret; | 129 | return ret; |
133 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; | 130 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; |
134 | ieee80211_sta_req_auth(dev, &sdata->u.sta); | 131 | ieee80211_sta_req_auth(sdata, &sdata->u.sta); |
135 | return 0; | 132 | return 0; |
136 | } | 133 | } |
137 | 134 | ||
@@ -276,21 +273,21 @@ static int ieee80211_ioctl_siwmode(struct net_device *dev, | |||
276 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 273 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
277 | int type; | 274 | int type; |
278 | 275 | ||
279 | if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN) | 276 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) |
280 | return -EOPNOTSUPP; | 277 | return -EOPNOTSUPP; |
281 | 278 | ||
282 | switch (*mode) { | 279 | switch (*mode) { |
283 | case IW_MODE_INFRA: | 280 | case IW_MODE_INFRA: |
284 | type = IEEE80211_IF_TYPE_STA; | 281 | type = NL80211_IFTYPE_STATION; |
285 | break; | 282 | break; |
286 | case IW_MODE_ADHOC: | 283 | case IW_MODE_ADHOC: |
287 | type = IEEE80211_IF_TYPE_IBSS; | 284 | type = NL80211_IFTYPE_ADHOC; |
288 | break; | 285 | break; |
289 | case IW_MODE_REPEAT: | 286 | case IW_MODE_REPEAT: |
290 | type = IEEE80211_IF_TYPE_WDS; | 287 | type = NL80211_IFTYPE_WDS; |
291 | break; | 288 | break; |
292 | case IW_MODE_MONITOR: | 289 | case IW_MODE_MONITOR: |
293 | type = IEEE80211_IF_TYPE_MNTR; | 290 | type = NL80211_IFTYPE_MONITOR; |
294 | break; | 291 | break; |
295 | default: | 292 | default: |
296 | return -EINVAL; | 293 | return -EINVAL; |
@@ -308,22 +305,22 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev, | |||
308 | 305 | ||
309 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 306 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
310 | switch (sdata->vif.type) { | 307 | switch (sdata->vif.type) { |
311 | case IEEE80211_IF_TYPE_AP: | 308 | case NL80211_IFTYPE_AP: |
312 | *mode = IW_MODE_MASTER; | 309 | *mode = IW_MODE_MASTER; |
313 | break; | 310 | break; |
314 | case IEEE80211_IF_TYPE_STA: | 311 | case NL80211_IFTYPE_STATION: |
315 | *mode = IW_MODE_INFRA; | 312 | *mode = IW_MODE_INFRA; |
316 | break; | 313 | break; |
317 | case IEEE80211_IF_TYPE_IBSS: | 314 | case NL80211_IFTYPE_ADHOC: |
318 | *mode = IW_MODE_ADHOC; | 315 | *mode = IW_MODE_ADHOC; |
319 | break; | 316 | break; |
320 | case IEEE80211_IF_TYPE_MNTR: | 317 | case NL80211_IFTYPE_MONITOR: |
321 | *mode = IW_MODE_MONITOR; | 318 | *mode = IW_MODE_MONITOR; |
322 | break; | 319 | break; |
323 | case IEEE80211_IF_TYPE_WDS: | 320 | case NL80211_IFTYPE_WDS: |
324 | *mode = IW_MODE_REPEAT; | 321 | *mode = IW_MODE_REPEAT; |
325 | break; | 322 | break; |
326 | case IEEE80211_IF_TYPE_VLAN: | 323 | case NL80211_IFTYPE_AP_VLAN: |
327 | *mode = IW_MODE_SECOND; /* FIXME */ | 324 | *mode = IW_MODE_SECOND; /* FIXME */ |
328 | break; | 325 | break; |
329 | default: | 326 | default: |
@@ -333,60 +330,31 @@ static int ieee80211_ioctl_giwmode(struct net_device *dev, | |||
333 | return 0; | 330 | return 0; |
334 | } | 331 | } |
335 | 332 | ||
336 | int ieee80211_set_freq(struct net_device *dev, int freqMHz) | ||
337 | { | ||
338 | int ret = -EINVAL; | ||
339 | struct ieee80211_channel *chan; | ||
340 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
341 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
342 | |||
343 | chan = ieee80211_get_channel(local->hw.wiphy, freqMHz); | ||
344 | |||
345 | if (chan && !(chan->flags & IEEE80211_CHAN_DISABLED)) { | ||
346 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && | ||
347 | chan->flags & IEEE80211_CHAN_NO_IBSS) { | ||
348 | printk(KERN_DEBUG "%s: IBSS not allowed on frequency " | ||
349 | "%d MHz\n", dev->name, chan->center_freq); | ||
350 | return ret; | ||
351 | } | ||
352 | local->oper_channel = chan; | ||
353 | |||
354 | if (local->sta_sw_scanning || local->sta_hw_scanning) | ||
355 | ret = 0; | ||
356 | else | ||
357 | ret = ieee80211_hw_config(local); | ||
358 | |||
359 | rate_control_clear(local); | ||
360 | } | ||
361 | |||
362 | return ret; | ||
363 | } | ||
364 | |||
365 | static int ieee80211_ioctl_siwfreq(struct net_device *dev, | 333 | static int ieee80211_ioctl_siwfreq(struct net_device *dev, |
366 | struct iw_request_info *info, | 334 | struct iw_request_info *info, |
367 | struct iw_freq *freq, char *extra) | 335 | struct iw_freq *freq, char *extra) |
368 | { | 336 | { |
369 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 337 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
370 | 338 | ||
371 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) | 339 | if (sdata->vif.type == NL80211_IFTYPE_STATION) |
372 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL; | 340 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_CHANNEL_SEL; |
373 | 341 | ||
374 | /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */ | 342 | /* freq->e == 0: freq->m = channel; otherwise freq = m * 10^e */ |
375 | if (freq->e == 0) { | 343 | if (freq->e == 0) { |
376 | if (freq->m < 0) { | 344 | if (freq->m < 0) { |
377 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) | 345 | if (sdata->vif.type == NL80211_IFTYPE_STATION) |
378 | sdata->u.sta.flags |= | 346 | sdata->u.sta.flags |= |
379 | IEEE80211_STA_AUTO_CHANNEL_SEL; | 347 | IEEE80211_STA_AUTO_CHANNEL_SEL; |
380 | return 0; | 348 | return 0; |
381 | } else | 349 | } else |
382 | return ieee80211_set_freq(dev, | 350 | return ieee80211_set_freq(sdata, |
383 | ieee80211_channel_to_frequency(freq->m)); | 351 | ieee80211_channel_to_frequency(freq->m)); |
384 | } else { | 352 | } else { |
385 | int i, div = 1000000; | 353 | int i, div = 1000000; |
386 | for (i = 0; i < freq->e; i++) | 354 | for (i = 0; i < freq->e; i++) |
387 | div /= 10; | 355 | div /= 10; |
388 | if (div > 0) | 356 | if (div > 0) |
389 | return ieee80211_set_freq(dev, freq->m / div); | 357 | return ieee80211_set_freq(sdata, freq->m / div); |
390 | else | 358 | else |
391 | return -EINVAL; | 359 | return -EINVAL; |
392 | } | 360 | } |
@@ -418,8 +386,8 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev, | |||
418 | len--; | 386 | len--; |
419 | 387 | ||
420 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 388 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
421 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 389 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
422 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 390 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
423 | int ret; | 391 | int ret; |
424 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) { | 392 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) { |
425 | if (len > IEEE80211_MAX_SSID_LEN) | 393 | if (len > IEEE80211_MAX_SSID_LEN) |
@@ -432,14 +400,14 @@ static int ieee80211_ioctl_siwessid(struct net_device *dev, | |||
432 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_SSID_SEL; | 400 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_SSID_SEL; |
433 | else | 401 | else |
434 | sdata->u.sta.flags |= IEEE80211_STA_AUTO_SSID_SEL; | 402 | sdata->u.sta.flags |= IEEE80211_STA_AUTO_SSID_SEL; |
435 | ret = ieee80211_sta_set_ssid(dev, ssid, len); | 403 | ret = ieee80211_sta_set_ssid(sdata, ssid, len); |
436 | if (ret) | 404 | if (ret) |
437 | return ret; | 405 | return ret; |
438 | ieee80211_sta_req_auth(dev, &sdata->u.sta); | 406 | ieee80211_sta_req_auth(sdata, &sdata->u.sta); |
439 | return 0; | 407 | return 0; |
440 | } | 408 | } |
441 | 409 | ||
442 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { | 410 | if (sdata->vif.type == NL80211_IFTYPE_AP) { |
443 | memcpy(sdata->u.ap.ssid, ssid, len); | 411 | memcpy(sdata->u.ap.ssid, ssid, len); |
444 | memset(sdata->u.ap.ssid + len, 0, | 412 | memset(sdata->u.ap.ssid + len, 0, |
445 | IEEE80211_MAX_SSID_LEN - len); | 413 | IEEE80211_MAX_SSID_LEN - len); |
@@ -458,9 +426,9 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev, | |||
458 | 426 | ||
459 | struct ieee80211_sub_if_data *sdata; | 427 | struct ieee80211_sub_if_data *sdata; |
460 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 428 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
461 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 429 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
462 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 430 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
463 | int res = ieee80211_sta_get_ssid(dev, ssid, &len); | 431 | int res = ieee80211_sta_get_ssid(sdata, ssid, &len); |
464 | if (res == 0) { | 432 | if (res == 0) { |
465 | data->length = len; | 433 | data->length = len; |
466 | data->flags = 1; | 434 | data->flags = 1; |
@@ -469,7 +437,7 @@ static int ieee80211_ioctl_giwessid(struct net_device *dev, | |||
469 | return res; | 437 | return res; |
470 | } | 438 | } |
471 | 439 | ||
472 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { | 440 | if (sdata->vif.type == NL80211_IFTYPE_AP) { |
473 | len = sdata->u.ap.ssid_len; | 441 | len = sdata->u.ap.ssid_len; |
474 | if (len > IW_ESSID_MAX_SIZE) | 442 | if (len > IW_ESSID_MAX_SIZE) |
475 | len = IW_ESSID_MAX_SIZE; | 443 | len = IW_ESSID_MAX_SIZE; |
@@ -489,8 +457,8 @@ static int ieee80211_ioctl_siwap(struct net_device *dev, | |||
489 | struct ieee80211_sub_if_data *sdata; | 457 | struct ieee80211_sub_if_data *sdata; |
490 | 458 | ||
491 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 459 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
492 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 460 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
493 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 461 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
494 | int ret; | 462 | int ret; |
495 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) { | 463 | if (sdata->flags & IEEE80211_SDATA_USERSPACE_MLME) { |
496 | memcpy(sdata->u.sta.bssid, (u8 *) &ap_addr->sa_data, | 464 | memcpy(sdata->u.sta.bssid, (u8 *) &ap_addr->sa_data, |
@@ -504,12 +472,12 @@ static int ieee80211_ioctl_siwap(struct net_device *dev, | |||
504 | sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL; | 472 | sdata->u.sta.flags |= IEEE80211_STA_AUTO_BSSID_SEL; |
505 | else | 473 | else |
506 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; | 474 | sdata->u.sta.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; |
507 | ret = ieee80211_sta_set_bssid(dev, (u8 *) &ap_addr->sa_data); | 475 | ret = ieee80211_sta_set_bssid(sdata, (u8 *) &ap_addr->sa_data); |
508 | if (ret) | 476 | if (ret) |
509 | return ret; | 477 | return ret; |
510 | ieee80211_sta_req_auth(dev, &sdata->u.sta); | 478 | ieee80211_sta_req_auth(sdata, &sdata->u.sta); |
511 | return 0; | 479 | return 0; |
512 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { | 480 | } else if (sdata->vif.type == NL80211_IFTYPE_WDS) { |
513 | /* | 481 | /* |
514 | * If it is necessary to update the WDS peer address | 482 | * If it is necessary to update the WDS peer address |
515 | * while the interface is running, then we need to do | 483 | * while the interface is running, then we need to do |
@@ -537,10 +505,10 @@ static int ieee80211_ioctl_giwap(struct net_device *dev, | |||
537 | struct ieee80211_sub_if_data *sdata; | 505 | struct ieee80211_sub_if_data *sdata; |
538 | 506 | ||
539 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 507 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
540 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 508 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
541 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | 509 | sdata->vif.type == NL80211_IFTYPE_ADHOC) { |
542 | if (sdata->u.sta.state == IEEE80211_ASSOCIATED || | 510 | if (sdata->u.sta.state == IEEE80211_STA_MLME_ASSOCIATED || |
543 | sdata->u.sta.state == IEEE80211_IBSS_JOINED) { | 511 | sdata->u.sta.state == IEEE80211_STA_MLME_IBSS_JOINED) { |
544 | ap_addr->sa_family = ARPHRD_ETHER; | 512 | ap_addr->sa_family = ARPHRD_ETHER; |
545 | memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); | 513 | memcpy(&ap_addr->sa_data, sdata->u.sta.bssid, ETH_ALEN); |
546 | return 0; | 514 | return 0; |
@@ -548,7 +516,7 @@ static int ieee80211_ioctl_giwap(struct net_device *dev, | |||
548 | memset(&ap_addr->sa_data, 0, ETH_ALEN); | 516 | memset(&ap_addr->sa_data, 0, ETH_ALEN); |
549 | return 0; | 517 | return 0; |
550 | } | 518 | } |
551 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_WDS) { | 519 | } else if (sdata->vif.type == NL80211_IFTYPE_WDS) { |
552 | ap_addr->sa_family = ARPHRD_ETHER; | 520 | ap_addr->sa_family = ARPHRD_ETHER; |
553 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); | 521 | memcpy(&ap_addr->sa_data, sdata->u.wds.remote_addr, ETH_ALEN); |
554 | return 0; | 522 | return 0; |
@@ -570,10 +538,10 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev, | |||
570 | if (!netif_running(dev)) | 538 | if (!netif_running(dev)) |
571 | return -ENETDOWN; | 539 | return -ENETDOWN; |
572 | 540 | ||
573 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && | 541 | if (sdata->vif.type != NL80211_IFTYPE_STATION && |
574 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS && | 542 | sdata->vif.type != NL80211_IFTYPE_ADHOC && |
575 | sdata->vif.type != IEEE80211_IF_TYPE_MESH_POINT && | 543 | sdata->vif.type != NL80211_IFTYPE_MESH_POINT && |
576 | sdata->vif.type != IEEE80211_IF_TYPE_AP) | 544 | sdata->vif.type != NL80211_IFTYPE_AP) |
577 | return -EOPNOTSUPP; | 545 | return -EOPNOTSUPP; |
578 | 546 | ||
579 | /* if SSID was specified explicitly then use that */ | 547 | /* if SSID was specified explicitly then use that */ |
@@ -584,7 +552,7 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev, | |||
584 | ssid_len = req->essid_len; | 552 | ssid_len = req->essid_len; |
585 | } | 553 | } |
586 | 554 | ||
587 | return ieee80211_sta_req_scan(dev, ssid, ssid_len); | 555 | return ieee80211_request_scan(sdata, ssid, ssid_len); |
588 | } | 556 | } |
589 | 557 | ||
590 | 558 | ||
@@ -594,11 +562,14 @@ static int ieee80211_ioctl_giwscan(struct net_device *dev, | |||
594 | { | 562 | { |
595 | int res; | 563 | int res; |
596 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 564 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
565 | struct ieee80211_sub_if_data *sdata; | ||
566 | |||
567 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
597 | 568 | ||
598 | if (local->sta_sw_scanning || local->sta_hw_scanning) | 569 | if (local->sw_scanning || local->hw_scanning) |
599 | return -EAGAIN; | 570 | return -EAGAIN; |
600 | 571 | ||
601 | res = ieee80211_sta_scan_results(dev, info, extra, data->length); | 572 | res = ieee80211_scan_results(local, info, extra, data->length); |
602 | if (res >= 0) { | 573 | if (res >= 0) { |
603 | data->length = res; | 574 | data->length = res; |
604 | return 0; | 575 | return 0; |
@@ -656,7 +627,7 @@ static int ieee80211_ioctl_giwrate(struct net_device *dev, | |||
656 | 627 | ||
657 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 628 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
658 | 629 | ||
659 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 630 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
660 | return -EOPNOTSUPP; | 631 | return -EOPNOTSUPP; |
661 | 632 | ||
662 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 633 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; |
@@ -665,8 +636,8 @@ static int ieee80211_ioctl_giwrate(struct net_device *dev, | |||
665 | 636 | ||
666 | sta = sta_info_get(local, sdata->u.sta.bssid); | 637 | sta = sta_info_get(local, sdata->u.sta.bssid); |
667 | 638 | ||
668 | if (sta && sta->txrate_idx < sband->n_bitrates) | 639 | if (sta && sta->last_txrate_idx < sband->n_bitrates) |
669 | rate->value = sband->bitrates[sta->txrate_idx].bitrate; | 640 | rate->value = sband->bitrates[sta->last_txrate_idx].bitrate; |
670 | else | 641 | else |
671 | rate->value = 0; | 642 | rate->value = 0; |
672 | 643 | ||
@@ -887,17 +858,17 @@ static int ieee80211_ioctl_siwmlme(struct net_device *dev, | |||
887 | struct iw_mlme *mlme = (struct iw_mlme *) extra; | 858 | struct iw_mlme *mlme = (struct iw_mlme *) extra; |
888 | 859 | ||
889 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 860 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
890 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA && | 861 | if (sdata->vif.type != NL80211_IFTYPE_STATION && |
891 | sdata->vif.type != IEEE80211_IF_TYPE_IBSS) | 862 | sdata->vif.type != NL80211_IFTYPE_ADHOC) |
892 | return -EINVAL; | 863 | return -EINVAL; |
893 | 864 | ||
894 | switch (mlme->cmd) { | 865 | switch (mlme->cmd) { |
895 | case IW_MLME_DEAUTH: | 866 | case IW_MLME_DEAUTH: |
896 | /* TODO: mlme->addr.sa_data */ | 867 | /* TODO: mlme->addr.sa_data */ |
897 | return ieee80211_sta_deauthenticate(dev, mlme->reason_code); | 868 | return ieee80211_sta_deauthenticate(sdata, mlme->reason_code); |
898 | case IW_MLME_DISASSOC: | 869 | case IW_MLME_DISASSOC: |
899 | /* TODO: mlme->addr.sa_data */ | 870 | /* TODO: mlme->addr.sa_data */ |
900 | return ieee80211_sta_disassociate(dev, mlme->reason_code); | 871 | return ieee80211_sta_disassociate(sdata, mlme->reason_code); |
901 | default: | 872 | default: |
902 | return -EOPNOTSUPP; | 873 | return -EOPNOTSUPP; |
903 | } | 874 | } |
@@ -938,7 +909,7 @@ static int ieee80211_ioctl_siwencode(struct net_device *dev, | |||
938 | } | 909 | } |
939 | 910 | ||
940 | return ieee80211_set_encryption( | 911 | return ieee80211_set_encryption( |
941 | dev, bcaddr, | 912 | sdata, bcaddr, |
942 | idx, alg, remove, | 913 | idx, alg, remove, |
943 | !sdata->default_key, | 914 | !sdata->default_key, |
944 | keybuf, erq->length); | 915 | keybuf, erq->length); |
@@ -983,7 +954,7 @@ static int ieee80211_ioctl_giwencode(struct net_device *dev, | |||
983 | erq->length = sdata->keys[idx]->conf.keylen; | 954 | erq->length = sdata->keys[idx]->conf.keylen; |
984 | erq->flags |= IW_ENCODE_ENABLED; | 955 | erq->flags |= IW_ENCODE_ENABLED; |
985 | 956 | ||
986 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA) { | 957 | if (sdata->vif.type == NL80211_IFTYPE_STATION) { |
987 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; | 958 | struct ieee80211_if_sta *ifsta = &sdata->u.sta; |
988 | switch (ifsta->auth_alg) { | 959 | switch (ifsta->auth_alg) { |
989 | case WLAN_AUTH_OPEN: | 960 | case WLAN_AUTH_OPEN: |
@@ -1057,7 +1028,7 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev, | |||
1057 | sdata->drop_unencrypted = !!data->value; | 1028 | sdata->drop_unencrypted = !!data->value; |
1058 | break; | 1029 | break; |
1059 | case IW_AUTH_PRIVACY_INVOKED: | 1030 | case IW_AUTH_PRIVACY_INVOKED: |
1060 | if (sdata->vif.type != IEEE80211_IF_TYPE_STA) | 1031 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
1061 | ret = -EINVAL; | 1032 | ret = -EINVAL; |
1062 | else { | 1033 | else { |
1063 | sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED; | 1034 | sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED; |
@@ -1072,8 +1043,8 @@ static int ieee80211_ioctl_siwauth(struct net_device *dev, | |||
1072 | } | 1043 | } |
1073 | break; | 1044 | break; |
1074 | case IW_AUTH_80211_AUTH_ALG: | 1045 | case IW_AUTH_80211_AUTH_ALG: |
1075 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 1046 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
1076 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) | 1047 | sdata->vif.type == NL80211_IFTYPE_ADHOC) |
1077 | sdata->u.sta.auth_algs = data->value; | 1048 | sdata->u.sta.auth_algs = data->value; |
1078 | else | 1049 | else |
1079 | ret = -EOPNOTSUPP; | 1050 | ret = -EOPNOTSUPP; |
@@ -1095,8 +1066,8 @@ static struct iw_statistics *ieee80211_get_wireless_stats(struct net_device *dev | |||
1095 | 1066 | ||
1096 | rcu_read_lock(); | 1067 | rcu_read_lock(); |
1097 | 1068 | ||
1098 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 1069 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
1099 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) | 1070 | sdata->vif.type == NL80211_IFTYPE_ADHOC) |
1100 | sta = sta_info_get(local, sdata->u.sta.bssid); | 1071 | sta = sta_info_get(local, sdata->u.sta.bssid); |
1101 | if (!sta) { | 1072 | if (!sta) { |
1102 | wstats->discard.fragment = 0; | 1073 | wstats->discard.fragment = 0; |
@@ -1126,8 +1097,8 @@ static int ieee80211_ioctl_giwauth(struct net_device *dev, | |||
1126 | 1097 | ||
1127 | switch (data->flags & IW_AUTH_INDEX) { | 1098 | switch (data->flags & IW_AUTH_INDEX) { |
1128 | case IW_AUTH_80211_AUTH_ALG: | 1099 | case IW_AUTH_80211_AUTH_ALG: |
1129 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | 1100 | if (sdata->vif.type == NL80211_IFTYPE_STATION || |
1130 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) | 1101 | sdata->vif.type == NL80211_IFTYPE_ADHOC) |
1131 | data->value = sdata->u.sta.auth_algs; | 1102 | data->value = sdata->u.sta.auth_algs; |
1132 | else | 1103 | else |
1133 | ret = -EOPNOTSUPP; | 1104 | ret = -EOPNOTSUPP; |
@@ -1184,7 +1155,7 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev, | |||
1184 | } else | 1155 | } else |
1185 | idx--; | 1156 | idx--; |
1186 | 1157 | ||
1187 | return ieee80211_set_encryption(dev, ext->addr.sa_data, idx, alg, | 1158 | return ieee80211_set_encryption(sdata, ext->addr.sa_data, idx, alg, |
1188 | remove, | 1159 | remove, |
1189 | ext->ext_flags & | 1160 | ext->ext_flags & |
1190 | IW_ENCODE_EXT_SET_TX_KEY, | 1161 | IW_ENCODE_EXT_SET_TX_KEY, |