Commit 50075892 authored by Arik Nemtsov's avatar Arik Nemtsov Committed by Johannes Berg

mac80211: add TDLS supported channels correctly

The function adding the supported channels IE during a TDLS connection had
several issues:
1. If the entire subband is usable, the function exitted the loop without
   adding it
2. The function only checked chandef_usable, ignoring flags like RADAR
   which would prevent TDLS off-channel communcation.
3. HT20 was explicitly required in the chandef, while not a requirement
   for TDLS off-channel.
Signed-off-by: default avatarArik Nemtsov <arikx.nemtsov@intel.com>
Reviewed-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 3b24f4c6
...@@ -68,17 +68,24 @@ ieee80211_tdls_add_subband(struct ieee80211_sub_if_data *sdata, ...@@ -68,17 +68,24 @@ ieee80211_tdls_add_subband(struct ieee80211_sub_if_data *sdata,
ch = ieee80211_get_channel(sdata->local->hw.wiphy, i); ch = ieee80211_get_channel(sdata->local->hw.wiphy, i);
if (ch) { if (ch) {
/* we will be active on the channel */ /* we will be active on the channel */
u32 flags = IEEE80211_CHAN_DISABLED |
IEEE80211_CHAN_NO_IR;
cfg80211_chandef_create(&chandef, ch, cfg80211_chandef_create(&chandef, ch,
NL80211_CHAN_HT20); NL80211_CHAN_NO_HT);
if (cfg80211_chandef_usable(sdata->local->hw.wiphy, if (cfg80211_reg_can_beacon(sdata->local->hw.wiphy,
&chandef, flags)) { &chandef,
sdata->wdev.iftype)) {
ch_cnt++; ch_cnt++;
/*
* check if the next channel is also part of
* this allowed range
*/
continue; continue;
} }
} }
/*
* we've reached the end of a range, with allowed channels
* found
*/
if (ch_cnt) { if (ch_cnt) {
u8 *pos = skb_put(skb, 2); u8 *pos = skb_put(skb, 2);
*pos++ = ieee80211_frequency_to_channel(subband_start); *pos++ = ieee80211_frequency_to_channel(subband_start);
...@@ -89,6 +96,15 @@ ieee80211_tdls_add_subband(struct ieee80211_sub_if_data *sdata, ...@@ -89,6 +96,15 @@ ieee80211_tdls_add_subband(struct ieee80211_sub_if_data *sdata,
} }
} }
/* all channels in the requested range are allowed - add them here */
if (ch_cnt) {
u8 *pos = skb_put(skb, 2);
*pos++ = ieee80211_frequency_to_channel(subband_start);
*pos++ = ch_cnt;
subband_cnt++;
}
return subband_cnt; return subband_cnt;
} }
......
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