[openwrt/openwrt] wifi-scripts: ucode: fix setting supported/basic rates in config

LEDE Commits lede-commits at lists.infradead.org
Thu Aug 14 09:24:39 PDT 2025


nbd pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/6ae4115746268d9b5b420d949a78f2139e5dc91b

commit 6ae4115746268d9b5b420d949a78f2139e5dc91b
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Thu Aug 14 18:24:08 2025 +0200

    wifi-scripts: ucode: fix setting supported/basic rates in config
    
    Only set the default based on cell density, do not override.
    
    Fixes: https://github.com/openwrt/openwrt/issues/19673
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 .../files-ucode/usr/share/ucode/wifi/hostapd.uc    | 40 +++++++++++-----------
 1 file changed, 20 insertions(+), 20 deletions(-)

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 b97597a1b3..b8f67b6107 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
@@ -86,50 +86,50 @@ function device_cell_density_append(config) {
 	switch (config.hw_mode) {
 	case 'b':
 		if (config.cell_density == 1) {
-			config.supported_rates = [ 5500, 11000 ];
-			config.basic_rates = [ 5500, 11000 ];
+			config.supported_rates ??= [ 5500, 11000 ];
+			config.basic_rates ??= [ 5500, 11000 ];
 		} else if (config.cell_density > 2) {
-			config.supported_rates = [ 11000 ];
-			config.basic_rates = [ 11000 ];
+			config.supported_rates ??= [ 11000 ];
+			config.basic_rates ??= [ 11000 ];
 		}
 		;;
 	case 'g':
 		if (config.cell_density in [ 0, 1 ]) {
 			if (!config.legacy_rates) {
-				config.supported_rates = [ 6000, 9000, 12000, 18000, 24000, 36000, 48000, 54000 ];
-				config.basic_rates = [ 6000, 12000, 24000 ];
+				config.supported_rates ??= [ 6000, 9000, 12000, 18000, 24000, 36000, 48000, 54000 ];
+				config.basic_rates ??= [ 6000, 12000, 24000 ];
 			} else if (config.cell_density == 1) {
-				config.supported_rates = [ 5500, 6000, 9000, 11000, 12000, 18000, 24000, 36000, 48000, 54000 ];
-				config.basic_rates = [ 5500, 11000 ];
+				config.supported_rates ??= [ 5500, 6000, 9000, 11000, 12000, 18000, 24000, 36000, 48000, 54000 ];
+				config.basic_rates ??= [ 5500, 11000 ];
 			}
 		} else if (config.cell_density == 2 || (config.cell_density > 3 && config.legacy_rates)) {
 			if (!config.legacy_rates) {
-				config.supported_rates = [ 12000, 18000, 24000, 36000, 48000, 54000 ];
-				config.basic_rates = [ 12000, 24000 ];
+				config.supported_rates ??= [ 12000, 18000, 24000, 36000, 48000, 54000 ];
+				config.basic_rates ??= [ 12000, 24000 ];
 			} else {
-				config.supported_rates = [ 11000, 12000, 18000, 24000, 36000, 48000, 54000 ];
-				config.basic_rates = [ 11000 ];
+				config.supported_rates ??= [ 11000, 12000, 18000, 24000, 36000, 48000, 54000 ];
+				config.basic_rates ??= [ 11000 ];
 			}
 		} else if (config.cell_density > 2) {
-			 config.supported_rates = [ 24000, 36000, 48000, 54000 ];
-			 config.basic_rates = [ 24000 ];
+			 config.supported_rates ??= [ 24000, 36000, 48000, 54000 ];
+			 config.basic_rates ??= [ 24000 ];
 		}
 		;;
 	case 'a':
 		switch (config.cell_density) {
 		case 1:
-			config.supported_rates = [ 6000, 9000, 12000, 18000, 24000, 36000, 48000, 54000 ];
-			config.basic_rates = [ 6000, 12000, 24000 ];
+			config.supported_rates ??= [ 6000, 9000, 12000, 18000, 24000, 36000, 48000, 54000 ];
+			config.basic_rates ??= [ 6000, 12000, 24000 ];
 			break;
 
 		case 2:
-			config.supported_rates = [ 12000, 18000, 24000, 36000, 48000, 54000 ];
-			config.basic_rates = [ 12000, 24000 ];
+			config.supported_rates ??= [ 12000, 18000, 24000, 36000, 48000, 54000 ];
+			config.basic_rates ??= [ 12000, 24000 ];
 			break;
 
 		case 3:
-			config.supported_rates = [ 24000, 36000, 48000, 54000 ];
-			config.basic_rates = [ 24000 ];
+			config.supported_rates ??= [ 24000, 36000, 48000, 54000 ];
+			config.basic_rates ??= [ 24000 ];
 			break;
 		}
 	}




More information about the lede-commits mailing list