From patchwork Mon May 19 14:49:04 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rostislav Lisovy X-Patchwork-Id: 4202741 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 178EBBEEAB for ; Mon, 19 May 2014 14:50:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 461522026D for ; Mon, 19 May 2014 14:50:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 5F6C920221 for ; Mon, 19 May 2014 14:50:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754354AbaESOt5 (ORCPT ); Mon, 19 May 2014 10:49:57 -0400 Received: from mail-ee0-f43.google.com ([74.125.83.43]:50372 "EHLO mail-ee0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932300AbaESOtQ (ORCPT ); Mon, 19 May 2014 10:49:16 -0400 Received: by mail-ee0-f43.google.com with SMTP id d17so3663286eek.16 for ; Mon, 19 May 2014 07:49:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=08lnoTMlLPdOvZZB6j5r3tYF88PSQ5FQl0k/+98uvtY=; b=l+4bCe52Vt/2cOj06YIWVB7kBHAwGUX65f5rVGAU2DAJubKbYqjOpuJU3KbTMt9KnT WUHzjJPP/I776z6ILXTcVqllRQnGKA+p7yrw5PHYXJwgxw/lCkuYGXgY6w9/A0ac5Fm7 Tiq7oGjc09ug/W7xIEYF/NEysVtWqrAz8sK8amiVpSDJBPX2iqKhjzsfpyProWaay3Cd A7mch2HkftmFWIIdayLWyQrWr6qFr347ObrdMG8jqv2w+Q7Kuw7SW5lFbpgkkOpjqg+R AOWWzIGB7Is0jIHrbpCXA7ZbQLpADZdy00b6yWJBdpF4aa+Sys8j9IW29tkENakmtGZ7 X14Q== X-Received: by 10.15.10.198 with SMTP id g46mr6424088eet.39.1400510953956; Mon, 19 May 2014 07:49:13 -0700 (PDT) Received: from c2c-vostro1.felk.cvut.cz ([147.32.86.112]) by mx.google.com with ESMTPSA id 44sm41385938eer.35.2014.05.19.07.49.12 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 19 May 2014 07:49:13 -0700 (PDT) X-Google-Original-From: Rostislav Lisovy From: Rostislav Lisovy To: Johannes Berg , "John W. Linville" , linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Michal Sojka , s.sander@nordsys.de, jan-niklas.meier@volkswagen.de, Rostislav Lisovy Subject: [RFC 1/2] cfg80211: Add channel flags limiting availability to OCB mode only Date: Mon, 19 May 2014 16:49:04 +0200 Message-Id: <1400510945-24868-2-git-send-email-rostislav.lisovy@fel.cvut.cz> X-Mailer: git-send-email 2.0.0.rc0 In-Reply-To: <1400510945-24868-1-git-send-email-rostislav.lisovy@fel.cvut.cz> References: <1400510945-24868-1-git-send-email-rostislav.lisovy@fel.cvut.cz> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-7.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 IEEE 802.11p operates in its own 5.9GHz band. When there will be a record for the 5.9GHz band in the regulatory daemon, it must be limited to the OCB mode only -- using the newly added flags. Signed-off-by: Rostislav Lisovy --- include/net/cfg80211.h | 2 ++ include/uapi/linux/nl80211.h | 5 +++++ net/wireless/nl80211.c | 3 +++ net/wireless/reg.c | 2 ++ 4 files changed, 12 insertions(+) diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h index 5c7169b..6722ab2 100644 --- a/include/net/cfg80211.h +++ b/include/net/cfg80211.h @@ -115,6 +115,7 @@ enum ieee80211_band { * on this channel. * @IEEE80211_CHAN_NO_10MHZ: 10 MHz bandwidth is not permitted * on this channel. + * @IEEE80211_CHAN_OCB_ONLY: only OCB is allowed on this channel. * */ enum ieee80211_channel_flags { @@ -131,6 +132,7 @@ enum ieee80211_channel_flags { IEEE80211_CHAN_GO_CONCURRENT = 1<<10, IEEE80211_CHAN_NO_20MHZ = 1<<11, IEEE80211_CHAN_NO_10MHZ = 1<<12, + IEEE80211_CHAN_OCB_ONLY = 1<<13, }; #define IEEE80211_CHAN_NO_HT40 \ diff --git a/include/uapi/linux/nl80211.h b/include/uapi/linux/nl80211.h index 406010d..970c5df 100644 --- a/include/uapi/linux/nl80211.h +++ b/include/uapi/linux/nl80211.h @@ -2362,6 +2362,8 @@ enum nl80211_band_attr { * on this channel in current regulatory domain. * @NL80211_FREQUENCY_ATTR_NO_10MHZ: 10 MHz operation is not allowed * on this channel in current regulatory domain. + * @NL80211_FREQUENCY_ATTR_OCB_ONLY: no other than OCB networks are + * permitted on this channel in current regulatory domain. * @NL80211_FREQUENCY_ATTR_MAX: highest frequency attribute number * currently defined * @__NL80211_FREQUENCY_ATTR_AFTER_LAST: internal use @@ -2390,6 +2392,7 @@ enum nl80211_frequency_attr { NL80211_FREQUENCY_ATTR_GO_CONCURRENT, NL80211_FREQUENCY_ATTR_NO_20MHZ, NL80211_FREQUENCY_ATTR_NO_10MHZ, + NL80211_FREQUENCY_ATTR_OCB_ONLY, /* keep last */ __NL80211_FREQUENCY_ATTR_AFTER_LAST, @@ -2558,6 +2561,7 @@ enum nl80211_sched_scan_match_attr { * @NL80211_RRF_AUTO_BW: maximum available bandwidth should be calculated * base on contiguous rules and wider channels will be allowed to cross * multiple contiguous/overlapping frequency ranges. + * @NL80211_RRF_OCB_ONLY: no other than OCB is allowed */ enum nl80211_reg_rule_flags { NL80211_RRF_NO_OFDM = 1<<0, @@ -2570,6 +2574,7 @@ enum nl80211_reg_rule_flags { NL80211_RRF_NO_IR = 1<<7, __NL80211_RRF_NO_IBSS = 1<<8, NL80211_RRF_AUTO_BW = 1<<11, + NL80211_RRF_OCB_ONLY = 1<<12, }; #define NL80211_RRF_PASSIVE_SCAN NL80211_RRF_NO_IR diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 0f1b18f2..c766c31 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c @@ -633,6 +633,9 @@ static int nl80211_msg_put_channel(struct sk_buff *msg, if ((chan->flags & IEEE80211_CHAN_NO_10MHZ) && nla_put_flag(msg, NL80211_FREQUENCY_ATTR_NO_10MHZ)) goto nla_put_failure; + if ((chan->flags & IEEE80211_CHAN_OCB_ONLY) && + nla_put_flag(msg, NL80211_FREQUENCY_ATTR_OCB_ONLY)) + goto nla_put_failure; } if (nla_put_u32(msg, NL80211_FREQUENCY_ATTR_MAX_TX_POWER, diff --git a/net/wireless/reg.c b/net/wireless/reg.c index e78f532..74e41f7 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c @@ -906,6 +906,8 @@ static u32 map_regdom_flags(u32 rd_flags) channel_flags |= IEEE80211_CHAN_NO_OFDM; if (rd_flags & NL80211_RRF_NO_OUTDOOR) channel_flags |= IEEE80211_CHAN_INDOOR_ONLY; + if (rd_flags & NL80211_RRF_OCB_ONLY) + channel_flags |= IEEE80211_CHAN_OCB_ONLY; return channel_flags; }