aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/net/cfg80211.h14
-rw-r--r--net/mac80211/mlme.c6
-rw-r--r--net/wireless/reg.c6
-rw-r--r--net/wireless/reg.h15
-rw-r--r--net/wireless/sme.c16
5 files changed, 33 insertions, 24 deletions
diff --git a/include/net/cfg80211.h b/include/net/cfg80211.h
index e1b92358242b..fa729979de88 100644
--- a/include/net/cfg80211.h
+++ b/include/net/cfg80211.h
@@ -1514,20 +1514,6 @@ unsigned int cfg80211_classify8021d(struct sk_buff *skb);
1514extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2); 1514extern int regulatory_hint(struct wiphy *wiphy, const char *alpha2);
1515 1515
1516/** 1516/**
1517 * regulatory_hint_11d - hints a country IE as a regulatory domain
1518 * @wiphy: the wireless device giving the hint (used only for reporting
1519 * conflicts)
1520 * @country_ie: pointer to the country IE
1521 * @country_ie_len: length of the country IE
1522 *
1523 * We will intersect the rd with the what CRDA tells us should apply
1524 * for the alpha2 this country IE belongs to, this prevents APs from
1525 * sending us incorrect or outdated information against a country.
1526 */
1527extern void regulatory_hint_11d(struct wiphy *wiphy,
1528 u8 *country_ie,
1529 u8 country_ie_len);
1530/**
1531 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain 1517 * wiphy_apply_custom_regulatory - apply a custom driver regulatory domain
1532 * @wiphy: the wireless device we want to process the regulatory domain on 1518 * @wiphy: the wireless device we want to process the regulatory domain on
1533 * @regd: the custom regulatory domain to use for this wiphy 1519 * @regd: the custom regulatory domain to use for this wiphy
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 2d5edfda867a..c9e4091cd2bb 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -1845,12 +1845,8 @@ static void ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata,
1845 bssid, ap_ht_cap_flags); 1845 bssid, ap_ht_cap_flags);
1846 } 1846 }
1847 1847
1848 /* Note: country IE parsing is done for us by cfg80211 */
1848 if (elems.country_elem) { 1849 if (elems.country_elem) {
1849 /* Note we are only reviewing this on beacons
1850 * for the BSSID we are associated to */
1851 regulatory_hint_11d(local->hw.wiphy,
1852 elems.country_elem, elems.country_elem_len);
1853
1854 /* TODO: IBSS also needs this */ 1850 /* TODO: IBSS also needs this */
1855 if (elems.pwr_constr_elem) 1851 if (elems.pwr_constr_elem)
1856 ieee80211_handle_pwr_constr(sdata, 1852 ieee80211_handle_pwr_constr(sdata,
diff --git a/net/wireless/reg.c b/net/wireless/reg.c
index 6ab56f098de1..b3ac0aace0e5 100644
--- a/net/wireless/reg.c
+++ b/net/wireless/reg.c
@@ -1822,10 +1822,7 @@ void regulatory_hint_11d(struct wiphy *wiphy,
1822 env = ENVIRON_OUTDOOR; 1822 env = ENVIRON_OUTDOOR;
1823 1823
1824 /* 1824 /*
1825 * We will run this for *every* beacon processed for the BSSID, so 1825 * We will run this only upon a successful connection on cfg80211.
1826 * we optimize an early check to exit out early if we don't have to
1827 * do anything
1828 *
1829 * We leave conflict resolution to the workqueue, where can hold 1826 * We leave conflict resolution to the workqueue, where can hold
1830 * cfg80211_mutex. 1827 * cfg80211_mutex.
1831 */ 1828 */
@@ -1878,7 +1875,6 @@ free_rd_out:
1878out: 1875out:
1879 mutex_unlock(&reg_mutex); 1876 mutex_unlock(&reg_mutex);
1880} 1877}
1881EXPORT_SYMBOL(regulatory_hint_11d);
1882 1878
1883static bool freq_is_chan_12_13_14(u16 freq) 1879static bool freq_is_chan_12_13_14(u16 freq)
1884{ 1880{
diff --git a/net/wireless/reg.h b/net/wireless/reg.h
index e37829a49dc4..662a9dad76d5 100644
--- a/net/wireless/reg.h
+++ b/net/wireless/reg.h
@@ -36,4 +36,19 @@ int regulatory_hint_found_beacon(struct wiphy *wiphy,
36 struct ieee80211_channel *beacon_chan, 36 struct ieee80211_channel *beacon_chan,
37 gfp_t gfp); 37 gfp_t gfp);
38 38
39/**
40 * regulatory_hint_11d - hints a country IE as a regulatory domain
41 * @wiphy: the wireless device giving the hint (used only for reporting
42 * conflicts)
43 * @country_ie: pointer to the country IE
44 * @country_ie_len: length of the country IE
45 *
46 * We will intersect the rd with the what CRDA tells us should apply
47 * for the alpha2 this country IE belongs to, this prevents APs from
48 * sending us incorrect or outdated information against a country.
49 */
50void regulatory_hint_11d(struct wiphy *wiphy,
51 u8 *country_ie,
52 u8 country_ie_len);
53
39#endif /* __NET_WIRELESS_REG_H */ 54#endif /* __NET_WIRELESS_REG_H */
diff --git a/net/wireless/sme.c b/net/wireless/sme.c
index 3728d2b88b25..af91192eedf5 100644
--- a/net/wireless/sme.c
+++ b/net/wireless/sme.c
@@ -13,6 +13,7 @@
13#include <net/cfg80211.h> 13#include <net/cfg80211.h>
14#include <net/rtnetlink.h> 14#include <net/rtnetlink.h>
15#include "nl80211.h" 15#include "nl80211.h"
16#include "reg.h"
16 17
17struct cfg80211_conn { 18struct cfg80211_conn {
18 struct cfg80211_connect_params params; 19 struct cfg80211_connect_params params;
@@ -320,6 +321,7 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
320 struct cfg80211_bss *bss) 321 struct cfg80211_bss *bss)
321{ 322{
322 struct wireless_dev *wdev = dev->ieee80211_ptr; 323 struct wireless_dev *wdev = dev->ieee80211_ptr;
324 u8 *country_ie;
323#ifdef CONFIG_WIRELESS_EXT 325#ifdef CONFIG_WIRELESS_EXT
324 union iwreq_data wrqu; 326 union iwreq_data wrqu;
325#endif 327#endif
@@ -401,6 +403,20 @@ void __cfg80211_connect_result(struct net_device *dev, const u8 *bssid,
401 403
402 wdev->sme_state = CFG80211_SME_CONNECTED; 404 wdev->sme_state = CFG80211_SME_CONNECTED;
403 cfg80211_upload_connect_keys(wdev); 405 cfg80211_upload_connect_keys(wdev);
406
407 country_ie = (u8 *) ieee80211_bss_get_ie(bss, WLAN_EID_COUNTRY);
408
409 if (!country_ie)
410 return;
411
412 /*
413 * ieee80211_bss_get_ie() ensures we can access:
414 * - country_ie + 2, the start of the country ie data, and
415 * - and country_ie[1] which is the IE length
416 */
417 regulatory_hint_11d(wdev->wiphy,
418 country_ie + 2,
419 country_ie[1]);
404} 420}
405 421
406void cfg80211_connect_result(struct net_device *dev, const u8 *bssid, 422void cfg80211_connect_result(struct net_device *dev, const u8 *bssid,