From patchwork Wed May 12 21:07:37 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Benoit PAPILLAULT X-Patchwork-Id: 99098 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o4CL7to9020065 for ; Wed, 12 May 2010 21:07:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755325Ab0ELVHx (ORCPT ); Wed, 12 May 2010 17:07:53 -0400 Received: from smtp3-g21.free.fr ([212.27.42.3]:38097 "EHLO smtp3-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753622Ab0ELVHw (ORCPT ); Wed, 12 May 2010 17:07:52 -0400 Received: from smtp3-g21.free.fr (localhost [127.0.0.1]) by smtp3-g21.free.fr (Postfix) with ESMTP id F2CDD818112; Wed, 12 May 2010 23:07:43 +0200 (CEST) Received: from xian.sabine-et-benoit.com (ns.popipo.fr [88.163.232.53]) by smtp3-g21.free.fr (Postfix) with ESMTP; Wed, 12 May 2010 23:07:42 +0200 (CEST) Received: by xian.sabine-et-benoit.com (Postfix, from userid 1000) id 141CB98001; Wed, 12 May 2010 23:07:40 +0200 (CEST) From: Benoit Papillault To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Benoit Papillault Subject: [PATCH] cfg80211: Parse channel_type in NL80211_CMD_JOIN_IBSS Date: Wed, 12 May 2010 23:07:37 +0200 Message-Id: <1273698460-18061-1-git-send-email-benoit.papillault@free.fr> X-Mailer: git-send-email 1.5.6.5 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Wed, 12 May 2010 21:07:55 +0000 (UTC) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index b44a2e5..5ead439 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -806,6 +806,7 @@ struct cfg80211_ibss_params { u8 *ssid; u8 *bssid; struct ieee80211_channel *channel; + enum nl80211_channel_type channel_type; u8 *ie; u8 ssid_len, ie_len; u16 beacon_interval; diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index aaa1aad..039c13f 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -3879,6 +3879,7 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) struct cfg80211_ibss_params ibss; struct wiphy *wiphy; struct cfg80211_cached_keys *connkeys = NULL; + enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; int err; memset(&ibss, 0, sizeof(ibss)); @@ -3900,6 +3901,17 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) return -EINVAL; } + if (info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]) { + channel_type = nla_get_u32( + info->attrs[NL80211_ATTR_WIPHY_CHANNEL_TYPE]); + if (channel_type != NL80211_CHAN_NO_HT && + channel_type != NL80211_CHAN_HT20 && + channel_type != NL80211_CHAN_HT40PLUS && + channel_type != NL80211_CHAN_HT40MINUS) + return -EINVAL; + } + ibss.channel_type = channel_type; + rtnl_lock(); err = get_rdev_dev_by_info_ifindex(info, &rdev, &dev); @@ -3933,11 +3945,11 @@ static int nl80211_join_ibss(struct sk_buff *skb, struct genl_info *info) ibss.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); } - ibss.channel = ieee80211_get_channel(wiphy, - nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ])); + ibss.channel = rdev_freq_to_chan(rdev, + nla_get_u32(info->attrs[NL80211_ATTR_WIPHY_FREQ]), + channel_type); if (!ibss.channel || - ibss.channel->flags & IEEE80211_CHAN_NO_IBSS || - ibss.channel->flags & IEEE80211_CHAN_DISABLED) { + ibss.channel->flags & IEEE80211_CHAN_NO_IBSS) { err = -EINVAL; goto out; }