Commit 3a40414f authored by Johannes Berg's avatar Johannes Berg

mac80211: connect with HT20 if HT40 is not permitted

Some changes to fix issues with HT40 APs in Korea
and follow-up changes to allow using HT40 even if
the local regulatory database disallows it caused
issues with iwlwifi (and could cause issues with
other devices); iwlwifi firmware would assert if
you tried to connect to an AP that has an invalid
configuration (e.g. using HT40- on channel 140.)

Fix this, while avoiding the "Korean AP" issue by
disabling HT40 and advertising HT20 to the AP
when connecting.

Cc: stable@vger.kernel.org [3.6]
Reported-by: default avatarFlorian Reitmeir <florian@reitmeir.org>
Tested-by: default avatarFlorian Reitmeir <florian@reitmeir.org>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 6863255b
...@@ -3099,24 +3099,34 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata, ...@@ -3099,24 +3099,34 @@ static int ieee80211_prep_channel(struct ieee80211_sub_if_data *sdata,
ht_cfreq, ht_oper->primary_chan, ht_cfreq, ht_oper->primary_chan,
cbss->channel->band); cbss->channel->band);
ht_oper = NULL; ht_oper = NULL;
} else {
channel_type = NL80211_CHAN_HT20;
} }
} }
if (ht_oper) { if (ht_oper && sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) {
channel_type = NL80211_CHAN_HT20; /*
* cfg80211 already verified that the channel itself can
* be used, but it didn't check that we can do the right
* HT type, so do that here as well. If HT40 isn't allowed
* on this channel, disable 40 MHz operation.
*/
if (sband->ht_cap.cap & IEEE80211_HT_CAP_SUP_WIDTH_20_40) { switch (ht_oper->ht_param & IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
switch (ht_oper->ht_param &
IEEE80211_HT_PARAM_CHA_SEC_OFFSET) {
case IEEE80211_HT_PARAM_CHA_SEC_ABOVE: case IEEE80211_HT_PARAM_CHA_SEC_ABOVE:
if (cbss->channel->flags & IEEE80211_CHAN_NO_HT40PLUS)
ifmgd->flags |= IEEE80211_STA_DISABLE_40MHZ;
else
channel_type = NL80211_CHAN_HT40PLUS; channel_type = NL80211_CHAN_HT40PLUS;
break; break;
case IEEE80211_HT_PARAM_CHA_SEC_BELOW: case IEEE80211_HT_PARAM_CHA_SEC_BELOW:
if (cbss->channel->flags & IEEE80211_CHAN_NO_HT40MINUS)
ifmgd->flags |= IEEE80211_STA_DISABLE_40MHZ;
else
channel_type = NL80211_CHAN_HT40MINUS; channel_type = NL80211_CHAN_HT40MINUS;
break; break;
} }
} }
}
if (!ieee80211_set_channel_type(local, sdata, channel_type)) { if (!ieee80211_set_channel_type(local, sdata, channel_type)) {
/* can only fail due to HT40+/- mismatch */ /* can only fail due to HT40+/- mismatch */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment