From patchwork Wed Apr 3 12:51:56 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Zefir Kurtisi X-Patchwork-Id: 2387011 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7AEE73FD8C for ; Wed, 3 Apr 2013 12:52:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1759625Ab3DCMwH (ORCPT ); Wed, 3 Apr 2013 08:52:07 -0400 Received: from mail.neratec.com ([80.75.119.105]:34139 "EHLO mail.neratec.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1759183Ab3DCMwG (ORCPT ); Wed, 3 Apr 2013 08:52:06 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.neratec.com (Postfix) with ESMTP id D2F5F8BDF6D; Wed, 3 Apr 2013 14:52:01 +0200 (CEST) X-Virus-Scanned: amavisd-new at neratec.com Received: from mail.neratec.com ([127.0.0.1]) by localhost (mail.neratec.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id w5nm2kPpRfFO; Wed, 3 Apr 2013 14:52:01 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by mail.neratec.com (Postfix) with ESMTP id 7AFEA8BDF6E; Wed, 3 Apr 2013 14:52:01 +0200 (CEST) X-Virus-Scanned: amavisd-new at neratec.com Received: from mail.neratec.com ([127.0.0.1]) by localhost (mail.neratec.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id atWXuYDbC2BZ; Wed, 3 Apr 2013 14:52:01 +0200 (CEST) Received: from CHL500308.neratec.local (CHL500308.neratec.local [192.168.11.104]) by mail.neratec.com (Postfix) with ESMTPSA id 1395F8BDF61; Wed, 3 Apr 2013 14:52:00 +0200 (CEST) From: Zefir Kurtisi To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, Zefir Kurtisi Subject: [PATCH] iw: display DFS regulatory domain Date: Wed, 3 Apr 2013 14:51:56 +0200 Message-Id: <1364993516-12537-1-git-send-email-zefir.kurtisi@neratec.com> X-Mailer: git-send-email 1.7.4.1 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Signed-off-by: Zefir Kurtisi --- reg.c | 24 +++++++++++++++++++++++- 1 files changed, 23 insertions(+), 1 deletions(-) diff --git a/reg.c b/reg.c index 5afc92b..9a60cec 100644 --- a/reg.c +++ b/reg.c @@ -59,6 +59,22 @@ char *reg_initiator_to_string(__u8 initiator) } } +static const char *dfs_domain_name(enum nl80211_dfs_regions region) +{ + switch (region) { + case NL80211_DFS_UNSET: + return "DFS-UNSET"; + case NL80211_DFS_FCC: + return "DFS-FCC"; + case NL80211_DFS_ETSI: + return "DFS-ETSI"; + case NL80211_DFS_JP: + return "DFS-JP"; + default: + return "DFS-invalid"; + } +} + static int handle_reg_set(struct nl80211_state *state, struct nl_cb *cb, struct nl_msg *msg, @@ -110,6 +126,7 @@ static int print_reg_handler(struct nl_msg *msg, void *arg) char *alpha2; struct nlattr *nl_rule; int rem_rule; + enum nl80211_dfs_regions dfs_domain; static struct nla_policy reg_rule_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = { [NL80211_ATTR_REG_RULE_FLAGS] = { .type = NLA_U32 }, [NL80211_ATTR_FREQ_RANGE_START] = { .type = NLA_U32 }, @@ -132,8 +149,13 @@ static int print_reg_handler(struct nl_msg *msg, void *arg) return NL_SKIP; } + if (tb_msg[NL80211_ATTR_DFS_REGION]) + dfs_domain = nla_get_u8(tb_msg[NL80211_ATTR_DFS_REGION]); + else + dfs_domain = NL80211_DFS_UNSET; + alpha2 = nla_data(tb_msg[NL80211_ATTR_REG_ALPHA2]); - printf("country %c%c:\n", alpha2[0], alpha2[1]); + printf("country %c%c: %s\n", alpha2[0], alpha2[1], dfs_domain_name(dfs_domain)); nla_for_each_nested(nl_rule, tb_msg[NL80211_ATTR_REG_RULES], rem_rule) { struct nlattr *tb_rule[NL80211_FREQUENCY_ATTR_MAX + 1];