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>
This commit is contained in:
Luis R. Rodriguez 2013-11-25 20:56:09 +01:00 committed by Johannes Berg
parent 60f4a7b167
commit 6c474799dc
2 changed files with 28 additions and 0 deletions

View File

@ -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)

View File

@ -21,6 +21,7 @@ extern const struct ieee80211_regdomain __rcu *cfg80211_regdomain;
bool reg_is_valid_request(const char *alpha2);
bool is_world_regdom(const char *alpha2);
bool reg_supported_dfs_region(enum nl80211_dfs_regions dfs_region);
enum nl80211_dfs_regions reg_get_dfs_region(struct wiphy *wiphy);
int regulatory_hint_user(const char *alpha2,
enum nl80211_user_reg_hint_type user_reg_hint_type);