From patchwork Wed Jan 7 14:45:07 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arik Nemtsov X-Patchwork-Id: 5584911 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 4DD02BF6C3 for ; Wed, 7 Jan 2015 14:45:16 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6F464201F4 for ; Wed, 7 Jan 2015 14:45:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 6B7DE201D3 for ; Wed, 7 Jan 2015 14:45:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752378AbbAGOpL (ORCPT ); Wed, 7 Jan 2015 09:45:11 -0500 Received: from mail-we0-f171.google.com ([74.125.82.171]:53901 "EHLO mail-we0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752265AbbAGOpL (ORCPT ); Wed, 7 Jan 2015 09:45:11 -0500 Received: by mail-we0-f171.google.com with SMTP id u56so1299915wes.16 for ; Wed, 07 Jan 2015 06:45:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=cfyz4B3RGGCzcAX+fZPJ4bmYhUnvNlP0CYV+3WK7v8s=; b=VpaPzfgq7M2RQuucHby5e5nzcLzK+iFDOTVz65kh72vfNEkhkl6di8gqemGAXiH8Z7 OWyp5kfS+Fkd5u7QydbMItlrGjS0SvMhlAO9o/pumW438CaCU4sROHn/OD7MPpGsp3ws XwmdKV6vXdbUsjR4Qmg3urUCi6b53mxHEBCwqC7yC85cPhWf6a1Zi3gQRfJE8Cw57jB3 8zWSnEAjyHjjYVBHgp71vM2bNjsW2eI9k+273Tqao7u8hqWQV4B8G9Ho+hbJaPRX6UKB fQGOgNUAqK4IZdrOtzEQXvPkduf7k2SNoW8VD1VV+MgeN1HcX6+o7cYFcomD05UtLeDV tpnw== X-Gm-Message-State: ALoCoQldyR8kLBIOjpq+0ssPkYmH/RpIZRbBok5biZNLYbfLW9VVVmbCXYzqyxXwX0KTSwP+zTE6 X-Received: by 10.181.28.165 with SMTP id jp5mr49153570wid.76.1420641909879; Wed, 07 Jan 2015 06:45:09 -0800 (PST) Received: from athena.ger.corp.intel.com (93-172-181-114.bb.netvision.net.il. [93.172.181.114]) by mx.google.com with ESMTPSA id bo3sm2362799wjb.44.2015.01.07.06.45.08 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jan 2015 06:45:09 -0800 (PST) From: Arik Nemtsov To: Cc: Johannes Berg , Arik Nemtsov Subject: [PATCH v3] mac80211: add TDLS supported channels correctly Date: Wed, 7 Jan 2015 16:45:07 +0200 Message-Id: <1420641907-4350-1-git-send-email-arik@wizery.com> X-Mailer: git-send-email 2.1.0 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Emmanuel Grumbach --- 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..9b789c6 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; }