Wi-Fi: Add configuration option to enable legacy rates

Normally you don't want this, but there may be cases with
stupid IoT devices. They are therefore disabled by default.
This commit is contained in:
Mattias Walström
2026-06-05 14:54:53 +02:00
parent be6cf4dcd5
commit 40147a5265
4 changed files with 96 additions and 5 deletions
+2
View File
@@ -15,6 +15,8 @@ All notable changes to the project are documented in this file.
backhaul between each other without cabling
- Add band steering for dual-band access points, nudging dual-band
clients onto the faster 5/6 GHz band
- Add `legacy-rates` option to re-enable 802.11b rates on 2.4 GHz for
old IoT devices (disabled by default)
[wifi]: wifi.md
+68
View File
@@ -156,6 +156,11 @@ admin@example:/config/hardware/component/radio0/wifi-radio/> <b>leave</b>
- `channel-width`: AP channel bandwidth. Supported values are `auto`, `20MHz`,
`40MHz`, `80MHz`, and `160MHz`. Wider channels require matching hardware,
regulatory approval, and are only available on 5GHz/6GHz where supported.
- `legacy-rates`: Allow legacy 802.11b rates (1, 2, 5.5, 11 Mbps) on 2.4GHz
(default: disabled). Slow 802.11b clients consume excessive airtime and
degrade throughput for all stations, so the rates are normally suppressed.
Enable only when old 2.4GHz-only IoT devices need them to associate. No
effect on 5GHz/6GHz.
- `probe-timeout`: Seconds to wait for PHY detection at boot (default: 0). Set
to a non-zero value (e.g., 30) for USB WiFi dongles that are slow to
initialize due to firmware loading
@@ -165,6 +170,69 @@ admin@example:/config/hardware/component/radio0/wifi-radio/> <b>leave</b>
> constraints and hardware capabilities. Channel width can now be set
> explicitly for AP mode, or left at `auto` to let the driver choose.
### Bands and Channels
Each band strikes a different balance between range and capacity. The
`country-code` decides which channels are legal in your location; the
lists below are the common allocations, and your regulatory domain may
allow fewer.
**2.4 GHz**
Channels 1-13 are available in most of the world, 1-11 in the US and
Canada, and 14 in Japan (802.11b only). At 20 MHz only three channels
avoid overlap: 1, 6, and 11. A 40 MHz channel takes up most of the
band, so it is seldom worth using here.
Drawbacks:
- This is the most crowded band. It is shared with Bluetooth, Zigbee,
cordless phones, microwave ovens, and most of the neighboring Wi-Fi.
- Narrow channels and constant contention hold real throughput well
below 5 and 6 GHz.
- The upside is range: 2.4 GHz reaches further and passes through walls
better, which keeps it useful for distant clients and 2.4 GHz-only
IoT devices.
**5 GHz**
UNII-1 (channels 36-48) and UNII-3 (149-165) need no radar checks.
UNII-2 (channels 52-64 and 100-144) shares spectrum with radar and
requires DFS. ETSI regions such as the EU do not include UNII-3, so the
only non-DFS 5 GHz channels there are 36-48. This band supports 20, 40,
80, and 160 MHz, so it is the one to use for wide, fast channels.
Drawbacks:
- Shorter range than 2.4 GHz, and a weaker signal through walls and
floors.
- A DFS channel must be monitored for radar for 60 seconds (up to 10
minutes near some weather radars) before the AP may transmit, which
delays start-up. If radar appears later, the AP has to leave the
channel within 10 seconds and avoid it for 30 minutes, dropping
clients during the move.
- The widest 80 and 160 MHz channels almost always sit on DFS spectrum,
so the same radar rules apply to them.
**6 GHz**
The FCC regions open 59 channels (1, 5, 9 ... 233) across 5925-7125 MHz.
ETSI regions, including the EU, currently open only the lower part,
5945-6425 MHz (channels 1-93), for indoor use. Clients find networks on
the 15 Preferred Scanning Channels (5, 21, 37 ... 229) spaced every
80 MHz, and `auto` selects channel 37. There is no DFS in 6 GHz, so
there is no radar start-up delay.
Drawbacks:
- The shortest range and the weakest wall penetration of the three
bands.
- Only Wi-Fi 6E and newer clients can use it; older phones and IoT
devices cannot see the band at all.
- AP operation requires WPA3-Personal (SAE) with management frame
protection, so WPA2-only and open networks are rejected.
- Indoor power limits cap coverage further.
### WiFi 6 Support
WiFi 6 (802.11ax) is always enabled in AP mode on all bands, providing improved
+12 -5
View File
@@ -871,11 +871,13 @@ static void wifi_gen_radio_config(FILE *hostapd, const char *radio_name,
char ht_capab[512], vht_capab[512];
int chwidth = 0; /* 0=20/40, 1=80, 2=160 */
int ch = 0;
bool legacy_rates;
country = lydx_get_cattr(radio_node, "country-code");
band = lydx_get_cattr(radio_node, "band");
channel = lydx_get_cattr(radio_node, "channel");
width = lydx_get_cattr(radio_node, "channel-width");
legacy_rates = lydx_is_enabled(radio_node, "legacy-rates");
if (channel && strcmp(channel, "auto"))
ch = atoi(channel);
@@ -908,13 +910,18 @@ static void wifi_gen_radio_config(FILE *hostapd, const char *radio_name,
fprintf(hostapd, "hw_mode=g\n");
/*
* Disable legacy 802.11b rates (1, 2, 5.5, 11 Mbps).
* Slow clients using these rates consume excessive
* airtime, degrading performance for all clients.
* Disable legacy 802.11b rates (1, 2, 5.5, 11 Mbps)
* unless explicitly enabled via 'legacy-rates'. Slow
* 802.11b clients consume excessive airtime, degrading
* performance for all clients. When enabled, hostapd
* keeps its default rate set so old 2.4GHz-only IoT
* devices can still associate.
* Rates in 0.5 Mbps units: 60=6M, 90=9M, etc.
*/
fprintf(hostapd, "supported_rates=60 90 120 180 240 360 480 540\n");
fprintf(hostapd, "basic_rates=60 120 240\n");
if (!legacy_rates) {
fprintf(hostapd, "supported_rates=60 90 120 180 240 360 480 540\n");
fprintf(hostapd, "basic_rates=60 120 240\n");
}
} else if (!strcmp(band, "5GHz") || !strcmp(band, "6GHz")) {
/* hw_mode=a: 5GHz/6GHz with 802.11a (OFDM) as baseline */
fprintf(hostapd, "hw_mode=a\n");
+14
View File
@@ -345,6 +345,20 @@ module infix-hardware {
Only applicable in Access Point mode.";
}
leaf legacy-rates {
type boolean;
default false;
description
"Allow legacy 802.11b rates (1, 2, 5.5, 11 Mbps) on 2.4 GHz.
Disabled by default: slow 802.11b clients consume excessive
airtime and degrade throughput for all associated stations.
Enable only when old 2.4 GHz-only IoT devices require these
rates to associate.
No effect on 5 GHz or 6 GHz radios.";
}
leaf probe-timeout {
type uint8;
description