Search Linux Wireless

[PATCH 03/12] cfg80211: add option for wiphys to disregard country IEs

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

 



Country IEs can be disregarded based on regulatory policy by
a driver. This is only possible, of course, if the driver already
has its own regulatory domain.

Signed-off-by: Luis R. Rodriguez <lrodriguez@xxxxxxxxxxx>
---
 include/net/wireless.h |    4 ++++
 net/wireless/reg.c     |   17 +++++++++++------
 2 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/include/net/wireless.h b/include/net/wireless.h
index 9e73aae..ea89958 100644
--- a/include/net/wireless.h
+++ b/include/net/wireless.h
@@ -181,6 +181,9 @@ struct ieee80211_supported_band {
  * struct wiphy - wireless hardware description
  * @idx: the wiphy index assigned to this item
  * @class_dev: the class device representing /sys/class/ieee80211/<wiphy-name>
+ * @ignore_country_ies: tells us the wireless core should ignore country IEs
+ *	received by itself or by other wireless drivers. This will only
+ *	apply if the driver has provided a regulatory_hint()
  * @fw_handles_regulatory: tells us the firmware for this device
  * 	has its own regulatory solution and cannot identify the
  * 	ISO / IEC 3166 alpha2 it belongs to. When this is enabled
@@ -202,6 +205,7 @@ struct wiphy {
 	u16 interface_modes;
 
 	bool fw_handles_regulatory;
+	bool ignore_country_ies;
 
 	/* If multiple wiphys are registered and you're handed e.g.
 	 * a regular netdev with assigned ieee80211_ptr, you won't
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 1a5b37a..49c9c25 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -782,12 +782,16 @@ static u32 map_regdom_flags(u32 rd_flags)
 	return channel_flags;
 }
 
-/* Follow the driver's regulatory domain, if present, unless a country
- * IE has been processed */
+/* Follow the driver's regulatory domain if a driver always prefers
+ * that. If no preference is specified we follow the driver's regulatory
+ * domain unless a country IE has been processed */
 static int reg_follow_driver_regd(struct wiphy *wiphy)
 {
-	if (last_request->initiator != REGDOM_SET_BY_COUNTRY_IE &&
-	    wiphy->regd)
+	if (!wiphy->regd)
+		return false;
+	if (wiphy->ignore_country_ies)
+		return true;
+	if (last_request->initiator != REGDOM_SET_BY_COUNTRY_IE)
 		return true;
 	return false;
 }
@@ -890,7 +894,7 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
 		 *
 		 * http://tinyurl.com/11d-clarification
 		 */
-		if (r == -ERANGE &&
+		if (!reg_follow_driver_regd(wiphy) && r == -ERANGE &&
 		    last_request->initiator == REGDOM_SET_BY_COUNTRY_IE) {
 #ifdef CONFIG_CFG80211_REG_DEBUG
 			printk(KERN_DEBUG "cfg80211: Leaving channel %d MHz "
@@ -902,7 +906,8 @@ static void handle_channel(struct wiphy *wiphy, enum ieee80211_band band,
 		/* In this case we know the country IE has at least one reg rule
 		 * for the band so we respect its band definitions */
 #ifdef CONFIG_CFG80211_REG_DEBUG
-			if (last_request->initiator == REGDOM_SET_BY_COUNTRY_IE)
+			if (!reg_follow_driver_regd(wiphy) &&
+			    last_request->initiator == REGDOM_SET_BY_COUNTRY_IE)
 				printk(KERN_DEBUG "cfg80211: Disabling "
 					"channel %d MHz on %s due to "
 					"Country IE\n",
-- 
1.6.1.rc3.51.g5832d

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