From patchwork Tue Nov 12 15:46:50 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Peer, Ilan" X-Patchwork-Id: 3173551 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 05B309F39E for ; Tue, 12 Nov 2013 15:46:47 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C728D20161 for ; Tue, 12 Nov 2013 15:46:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A9DF20204 for ; Tue, 12 Nov 2013 15:46:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755837Ab3KLPqi (ORCPT ); Tue, 12 Nov 2013 10:46:38 -0500 Received: from mga11.intel.com ([192.55.52.93]:23257 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755742Ab3KLPqh (ORCPT ); Tue, 12 Nov 2013 10:46:37 -0500 Received: from fmsmga002.fm.intel.com ([10.253.24.26]) by fmsmga102.fm.intel.com with ESMTP; 12 Nov 2013 07:46:19 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.93,685,1378882800"; d="scan'208";a="432129139" Received: from ipeer-e6430-1.jer.intel.com ([10.12.217.166]) by fmsmga002.fm.intel.com with ESMTP; 12 Nov 2013 07:46:18 -0800 From: Ilan Peer To: linux-wireless@vger.kernel.org Cc: Ilan Peer Subject: [PATCH] iw: Use NL80211_FREQUENCY_ATTR_NO_IR channel attribute Date: Tue, 12 Nov 2013 17:46:50 +0200 Message-Id: <1384271210-26762-1-git-send-email-ilan.peer@intel.com> X-Mailer: git-send-email 1.7.10.4 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, RP_MATCHES_RCVD, 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 Align iw with the change in nl80211.h where NL80211_FREQUENCY_ATTR_NO_IBSS and NL80211_FREQUENCY_ATTR_PASSIVE_SCAN were replaced by NL80211_FREQUENCY_ATTR_NO_IR. In case both NL80211_FREQUENCY_ATTR_NO_IR and __NL80211_FREQUENCY_ATTR_NO_IBSS are set, assume that a new kernel is used and use the NO_IR notation, otherwise use the previous notation. This change requires nl80211.h with the new definitions Signed-off-by: Ilan Peer --- event.c | 24 ++++++++++++++---------- info.c | 18 ++++++++++++------ reg.c | 10 ++++++++-- 3 files changed, 34 insertions(+), 18 deletions(-) diff --git a/event.c b/event.c index 603b072..bfdb0fb 100644 --- a/event.c +++ b/event.c @@ -11,7 +11,7 @@ static int no_seq_check(struct nl_msg *msg, void *arg) struct ieee80211_beacon_channel { __u16 center_freq; - bool passive_scan; + bool no_ir; bool no_ibss; }; @@ -21,8 +21,8 @@ static int parse_beacon_hint_chan(struct nlattr *tb, struct nlattr *tb_freq[NL80211_FREQUENCY_ATTR_MAX + 1]; static struct nla_policy beacon_freq_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = { [NL80211_FREQUENCY_ATTR_FREQ] = { .type = NLA_U32 }, - [NL80211_FREQUENCY_ATTR_PASSIVE_SCAN] = { .type = NLA_FLAG }, - [NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG }, + [NL80211_FREQUENCY_ATTR_NO_IR] = { .type = NLA_FLAG }, + [__NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG }, }; if (nla_parse_nested(tb_freq, @@ -33,9 +33,9 @@ static int parse_beacon_hint_chan(struct nlattr *tb, chan->center_freq = nla_get_u32(tb_freq[NL80211_FREQUENCY_ATTR_FREQ]); - if (tb_freq[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN]) - chan->passive_scan = true; - if (tb_freq[NL80211_FREQUENCY_ATTR_NO_IBSS]) + if (tb_freq[NL80211_FREQUENCY_ATTR_NO_IR]) + chan->no_ir = true; + if (tb_freq[__NL80211_FREQUENCY_ATTR_NO_IBSS]) chan->no_ibss = true; return 0; @@ -394,10 +394,14 @@ static int print_event(struct nl_msg *msg, void *arg) chan_before_beacon.center_freq, ieee80211_frequency_to_channel(chan_before_beacon.center_freq)); - if (chan_before_beacon.passive_scan && !chan_after_beacon.passive_scan) - printf("\to active scanning enabled\n"); - if (chan_before_beacon.no_ibss && !chan_after_beacon.no_ibss) - printf("\to beaconing enabled\n"); + if (chan_before_beacon.no_ir && !chan_after_beacon.no_ir) { + if (chan_before_beacon.no_ibss && !chan_after_beacon.no_ibss) + printf("\to Initiating radiation enabled\n"); + else + printf("\to active scan enabled\n"); + } else if (chan_before_beacon.no_ibss && !chan_after_beacon.no_ibss) { + printf("\to ibss enabled\n"); + } break; case NL80211_CMD_NEW_STATION: diff --git a/info.c b/info.c index 7e61e88..b918439 100644 --- a/info.c +++ b/info.c @@ -74,8 +74,8 @@ static int print_phy_handler(struct nl_msg *msg, void *arg) static struct nla_policy freq_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = { [NL80211_FREQUENCY_ATTR_FREQ] = { .type = NLA_U32 }, [NL80211_FREQUENCY_ATTR_DISABLED] = { .type = NLA_FLAG }, - [NL80211_FREQUENCY_ATTR_PASSIVE_SCAN] = { .type = NLA_FLAG }, - [NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG }, + [NL80211_FREQUENCY_ATTR_NO_IR] = { .type = NLA_FLAG }, + [__NL80211_FREQUENCY_ATTR_NO_IBSS] = { .type = NLA_FLAG }, [NL80211_FREQUENCY_ATTR_RADAR] = { .type = NLA_FLAG }, [NL80211_FREQUENCY_ATTR_MAX_TX_POWER] = { .type = NLA_U32 }, }; @@ -172,10 +172,16 @@ static int print_phy_handler(struct nl_msg *msg, void *arg) print_flag("disabled", &open); goto next; } - if (tb_freq[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN]) - print_flag("passive scanning", &open); - if (tb_freq[NL80211_FREQUENCY_ATTR_NO_IBSS]) - print_flag("no IBSS", &open); + + /* If both flags are set assume an new kernel */ + if (tb_freq[NL80211_FREQUENCY_ATTR_NO_IR] && tb_freq[__NL80211_FREQUENCY_ATTR_NO_IBSS]) { + print_flag("not allowed to initiate radiation", &open); + } else if (tb_freq[NL80211_FREQUENCY_ATTR_PASSIVE_SCAN]) { + print_flag("passive scan", &open); + } else if (tb_freq[__NL80211_FREQUENCY_ATTR_NO_IBSS]){ + print_flag("no ibss", &open); + } + if (tb_freq[NL80211_FREQUENCY_ATTR_RADAR]) print_flag("radar detection", &open); next: diff --git a/reg.c b/reg.c index 9a60cec..f2481fe 100644 --- a/reg.c +++ b/reg.c @@ -193,8 +193,14 @@ static int print_reg_handler(struct nl_msg *msg, void *arg) PARSE_FLAG(NL80211_RRF_NO_OUTDOOR, "NO-OUTDOOR"); PARSE_FLAG(NL80211_RRF_DFS, "DFS"); PARSE_FLAG(NL80211_RRF_PTP_ONLY, "PTP-ONLY"); - PARSE_FLAG(NL80211_RRF_PASSIVE_SCAN, "PASSIVE-SCAN"); - PARSE_FLAG(NL80211_RRF_NO_IBSS, "NO-IBSS"); + + /* Kernels that support NO_IR always turn on both flags */ + if ((flags & NL80211_RRF_NO_IR) && (flags & __NL80211_RRF_NO_IBSS)) { + printf(", NO-IR"); + } else { + PARSE_FLAG(NL80211_RRF_PASSIVE_SCAN, "PASSIVE-SCAN"); + PARSE_FLAG(__NL80211_RRF_NO_IBSS, "NO-IBSS"); + } printf("\n"); }