diff options
Diffstat (limited to 'net/mac80211/cfg.c')
| -rw-r--r-- | net/mac80211/cfg.c | 419 |
1 files changed, 314 insertions, 105 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c index 9ae1a4760b58..29ac8e1a509e 100644 --- a/net/mac80211/cfg.c +++ b/net/mac80211/cfg.c | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | /* | 1 | /* |
| 2 | * mac80211 configuration hooks for cfg80211 | 2 | * mac80211 configuration hooks for cfg80211 |
| 3 | * | 3 | * |
| 4 | * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> | 4 | * Copyright 2006-2010 Johannes Berg <johannes@sipsolutions.net> |
| 5 | * | 5 | * |
| 6 | * This file is GPLv2 as found in COPYING. | 6 | * This file is GPLv2 as found in COPYING. |
| 7 | */ | 7 | */ |
| @@ -9,6 +9,7 @@ | |||
| 9 | #include <linux/ieee80211.h> | 9 | #include <linux/ieee80211.h> |
| 10 | #include <linux/nl80211.h> | 10 | #include <linux/nl80211.h> |
| 11 | #include <linux/rtnetlink.h> | 11 | #include <linux/rtnetlink.h> |
| 12 | #include <linux/slab.h> | ||
| 12 | #include <net/net_namespace.h> | 13 | #include <net/net_namespace.h> |
| 13 | #include <linux/rcupdate.h> | 14 | #include <linux/rcupdate.h> |
| 14 | #include <net/cfg80211.h> | 15 | #include <net/cfg80211.h> |
| @@ -78,17 +79,15 @@ static int ieee80211_change_iface(struct wiphy *wiphy, | |||
| 78 | enum nl80211_iftype type, u32 *flags, | 79 | enum nl80211_iftype type, u32 *flags, |
| 79 | struct vif_params *params) | 80 | struct vif_params *params) |
| 80 | { | 81 | { |
| 81 | struct ieee80211_sub_if_data *sdata; | 82 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 82 | int ret; | 83 | int ret; |
| 83 | 84 | ||
| 84 | if (netif_running(dev)) | 85 | if (ieee80211_sdata_running(sdata)) |
| 85 | return -EBUSY; | 86 | return -EBUSY; |
| 86 | 87 | ||
| 87 | if (!nl80211_params_check(type, params)) | 88 | if (!nl80211_params_check(type, params)) |
| 88 | return -EINVAL; | 89 | return -EINVAL; |
| 89 | 90 | ||
| 90 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
| 91 | |||
| 92 | ret = ieee80211_if_change_type(sdata, type); | 91 | ret = ieee80211_if_change_type(sdata, type); |
| 93 | if (ret) | 92 | if (ret) |
| 94 | return ret; | 93 | return ret; |
| @@ -98,9 +97,6 @@ static int ieee80211_change_iface(struct wiphy *wiphy, | |||
| 98 | params->mesh_id_len, | 97 | params->mesh_id_len, |
| 99 | params->mesh_id); | 98 | params->mesh_id); |
| 100 | 99 | ||
| 101 | if (sdata->vif.type != NL80211_IFTYPE_MONITOR || !flags) | ||
| 102 | return 0; | ||
| 103 | |||
| 104 | if (type == NL80211_IFTYPE_AP_VLAN && | 100 | if (type == NL80211_IFTYPE_AP_VLAN && |
| 105 | params && params->use_4addr == 0) | 101 | params && params->use_4addr == 0) |
| 106 | rcu_assign_pointer(sdata->u.vlan.sta, NULL); | 102 | rcu_assign_pointer(sdata->u.vlan.sta, NULL); |
| @@ -108,7 +104,9 @@ static int ieee80211_change_iface(struct wiphy *wiphy, | |||
| 108 | params && params->use_4addr >= 0) | 104 | params && params->use_4addr >= 0) |
| 109 | sdata->u.mgd.use_4addr = params->use_4addr; | 105 | sdata->u.mgd.use_4addr = params->use_4addr; |
| 110 | 106 | ||
| 111 | sdata->u.mntr_flags = *flags; | 107 | if (sdata->vif.type == NL80211_IFTYPE_MONITOR && flags) |
| 108 | sdata->u.mntr_flags = *flags; | ||
| 109 | |||
| 112 | return 0; | 110 | return 0; |
| 113 | } | 111 | } |
| 114 | 112 | ||
| @@ -122,6 +120,9 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, | |||
| 122 | struct ieee80211_key *key; | 120 | struct ieee80211_key *key; |
| 123 | int err; | 121 | int err; |
| 124 | 122 | ||
| 123 | if (!netif_running(dev)) | ||
| 124 | return -ENETDOWN; | ||
| 125 | |||
| 125 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 126 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 126 | 127 | ||
| 127 | switch (params->cipher) { | 128 | switch (params->cipher) { |
| @@ -142,17 +143,22 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, | |||
| 142 | return -EINVAL; | 143 | return -EINVAL; |
| 143 | } | 144 | } |
| 144 | 145 | ||
| 146 | /* reject WEP and TKIP keys if WEP failed to initialize */ | ||
| 147 | if ((alg == ALG_WEP || alg == ALG_TKIP) && | ||
| 148 | IS_ERR(sdata->local->wep_tx_tfm)) | ||
| 149 | return -EINVAL; | ||
| 150 | |||
| 145 | key = ieee80211_key_alloc(alg, key_idx, params->key_len, params->key, | 151 | key = ieee80211_key_alloc(alg, key_idx, params->key_len, params->key, |
| 146 | params->seq_len, params->seq); | 152 | params->seq_len, params->seq); |
| 147 | if (!key) | 153 | if (!key) |
| 148 | return -ENOMEM; | 154 | return -ENOMEM; |
| 149 | 155 | ||
| 150 | rcu_read_lock(); | 156 | mutex_lock(&sdata->local->sta_mtx); |
| 151 | 157 | ||
| 152 | if (mac_addr) { | 158 | if (mac_addr) { |
| 153 | sta = sta_info_get(sdata->local, mac_addr); | 159 | sta = sta_info_get_bss(sdata, mac_addr); |
| 154 | if (!sta) { | 160 | if (!sta) { |
| 155 | ieee80211_key_free(key); | 161 | ieee80211_key_free(sdata->local, key); |
| 156 | err = -ENOENT; | 162 | err = -ENOENT; |
| 157 | goto out_unlock; | 163 | goto out_unlock; |
| 158 | } | 164 | } |
| @@ -162,7 +168,7 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, | |||
| 162 | 168 | ||
| 163 | err = 0; | 169 | err = 0; |
| 164 | out_unlock: | 170 | out_unlock: |
| 165 | rcu_read_unlock(); | 171 | mutex_unlock(&sdata->local->sta_mtx); |
| 166 | 172 | ||
| 167 | return err; | 173 | return err; |
| 168 | } | 174 | } |
| @@ -176,17 +182,17 @@ static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev, | |||
| 176 | 182 | ||
| 177 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 183 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 178 | 184 | ||
| 179 | rcu_read_lock(); | 185 | mutex_lock(&sdata->local->sta_mtx); |
| 180 | 186 | ||
| 181 | if (mac_addr) { | 187 | if (mac_addr) { |
| 182 | ret = -ENOENT; | 188 | ret = -ENOENT; |
| 183 | 189 | ||
| 184 | sta = sta_info_get(sdata->local, mac_addr); | 190 | sta = sta_info_get_bss(sdata, mac_addr); |
| 185 | if (!sta) | 191 | if (!sta) |
| 186 | goto out_unlock; | 192 | goto out_unlock; |
| 187 | 193 | ||
| 188 | if (sta->key) { | 194 | if (sta->key) { |
| 189 | ieee80211_key_free(sta->key); | 195 | ieee80211_key_free(sdata->local, sta->key); |
| 190 | WARN_ON(sta->key); | 196 | WARN_ON(sta->key); |
| 191 | ret = 0; | 197 | ret = 0; |
| 192 | } | 198 | } |
| @@ -199,12 +205,12 @@ static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev, | |||
| 199 | goto out_unlock; | 205 | goto out_unlock; |
| 200 | } | 206 | } |
| 201 | 207 | ||
| 202 | ieee80211_key_free(sdata->keys[key_idx]); | 208 | ieee80211_key_free(sdata->local, sdata->keys[key_idx]); |
| 203 | WARN_ON(sdata->keys[key_idx]); | 209 | WARN_ON(sdata->keys[key_idx]); |
| 204 | 210 | ||
| 205 | ret = 0; | 211 | ret = 0; |
| 206 | out_unlock: | 212 | out_unlock: |
| 207 | rcu_read_unlock(); | 213 | mutex_unlock(&sdata->local->sta_mtx); |
| 208 | 214 | ||
| 209 | return ret; | 215 | return ret; |
| 210 | } | 216 | } |
| @@ -228,7 +234,7 @@ static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev, | |||
| 228 | rcu_read_lock(); | 234 | rcu_read_lock(); |
| 229 | 235 | ||
| 230 | if (mac_addr) { | 236 | if (mac_addr) { |
| 231 | sta = sta_info_get(sdata->local, mac_addr); | 237 | sta = sta_info_get_bss(sdata, mac_addr); |
| 232 | if (!sta) | 238 | if (!sta) |
| 233 | goto out; | 239 | goto out; |
| 234 | 240 | ||
| @@ -307,15 +313,10 @@ static int ieee80211_config_default_key(struct wiphy *wiphy, | |||
| 307 | struct net_device *dev, | 313 | struct net_device *dev, |
| 308 | u8 key_idx) | 314 | u8 key_idx) |
| 309 | { | 315 | { |
| 310 | struct ieee80211_sub_if_data *sdata; | 316 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 311 | |||
| 312 | rcu_read_lock(); | ||
| 313 | 317 | ||
| 314 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
| 315 | ieee80211_set_default_key(sdata, key_idx); | 318 | ieee80211_set_default_key(sdata, key_idx); |
| 316 | 319 | ||
| 317 | rcu_read_unlock(); | ||
| 318 | |||
| 319 | return 0; | 320 | return 0; |
| 320 | } | 321 | } |
| 321 | 322 | ||
| @@ -323,15 +324,10 @@ static int ieee80211_config_default_mgmt_key(struct wiphy *wiphy, | |||
| 323 | struct net_device *dev, | 324 | struct net_device *dev, |
| 324 | u8 key_idx) | 325 | u8 key_idx) |
| 325 | { | 326 | { |
| 326 | struct ieee80211_sub_if_data *sdata; | 327 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 327 | |||
| 328 | rcu_read_lock(); | ||
| 329 | 328 | ||
| 330 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
| 331 | ieee80211_set_default_mgmt_key(sdata, key_idx); | 329 | ieee80211_set_default_mgmt_key(sdata, key_idx); |
| 332 | 330 | ||
| 333 | rcu_read_unlock(); | ||
| 334 | |||
| 335 | return 0; | 331 | return 0; |
| 336 | } | 332 | } |
| 337 | 333 | ||
| @@ -412,18 +408,24 @@ static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev, | |||
| 412 | return ret; | 408 | return ret; |
| 413 | } | 409 | } |
| 414 | 410 | ||
| 411 | static int ieee80211_dump_survey(struct wiphy *wiphy, struct net_device *dev, | ||
| 412 | int idx, struct survey_info *survey) | ||
| 413 | { | ||
| 414 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
| 415 | |||
| 416 | return drv_get_survey(local, idx, survey); | ||
| 417 | } | ||
| 418 | |||
| 415 | static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev, | 419 | static int ieee80211_get_station(struct wiphy *wiphy, struct net_device *dev, |
| 416 | u8 *mac, struct station_info *sinfo) | 420 | u8 *mac, struct station_info *sinfo) |
| 417 | { | 421 | { |
| 418 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 422 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 419 | struct sta_info *sta; | 423 | struct sta_info *sta; |
| 420 | int ret = -ENOENT; | 424 | int ret = -ENOENT; |
| 421 | 425 | ||
| 422 | rcu_read_lock(); | 426 | rcu_read_lock(); |
| 423 | 427 | ||
| 424 | /* XXX: verify sta->dev == dev */ | 428 | sta = sta_info_get_bss(sdata, mac); |
| 425 | |||
| 426 | sta = sta_info_get(local, mac); | ||
| 427 | if (sta) { | 429 | if (sta) { |
| 428 | ret = 0; | 430 | ret = 0; |
| 429 | sta_set_sinfo(sta, sinfo); | 431 | sta_set_sinfo(sta, sinfo); |
| @@ -519,6 +521,8 @@ static int ieee80211_config_beacon(struct ieee80211_sub_if_data *sdata, | |||
| 519 | if (old) | 521 | if (old) |
| 520 | memcpy(new->tail, old->tail, new_tail_len); | 522 | memcpy(new->tail, old->tail, new_tail_len); |
| 521 | 523 | ||
| 524 | sdata->vif.bss_conf.dtim_period = new->dtim_period; | ||
| 525 | |||
| 522 | rcu_assign_pointer(sdata->u.ap.beacon, new); | 526 | rcu_assign_pointer(sdata->u.ap.beacon, new); |
| 523 | 527 | ||
| 524 | synchronize_rcu(); | 528 | synchronize_rcu(); |
| @@ -591,7 +595,7 @@ struct iapp_layer2_update { | |||
| 591 | u8 ssap; /* 0 */ | 595 | u8 ssap; /* 0 */ |
| 592 | u8 control; | 596 | u8 control; |
| 593 | u8 xid_info[3]; | 597 | u8 xid_info[3]; |
| 594 | } __attribute__ ((packed)); | 598 | } __packed; |
| 595 | 599 | ||
| 596 | static void ieee80211_send_layer2_update(struct sta_info *sta) | 600 | static void ieee80211_send_layer2_update(struct sta_info *sta) |
| 597 | { | 601 | { |
| @@ -623,7 +627,7 @@ static void ieee80211_send_layer2_update(struct sta_info *sta) | |||
| 623 | skb->dev = sta->sdata->dev; | 627 | skb->dev = sta->sdata->dev; |
| 624 | skb->protocol = eth_type_trans(skb, sta->sdata->dev); | 628 | skb->protocol = eth_type_trans(skb, sta->sdata->dev); |
| 625 | memset(skb->cb, 0, sizeof(skb->cb)); | 629 | memset(skb->cb, 0, sizeof(skb->cb)); |
| 626 | netif_rx(skb); | 630 | netif_rx_ni(skb); |
| 627 | } | 631 | } |
| 628 | 632 | ||
| 629 | static void sta_apply_parameters(struct ieee80211_local *local, | 633 | static void sta_apply_parameters(struct ieee80211_local *local, |
| @@ -732,7 +736,7 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, | |||
| 732 | } else | 736 | } else |
| 733 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 737 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 734 | 738 | ||
| 735 | if (compare_ether_addr(mac, dev->dev_addr) == 0) | 739 | if (compare_ether_addr(mac, sdata->vif.addr) == 0) |
| 736 | return -EINVAL; | 740 | return -EINVAL; |
| 737 | 741 | ||
| 738 | if (is_multicast_ether_addr(mac)) | 742 | if (is_multicast_ether_addr(mac)) |
| @@ -751,9 +755,7 @@ static int ieee80211_add_station(struct wiphy *wiphy, struct net_device *dev, | |||
| 751 | layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN || | 755 | layer2_update = sdata->vif.type == NL80211_IFTYPE_AP_VLAN || |
| 752 | sdata->vif.type == NL80211_IFTYPE_AP; | 756 | sdata->vif.type == NL80211_IFTYPE_AP; |
| 753 | 757 | ||
| 754 | rcu_read_lock(); | 758 | err = sta_info_insert_rcu(sta); |
| 755 | |||
| 756 | err = sta_info_insert(sta); | ||
| 757 | if (err) { | 759 | if (err) { |
| 758 | rcu_read_unlock(); | 760 | rcu_read_unlock(); |
| 759 | return err; | 761 | return err; |
| @@ -772,27 +774,13 @@ static int ieee80211_del_station(struct wiphy *wiphy, struct net_device *dev, | |||
| 772 | { | 774 | { |
| 773 | struct ieee80211_local *local = wiphy_priv(wiphy); | 775 | struct ieee80211_local *local = wiphy_priv(wiphy); |
| 774 | struct ieee80211_sub_if_data *sdata; | 776 | struct ieee80211_sub_if_data *sdata; |
| 775 | struct sta_info *sta; | ||
| 776 | 777 | ||
| 777 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 778 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 778 | 779 | ||
| 779 | if (mac) { | 780 | if (mac) |
| 780 | rcu_read_lock(); | 781 | return sta_info_destroy_addr_bss(sdata, mac); |
| 781 | |||
| 782 | /* XXX: get sta belonging to dev */ | ||
| 783 | sta = sta_info_get(local, mac); | ||
| 784 | if (!sta) { | ||
| 785 | rcu_read_unlock(); | ||
| 786 | return -ENOENT; | ||
| 787 | } | ||
| 788 | |||
| 789 | sta_info_unlink(&sta); | ||
| 790 | rcu_read_unlock(); | ||
| 791 | |||
| 792 | sta_info_destroy(sta); | ||
| 793 | } else | ||
| 794 | sta_info_flush(local, sdata); | ||
| 795 | 782 | ||
| 783 | sta_info_flush(local, sdata); | ||
| 796 | return 0; | 784 | return 0; |
| 797 | } | 785 | } |
| 798 | 786 | ||
| @@ -801,14 +789,14 @@ static int ieee80211_change_station(struct wiphy *wiphy, | |||
| 801 | u8 *mac, | 789 | u8 *mac, |
| 802 | struct station_parameters *params) | 790 | struct station_parameters *params) |
| 803 | { | 791 | { |
| 792 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
| 804 | struct ieee80211_local *local = wiphy_priv(wiphy); | 793 | struct ieee80211_local *local = wiphy_priv(wiphy); |
| 805 | struct sta_info *sta; | 794 | struct sta_info *sta; |
| 806 | struct ieee80211_sub_if_data *vlansdata; | 795 | struct ieee80211_sub_if_data *vlansdata; |
| 807 | 796 | ||
| 808 | rcu_read_lock(); | 797 | rcu_read_lock(); |
| 809 | 798 | ||
| 810 | /* XXX: get sta belonging to dev */ | 799 | sta = sta_info_get_bss(sdata, mac); |
| 811 | sta = sta_info_get(local, mac); | ||
| 812 | if (!sta) { | 800 | if (!sta) { |
| 813 | rcu_read_unlock(); | 801 | rcu_read_unlock(); |
| 814 | return -ENOENT; | 802 | return -ENOENT; |
| @@ -847,7 +835,6 @@ static int ieee80211_change_station(struct wiphy *wiphy, | |||
| 847 | static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev, | 835 | static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev, |
| 848 | u8 *dst, u8 *next_hop) | 836 | u8 *dst, u8 *next_hop) |
| 849 | { | 837 | { |
| 850 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
| 851 | struct ieee80211_sub_if_data *sdata; | 838 | struct ieee80211_sub_if_data *sdata; |
| 852 | struct mesh_path *mpath; | 839 | struct mesh_path *mpath; |
| 853 | struct sta_info *sta; | 840 | struct sta_info *sta; |
| @@ -856,7 +843,7 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev, | |||
| 856 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 843 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 857 | 844 | ||
| 858 | rcu_read_lock(); | 845 | rcu_read_lock(); |
| 859 | sta = sta_info_get(local, next_hop); | 846 | sta = sta_info_get(sdata, next_hop); |
| 860 | if (!sta) { | 847 | if (!sta) { |
| 861 | rcu_read_unlock(); | 848 | rcu_read_unlock(); |
| 862 | return -ENOENT; | 849 | return -ENOENT; |
| @@ -895,7 +882,6 @@ static int ieee80211_change_mpath(struct wiphy *wiphy, | |||
| 895 | struct net_device *dev, | 882 | struct net_device *dev, |
| 896 | u8 *dst, u8 *next_hop) | 883 | u8 *dst, u8 *next_hop) |
| 897 | { | 884 | { |
| 898 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
| 899 | struct ieee80211_sub_if_data *sdata; | 885 | struct ieee80211_sub_if_data *sdata; |
| 900 | struct mesh_path *mpath; | 886 | struct mesh_path *mpath; |
| 901 | struct sta_info *sta; | 887 | struct sta_info *sta; |
| @@ -904,7 +890,7 @@ static int ieee80211_change_mpath(struct wiphy *wiphy, | |||
| 904 | 890 | ||
| 905 | rcu_read_lock(); | 891 | rcu_read_lock(); |
| 906 | 892 | ||
| 907 | sta = sta_info_get(local, next_hop); | 893 | sta = sta_info_get(sdata, next_hop); |
| 908 | if (!sta) { | 894 | if (!sta) { |
| 909 | rcu_read_unlock(); | 895 | rcu_read_unlock(); |
| 910 | return -ENOENT; | 896 | return -ENOENT; |
| @@ -1092,6 +1078,13 @@ static int ieee80211_change_bss(struct wiphy *wiphy, | |||
| 1092 | params->use_short_preamble; | 1078 | params->use_short_preamble; |
| 1093 | changed |= BSS_CHANGED_ERP_PREAMBLE; | 1079 | changed |= BSS_CHANGED_ERP_PREAMBLE; |
| 1094 | } | 1080 | } |
| 1081 | |||
| 1082 | if (!sdata->vif.bss_conf.use_short_slot && | ||
| 1083 | sdata->local->hw.conf.channel->band == IEEE80211_BAND_5GHZ) { | ||
| 1084 | sdata->vif.bss_conf.use_short_slot = true; | ||
| 1085 | changed |= BSS_CHANGED_ERP_SLOT; | ||
| 1086 | } | ||
| 1087 | |||
| 1095 | if (params->use_short_slot_time >= 0) { | 1088 | if (params->use_short_slot_time >= 0) { |
| 1096 | sdata->vif.bss_conf.use_short_slot = | 1089 | sdata->vif.bss_conf.use_short_slot = |
| 1097 | params->use_short_slot_time; | 1090 | params->use_short_slot_time; |
| @@ -1116,6 +1109,13 @@ static int ieee80211_change_bss(struct wiphy *wiphy, | |||
| 1116 | changed |= BSS_CHANGED_BASIC_RATES; | 1109 | changed |= BSS_CHANGED_BASIC_RATES; |
| 1117 | } | 1110 | } |
| 1118 | 1111 | ||
| 1112 | if (params->ap_isolate >= 0) { | ||
| 1113 | if (params->ap_isolate) | ||
| 1114 | sdata->flags |= IEEE80211_SDATA_DONT_BRIDGE_PACKETS; | ||
| 1115 | else | ||
| 1116 | sdata->flags &= ~IEEE80211_SDATA_DONT_BRIDGE_PACKETS; | ||
| 1117 | } | ||
| 1118 | |||
| 1119 | ieee80211_bss_info_change_notify(sdata, changed); | 1119 | ieee80211_bss_info_change_notify(sdata, changed); |
| 1120 | 1120 | ||
| 1121 | return 0; | 1121 | return 0; |
| @@ -1135,6 +1135,13 @@ static int ieee80211_set_txq_params(struct wiphy *wiphy, | |||
| 1135 | p.cw_max = params->cwmax; | 1135 | p.cw_max = params->cwmax; |
| 1136 | p.cw_min = params->cwmin; | 1136 | p.cw_min = params->cwmin; |
| 1137 | p.txop = params->txop; | 1137 | p.txop = params->txop; |
| 1138 | |||
| 1139 | /* | ||
| 1140 | * Setting tx queue params disables u-apsd because it's only | ||
| 1141 | * called in master mode. | ||
| 1142 | */ | ||
| 1143 | p.uapsd = false; | ||
| 1144 | |||
| 1138 | if (drv_conf_tx(local, params->queue, &p)) { | 1145 | if (drv_conf_tx(local, params->queue, &p)) { |
| 1139 | printk(KERN_DEBUG "%s: failed to set TX queue " | 1146 | printk(KERN_DEBUG "%s: failed to set TX queue " |
| 1140 | "parameters for queue %d\n", | 1147 | "parameters for queue %d\n", |
| @@ -1146,15 +1153,39 @@ static int ieee80211_set_txq_params(struct wiphy *wiphy, | |||
| 1146 | } | 1153 | } |
| 1147 | 1154 | ||
| 1148 | static int ieee80211_set_channel(struct wiphy *wiphy, | 1155 | static int ieee80211_set_channel(struct wiphy *wiphy, |
| 1156 | struct net_device *netdev, | ||
| 1149 | struct ieee80211_channel *chan, | 1157 | struct ieee80211_channel *chan, |
| 1150 | enum nl80211_channel_type channel_type) | 1158 | enum nl80211_channel_type channel_type) |
| 1151 | { | 1159 | { |
| 1152 | struct ieee80211_local *local = wiphy_priv(wiphy); | 1160 | struct ieee80211_local *local = wiphy_priv(wiphy); |
| 1161 | struct ieee80211_sub_if_data *sdata = NULL; | ||
| 1162 | |||
| 1163 | if (netdev) | ||
| 1164 | sdata = IEEE80211_DEV_TO_SUB_IF(netdev); | ||
| 1165 | |||
| 1166 | switch (ieee80211_get_channel_mode(local, NULL)) { | ||
| 1167 | case CHAN_MODE_HOPPING: | ||
| 1168 | return -EBUSY; | ||
| 1169 | case CHAN_MODE_FIXED: | ||
| 1170 | if (local->oper_channel != chan) | ||
| 1171 | return -EBUSY; | ||
| 1172 | if (!sdata && local->_oper_channel_type == channel_type) | ||
| 1173 | return 0; | ||
| 1174 | break; | ||
| 1175 | case CHAN_MODE_UNDEFINED: | ||
| 1176 | break; | ||
| 1177 | } | ||
| 1153 | 1178 | ||
| 1154 | local->oper_channel = chan; | 1179 | local->oper_channel = chan; |
| 1155 | local->oper_channel_type = channel_type; | ||
| 1156 | 1180 | ||
| 1157 | return ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); | 1181 | if (!ieee80211_set_channel_type(local, sdata, channel_type)) |
| 1182 | return -EBUSY; | ||
| 1183 | |||
| 1184 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_CHANNEL); | ||
| 1185 | if (sdata && sdata->vif.type != NL80211_IFTYPE_MONITOR) | ||
| 1186 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_HT); | ||
| 1187 | |||
| 1188 | return 0; | ||
| 1158 | } | 1189 | } |
| 1159 | 1190 | ||
| 1160 | #ifdef CONFIG_PM | 1191 | #ifdef CONFIG_PM |
| @@ -1198,6 +1229,20 @@ static int ieee80211_auth(struct wiphy *wiphy, struct net_device *dev, | |||
| 1198 | static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev, | 1229 | static int ieee80211_assoc(struct wiphy *wiphy, struct net_device *dev, |
| 1199 | struct cfg80211_assoc_request *req) | 1230 | struct cfg80211_assoc_request *req) |
| 1200 | { | 1231 | { |
| 1232 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
| 1233 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
| 1234 | |||
| 1235 | switch (ieee80211_get_channel_mode(local, sdata)) { | ||
| 1236 | case CHAN_MODE_HOPPING: | ||
| 1237 | return -EBUSY; | ||
| 1238 | case CHAN_MODE_FIXED: | ||
| 1239 | if (local->oper_channel == req->bss->channel) | ||
| 1240 | break; | ||
| 1241 | return -EBUSY; | ||
| 1242 | case CHAN_MODE_UNDEFINED: | ||
| 1243 | break; | ||
| 1244 | } | ||
| 1245 | |||
| 1201 | return ieee80211_mgd_assoc(IEEE80211_DEV_TO_SUB_IF(dev), req); | 1246 | return ieee80211_mgd_assoc(IEEE80211_DEV_TO_SUB_IF(dev), req); |
| 1202 | } | 1247 | } |
| 1203 | 1248 | ||
| @@ -1220,8 +1265,22 @@ static int ieee80211_disassoc(struct wiphy *wiphy, struct net_device *dev, | |||
| 1220 | static int ieee80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, | 1265 | static int ieee80211_join_ibss(struct wiphy *wiphy, struct net_device *dev, |
| 1221 | struct cfg80211_ibss_params *params) | 1266 | struct cfg80211_ibss_params *params) |
| 1222 | { | 1267 | { |
| 1268 | struct ieee80211_local *local = wiphy_priv(wiphy); | ||
| 1223 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 1269 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 1224 | 1270 | ||
| 1271 | switch (ieee80211_get_channel_mode(local, sdata)) { | ||
| 1272 | case CHAN_MODE_HOPPING: | ||
| 1273 | return -EBUSY; | ||
| 1274 | case CHAN_MODE_FIXED: | ||
| 1275 | if (!params->channel_fixed) | ||
| 1276 | return -EBUSY; | ||
| 1277 | if (local->oper_channel == params->channel) | ||
| 1278 | break; | ||
| 1279 | return -EBUSY; | ||
| 1280 | case CHAN_MODE_UNDEFINED: | ||
| 1281 | break; | ||
| 1282 | } | ||
| 1283 | |||
| 1225 | return ieee80211_ibss_join(sdata, params); | 1284 | return ieee80211_ibss_join(sdata, params); |
| 1226 | } | 1285 | } |
| 1227 | 1286 | ||
| @@ -1237,6 +1296,13 @@ static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) | |||
| 1237 | struct ieee80211_local *local = wiphy_priv(wiphy); | 1296 | struct ieee80211_local *local = wiphy_priv(wiphy); |
| 1238 | int err; | 1297 | int err; |
| 1239 | 1298 | ||
| 1299 | if (changed & WIPHY_PARAM_COVERAGE_CLASS) { | ||
| 1300 | err = drv_set_coverage_class(local, wiphy->coverage_class); | ||
| 1301 | |||
| 1302 | if (err) | ||
| 1303 | return err; | ||
| 1304 | } | ||
| 1305 | |||
| 1240 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) { | 1306 | if (changed & WIPHY_PARAM_RTS_THRESHOLD) { |
| 1241 | err = drv_set_rts_threshold(local, wiphy->rts_threshold); | 1307 | err = drv_set_rts_threshold(local, wiphy->rts_threshold); |
| 1242 | 1308 | ||
| @@ -1256,28 +1322,28 @@ static int ieee80211_set_wiphy_params(struct wiphy *wiphy, u32 changed) | |||
| 1256 | } | 1322 | } |
| 1257 | 1323 | ||
| 1258 | static int ieee80211_set_tx_power(struct wiphy *wiphy, | 1324 | static int ieee80211_set_tx_power(struct wiphy *wiphy, |
| 1259 | enum tx_power_setting type, int dbm) | 1325 | enum nl80211_tx_power_setting type, int mbm) |
| 1260 | { | 1326 | { |
| 1261 | struct ieee80211_local *local = wiphy_priv(wiphy); | 1327 | struct ieee80211_local *local = wiphy_priv(wiphy); |
| 1262 | struct ieee80211_channel *chan = local->hw.conf.channel; | 1328 | struct ieee80211_channel *chan = local->hw.conf.channel; |
| 1263 | u32 changes = 0; | 1329 | u32 changes = 0; |
| 1264 | 1330 | ||
| 1265 | switch (type) { | 1331 | switch (type) { |
| 1266 | case TX_POWER_AUTOMATIC: | 1332 | case NL80211_TX_POWER_AUTOMATIC: |
| 1267 | local->user_power_level = -1; | 1333 | local->user_power_level = -1; |
| 1268 | break; | 1334 | break; |
| 1269 | case TX_POWER_LIMITED: | 1335 | case NL80211_TX_POWER_LIMITED: |
| 1270 | if (dbm < 0) | 1336 | if (mbm < 0 || (mbm % 100)) |
| 1271 | return -EINVAL; | 1337 | return -EOPNOTSUPP; |
| 1272 | local->user_power_level = dbm; | 1338 | local->user_power_level = MBM_TO_DBM(mbm); |
| 1273 | break; | 1339 | break; |
| 1274 | case TX_POWER_FIXED: | 1340 | case NL80211_TX_POWER_FIXED: |
| 1275 | if (dbm < 0) | 1341 | if (mbm < 0 || (mbm % 100)) |
| 1276 | return -EINVAL; | 1342 | return -EOPNOTSUPP; |
| 1277 | /* TODO: move to cfg80211 when it knows the channel */ | 1343 | /* TODO: move to cfg80211 when it knows the channel */ |
| 1278 | if (dbm > chan->max_power) | 1344 | if (MBM_TO_DBM(mbm) > chan->max_power) |
| 1279 | return -EINVAL; | 1345 | return -EINVAL; |
| 1280 | local->user_power_level = dbm; | 1346 | local->user_power_level = MBM_TO_DBM(mbm); |
| 1281 | break; | 1347 | break; |
| 1282 | } | 1348 | } |
| 1283 | 1349 | ||
| @@ -1324,12 +1390,55 @@ static int ieee80211_testmode_cmd(struct wiphy *wiphy, void *data, int len) | |||
| 1324 | } | 1390 | } |
| 1325 | #endif | 1391 | #endif |
| 1326 | 1392 | ||
| 1393 | int __ieee80211_request_smps(struct ieee80211_sub_if_data *sdata, | ||
| 1394 | enum ieee80211_smps_mode smps_mode) | ||
| 1395 | { | ||
| 1396 | const u8 *ap; | ||
| 1397 | enum ieee80211_smps_mode old_req; | ||
| 1398 | int err; | ||
| 1399 | |||
| 1400 | old_req = sdata->u.mgd.req_smps; | ||
| 1401 | sdata->u.mgd.req_smps = smps_mode; | ||
| 1402 | |||
| 1403 | if (old_req == smps_mode && | ||
| 1404 | smps_mode != IEEE80211_SMPS_AUTOMATIC) | ||
| 1405 | return 0; | ||
| 1406 | |||
| 1407 | /* | ||
| 1408 | * If not associated, or current association is not an HT | ||
| 1409 | * association, there's no need to send an action frame. | ||
| 1410 | */ | ||
| 1411 | if (!sdata->u.mgd.associated || | ||
| 1412 | sdata->vif.bss_conf.channel_type == NL80211_CHAN_NO_HT) { | ||
| 1413 | mutex_lock(&sdata->local->iflist_mtx); | ||
| 1414 | ieee80211_recalc_smps(sdata->local, sdata); | ||
| 1415 | mutex_unlock(&sdata->local->iflist_mtx); | ||
| 1416 | return 0; | ||
| 1417 | } | ||
| 1418 | |||
| 1419 | ap = sdata->u.mgd.associated->bssid; | ||
| 1420 | |||
| 1421 | if (smps_mode == IEEE80211_SMPS_AUTOMATIC) { | ||
| 1422 | if (sdata->u.mgd.powersave) | ||
| 1423 | smps_mode = IEEE80211_SMPS_DYNAMIC; | ||
| 1424 | else | ||
| 1425 | smps_mode = IEEE80211_SMPS_OFF; | ||
| 1426 | } | ||
| 1427 | |||
| 1428 | /* send SM PS frame to AP */ | ||
| 1429 | err = ieee80211_send_smps_action(sdata, smps_mode, | ||
| 1430 | ap, ap); | ||
| 1431 | if (err) | ||
| 1432 | sdata->u.mgd.req_smps = old_req; | ||
| 1433 | |||
| 1434 | return err; | ||
| 1435 | } | ||
| 1436 | |||
| 1327 | static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | 1437 | static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, |
| 1328 | bool enabled, int timeout) | 1438 | bool enabled, int timeout) |
| 1329 | { | 1439 | { |
| 1330 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 1440 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 1331 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1441 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 1332 | struct ieee80211_conf *conf = &local->hw.conf; | ||
| 1333 | 1442 | ||
| 1334 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | 1443 | if (sdata->vif.type != NL80211_IFTYPE_STATION) |
| 1335 | return -EOPNOTSUPP; | 1444 | return -EOPNOTSUPP; |
| @@ -1338,11 +1447,16 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | |||
| 1338 | return -EOPNOTSUPP; | 1447 | return -EOPNOTSUPP; |
| 1339 | 1448 | ||
| 1340 | if (enabled == sdata->u.mgd.powersave && | 1449 | if (enabled == sdata->u.mgd.powersave && |
| 1341 | timeout == conf->dynamic_ps_timeout) | 1450 | timeout == local->dynamic_ps_forced_timeout) |
| 1342 | return 0; | 1451 | return 0; |
| 1343 | 1452 | ||
| 1344 | sdata->u.mgd.powersave = enabled; | 1453 | sdata->u.mgd.powersave = enabled; |
| 1345 | conf->dynamic_ps_timeout = timeout; | 1454 | local->dynamic_ps_forced_timeout = timeout; |
| 1455 | |||
| 1456 | /* no change, but if automatic follow powersave */ | ||
| 1457 | mutex_lock(&sdata->u.mgd.mtx); | ||
| 1458 | __ieee80211_request_smps(sdata, sdata->u.mgd.req_smps); | ||
| 1459 | mutex_unlock(&sdata->u.mgd.mtx); | ||
| 1346 | 1460 | ||
| 1347 | if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) | 1461 | if (local->hw.flags & IEEE80211_HW_SUPPORTS_DYNAMIC_PS) |
| 1348 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); | 1462 | ieee80211_hw_config(local, IEEE80211_CONF_CHANGE_PS); |
| @@ -1352,6 +1466,35 @@ static int ieee80211_set_power_mgmt(struct wiphy *wiphy, struct net_device *dev, | |||
| 1352 | return 0; | 1466 | return 0; |
| 1353 | } | 1467 | } |
| 1354 | 1468 | ||
| 1469 | static int ieee80211_set_cqm_rssi_config(struct wiphy *wiphy, | ||
| 1470 | struct net_device *dev, | ||
| 1471 | s32 rssi_thold, u32 rssi_hyst) | ||
| 1472 | { | ||
| 1473 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
| 1474 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | ||
| 1475 | struct ieee80211_vif *vif = &sdata->vif; | ||
| 1476 | struct ieee80211_bss_conf *bss_conf = &vif->bss_conf; | ||
| 1477 | |||
| 1478 | if (rssi_thold == bss_conf->cqm_rssi_thold && | ||
| 1479 | rssi_hyst == bss_conf->cqm_rssi_hyst) | ||
| 1480 | return 0; | ||
| 1481 | |||
| 1482 | bss_conf->cqm_rssi_thold = rssi_thold; | ||
| 1483 | bss_conf->cqm_rssi_hyst = rssi_hyst; | ||
| 1484 | |||
| 1485 | if (!(local->hw.flags & IEEE80211_HW_SUPPORTS_CQM_RSSI)) { | ||
| 1486 | if (sdata->vif.type != NL80211_IFTYPE_STATION) | ||
| 1487 | return -EOPNOTSUPP; | ||
| 1488 | return 0; | ||
| 1489 | } | ||
| 1490 | |||
| 1491 | /* tell the driver upon association, unless already associated */ | ||
| 1492 | if (sdata->u.mgd.associated) | ||
| 1493 | ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_CQM); | ||
| 1494 | |||
| 1495 | return 0; | ||
| 1496 | } | ||
| 1497 | |||
| 1355 | static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, | 1498 | static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, |
| 1356 | struct net_device *dev, | 1499 | struct net_device *dev, |
| 1357 | const u8 *addr, | 1500 | const u8 *addr, |
| @@ -1359,39 +1502,100 @@ static int ieee80211_set_bitrate_mask(struct wiphy *wiphy, | |||
| 1359 | { | 1502 | { |
| 1360 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 1503 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 1361 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1504 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 1362 | int i, err = -EINVAL; | 1505 | int i; |
| 1363 | u32 target_rate; | ||
| 1364 | struct ieee80211_supported_band *sband; | ||
| 1365 | 1506 | ||
| 1366 | sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; | 1507 | /* |
| 1508 | * This _could_ be supported by providing a hook for | ||
| 1509 | * drivers for this function, but at this point it | ||
| 1510 | * doesn't seem worth bothering. | ||
| 1511 | */ | ||
| 1512 | if (local->hw.flags & IEEE80211_HW_HAS_RATE_CONTROL) | ||
| 1513 | return -EOPNOTSUPP; | ||
| 1367 | 1514 | ||
| 1368 | /* target_rate = -1, rate->fixed = 0 means auto only, so use all rates | ||
| 1369 | * target_rate = X, rate->fixed = 1 means only rate X | ||
| 1370 | * target_rate = X, rate->fixed = 0 means all rates <= X */ | ||
| 1371 | sdata->max_ratectrl_rateidx = -1; | ||
| 1372 | sdata->force_unicast_rateidx = -1; | ||
| 1373 | 1515 | ||
| 1374 | if (mask->fixed) | 1516 | for (i = 0; i < IEEE80211_NUM_BANDS; i++) |
| 1375 | target_rate = mask->fixed / 100; | 1517 | sdata->rc_rateidx_mask[i] = mask->control[i].legacy; |
| 1376 | else if (mask->maxrate) | 1518 | |
| 1377 | target_rate = mask->maxrate / 100; | 1519 | return 0; |
| 1378 | else | 1520 | } |
| 1379 | return 0; | 1521 | |
| 1522 | static int ieee80211_remain_on_channel(struct wiphy *wiphy, | ||
| 1523 | struct net_device *dev, | ||
| 1524 | struct ieee80211_channel *chan, | ||
| 1525 | enum nl80211_channel_type channel_type, | ||
| 1526 | unsigned int duration, | ||
| 1527 | u64 *cookie) | ||
| 1528 | { | ||
| 1529 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
| 1380 | 1530 | ||
| 1381 | for (i=0; i< sband->n_bitrates; i++) { | 1531 | return ieee80211_wk_remain_on_channel(sdata, chan, channel_type, |
| 1382 | struct ieee80211_rate *brate = &sband->bitrates[i]; | 1532 | duration, cookie); |
| 1383 | int this_rate = brate->bitrate; | 1533 | } |
| 1534 | |||
| 1535 | static int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy, | ||
| 1536 | struct net_device *dev, | ||
| 1537 | u64 cookie) | ||
| 1538 | { | ||
| 1539 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
| 1540 | |||
| 1541 | return ieee80211_wk_cancel_remain_on_channel(sdata, cookie); | ||
| 1542 | } | ||
| 1543 | |||
| 1544 | static int ieee80211_action(struct wiphy *wiphy, struct net_device *dev, | ||
| 1545 | struct ieee80211_channel *chan, | ||
| 1546 | enum nl80211_channel_type channel_type, | ||
| 1547 | bool channel_type_valid, | ||
| 1548 | const u8 *buf, size_t len, u64 *cookie) | ||
| 1549 | { | ||
| 1550 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | ||
| 1551 | struct ieee80211_local *local = sdata->local; | ||
| 1552 | struct sk_buff *skb; | ||
| 1553 | struct sta_info *sta; | ||
| 1554 | const struct ieee80211_mgmt *mgmt = (void *)buf; | ||
| 1555 | u32 flags = IEEE80211_TX_INTFL_NL80211_FRAME_TX | | ||
| 1556 | IEEE80211_TX_CTL_REQ_TX_STATUS; | ||
| 1384 | 1557 | ||
| 1385 | if (target_rate == this_rate) { | 1558 | /* Check that we are on the requested channel for transmission */ |
| 1386 | sdata->max_ratectrl_rateidx = i; | 1559 | if (chan != local->tmp_channel && |
| 1387 | if (mask->fixed) | 1560 | chan != local->oper_channel) |
| 1388 | sdata->force_unicast_rateidx = i; | 1561 | return -EBUSY; |
| 1389 | err = 0; | 1562 | if (channel_type_valid && |
| 1563 | (channel_type != local->tmp_channel_type && | ||
| 1564 | channel_type != local->_oper_channel_type)) | ||
| 1565 | return -EBUSY; | ||
| 1566 | |||
| 1567 | switch (sdata->vif.type) { | ||
| 1568 | case NL80211_IFTYPE_ADHOC: | ||
| 1569 | if (mgmt->u.action.category == WLAN_CATEGORY_PUBLIC) | ||
| 1390 | break; | 1570 | break; |
| 1391 | } | 1571 | rcu_read_lock(); |
| 1572 | sta = sta_info_get(sdata, mgmt->da); | ||
| 1573 | rcu_read_unlock(); | ||
| 1574 | if (!sta) | ||
| 1575 | return -ENOLINK; | ||
| 1576 | break; | ||
| 1577 | case NL80211_IFTYPE_STATION: | ||
| 1578 | if (!(sdata->u.mgd.flags & IEEE80211_STA_MFP_ENABLED)) | ||
| 1579 | flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; | ||
| 1580 | break; | ||
| 1581 | default: | ||
| 1582 | return -EOPNOTSUPP; | ||
| 1392 | } | 1583 | } |
| 1393 | 1584 | ||
| 1394 | return err; | 1585 | skb = dev_alloc_skb(local->hw.extra_tx_headroom + len); |
| 1586 | if (!skb) | ||
| 1587 | return -ENOMEM; | ||
| 1588 | skb_reserve(skb, local->hw.extra_tx_headroom); | ||
| 1589 | |||
| 1590 | memcpy(skb_put(skb, len), buf, len); | ||
| 1591 | |||
| 1592 | IEEE80211_SKB_CB(skb)->flags = flags; | ||
| 1593 | |||
| 1594 | skb->dev = sdata->dev; | ||
| 1595 | ieee80211_tx_skb(sdata, skb); | ||
| 1596 | |||
| 1597 | *cookie = (unsigned long) skb; | ||
| 1598 | return 0; | ||
| 1395 | } | 1599 | } |
| 1396 | 1600 | ||
| 1397 | struct cfg80211_ops mac80211_config_ops = { | 1601 | struct cfg80211_ops mac80211_config_ops = { |
| @@ -1411,6 +1615,7 @@ struct cfg80211_ops mac80211_config_ops = { | |||
| 1411 | .change_station = ieee80211_change_station, | 1615 | .change_station = ieee80211_change_station, |
| 1412 | .get_station = ieee80211_get_station, | 1616 | .get_station = ieee80211_get_station, |
| 1413 | .dump_station = ieee80211_dump_station, | 1617 | .dump_station = ieee80211_dump_station, |
| 1618 | .dump_survey = ieee80211_dump_survey, | ||
| 1414 | #ifdef CONFIG_MAC80211_MESH | 1619 | #ifdef CONFIG_MAC80211_MESH |
| 1415 | .add_mpath = ieee80211_add_mpath, | 1620 | .add_mpath = ieee80211_add_mpath, |
| 1416 | .del_mpath = ieee80211_del_mpath, | 1621 | .del_mpath = ieee80211_del_mpath, |
| @@ -1440,4 +1645,8 @@ struct cfg80211_ops mac80211_config_ops = { | |||
| 1440 | CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd) | 1645 | CFG80211_TESTMODE_CMD(ieee80211_testmode_cmd) |
| 1441 | .set_power_mgmt = ieee80211_set_power_mgmt, | 1646 | .set_power_mgmt = ieee80211_set_power_mgmt, |
| 1442 | .set_bitrate_mask = ieee80211_set_bitrate_mask, | 1647 | .set_bitrate_mask = ieee80211_set_bitrate_mask, |
| 1648 | .remain_on_channel = ieee80211_remain_on_channel, | ||
| 1649 | .cancel_remain_on_channel = ieee80211_cancel_remain_on_channel, | ||
| 1650 | .action = ieee80211_action, | ||
| 1651 | .set_cqm_rssi_config = ieee80211_set_cqm_rssi_config, | ||
| 1443 | }; | 1652 | }; |
