aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2015-01-07 09:45:07 -0500
committerJohannes Berg <johannes.berg@intel.com>2015-01-14 03:34:33 -0500
commit50075892ba30c4c19c41235b5308ee5a1e2125d7 (patch)
treef83c564dd090c586fe5936d35e063574204fcd73
parent3b24f4c65386dc0f2efb41027bc6e410ea2c0049 (diff)
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: Arik Nemtsov <arikx.nemtsov@intel.com> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
-rw-r--r--net/mac80211/tdls.c26
1 files changed, 21 insertions, 5 deletions
diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index 159ebf1304b2..917088dfd696 100644
--- a/net/mac80211/tdls.c
+++ b/net/mac80211/tdls.c
@@ -68,17 +68,24 @@ ieee80211_tdls_add_subband(struct ieee80211_sub_if_data *sdata,
68 ch = ieee80211_get_channel(sdata->local->hw.wiphy, i); 68 ch = ieee80211_get_channel(sdata->local->hw.wiphy, i);
69 if (ch) { 69 if (ch) {
70 /* we will be active on the channel */ 70 /* we will be active on the channel */
71 u32 flags = IEEE80211_CHAN_DISABLED |
72 IEEE80211_CHAN_NO_IR;
73 cfg80211_chandef_create(&chandef, ch, 71 cfg80211_chandef_create(&chandef, ch,
74 NL80211_CHAN_HT20); 72 NL80211_CHAN_NO_HT);
75 if (cfg80211_chandef_usable(sdata->local->hw.wiphy, 73 if (cfg80211_reg_can_beacon(sdata->local->hw.wiphy,
76 &chandef, flags)) { 74 &chandef,
75 sdata->wdev.iftype)) {
77 ch_cnt++; 76 ch_cnt++;
77 /*
78 * check if the next channel is also part of
79 * this allowed range
80 */
78 continue; 81 continue;
79 } 82 }
80 } 83 }
81 84
85 /*
86 * we've reached the end of a range, with allowed channels
87 * found
88 */
82 if (ch_cnt) { 89 if (ch_cnt) {
83 u8 *pos = skb_put(skb, 2); 90 u8 *pos = skb_put(skb, 2);
84 *pos++ = ieee80211_frequency_to_channel(subband_start); 91 *pos++ = ieee80211_frequency_to_channel(subband_start);
@@ -89,6 +96,15 @@ ieee80211_tdls_add_subband(struct ieee80211_sub_if_data *sdata,
89 } 96 }
90 } 97 }
91 98
99 /* all channels in the requested range are allowed - add them here */
100 if (ch_cnt) {
101 u8 *pos = skb_put(skb, 2);
102 *pos++ = ieee80211_frequency_to_channel(subband_start);
103 *pos++ = ch_cnt;
104
105 subband_cnt++;
106 }
107
92 return subband_cnt; 108 return subband_cnt;
93} 109}
94 110