Commit 8dcb2003 authored by Jouni Malinen's avatar Jouni Malinen Committed by John W. Linville

mac80211: Filter ProbeReq SuppRates based on TX rate mask

If the TX rate set has been masked, the removed rates can also be
removed from the Supported Rates and Extended Supported Rates IEs in
Probe Request frames.
Signed-off-by: default avatarJouni Malinen <j@w1.fi>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 29ad2fac
...@@ -1256,7 +1256,7 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, ...@@ -1256,7 +1256,7 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
const u8 *key, u8 key_len, u8 key_idx); const u8 *key, u8 key_len, u8 key_idx);
int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
const u8 *ie, size_t ie_len, const u8 *ie, size_t ie_len,
enum ieee80211_band band); enum ieee80211_band band, u32 rate_mask);
void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
const u8 *ssid, size_t ssid_len, const u8 *ssid, size_t ssid_len,
const u8 *ie, size_t ie_len); const u8 *ie, size_t ie_len);
......
...@@ -242,7 +242,7 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_local *local) ...@@ -242,7 +242,7 @@ static bool ieee80211_prep_hw_scan(struct ieee80211_local *local)
local->hw_scan_req->n_channels = n_chans; local->hw_scan_req->n_channels = n_chans;
ielen = ieee80211_build_preq_ies(local, (u8 *)local->hw_scan_req->ie, ielen = ieee80211_build_preq_ies(local, (u8 *)local->hw_scan_req->ie,
req->ie, req->ie_len, band); req->ie, req->ie_len, band, (u32) -1);
local->hw_scan_req->ie_len = ielen; local->hw_scan_req->ie_len = ielen;
return true; return true;
......
...@@ -895,26 +895,33 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata, ...@@ -895,26 +895,33 @@ void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
const u8 *ie, size_t ie_len, const u8 *ie, size_t ie_len,
enum ieee80211_band band) enum ieee80211_band band, u32 rate_mask)
{ {
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
u8 *pos; u8 *pos;
size_t offset = 0, noffset; size_t offset = 0, noffset;
int supp_rates_len, i; int supp_rates_len, i;
u8 rates[32];
int num_rates;
int ext_rates_len;
sband = local->hw.wiphy->bands[band]; sband = local->hw.wiphy->bands[band];
pos = buffer; pos = buffer;
supp_rates_len = min_t(int, sband->n_bitrates, 8); num_rates = 0;
for (i = 0; i < sband->n_bitrates; i++) {
if ((BIT(i) & rate_mask) == 0)
continue; /* skip rate */
rates[num_rates++] = (u8) (sband->bitrates[i].bitrate / 5);
}
supp_rates_len = min_t(int, num_rates, 8);
*pos++ = WLAN_EID_SUPP_RATES; *pos++ = WLAN_EID_SUPP_RATES;
*pos++ = supp_rates_len; *pos++ = supp_rates_len;
memcpy(pos, rates, supp_rates_len);
for (i = 0; i < supp_rates_len; i++) { pos += supp_rates_len;
int rate = sband->bitrates[i].bitrate;
*pos++ = (u8) (rate / 5);
}
/* insert "request information" if in custom IEs */ /* insert "request information" if in custom IEs */
if (ie && ie_len) { if (ie && ie_len) {
...@@ -932,14 +939,12 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer, ...@@ -932,14 +939,12 @@ int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
offset = noffset; offset = noffset;
} }
if (sband->n_bitrates > i) { ext_rates_len = num_rates - supp_rates_len;
if (ext_rates_len > 0) {
*pos++ = WLAN_EID_EXT_SUPP_RATES; *pos++ = WLAN_EID_EXT_SUPP_RATES;
*pos++ = sband->n_bitrates - i; *pos++ = ext_rates_len;
memcpy(pos, rates + supp_rates_len, ext_rates_len);
for (; i < sband->n_bitrates; i++) { pos += ext_rates_len;
int rate = sband->bitrates[i].bitrate;
*pos++ = (u8) (rate / 5);
}
} }
/* insert custom IEs that go before HT */ /* insert custom IEs that go before HT */
...@@ -1018,7 +1023,9 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst, ...@@ -1018,7 +1023,9 @@ void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata, u8 *dst,
} }
buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len, buf_len = ieee80211_build_preq_ies(local, buf, ie, ie_len,
local->hw.conf.channel->band); local->hw.conf.channel->band,
sdata->rc_rateidx_mask
[local->hw.conf.channel->band]);
skb = ieee80211_probereq_get(&local->hw, &sdata->vif, skb = ieee80211_probereq_get(&local->hw, &sdata->vif,
ssid, ssid_len, ssid, ssid_len,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment