Index | Thread | Search

From:
Mark Kettenis <mark.kettenis@xs4all.nl>
Subject:
Re: fix net80211 802.11g compatibility check
To:
Stefan Sperling <stsp@stsp.name>
Cc:
tech@openbsd.org
Date:
Thu, 31 Jul 2025 12:48:49 +0200

Download raw body.

Thread
> Date: Thu, 31 Jul 2025 12:26:18 +0200
> From: Stefan Sperling <stsp@stsp.name>
> 
> I have a WIP fix for qwx which relies on ieee80211_iserp_sta() to
> detect whether an AP supports 802.11g, rather than 802.11b only.
> 
> And I encountered an access point which qwx could not connect to when
> my WIP fix is applied.
> 
> This AP allows 11g clients but blocks 11b clients by not announcing
> support for 11b rates in its beacons.
> 
> ieee80211_iserp_sta() is supposed to detect whether a peer supports ERP/11g.
> Yet it will return false for APs which do not announce support for any
> of the 11b (pre-11g) data rates in their beacons.
> 
> This code seems to be based on the last sentence in this paragraph from
>  the 802.11 standard (I am from quoting from the 2012 / 11n version):
> 
>   18. Extended Rate PHY (ERP) specification
> 
>   [...]
> 
>   18.1.2 Introduction
> 
>   The ERP builds on the payload data rates of 1 and 2 Mb/s, as described
>   in Clause 15, that use DSSS modulation and builds on the payload data
>   rates of 1, 2, 5.5, and 11 Mb/s, as described in Clause 16, that use
>   DSSS and CCK.
> 
>   The ERP draws from Clause 17 to provide additional payload data rates
>   of 6, 9, 12, 18, 24, 36, 48, and 54 Mb/s. Of these rates, transmission
>   and reception capability for 1, 2, 5.5, 6, 11, 12, and 24 Mb/s data
>   rates is mandatory.
> 
> To summarize:
> 
> ERP rates are the OFDM rates: 6, 9, 12, 18, 24, 36, 48, and 54 Mb/s.
> These rates were introduced with 11g. The mandatory ones are: 6, 12, and 24.
> 
> The CCK rates are 1, 2, 5.5, and 11. These were already present in 11b.
> They are not relevant when checking for EP/11g support. The mandatory
> ones are 1, 2, and 5. Current APs may choose to disable support even
> for the mandatory ones, which makes ieee80211_iserp_sta() return false
> even though the AP supports ERP/11g.
> 
> Fix below. ok?

makes sense to me; ok kettenis@

> (Rate arrays in beacons and in our code represent data rates in units
> of 512Kb/s. Divide by 2 to get Mbit/s: 12 -> 6, 24 -> 12, 48 -> 24)
> 
> (Clause 18 used to be called Clause 19 in earlier standard revisions.)
> 
> M  sys/net80211/ieee80211_node.c  |  7+  3-
> 
> 1 file changed, 7 insertions(+), 3 deletions(-)
> 
> commit - d640f8310f2c7fb76506646c2f836023d40fa2ae
> commit + 8716e27d44c511046d01f245922e9015a72552fb
> blob - ccf47c6cf6750600db391afa5be8d4e792b8821c
> blob + f38a0917731c91e2e68fe3c8350ac847e19c1fb6
> --- sys/net80211/ieee80211_node.c
> +++ sys/net80211/ieee80211_node.c
> @@ -2706,13 +2706,17 @@ ieee80211_node_addba_request_ac_vo_to(void *arg)
>  int
>  ieee80211_iserp_sta(const struct ieee80211_node *ni)
>  {
> -	static const u_int8_t rates[] = { 2, 4, 11, 22, 12, 24, 48 };
> +	static const u_int8_t rates[] = { 12, 24, 48 };
>  	const struct ieee80211_rateset *rs = &ni->ni_rates;
>  	int i, j;
>  
>  	/*
> -	 * A STA supports ERP operation if it includes all the Clause 19
> -	 * mandatory rates in its supported rate set.
> +	 * A STA supports ERP operation if it includes all mandatory legacy
> +	 * OFDM rates in its supported rate set.
> +	 * We used to check for mandatory CCK rates here as well. However,
> +	 * there are APs which deliberately disable CCK rates to prevent
> +	 * 11b clients from connecting. We want to detect such APs as 11g,
> +	 * because otherwise we will fail to connect to them.
>  	 */
>  	for (i = 0; i < nitems(rates); i++) {
>  		for (j = 0; j < rs->rs_nrates; j++) {
> 
>