Skip to contentSkip to conversation

mac80211: handle HT PHY BSS membership selector value correctly

PATCH Superseded Christian Lamparter 3 participants 7 messages Oct 13, 2011 – Nov 9, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: handle HT PHY BSS membership selector value correctly

802.11n-2009 extends the supported rates element with a magic value which can be used to prevent legacy stations from joining the BSS.

However, this magic value is not a rate like the others and the magic can simply be ignored/skipped at this late stage.

---
pending... still testing.

---
 include/linux/ieee80211.h |    4 ++
 net/mac80211/mlme.c       |   71 ++++++++++++++++++++++++--------------------
 2 files changed, 42 insertions(+), 33 deletions(-)
include/linux/ieee80211.h +4 -0
index 48363c3..7d2c72d 100644
@@ -770,6 +770,10 @@ struct ieee80211_mgmt {
 	} u;
 } __attribute__ ((packed));
 
+/* Supported Rates flags and value encodings in 802.11n-2009 7.3.2.2 */
+#define BSS_MEMBERSHIP_SELECTOR		BIT(7)
+#define BSS_MEMBERSHIP_SELECTOR_HT_PHY	127
+
 /* mgmt header + 1 byte category code */
 #define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
 
net/mac80211/mlme.c +38 -33

90 lines not on this page · raw message

Signature · 1 line
1.7.7
#1 lore raw
Quoted 3 lines · Christian Lamparter

802.11n-2009 extends the supported rates element with a magic value which can be used to prevent legacy stations from joining the BSS.

Well, it can be used to try to make legacy stations not attempt connection, but no guarantees on them actually checking whether they support all the "basic rates".. For example, where is mac80211 (or wpa_supplicant) doing that check? ;-)

net/mac80211/mlme.c ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, · line 1467

Quoted 7 lines
net/mac80211/mlme.c +4 -0
@@ -1463,6 +1463,38 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
+static void ieee80211_get_rates(struct ieee80211_supported_band *sband,
 
+	for (i = 0; i < supp_rates_len; i++) {
+		int rate = (supp_rates[i] & 0x7f) * 5;
+		bool is_basic = !!(supp_rates[i] & BSS_MEMBERSHIP_SELECTOR);

This looks a bit odd since the BSS_MEMBERSHIP_SELECTOR is not exactly same as basic rate indicator even through they share the same bit. We used to have the magic 0x80 value here which could actually look less confusing than the mixing of basic and BSS membership terms.

net/mac80211/mlme.c ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, · line 1478

Quoted 2 lines
net/mac80211/mlme.c +2 -0
+		if (rate > 110)
+			*have_higher_than_11mbit = true;

While this is not really introduced by this patch, this looks quite bogus since the higher-than-11Mbps is then used to figure out whether this was a 802.11g network. That is not correct since a network with a single supported rate 6 Mbps should also get that behavior.. More robust mechanism would be to check for any OFDM rate being listed.

net/mac80211/mlme.c static bool ieee80211_assoc_success(struct ieee80211_work *wk, · line 1565

Quoted 6 lines
net/mac80211/mlme.c +5 -0
+	ieee80211_get_rates(sband, elems.supp_rates, elems.supp_rates_len,
+			    &rates, &basic_rates, &have_higher_than_11mbit);
 
+	ieee80211_get_rates(sband, elems.ext_supp_rates,
+			    elems.ext_supp_rates_len, &rates, &basic_rates,
+			    &have_higher_than_11mbit);

Yay for getting rid of the duplicated loop :-).

Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA
#2 lore raw
Quoted 9 lines · Jouni Malinen
Quoted 3 lines · Christian Lamparter

802.11n-2009 extends the supported rates element with a magic value which can be used to prevent legacy stations from joining the BSS.

Well, it can be used to try to make legacy stations not attempt connection, but no guarantees on them actually checking whether they support all the "basic rates".. For example, where is mac80211 (or wpa_supplicant) doing that check? ;-)

Actually, you have already implemented the check elsewhere :)

Quoted 33 lines

net/mac80211/mlme.c ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, · line 1467

