diff options
Diffstat (limited to 'net/wireless/reg.c')
-rw-r--r-- | net/wireless/reg.c | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/net/wireless/reg.c b/net/wireless/reg.c index 2303ee73b50a..72d170ca3406 100644 --- a/net/wireless/reg.c +++ b/net/wireless/reg.c | |||
@@ -350,6 +350,9 @@ static void reg_regdb_search(struct work_struct *work) | |||
350 | struct reg_regdb_search_request *request; | 350 | struct reg_regdb_search_request *request; |
351 | const struct ieee80211_regdomain *curdom, *regdom; | 351 | const struct ieee80211_regdomain *curdom, *regdom; |
352 | int i, r; | 352 | int i, r; |
353 | bool set_reg = false; | ||
354 | |||
355 | mutex_lock(&cfg80211_mutex); | ||
353 | 356 | ||
354 | mutex_lock(®_regdb_search_mutex); | 357 | mutex_lock(®_regdb_search_mutex); |
355 | while (!list_empty(®_regdb_search_list)) { | 358 | while (!list_empty(®_regdb_search_list)) { |
@@ -365,9 +368,7 @@ static void reg_regdb_search(struct work_struct *work) | |||
365 | r = reg_copy_regd(®dom, curdom); | 368 | r = reg_copy_regd(®dom, curdom); |
366 | if (r) | 369 | if (r) |
367 | break; | 370 | break; |
368 | mutex_lock(&cfg80211_mutex); | 371 | set_reg = true; |
369 | set_regdom(regdom); | ||
370 | mutex_unlock(&cfg80211_mutex); | ||
371 | break; | 372 | break; |
372 | } | 373 | } |
373 | } | 374 | } |
@@ -375,6 +376,11 @@ static void reg_regdb_search(struct work_struct *work) | |||
375 | kfree(request); | 376 | kfree(request); |
376 | } | 377 | } |
377 | mutex_unlock(®_regdb_search_mutex); | 378 | mutex_unlock(®_regdb_search_mutex); |
379 | |||
380 | if (set_reg) | ||
381 | set_regdom(regdom); | ||
382 | |||
383 | mutex_unlock(&cfg80211_mutex); | ||
378 | } | 384 | } |
379 | 385 | ||
380 | static DECLARE_WORK(reg_regdb_work, reg_regdb_search); | 386 | static DECLARE_WORK(reg_regdb_work, reg_regdb_search); |
@@ -680,6 +686,8 @@ static u32 map_regdom_flags(u32 rd_flags) | |||
680 | channel_flags |= IEEE80211_CHAN_NO_IBSS; | 686 | channel_flags |= IEEE80211_CHAN_NO_IBSS; |
681 | if (rd_flags & NL80211_RRF_DFS) | 687 | if (rd_flags & NL80211_RRF_DFS) |
682 | channel_flags |= IEEE80211_CHAN_RADAR; | 688 | channel_flags |= IEEE80211_CHAN_RADAR; |
689 | if (rd_flags & NL80211_RRF_NO_OFDM) | ||
690 | channel_flags |= IEEE80211_CHAN_NO_OFDM; | ||
683 | return channel_flags; | 691 | return channel_flags; |
684 | } | 692 | } |
685 | 693 | ||
@@ -901,7 +909,21 @@ static void handle_channel(struct wiphy *wiphy, | |||
901 | chan->max_antenna_gain = min(chan->orig_mag, | 909 | chan->max_antenna_gain = min(chan->orig_mag, |
902 | (int) MBI_TO_DBI(power_rule->max_antenna_gain)); | 910 | (int) MBI_TO_DBI(power_rule->max_antenna_gain)); |
903 | chan->max_reg_power = (int) MBM_TO_DBM(power_rule->max_eirp); | 911 | chan->max_reg_power = (int) MBM_TO_DBM(power_rule->max_eirp); |
904 | chan->max_power = min(chan->max_power, chan->max_reg_power); | 912 | if (chan->orig_mpwr) { |
913 | /* | ||
914 | * Devices that have their own custom regulatory domain | ||
915 | * but also use WIPHY_FLAG_STRICT_REGULATORY will follow the | ||
916 | * passed country IE power settings. | ||
917 | */ | ||
918 | if (initiator == NL80211_REGDOM_SET_BY_COUNTRY_IE && | ||
919 | wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY && | ||
920 | wiphy->flags & WIPHY_FLAG_STRICT_REGULATORY) | ||
921 | chan->max_power = chan->max_reg_power; | ||
922 | else | ||
923 | chan->max_power = min(chan->orig_mpwr, | ||
924 | chan->max_reg_power); | ||
925 | } else | ||
926 | chan->max_power = chan->max_reg_power; | ||
905 | } | 927 | } |
906 | 928 | ||
907 | static void handle_band(struct wiphy *wiphy, | 929 | static void handle_band(struct wiphy *wiphy, |
@@ -1885,6 +1907,7 @@ static void restore_custom_reg_settings(struct wiphy *wiphy) | |||
1885 | chan->flags = chan->orig_flags; | 1907 | chan->flags = chan->orig_flags; |
1886 | chan->max_antenna_gain = chan->orig_mag; | 1908 | chan->max_antenna_gain = chan->orig_mag; |
1887 | chan->max_power = chan->orig_mpwr; | 1909 | chan->max_power = chan->orig_mpwr; |
1910 | chan->beacon_found = false; | ||
1888 | } | 1911 | } |
1889 | } | 1912 | } |
1890 | } | 1913 | } |