[PATCH 1/2] nl80211: print dfs region info

Janusz Dziedzic janusz.dziedzic at tieto.com
Fri Jan 24 17:12:23 EST 2014


Print dfs region info when print
regulatory information.

Signed-hostap: Janusz Dziedzic <janusz.dziedzic at tieto.com>
---
 src/drivers/driver_nl80211.c |   26 ++++++++++++++++++++++++--
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 6c4c816..79254b5 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -6415,6 +6415,21 @@ static void nl80211_reg_rule_vht(struct nlattr *tb[],
 	}
 }
 
+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 nl80211_get_reg(struct nl_msg *msg, void *arg)
 {
@@ -6424,6 +6439,7 @@ static int nl80211_get_reg(struct nl_msg *msg, void *arg)
 	struct nlattr *nl_rule;
 	struct nlattr *tb_rule[NL80211_FREQUENCY_ATTR_MAX + 1];
 	int rem_rule;
+	enum nl80211_dfs_regions dfs_domain;
 	static struct nla_policy reg_policy[NL80211_FREQUENCY_ATTR_MAX + 1] = {
 		[NL80211_ATTR_REG_RULE_FLAGS] = { .type = NLA_U32 },
 		[NL80211_ATTR_FREQ_RANGE_START] = { .type = NLA_U32 },
@@ -6442,8 +6458,14 @@ static int nl80211_get_reg(struct nl_msg *msg, void *arg)
 		return NL_SKIP;
 	}
 
-	wpa_printf(MSG_DEBUG, "nl80211: Regulatory information - country=%s",
-		   (char *) nla_data(tb_msg[NL80211_ATTR_REG_ALPHA2]));
+	if (tb_msg[NL80211_ATTR_DFS_REGION])
+		dfs_domain = nla_get_u8(tb_msg[NL80211_ATTR_DFS_REGION]);
+	else
+		dfs_domain = NL80211_DFS_UNSET;
+
+	wpa_printf(MSG_DEBUG, "nl80211: Regulatory information - country=%s : %s",
+		   (char *) nla_data(tb_msg[NL80211_ATTR_REG_ALPHA2]),
+		   dfs_domain_name(dfs_domain));
 
 	nla_for_each_nested(nl_rule, tb_msg[NL80211_ATTR_REG_RULES], rem_rule)
 	{
-- 
1.7.9.5



More information about the HostAP mailing list