Quoted 8 lines
net/mac80211/mlme.c +4 -0
@@ -1463,6 +1463,38 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
+static void ieee80211_get_rates(struct ieee80211_supported_band *sband,
 
+	for (i = 0; i < supp_rates_len; i++) {
+		int rate = (supp_rates[i] & 0x7f) * 5;
+		bool is_basic = !!(supp_rates[i] & BSS_MEMBERSHIP_SELECTOR);

This looks a bit odd since the BSS_MEMBERSHIP_SELECTOR is not exactly same as basic rate indicator even through they share the same bit. We used to have the magic 0x80 value here which could actually look less confusing than the mixing of basic and BSS membership terms.

net/mac80211/mlme.c ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, · line 1478

Quoted 2 lines
net/mac80211/mlme.c +2 -0
+		if (rate > 110)
+			*have_higher_than_11mbit = true;

While this is not really introduced by this patch, this looks quite bogus since the higher-than-11Mbps is then used to figure out whether this was a 802.11g network. That is not correct since a network with a single supported rate 6 Mbps should also get that behavior.. More robust mechanism would be to check for any OFDM rate being listed.

net/mac80211/mlme.c static bool ieee80211_assoc_success(struct ieee80211_work *wk, · line 1565

Quoted 6 lines
net/mac80211/mlme.c +5 -0
+	ieee80211_get_rates(sband, elems.supp_rates, elems.supp_rates_len,
+			    &rates, &basic_rates, &have_higher_than_11mbit);
 
+	ieee80211_get_rates(sband, elems.ext_supp_rates,
+			    elems.ext_supp_rates_len, &rates, &basic_rates,
+			    &have_higher_than_11mbit);

Yay for getting rid of the duplicated loop :-).

#3 lore raw

[Hit 'sent' by accident]

Quoted 11 lines · Christian Lamparter
Quoted 9 lines · Jouni Malinen
Quoted 3 lines · Christian Lamparter

802.11n-2009 extends the supported rates element with a magic value which can be used to prevent legacy stations from joining the BSS.

Well, it can be used to try to make legacy stations not attempt connection, but no guarantees on them actually checking whether they support all the "basic rates".. For example, where is mac80211 (or wpa_supplicant) doing that check? ;-)

Actually, you have already implemented the check in hostapd :)

commit 2944824315b7c74838c551ef08c9843e02de1d46

Author: Jouni Malinen <[email protected]>
Date:   Wed Feb 9 15:08:47 2011 +0200

line 682:

        if (hapd->iconf->ieee80211n && hapd->iconf->require_ht &&
            !(sta->flags & WLAN_STA_HT)) {
                hostapd_logger(hapd, sta->addr, HOSTAPD_MODULE_IEEE80211,
                               HOSTAPD_LEVEL_INFO, "Station does not support "
                               "mandatory HT PHY - reject association");
                return WLAN_STATUS_ASSOC_DENIED_NO_HT;
        }

