aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/util.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes.berg@intel.com>2012-07-23 08:53:27 -0400
committerJohannes Berg <johannes.berg@intel.com>2012-07-31 10:18:56 -0400
commit6b77863b719a4e32909c218c0d5a83a14f4d98c5 (patch)
treed259001a7b7c4963de72cd6b3b9bf8d350d2f1c8 /net/mac80211/util.c
parent679ef4eadde1f8e55074427c0d8de2da55ca81f9 (diff)
mac80211: fix current vs. operating channel in preq/beacon
When sending probe requests, e.g. during software scanning, these will go out on the *current* channel, so their IEs need to be built from the current channel. At other times, e.g. for beacons or probe request templates, the IEs will be used on the *operating* channel and using the current channel instead might result in errors. Add the appropriate parameters to respect the difference. Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'net/mac80211/util.c')
-rw-r--r--net/mac80211/util.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/net/mac80211/util.c b/net/mac80211/util.c
index 39005eca1a59..99e4258bdb26 100644
--- a/net/mac80211/util.c
+++ b/net/mac80211/util.c
@@ -1100,6 +1100,7 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
1100 1100
1101struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata, 1101struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
1102 u8 *dst, u32 ratemask, 1102 u8 *dst, u32 ratemask,
1103 struct ieee80211_channel *chan,
1103 const u8 *ssid, size_t ssid_len, 1104 const u8 *ssid, size_t ssid_len,
1104 const u8 *ie, size_t ie_len, 1105 const u8 *ie, size_t ie_len,
1105 bool directed) 1106 bool directed)
@@ -1109,7 +1110,7 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
1109 struct ieee80211_mgmt *mgmt; 1110 struct ieee80211_mgmt *mgmt;
1110 size_t buf_len; 1111 size_t buf_len;
1111 u8 *buf; 1112 u8 *buf;
1112 u8 chan; 1113 u8 chan_no;
1113 1114
1114 /* FIXME: come up with a proper value */ 1115 /* FIXME: come up with a proper value */
1115 buf = kmalloc(200 + ie_len, GFP_KERNEL); 1116 buf = kmalloc(200 + ie_len, GFP_KERNEL);
@@ -1122,14 +1123,12 @@ struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
1122 * badly-behaved APs don't respond when this parameter is included. 1123 * badly-behaved APs don't respond when this parameter is included.
1123 */ 1124 */
1124 if (directed) 1125 if (directed)
1125 chan = 0; 1126 chan_no = 0;
1126 else 1127 else
1127 chan = ieee80211_frequency_to_channel( 1128 chan_no = ieee80211_frequency_to_channel(chan->center_freq);
1128 local->hw.conf.channel->center_freq);
1129 1129
1130 buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len, 1130 buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len, chan->band,
1131 local->hw.conf.channel->band, 1131 ratemask, chan_no);
1132 ratemask, chan);
1133 1132
1134 skb = ieee80211_probereq_get(&local->hw, &sdata->vif, 1133 skb = ieee80211_probereq_get(&local->hw, &sdata->vif,
1135 ssid, ssid_len, 1134 ssid, ssid_len,
@@ -1158,7 +1157,9 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
1158{ 1157{
1159 struct sk_buff *skb; 1158 struct sk_buff *skb;
1160 1159
1161 skb = ieee80211_build_probe_req(sdata, dst, ratemask, ssid, ssid_len, 1160 skb = ieee80211_build_probe_req(sdata, dst, ratemask,
1161 sdata->local->hw.conf.channel,
1162 ssid, ssid_len,
1162 ie, ie_len, directed); 1163 ie, ie_len, directed);
1163 if (skb) { 1164 if (skb) {
1164 if (no_cck) 1165 if (no_cck)
@@ -1810,7 +1811,8 @@ ieee80211_ht_oper_to_channel_type(struct ieee80211_ht_operation *ht_oper)
1810} 1811}
1811 1812
1812int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata, 1813int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata,
1813 struct sk_buff *skb, bool need_basic) 1814 struct sk_buff *skb, bool need_basic,
1815 enum ieee80211_band band)
1814{ 1816{
1815 struct ieee80211_local *local = sdata->local; 1817 struct ieee80211_local *local = sdata->local;
1816 struct ieee80211_supported_band *sband; 1818 struct ieee80211_supported_band *sband;
@@ -1818,7 +1820,7 @@ int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata,
1818 u8 i, rates, *pos; 1820 u8 i, rates, *pos;
1819 u32 basic_rates = sdata->vif.bss_conf.basic_rates; 1821 u32 basic_rates = sdata->vif.bss_conf.basic_rates;
1820 1822
1821 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 1823 sband = local->hw.wiphy->bands[band];
1822 rates = sband->n_bitrates; 1824 rates = sband->n_bitrates;
1823 if (rates > 8) 1825 if (rates > 8)
1824 rates = 8; 1826 rates = 8;
@@ -1841,7 +1843,8 @@ int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata,
1841} 1843}
1842 1844
1843int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata, 1845int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata,
1844 struct sk_buff *skb, bool need_basic) 1846 struct sk_buff *skb, bool need_basic,
1847 enum ieee80211_band band)
1845{ 1848{
1846 struct ieee80211_local *local = sdata->local; 1849 struct ieee80211_local *local = sdata->local;
1847 struct ieee80211_supported_band *sband; 1850 struct ieee80211_supported_band *sband;
@@ -1849,7 +1852,7 @@ int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata,
1849 u8 i, exrates, *pos; 1852 u8 i, exrates, *pos;
1850 u32 basic_rates = sdata->vif.bss_conf.basic_rates; 1853 u32 basic_rates = sdata->vif.bss_conf.basic_rates;
1851 1854
1852 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 1855 sband = local->hw.wiphy->bands[band];
1853 exrates = sband->n_bitrates; 1856 exrates = sband->n_bitrates;
1854 if (exrates > 8) 1857 if (exrates > 8)
1855 exrates -= 8; 1858 exrates -= 8;