forked from luck/tmp_suning_uos_patched
cfg80211: enforce disabling channels by custom or strict settings
If a custom regulatory domain is passed and if a rule for a channel indicates it should be disabled that channel should always remain disabled as per its documentation and design. Likewise if WIPHY_FLAG_STRICT_REGULATORY flag is set and a regulatory_hint() is issued if a channel is disabled that channel should remain disabled. Without this change only drivers that set the _orig flags appropriately on their own would ensure disallowed channels remaind disabled. This helps drivers save code by relying on the APIS provided to entrust channels that should not be enabled be respected by only having to use wiphy_apply_custom_regulatory() or regulatory_hint() with the WIPHY_FLAG_STRICT_REGULATORY set. If wiphy_apply_custom_regulatory() is used together with WIPHY_FLAG_STRICT_REGULATORY and a regulatory_hint() issued later, the incoming regulatory domain can override previously set _orig parameters from the initial custom regulatory setting. 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:
parent
ae689390b0
commit
cc493e4f52
@ -846,8 +846,18 @@ static void handle_channel(struct wiphy *wiphy,
|
||||
PTR_ERR(reg_rule) == -ERANGE)
|
||||
return;
|
||||
|
||||
REG_DBG_PRINT("Disabling freq %d MHz\n", chan->center_freq);
|
||||
chan->flags |= IEEE80211_CHAN_DISABLED;
|
||||
if (lr->initiator == NL80211_REGDOM_SET_BY_DRIVER &&
|
||||
request_wiphy && request_wiphy == wiphy &&
|
||||
request_wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) {
|
||||
REG_DBG_PRINT("Disabling freq %d MHz for good\n",
|
||||
chan->center_freq);
|
||||
chan->orig_flags |= IEEE80211_CHAN_DISABLED;
|
||||
chan->flags = chan->orig_flags;
|
||||
} else {
|
||||
REG_DBG_PRINT("Disabling freq %d MHz\n",
|
||||
chan->center_freq);
|
||||
chan->flags |= IEEE80211_CHAN_DISABLED;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
@ -1250,7 +1260,8 @@ static void handle_channel_custom(struct wiphy *wiphy,
|
||||
if (IS_ERR(reg_rule)) {
|
||||
REG_DBG_PRINT("Disabling freq %d MHz as custom regd has no rule that fits it\n",
|
||||
chan->center_freq);
|
||||
chan->flags = IEEE80211_CHAN_DISABLED;
|
||||
chan->orig_flags |= IEEE80211_CHAN_DISABLED;
|
||||
chan->flags = chan->orig_flags;
|
||||
return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user