diff mbox

mac80211: add TDLS supported channels correctly

Message ID 1419847143-25447-1-git-send-email-arik@wizery.com (mailing list archive)
State Changes Requested
Delegated to: Johannes Berg
Headers show

Commit Message

Arik Nemtsov Dec. 29, 2014, 9:59 a.m. UTC
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>
---
 net/mac80211/tdls.c | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

Comments

Johannes Berg Jan. 6, 2015, 10:43 a.m. UTC | #1
On Mon, 2014-12-29 at 11:59 +0200, Arik Nemtsov wrote:
> 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.


That's a strangely formatted commit message ... :)


> +			if (cfg80211_reg_can_beacon(sdata->local->hw.wiphy,
> +						    &chandef,
> +						    sdata->wdev.iftype)) {
>  				ch_cnt++;
>  				continue;

With some thinking, I can understand it - but that means you need a
comment here.

johannes

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Arik Nemtsov Jan. 7, 2015, 1:28 p.m. UTC | #2
On Tue, Jan 6, 2015 at 12:43 PM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Mon, 2014-12-29 at 11:59 +0200, Arik Nemtsov wrote:
>> 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.
>
>
> That's a strangely formatted commit message ... :)

I thought it's clearer this way. You disagree?

>
>
>> +                     if (cfg80211_reg_can_beacon(sdata->local->hw.wiphy,
>> +                                                 &chandef,
>> +                                                 sdata->wdev.iftype)) {
>>                               ch_cnt++;
>>                               continue;
>
> With some thinking, I can understand it - but that means you need a
> comment here.

Sure.

Arik
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index 55ddd77..bd89249 100644
--- a/net/mac80211/tdls.c
+++ b/net/mac80211/tdls.c
@@ -68,12 +68,11 @@  ieee80211_tdls_add_subband(struct ieee80211_sub_if_data *sdata,
 		ch = ieee80211_get_channel(sdata->local->hw.wiphy, i);
 		if (ch) {
 			/* we will be active on the channel */
-			u32 flags = IEEE80211_CHAN_DISABLED |
-				    IEEE80211_CHAN_NO_IR;
 			cfg80211_chandef_create(&chandef, ch,
-						NL80211_CHAN_HT20);
-			if (cfg80211_chandef_usable(sdata->local->hw.wiphy,
-						    &chandef, flags)) {
+						NL80211_CHAN_NO_HT);
+			if (cfg80211_reg_can_beacon(sdata->local->hw.wiphy,
+						    &chandef,
+						    sdata->wdev.iftype)) {
 				ch_cnt++;
 				continue;
 			}
@@ -89,6 +88,14 @@  ieee80211_tdls_add_subband(struct ieee80211_sub_if_data *sdata,
 		}
 	}
 
+	if (ch_cnt) {
+		u8 *pos = skb_put(skb, 2);
+		*pos++ = ieee80211_frequency_to_channel(subband_start);
+		*pos++ = ch_cnt;
+
+		subband_cnt++;
+	}
+
 	return subband_cnt;
 }