Search Linux Wireless

[RFC v2 2/2] cfg80211: Restore orig channel values upon disconnect

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Rajkumar Manoharan <rmanohar@xxxxxxxxxxxxxxxx>

When we restore regulatory settings the world regulatory domain
is properly reset on cfg80211 (or user prefered regulatory domain)
but we were never setting back channel values for drivers that use
WIPHY_FLAG_CUSTOM_REGULATORY. Set these values up again by using
the orig_ channel parameters.

This fixes restoring custom regulatory settings upon disconnect
events.

Cc: compat@xxxxxxxxxxxxx
Cc: Paul Stewart <pstew@xxxxxxxxxx>
Cc: Rajkumar Manoharan <rmanohar@xxxxxxxxxxxxxxxx>
Cc: Senthilkumar Balasubramanian <senthilb@xxxxxxxxxxxxxxxx>
Signed-off-by: Rajkumar Manoharan <rmanohar@xxxxxxxxxxxxxxxx>
Signed-off-by: Luis R. Rodriguez <mcgrof@xxxxxxxxxxxxxxxx>
---
 net/wireless/reg.c |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 4fe396a..3d60b8d 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1801,6 +1801,7 @@ static void restore_regulatory_settings(bool reset_user)
 	struct reg_beacon *reg_beacon, *btmp;
 	struct regulatory_request *reg_request, *tmp;
 	LIST_HEAD(tmp_reg_req_list);
+	struct wiphy *wiphy;
 
 	mutex_lock(&cfg80211_mutex);
 	mutex_lock(&reg_mutex);
@@ -1853,6 +1854,25 @@ static void restore_regulatory_settings(bool reset_user)
 		kfree(last_request);
 	last_request = &core_request_world;
 
+	wiphy = wiphy_idx_to_wiphy(0);
+	if (wiphy && wiphy->flags & WIPHY_FLAG_CUSTOM_REGULATORY) {
+		struct ieee80211_supported_band *sband;
+		enum ieee80211_band band;
+		struct ieee80211_channel *chan;
+		int i;
+		for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
+			sband = wiphy->bands[band];
+			if (!sband)
+				continue;
+			for (i = 0; i < sband->n_channels; i++) {
+				chan = &sband->channels[i];
+				chan->flags = chan->orig_flags;
+				chan->max_antenna_gain = chan->orig_mag;
+				chan->max_power = chan->orig_mpwr;
+			}
+		}
+	}
+
 	mutex_unlock(&reg_mutex);
 	mutex_unlock(&cfg80211_mutex);
 
-- 
1.7.4.15.g7811d

--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux