summaryrefslogtreecommitdiffstats
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
authorLuis R. Rodriguez2013-11-25 20:56:09 +0100
committerJohannes Berg2013-12-03 13:53:40 +0100
commit6c474799dccc91c9cf03cd18ec32f97929549e9f (patch)
treee8240359cfbfca72162d9f0332fd64e9b5502300 /net/wireless/reg.c
parentnl80211/cfg80211: Set Operating Mode Notification (diff)
downloadkernel-qcow2-linux-6c474799dccc91c9cf03cd18ec32f97929549e9f.tar.gz
kernel-qcow2-linux-6c474799dccc91c9cf03cd18ec32f97929549e9f.tar.xz
kernel-qcow2-linux-6c474799dccc91c9cf03cd18ec32f97929549e9f.zip
cfg80211: add reg_get_dfs_region()
This can be used outside of the regulatory context for any checks on the DFS region. The central cfg80211 dfs_region is always used and if it does not match with the wiphy a debug print is issued. Signed-off-by: Luis R. Rodriguez <mcgrof@do-not-panic.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index ec54e1aac8e2..7d20d844ca60 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -135,6 +135,33 @@ static const char *reg_dfs_region_str(enum nl80211_dfs_regions dfs_region)
return "Unknown";
}
+enum nl80211_dfs_regions reg_get_dfs_region(struct wiphy *wiphy)
+{
+ const struct ieee80211_regdomain *regd = NULL;
+ const struct ieee80211_regdomain *wiphy_regd = NULL;
+
+ regd = get_cfg80211_regdom();
+ if (!wiphy)
+ goto out;
+
+ wiphy_regd = get_wiphy_regdom(wiphy);
+ if (!wiphy_regd)
+ goto out;
+
+ if (wiphy_regd->dfs_region == regd->dfs_region)
+ goto out;
+
+ REG_DBG_PRINT("%s: device specific dfs_region "
+ "(%s) disagrees with cfg80211's "
+ "central dfs_region (%s)\n",
+ dev_name(&wiphy->dev),
+ reg_dfs_region_str(wiphy_regd->dfs_region),
+ reg_dfs_region_str(regd->dfs_region));
+
+out:
+ return regd->dfs_region;
+}
+
static void rcu_free_regdom(const struct ieee80211_regdomain *r)
{
if (!r)