[openwrt/openwrt] wifi-scripts: correctly set basic-rates with wpa_supplicant

LEDE Commits lede-commits at lists.infradead.org
Thu Jul 10 17:59:53 PDT 2025


blocktrron pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/a854d833eabdbc3b42065927c136d75b981a1021

commit a854d833eabdbc3b42065927c136d75b981a1021
Author: David Bauer <mail at david-bauer.net>
AuthorDate: Wed Jul 9 15:24:29 2025 +0200

    wifi-scripts: correctly set basic-rates with wpa_supplicant
    
    Correctly load the list of basic_rates from UCI. basic-rates shall be
    stored as a option-list. The current code did not retrieve this list
    correctly.
    
    wpa_supplicant uses a different config option to set basic-rates
    when operating in mesh-mode.
    
    Use the correct config key and calculation for mesh-interfaces.
    
    Signed-off-by: David Bauer <mail at david-bauer.net>
---
 .../wifi-scripts/files/lib/netifd/hostapd.sh       | 25 ++++++++++++++++------
 1 file changed, 18 insertions(+), 7 deletions(-)

diff --git a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh
index 8d942194bd..c0fcf8dba0 100644
--- a/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh
+++ b/package/network/config/wifi-scripts/files/lib/netifd/hostapd.sh
@@ -1317,11 +1317,13 @@ wpa_supplicant_add_network() {
 
 	json_get_vars \
 		ssid bssid key \
-		basic_rate mcast_rate \
+		mcast_rate \
 		ieee80211w ieee80211r fils ocv \
 		multi_ap \
 		default_disabled
 
+	json_get_values basic_rate_list basic_rate
+
 	case "$auth_type" in
 		sae|owe|eap2|eap192)
 			set_default ieee80211w 2
@@ -1582,12 +1584,21 @@ wpa_supplicant_add_network() {
 	[ -n "$bssid_blacklist" ] && append network_data "bssid_blacklist=$bssid_blacklist" "$N$T"
 	[ -n "$bssid_whitelist" ] && append network_data "bssid_whitelist=$bssid_whitelist" "$N$T"
 
-	[ -n "$basic_rate" ] && {
-		local br rate_list=
-		for br in $basic_rate; do
-			wpa_supplicant_add_rate rate_list "$br"
-		done
-		[ -n "$rate_list" ] && append network_data "rates=$rate_list" "$N$T"
+	[ -n "$basic_rate_list" ] && {
+		local br rate rate_list=
+
+		if [ "$mode" = mesh ]; then
+			for br in $basic_rate_list; do
+				rate="$(($br / 100))"
+				append rate_list "$rate" " "
+			done
+			[ -n "$rate_list" ] && append network_data "mesh_basic_rates=$rate_list" "$N$T"
+		else
+			for br in $basic_rate_list; do
+				wpa_supplicant_add_rate rate_list "$br"
+			done
+			[ -n "$rate_list" ] && append network_data "rates=$rate_list" "$N$T"
+		fi
 	}
 
 	[ -n "$mcast_rate" ] && {




More information about the lede-commits mailing list