* [PATCH] mac80211: Filter ProbeReq SuppRates based on TX rate mask
@ 2010-08-28 16:36 Jouni Malinen
2010-08-30 7:48 ` Johannes Berg
0 siblings, 1 reply; 5+ messages in thread
From: Jouni Malinen @ 2010-08-28 16:36 UTC (permalink / raw)
To: John W. Linville, Johannes Berg; +Cc: linux-wireless
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: Jouni Malinen <j@w1.fi>
---
net/mac80211/ieee80211_i.h | 2 +-
net/mac80211/scan.c | 2 +-
net/mac80211/util.c | 37 ++++++++++++++++++++++---------------
3 files changed, 24 insertions(+), 17 deletions(-)
--- uml.orig/net/mac80211/ieee80211_i.h 2010-08-28 19:28:43.000000000 +0300
+++ uml/net/mac80211/ieee80211_i.h 2010-08-28 19:30:30.000000000 +0300
@@ -1229,7 +1229,7 @@ void ieee80211_send_auth(struct ieee8021
const u8 *key, u8 key_len, u8 key_idx);
int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
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,
const u8 *ssid, size_t ssid_len,
const u8 *ie, size_t ie_len);
--- uml.orig/net/mac80211/scan.c 2010-08-28 19:28:43.000000000 +0300
+++ uml/net/mac80211/scan.c 2010-08-28 19:30:30.000000000 +0300
@@ -243,7 +243,7 @@ static bool ieee80211_prep_hw_scan(struc
local->hw_scan_req->n_channels = n_chans;
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;
return true;
--- uml.orig/net/mac80211/util.c 2010-08-28 19:28:43.000000000 +0300
+++ uml/net/mac80211/util.c 2010-08-28 19:30:30.000000000 +0300
@@ -904,26 +904,33 @@ void ieee80211_send_auth(struct ieee8021
int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
const u8 *ie, size_t ie_len,
- enum ieee80211_band band)
+ enum ieee80211_band band, u32 rate_mask)
{
struct ieee80211_supported_band *sband;
u8 *pos;
size_t offset = 0, noffset;
int supp_rates_len, i;
+ u8 rates[32];
+ int num_rates;
+ int ext_rates_len;
sband = local->hw.wiphy->bands[band];
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++ = supp_rates_len;
-
- for (i = 0; i < supp_rates_len; i++) {
- int rate = sband->bitrates[i].bitrate;
- *pos++ = (u8) (rate / 5);
- }
+ memcpy(pos, rates, supp_rates_len);
+ pos += supp_rates_len;
/* insert "request information" if in custom IEs */
if (ie && ie_len) {
@@ -941,14 +948,12 @@ int ieee80211_build_preq_ies(struct ieee
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++ = sband->n_bitrates - i;
-
- for (; i < sband->n_bitrates; i++) {
- int rate = sband->bitrates[i].bitrate;
- *pos++ = (u8) (rate / 5);
- }
+ *pos++ = ext_rates_len;
+ memcpy(pos, rates + supp_rates_len, ext_rates_len);
+ pos += ext_rates_len;
}
/* insert custom IEs that go before HT */
@@ -1027,7 +1032,9 @@ void ieee80211_send_probe_req(struct iee
}
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,
ssid, ssid_len,
--
Jouni Malinen PGP id EFC895FA
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mac80211: Filter ProbeReq SuppRates based on TX rate mask
2010-08-28 16:36 [PATCH] mac80211: Filter ProbeReq SuppRates based on TX rate mask Jouni Malinen
@ 2010-08-30 7:48 ` Johannes Berg
2010-09-16 18:45 ` John W. Linville
2010-09-16 19:54 ` Jouni Malinen
0 siblings, 2 replies; 5+ messages in thread
From: Johannes Berg @ 2010-08-30 7:48 UTC (permalink / raw)
To: Jouni Malinen; +Cc: John W. Linville, linux-wireless
On Sat, 2010-08-28 at 19:36 +0300, Jouni Malinen wrote:
> 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.
Technically, the probe request frame indicates RX bitrates. I don't
really mind using the TX bitrates as well since typically I do think you
probably want them to be symmetric, but shouldn't that come with nl80211
updates etc. since that's all saying TX_BITRATES?
johannes
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mac80211: Filter ProbeReq SuppRates based on TX rate mask
2010-08-30 7:48 ` Johannes Berg
@ 2010-09-16 18:45 ` John W. Linville
2010-09-16 19:54 ` Jouni Malinen
1 sibling, 0 replies; 5+ messages in thread
From: John W. Linville @ 2010-09-16 18:45 UTC (permalink / raw)
To: Johannes Berg; +Cc: Jouni Malinen, linux-wireless
On Mon, Aug 30, 2010 at 09:48:10AM +0200, Johannes Berg wrote:
> On Sat, 2010-08-28 at 19:36 +0300, Jouni Malinen wrote:
> > 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.
>
> Technically, the probe request frame indicates RX bitrates. I don't
> really mind using the TX bitrates as well since typically I do think you
> probably want them to be symmetric, but shouldn't that come with nl80211
> updates etc. since that's all saying TX_BITRATES?
Ping?
--
John W. Linville Someday the world will need a hero, and you
linville@tuxdriver.com might be all we have. Be ready.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mac80211: Filter ProbeReq SuppRates based on TX rate mask
2010-08-30 7:48 ` Johannes Berg
2010-09-16 18:45 ` John W. Linville
@ 2010-09-16 19:54 ` Jouni Malinen
2010-09-16 19:55 ` Johannes Berg
1 sibling, 1 reply; 5+ messages in thread
From: Jouni Malinen @ 2010-09-16 19:54 UTC (permalink / raw)
To: Johannes Berg; +Cc: John W. Linville, linux-wireless
On Mon, Aug 30, 2010 at 09:48:10AM +0200, Johannes Berg wrote:
> On Sat, 2010-08-28 at 19:36 +0300, Jouni Malinen wrote:
> > 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.
>
> Technically, the probe request frame indicates RX bitrates. I don't
> really mind using the TX bitrates as well since typically I do think you
> probably want them to be symmetric, but shouldn't that come with nl80211
> updates etc. since that's all saying TX_BITRATES?
This change should really not be needed in the first place, but
unfortunately, P2P requires this for a compliant implementation.. The
field is really "Supported Rates", i.e., it would be used for both TX
and RX. I don't see any real point in configuring RX rates (i.e., make
hw not receive frames on one or more of the supported rates), so the TX
rate mask is the only reasonable configuration mechanism for this.
The minimum requirement (for P2P compliance) is to just remove rates 1,
2, 5.5, 11 Mbps from the list, so we could also add something to disable
802.11b rates in general if a different command would be desired.
--
Jouni Malinen PGP id EFC895FA
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] mac80211: Filter ProbeReq SuppRates based on TX rate mask
2010-09-16 19:54 ` Jouni Malinen
@ 2010-09-16 19:55 ` Johannes Berg
0 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2010-09-16 19:55 UTC (permalink / raw)
To: Jouni Malinen; +Cc: John W. Linville, linux-wireless
On Thu, 2010-09-16 at 09:54 -1000, Jouni Malinen wrote:
> On Mon, Aug 30, 2010 at 09:48:10AM +0200, Johannes Berg wrote:
> > On Sat, 2010-08-28 at 19:36 +0300, Jouni Malinen wrote:
> > > 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.
> >
> > Technically, the probe request frame indicates RX bitrates. I don't
> > really mind using the TX bitrates as well since typically I do think you
> > probably want them to be symmetric, but shouldn't that come with nl80211
> > updates etc. since that's all saying TX_BITRATES?
>
> This change should really not be needed in the first place, but
> unfortunately, P2P requires this for a compliant implementation.. The
> field is really "Supported Rates", i.e., it would be used for both TX
> and RX. I don't see any real point in configuring RX rates (i.e., make
> hw not receive frames on one or more of the supported rates), so the TX
> rate mask is the only reasonable configuration mechanism for this.
>
> The minimum requirement (for P2P compliance) is to just remove rates 1,
> 2, 5.5, 11 Mbps from the list, so we could also add something to disable
> 802.11b rates in general if a different command would be desired.
Yes, so it's not really "RX rates" but "advertised RX rates". I just
think that this fact should be made apparent in the documentation?
johannes
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-09-16 19:56 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-28 16:36 [PATCH] mac80211: Filter ProbeReq SuppRates based on TX rate mask Jouni Malinen
2010-08-30 7:48 ` Johannes Berg
2010-09-16 18:45 ` John W. Linville
2010-09-16 19:54 ` Jouni Malinen
2010-09-16 19:55 ` Johannes Berg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).