From patchwork Wed Aug 21 11:40:13 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Wunderlich X-Patchwork-Id: 2847685 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.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 0C718BF546 for ; Wed, 21 Aug 2013 11:40:30 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B489C201BA for ; Wed, 21 Aug 2013 11:40:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C789520399 for ; Wed, 21 Aug 2013 11:40:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751475Ab3HULkZ (ORCPT ); Wed, 21 Aug 2013 07:40:25 -0400 Received: from nick.hrz.tu-chemnitz.de ([134.109.228.11]:48860 "EHLO nick.hrz.tu-chemnitz.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751457Ab3HULkY (ORCPT ); Wed, 21 Aug 2013 07:40:24 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tu-chemnitz.de; s=dkim2010; h=Message-Id:Date:Subject:Cc:To:From; bh=un7jq8Xt0aUhgoE2bV9gLkaQogtQ524V0Yq/wpyOSxM=; b=q5O/jftPB4p2ZCkiYRw2FIS+sykSZrjeQXmM3baU0+OYWsm5fkcizpnqFUncNx4a5LECAxKl18jSiw0GEbB0X53j/i3nUjSWDfwatwyputurxxy950aeWLzBVsqhFLhg8NuP6TrDBFPa5afMZiM7wpvI9+Bs2ZqF8SXc3yC/GUw=; Received: from p579e7715.dip0.t-ipconnect.de ([87.158.119.21] helo=pandem0nium) by nick.hrz.tu-chemnitz.de with esmtpsa (TLSv1:DHE-RSA-AES128-SHA:128) (Exim 4.80.1) (envelope-from ) id 1VC6lw-0006Sf-Hl; Wed, 21 Aug 2013 13:40:22 +0200 Received: from dotslash by pandem0nium with local (Exim 4.80) (envelope-from ) id 1VC6lv-0007jS-9r; Wed, 21 Aug 2013 13:40:19 +0200 From: Simon Wunderlich To: linux-wireless@vger.kernel.org Cc: Johannes Berg , Mathias Kretschmer , Simon Wunderlich Subject: [PATCH] mac80211: fix ignored channel parameter Date: Wed, 21 Aug 2013 13:40:13 +0200 Message-Id: <1377085213-29695-1-git-send-email-siwu@hrz.tu-chemnitz.de> X-Mailer: git-send-email 1.7.10.4 X-purgate: clean X-purgate-type: clean X-purgate-ID: 154106::1377085220-000004FE-78095822/0-0/0-0 X-Scan-AV: nick.hrz.tu-chemnitz.de; 2013-08-21 13:40:20; 36d760b5bd55621085c34eaf65542ad1 X-Scan-SA: nick.hrz.tu-chemnitz.de; 2013-08-21 13:40:21; 9f67866c62749883c532758dd32ab148 X-Spam-Score: -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=-9.6 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,UNPARSEABLE_RELAY autolearn=unavailable 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 my earlier patch "mac80211: change IBSS channel state to chandef" created a regression by ignoring the channel parameter in __ieee80211_sta_join_ibss, which breaks IBSS channel selection. This patch fixes this situation by using the right channel and adopting the selected bandwidth mode. Cc: stable@vger.kernel.org Signed-off-by: Simon Wunderlich --- net/mac80211/ibss.c | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/net/mac80211/ibss.c b/net/mac80211/ibss.c index 74de0f1..2669595 100644 --- a/net/mac80211/ibss.c +++ b/net/mac80211/ibss.c @@ -201,7 +201,7 @@ error: static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, const u8 *bssid, const int beacon_int, - struct ieee80211_channel *chan, + struct cfg80211_chan_def *req_chandef, const u32 basic_rates, const u16 capability, u64 tsf, bool creator) @@ -213,6 +213,7 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, struct cfg80211_bss *bss; u32 bss_change; struct cfg80211_chan_def chandef; + struct ieee80211_channel *chan; struct beacon_data *presp; enum nl80211_bss_scan_width scan_width; bool have_higher_than_11mbit; @@ -244,7 +245,9 @@ static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, sdata->drop_unencrypted = capability & WLAN_CAPABILITY_PRIVACY ? 1 : 0; - chandef = ifibss->chandef; + /* make a copy of the chandef, it could be modified below. */ + chandef = *req_chandef; + chan = chandef.chan; if (!cfg80211_reg_can_beacon(local->hw.wiphy, &chandef)) { if (chandef.width == NL80211_CHAN_WIDTH_5 || chandef.width == NL80211_CHAN_WIDTH_10 || @@ -339,6 +342,7 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, struct cfg80211_bss *cbss = container_of((void *)bss, struct cfg80211_bss, priv); struct ieee80211_supported_band *sband; + struct cfg80211_chan_def chandef; u32 basic_rates; int i, j; u16 beacon_int = cbss->beacon_interval; @@ -352,6 +356,13 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, if (beacon_int < 10) beacon_int = 10; + chandef.chan = cbss->channel; + chandef.width = sdata->u.ibss.chandef.width; + chandef.center_freq1 = chandef.chan->center_freq + + sdata->u.ibss.chandef.center_freq1 - + sdata->u.ibss.chandef.chan->center_freq; + chandef.center_freq2 = 0; + sband = sdata->local->hw.wiphy->bands[cbss->channel->band]; rate_flags = ieee80211_chandef_rate_flags(&sdata->u.ibss.chandef); shift = ieee80211_vif_get_shift(&sdata->vif); @@ -385,7 +396,7 @@ static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, __ieee80211_sta_join_ibss(sdata, cbss->bssid, beacon_int, - cbss->channel, + &chandef, basic_rates, cbss->capability, tsf, false); @@ -867,7 +878,7 @@ static void ieee80211_sta_create_ibss(struct ieee80211_sub_if_data *sdata) sdata->drop_unencrypted = 0; __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int, - ifibss->chandef.chan, ifibss->basic_rates, + &ifibss->chandef, ifibss->basic_rates, capability, 0, true); }