[openwrt/openwrt] wifi-scripts: fix missing VHT capabilities detection
LEDE Commits
lede-commits at lists.infradead.org
Tue Feb 18 23:13:38 PST 2025
blogic pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/eabea737fae4638ace92e1404279f0d2b1839a7a
commit eabea737fae4638ace92e1404279f0d2b1839a7a
Author: Sean Khan <datapronix at protonmail.com>
AuthorDate: Mon Feb 17 17:08:09 2025 -0500
wifi-scripts: fix missing VHT capabilities detection
* Add missing parentheses in the conditionals for VHT160/VHT160-80PLUS80
and VHT_MAX_MPDU capabilities. The missing parentheses caused the bitwise
AND to be evaluated after the equality comparison due to ECMA's operator
precedence, where `==` has higher precedence than `&`.
* Fix Max MPDU length detection by changing the comparison operators to
`>=` vs `>` otherwise the condition would never be met.
* Add missing default values:
- `true` value for `short_gi_80` (As it exists for `short_gi_20`, `short_gi_40`, `short_gi_160`)
- `7` for `vht_max_mpdu` (Without it the loop in MAX-MPDU-* calculation always compares with null)
* Change the `vht160` condition to `config.vht160 <= 2`. This flag is
`2` by default, and only ever set to `0` when `vht_oper_chwidth < 2`.
Signed-off-by: Sean Khan <datapronix at protonmail.com>
Link: https://github.com/openwrt/openwrt/pull/18013
Signed-off-by: John Crispin <john at phrozen.org>
---
.../files-ucode/usr/share/schema/wireless.wifi-device.json | 6 ++++--
.../wifi-scripts/files-ucode/usr/share/ucode/wifi/hostapd.uc | 8 ++++----
2 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/package/network/config/wifi-scripts/files-ucode/usr/share/schema/wireless.wifi-device.json b/package/network/config/wifi-scripts/files-ucode/usr/share/schema/wireless.wifi-device.json
index 4354b4f816..79f7ec4e76 100644
--- a/package/network/config/wifi-scripts/files-ucode/usr/share/schema/wireless.wifi-device.json
+++ b/package/network/config/wifi-scripts/files-ucode/usr/share/schema/wireless.wifi-device.json
@@ -635,7 +635,8 @@
},
"short_gi_80": {
"description": "Short GI for 80 MHz",
- "type": "boolean"
+ "type": "boolean",
+ "default": true
},
"spectrum_mgmt_required": {
"description": "Set Spectrum Management subfield in the Capability Information field",
@@ -712,7 +713,8 @@
"description": "Indicates the maximum length of A-MPDU pre-EOF padding that the STA can recv",
"type": "number",
"minimum": 0,
- "maximum": 7
+ "maximum": 7,
+ "default": 7
},
"vht_max_mpdu": {
"description": "Maximum MPDU length",
diff --git a/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/wifi/hostapd.uc b/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/wifi/hostapd.uc
index c08d26d04f..223f84f7d7 100644
--- a/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/wifi/hostapd.uc
+++ b/package/network/config/wifi-scripts/files-ucode/usr/share/ucode/wifi/hostapd.uc
@@ -338,15 +338,15 @@ function device_htmode_append(config) {
config.vht_capab += '[BF-ANTENNA-' + min(((vht_capab >> 13) & 3) + 1, config.beamformer_antennas) + ']';
/* supported Channel widths */
- if (vht_capab & 0xc == 8 && config.vht160 <= 2)
+ if ((vht_capab & 0xc) == 8 && config.vht160 <= 2)
config.vht_capab += '[VHT160-80PLUS80]';
- else if (vht_capab & 0xc == 4 && config.vht160 <= 1)
+ else if ((vht_capab & 0xc) == 4 && config.vht160 <= 2)
config.vht_capab += '[VHT160]';
/* maximum MPDU length */
- if (vht_capab & 3 > 1 && config.vht_max_mpdu > 11454)
+ if ((vht_capab & 3) > 1 && config.vht_max_mpdu >= 11454)
config.vht_capab += '[MAX-MPDU-11454]';
- else if (vht_capab & 3 && config.vht_max_mpdu > 7991)
+ else if ((vht_capab & 3) && config.vht_max_mpdu >= 7991)
config.vht_capab += '[MAX-MPDU-7991]';
/* maximum A-MPDU length exponent */
More information about the lede-commits
mailing list