so if a legacy station decides to join a require_ht = 1 BSS then the AP will refuse it with WLAN_STATUS_ASSOC_DENIED_NO_HT and the wpa_supp client will blacklist the AP because of that and it will choose a different AP for the next try.

Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
net/mac80211/mlme.c +1 -0
@@ -1463,6 +1463,38 @@ ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata,
+static void ieee80211_get_rates(struct ieee80211_supported_band *sband,
Quoted 8 lines
Quoted 8 lines

net/mac80211/mlme.c ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, · line 1475

Quoted 3 lines
net/mac80211/mlme.c +3 -0
+	for (i = 0; i < supp_rates_len; i++) {
+		int rate = (supp_rates[i] & 0x7f) * 5;
+		bool is_basic = !!(supp_rates[i] & BSS_MEMBERSHIP_SELECTOR);

This looks a bit odd since the BSS_MEMBERSHIP_SELECTOR is not exactly same as basic rate indicator even through they share the same bit. We used to have the magic 0x80 value here which could actually look less confusing than the mixing of basic and BSS membership terms.

So, what's the exact difference between then BasicRate and a MembershipRate in this context then? Is a rate called "basic rate" when it's one of the legacy e.g.: 6, 12, 24 Mbit rates [And likewise: is a rate called a MembershipRate when only in the magic 127 HT PHY case?]

Quoted 8 lines
Quoted 8 lines

net/mac80211/mlme.c ieee80211_rx_mgmt_disassoc(struct ieee80211_sub_if_data *sdata, · line 1478

Quoted 3 lines
net/mac80211/mlme.c +2 -0
+		if (rate > 110)
+			*have_higher_than_11mbit = true;

While this is not really introduced by this patch, this looks quite bogus since the higher-than-11Mbps is then used to figure out whether this was a 802.11g network. That is not correct since a network with a single supported rate 6 Mbps should also get that behavior.. More robust mechanism would be to check for any OFDM rate being listed.

Also, there's 22mbit 8-PSK PBCC [I think mwl8k supports it and some TI stuff could support it as well]. The check is questionable, but fixing it may no be trivial either. [Anyway, it's a bit outside the scope and requires another patch]

Regards,
Chr

#4 lore raw

PATCH v2 1/1 mac80211: handle HT PHY BSS membership selector value correctly

802.11n-2009 extends the supported rates element with a magic value which can be used to prevent legacy stations from joining the BSS.

However, this magic value is not a rate like the others and the magic can simply be ignored/skipped at this late stage.

---
v2:
Jouni's comment... Although I'm still not sure what is the difference between the membership and basic rate flag at this point.

---
 include/linux/ieee80211.h |    3 ++
 net/mac80211/mlme.c       |   75 +++++++++++++++++++++++++--------------------
 2 files changed, 45 insertions(+), 33 deletions(-)
include/linux/ieee80211.h +3 -0
index 48363c3..9789aed 100644
@@ -770,6 +770,9 @@ struct ieee80211_mgmt {
 	} u;
 } __attribute__ ((packed));
 
+/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
+#define BSS_MEMBERSHIP_SELECTOR_HT_PHY	127
+
 /* mgmt header + 1 byte category code */
 #define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
 
net/mac80211/mlme.c +42 -33

94 lines not on this page · raw message

Signature · 1 line
1.7.6.3
#5 lore raw

PATCH v3 1/1 mac80211: handle HT PHY BSS membership selector value correctly

From: Christian Lamparter <[email protected]>

802.11n-2009 extends the supported rates element with a magic value which can be used to prevent legacy stations from joining the BSS.

However, this magic value is not a rate like the others and the magic can simply be ignored/skipped at this late stage.

---
This is the version I've merged. The v2 version conflicted with "mac80211: use min rate as basic rate for buggy APs" (commit 3432f9233704a66e6067944339a311744243707d).

Please take a close look to make sure I didn't mess it up!

 include/linux/ieee80211.h |    3 +
 net/mac80211/mlme.c       |   90 ++++++++++++++++++++++++--------------------
 2 files changed, 52 insertions(+), 41 deletions(-)
include/linux/ieee80211.h +3 -0
index 48363c3..9789aed 100644
@@ -770,6 +770,9 @@ struct ieee80211_mgmt {
 	} u;
 } __attribute__ ((packed));
 
+/* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
+#define BSS_MEMBERSHIP_SELECTOR_HT_PHY	127
+
 /* mgmt header + 1 byte category code */
 #define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
 
net/mac80211/mlme.c +49 -41

109 lines not on this page · raw message

Signature · 1 line
1.7.4.4
#6 lore raw
In reply to Christian Lamparter
Quoted 7 lines · Christian Lamparter
Quoted 6 lines · Jouni Malinen
Quoted 4 lines

Well, it can be used to try to make legacy stations not attempt connection, but no guarantees on them actually checking whether they support all the "basic rates".. For example, where is mac80211 (or wpa_supplicant) doing that check? ;-)

Actually, you have already implemented the check in hostapd :)

That's for AP mode which does not really use the BSS membership selector in any way. The point of this mechanism is that it is supposed to allow legacy stations to not even try to associate with the AP that requires some new functionality that the station is not even aware of. For this to have any real benefit, the station would need verify whether they support all "basic rates" (i.e., these would look like basic rates for them, but BSS membership selectors for any station that is aware of the new functionality). This would allow mandating this type of new requirement on BSS by BSS basis in an ESS without causing problems to the legacy stations.

Quoted 4 lines

So, what's the exact difference between then BasicRate and a MembershipRate in this context then? Is a rate called "basic rate" when it's one of the legacy e.g.: 6, 12, 24 Mbit rates [And likewise: is a rate called a MembershipRate when only in the magic 127 HT PHY case?]

More or less (though, I would not call the membership selector a "rate"). This is not really that clearly described, but I would indeed split the values in Supported Rates element (and Extended Supported Rates elements) in that way. This obviously depends on knowing the full list of rates or full list of membership selectors (which may be the easier thing to know in full).

The exact definition of what the value is does not really matter for a legacy station since the rule for them is that they would need to support any rate (& 0x7f) that has the 0x80 bit set.

Quoted 4 lines

Also, there's 22mbit 8-PSK PBCC [I think mwl8k supports it and some TI stuff could support it as well]. The check is questionable, but fixing it may no be trivial either. [Anyway, it's a bit outside the scope and requires another patch]

Agreed.

Signature · 1 line
Jouni Malinen                                            PGP id EFC895FA