From patchwork Wed Jan 7 14:21:45 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arik Nemtsov X-Patchwork-Id: 5584871 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 098DBBF6C3 for ; Wed, 7 Jan 2015 14:21:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 3211E20254 for ; Wed, 7 Jan 2015 14:21:53 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 56EC120221 for ; Wed, 7 Jan 2015 14:21:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751943AbbAGOVt (ORCPT ); Wed, 7 Jan 2015 09:21:49 -0500 Received: from mail-we0-f171.google.com ([74.125.82.171]:38980 "EHLO mail-we0-f171.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751133AbbAGOVt (ORCPT ); Wed, 7 Jan 2015 09:21:49 -0500 Received: by mail-we0-f171.google.com with SMTP id u56so1241165wes.30 for ; Wed, 07 Jan 2015 06:21:48 -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=i2RdjY3zHcGiiaYf5n954U0jNd5nAaSepPgLOaubJ+g=; b=Hem+Um805Evtul7WmTHAk6AKtVuNz/o9QXQ2N3BlqljqCly8od3U5Sf7LJ829TZ3CD MAiCK4L6W+6YcqNReeFwC7j5ED816G518keA3DEumxpBpPRn+fMoD1j1BE7a1cYsom9w gM0VeyBiUF3LuKnvcBuqPmHn88NKUjPcQik3bBMnviUzO1pxY3hjiPRThifUHuQp5wr0 RkKVxDBrQz/oZ+r3+CQhE6CXW9r+A05byVmH/BbNluIW+KbP3lI0HdcU45P3JUfVZc1B Hp3TG2HTizRGSR0VDxoGBn+Me5OG70M6dAQfatK5veAHZv70+x7Z0Tcfcna5NoCv1+1h JWhA== X-Gm-Message-State: ALoCoQlqGL+A1WEMsO9IQ1MukApOgE3HKNiFHbJJDoV0PFUfByTRwD9lga0hu6/1J89lztfOQd1/ X-Received: by 10.180.95.136 with SMTP id dk8mr48571332wib.64.1420640507900; Wed, 07 Jan 2015 06:21:47 -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 fo12sm18013787wic.19.2015.01.07.06.21.46 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 07 Jan 2015 06:21:47 -0800 (PST) From: Arik Nemtsov To: Cc: Johannes Berg , Arik Nemtsov Subject: [PATCH v2] mac80211: add TDLS supported channels correctly Date: Wed, 7 Jan 2015 16:21:45 +0200 Message-Id: <1420640505-16838-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..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; }