All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] mac80211: add TDLS supported channels correctly
@ 2015-01-07 14:21 Arik Nemtsov
  2015-01-07 14:28 ` Arik Nemtsov
  0 siblings, 1 reply; 2+ messages in thread
From: Arik Nemtsov @ 2015-01-07 14:21 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Arik Nemtsov

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 | 26 +++++++++++++++++++++-----
 1 file changed, 21 insertions(+), 5 deletions(-)

diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
index 55ddd77..c5c4342 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,
 		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++;
+				/*
+				 * check if the next channel is also part of
+				 * this allowed range */
+				 *
 				continue;
 			}
 		}
 
+		/*
+		 * we've reached the end of a range, with allowed channels
+		 * found
+		 */
 		if (ch_cnt) {
 			u8 *pos = skb_put(skb, 2);
 			*pos++ = ieee80211_frequency_to_channel(subband_start);
@@ -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;
 }
 
-- 
2.1.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH v2] mac80211: add TDLS supported channels correctly
  2015-01-07 14:21 [PATCH v2] mac80211: add TDLS supported channels correctly Arik Nemtsov
@ 2015-01-07 14:28 ` Arik Nemtsov
  0 siblings, 0 replies; 2+ messages in thread
From: Arik Nemtsov @ 2015-01-07 14:28 UTC (permalink / raw)
  To: linux-wireless; +Cc: Johannes Berg, Arik Nemtsov

On Wed, Jan 7, 2015 at 4:21 PM, Arik Nemtsov <arik@wizery.com> 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.
>
> Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com>
> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
> ---
>  net/mac80211/tdls.c | 26 +++++++++++++++++++++-----
>  1 file changed, 21 insertions(+), 5 deletions(-)
>
> diff --git a/net/mac80211/tdls.c b/net/mac80211/tdls.c
> index 55ddd77..c5c4342 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,
>                 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++;
> +                               /*
> +                                * check if the next channel is also part of
> +                                * this allowed range */
> +                                *

argh. resending. this wasn't compiled properly :)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-01-07 14:29 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-07 14:21 [PATCH v2] mac80211: add TDLS supported channels correctly Arik Nemtsov
2015-01-07 14:28 ` Arik Nemtsov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.