aboutsummaryrefslogtreecommitdiffstats
path: root/net/wireless/reg.c
diff options
context:
space:
mode:
authorArik Nemtsov <arik@wizery.com>2014-12-15 12:26:02 -0500
committerJohannes Berg <johannes.berg@intel.com>2014-12-17 05:49:55 -0500
commitdb8dfee57d37d2cd14a750477babbae52b69a494 (patch)
tree6d52011ec10a6891b45886df8e00983d75a773cd /net/wireless/reg.c
parent1bdd716cbccabc8127fbbaaa663c3090302ef78b (diff)
cfg80211: avoid intersection when applying self-managed reg
The custom-reg handling function can currently only add flags to a given channel. This results in stale flags being left applied. In some cases a channel was disabled and even the orig_flags were changed to reflect this. Previously the API was designed for a single invocation before wiphy registration, so this didn't matter. The previous approach doesn't scale well to self-managed regulatory devices, particularly when a more permissive regdom is applied after a restrictive one. Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r--net/wireless/reg.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index c040f8a0f1ed..9a5411cdf5e8 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1680,8 +1680,12 @@ static void handle_channel_custom(struct wiphy *wiphy,
1680 if (IS_ERR(reg_rule)) { 1680 if (IS_ERR(reg_rule)) {
1681 REG_DBG_PRINT("Disabling freq %d MHz as custom regd has no rule that fits it\n", 1681 REG_DBG_PRINT("Disabling freq %d MHz as custom regd has no rule that fits it\n",
1682 chan->center_freq); 1682 chan->center_freq);
1683 chan->orig_flags |= IEEE80211_CHAN_DISABLED; 1683 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED) {
1684 chan->flags = chan->orig_flags; 1684 chan->flags |= IEEE80211_CHAN_DISABLED;
1685 } else {
1686 chan->orig_flags |= IEEE80211_CHAN_DISABLED;
1687 chan->flags = chan->orig_flags;
1688 }
1685 return; 1689 return;
1686 } 1690 }
1687 1691
@@ -1706,7 +1710,13 @@ static void handle_channel_custom(struct wiphy *wiphy,
1706 chan->dfs_state = NL80211_DFS_USABLE; 1710 chan->dfs_state = NL80211_DFS_USABLE;
1707 1711
1708 chan->beacon_found = false; 1712 chan->beacon_found = false;
1709 chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags; 1713
1714 if (wiphy->regulatory_flags & REGULATORY_WIPHY_SELF_MANAGED)
1715 chan->flags = chan->orig_flags | bw_flags |
1716 map_regdom_flags(reg_rule->flags);
1717 else
1718 chan->flags |= map_regdom_flags(reg_rule->flags) | bw_flags;
1719
1710 chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain); 1720 chan->max_antenna_gain = (int) MBI_TO_DBI(power_rule->max_antenna_gain);
1711 chan->max_reg_power = chan->max_power = 1721 chan->max_reg_power = chan->max_power =
1712 (int) MBM_TO_DBM(power_rule->max_eirp); 1722 (int) MBM_TO_DBM(power_rule->max_eirp);