aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/mlme.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2013-11-04 14:45:14 -0500
committerJohn W. Linville <linville@tuxdriver.com>2013-11-04 14:45:14 -0500
commit01925efdf7e03b4b803b5c9f985163d687f7f017 (patch)
tree6c318f9bf002efac5ccd87e8edad35863d72bd17 /net/mac80211/mlme.c
parenta1b13b9ad3759dca24c6b721ee026c540a4e6564 (diff)
parent8ce9beac4661f576ea0d518b9f086bb52a171a37 (diff)
Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
Conflicts: drivers/net/wireless/iwlwifi/pcie/drv.c
Diffstat (limited to 'net/mac80211/mlme.c')
-rw-r--r--net/mac80211/mlme.c95
1 files changed, 86 insertions, 9 deletions
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 91cc8281e266..d7bdc4b97dde 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -2527,7 +2527,7 @@ static bool ieee80211_assoc_success(struct ieee80211_sub_if_data *sdata,
2527 */ 2527 */
2528 ifmgd->wmm_last_param_set = -1; 2528 ifmgd->wmm_last_param_set = -1;
2529 2529
2530 if (elems.wmm_param) 2530 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_WMM) && elems.wmm_param)
2531 ieee80211_sta_wmm_params(local, sdata, elems.wmm_param, 2531 ieee80211_sta_wmm_params(local, sdata, elems.wmm_param,
2532 elems.wmm_param_len); 2532 elems.wmm_param_len);
2533 else 2533 else
@@ -2955,7 +2955,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
2955 ieee80211_sta_process_chanswitch(sdata, rx_status->mactime, 2955 ieee80211_sta_process_chanswitch(sdata, rx_status->mactime,
2956 &elems, true); 2956 &elems, true);
2957 2957
2958 if (ieee80211_sta_wmm_params(local, sdata, elems.wmm_param, 2958 if (!(ifmgd->flags & IEEE80211_STA_DISABLE_WMM) &&
2959 ieee80211_sta_wmm_params(local, sdata, elems.wmm_param,
2959 elems.wmm_param_len)) 2960 elems.wmm_param_len))
2960 changed |= BSS_CHANGED_QOS; 2961 changed |= BSS_CHANGED_QOS;
2961 2962
@@ -3937,6 +3938,44 @@ int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
3937 return err; 3938 return err;
3938} 3939}
3939 3940
3941static bool ieee80211_usable_wmm_params(struct ieee80211_sub_if_data *sdata,
3942 const u8 *wmm_param, int len)
3943{
3944 const u8 *pos;
3945 size_t left;
3946
3947 if (len < 8)
3948 return false;
3949
3950 if (wmm_param[5] != 1 /* version */)
3951 return false;
3952
3953 pos = wmm_param + 8;
3954 left = len - 8;
3955
3956 for (; left >= 4; left -= 4, pos += 4) {
3957 u8 aifsn = pos[0] & 0x0f;
3958 u8 ecwmin = pos[1] & 0x0f;
3959 u8 ecwmax = (pos[1] & 0xf0) >> 4;
3960 int aci = (pos[0] >> 5) & 0x03;
3961
3962 if (aifsn < 2) {
3963 sdata_info(sdata,
3964 "AP has invalid WMM params (AIFSN=%d for ACI %d), disabling WMM\n",
3965 aifsn, aci);
3966 return false;
3967 }
3968 if (ecwmin > ecwmax) {
3969 sdata_info(sdata,
3970 "AP has invalid WMM params (ECWmin/max=%d/%d for ACI %d), disabling WMM\n",
3971 ecwmin, ecwmax, aci);
3972 return false;
3973 }
3974 }
3975
3976 return true;
3977}
3978
3940int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata, 3979int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
3941 struct cfg80211_assoc_request *req) 3980 struct cfg80211_assoc_request *req)
3942{ 3981{
@@ -3994,9 +4033,45 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
3994 } 4033 }
3995 4034
3996 /* prepare assoc data */ 4035 /* prepare assoc data */
3997 4036
3998 ifmgd->beacon_crc_valid = false; 4037 ifmgd->beacon_crc_valid = false;
3999 4038
4039 assoc_data->wmm = bss->wmm_used &&
4040 (local->hw.queues >= IEEE80211_NUM_ACS);
4041 if (assoc_data->wmm) {
4042 /* try to check validity of WMM params IE */
4043 const struct cfg80211_bss_ies *ies;
4044 const u8 *wp, *start, *end;
4045
4046 rcu_read_lock();
4047 ies = rcu_dereference(req->bss->ies);
4048 start = ies->data;
4049 end = start + ies->len;
4050
4051 while (true) {
4052 wp = cfg80211_find_vendor_ie(
4053 WLAN_OUI_MICROSOFT,
4054 WLAN_OUI_TYPE_MICROSOFT_WMM,
4055 start, end - start);
4056 if (!wp)
4057 break;
4058 start = wp + wp[1] + 2;
4059 /* if this IE is too short, try the next */
4060 if (wp[1] <= 4)
4061 continue;
4062 /* if this IE is WMM params, we found what we wanted */
4063 if (wp[6] == 1)
4064 break;
4065 }
4066
4067 if (!wp || !ieee80211_usable_wmm_params(sdata, wp + 2,
4068 wp[1] - 2)) {
4069 assoc_data->wmm = false;
4070 ifmgd->flags |= IEEE80211_STA_DISABLE_WMM;
4071 }
4072 rcu_read_unlock();
4073 }
4074
4000 /* 4075 /*
4001 * IEEE802.11n does not allow TKIP/WEP as pairwise ciphers in HT mode. 4076 * IEEE802.11n does not allow TKIP/WEP as pairwise ciphers in HT mode.
4002 * We still associate in non-HT mode (11a/b/g) if any one of these 4077 * We still associate in non-HT mode (11a/b/g) if any one of these
@@ -4026,18 +4101,22 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
4026 /* Also disable HT if we don't support it or the AP doesn't use WMM */ 4101 /* Also disable HT if we don't support it or the AP doesn't use WMM */
4027 sband = local->hw.wiphy->bands[req->bss->channel->band]; 4102 sband = local->hw.wiphy->bands[req->bss->channel->band];
4028 if (!sband->ht_cap.ht_supported || 4103 if (!sband->ht_cap.ht_supported ||
4029 local->hw.queues < IEEE80211_NUM_ACS || !bss->wmm_used) { 4104 local->hw.queues < IEEE80211_NUM_ACS || !bss->wmm_used ||
4105 ifmgd->flags & IEEE80211_STA_DISABLE_WMM) {
4030 ifmgd->flags |= IEEE80211_STA_DISABLE_HT; 4106 ifmgd->flags |= IEEE80211_STA_DISABLE_HT;
4031 if (!bss->wmm_used) 4107 if (!bss->wmm_used &&
4108 !(ifmgd->flags & IEEE80211_STA_DISABLE_WMM))
4032 netdev_info(sdata->dev, 4109 netdev_info(sdata->dev,
4033 "disabling HT as WMM/QoS is not supported by the AP\n"); 4110 "disabling HT as WMM/QoS is not supported by the AP\n");
4034 } 4111 }
4035 4112
4036 /* disable VHT if we don't support it or the AP doesn't use WMM */ 4113 /* disable VHT if we don't support it or the AP doesn't use WMM */
4037 if (!sband->vht_cap.vht_supported || 4114 if (!sband->vht_cap.vht_supported ||
4038 local->hw.queues < IEEE80211_NUM_ACS || !bss->wmm_used) { 4115 local->hw.queues < IEEE80211_NUM_ACS || !bss->wmm_used ||
4116 ifmgd->flags & IEEE80211_STA_DISABLE_WMM) {
4039 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT; 4117 ifmgd->flags |= IEEE80211_STA_DISABLE_VHT;
4040 if (!bss->wmm_used) 4118 if (!bss->wmm_used &&
4119 !(ifmgd->flags & IEEE80211_STA_DISABLE_WMM))
4041 netdev_info(sdata->dev, 4120 netdev_info(sdata->dev,
4042 "disabling VHT as WMM/QoS is not supported by the AP\n"); 4121 "disabling VHT as WMM/QoS is not supported by the AP\n");
4043 } 4122 }
@@ -4066,8 +4145,6 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
4066 sdata->smps_mode = ifmgd->req_smps; 4145 sdata->smps_mode = ifmgd->req_smps;
4067 4146
4068 assoc_data->capability = req->bss->capability; 4147 assoc_data->capability = req->bss->capability;
4069 assoc_data->wmm = bss->wmm_used &&
4070 (local->hw.queues >= IEEE80211_NUM_ACS);
4071 assoc_data->supp_rates = bss->supp_rates; 4148 assoc_data->supp_rates = bss->supp_rates;
4072 assoc_data->supp_rates_len = bss->supp_rates_len; 4149 assoc_data->supp_rates_len = bss->supp_rates_len;
4073 4150