aboutsummaryrefslogtreecommitdiffstats
path: root/package/kernel
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@nbd.name>2022-10-10 13:26:32 +0200
committerFelix Fietkau <nbd@nbd.name>2022-10-14 13:12:49 +0200
commitdb9c4a066aadef7be304ab4bdb44f31eac5fbc0d (patch)
tree9babbd28c659b955e5dbfe9e4ed35fe0feed36f2 /package/kernel
parent4d323303e7e5743f541e3b41dfb2ac1627e8d96d (diff)
downloadupstream-db9c4a066aadef7be304ab4bdb44f31eac5fbc0d.tar.gz
upstream-db9c4a066aadef7be304ab4bdb44f31eac5fbc0d.tar.bz2
upstream-db9c4a066aadef7be304ab4bdb44f31eac5fbc0d.zip
mac80211: fix detecting highest radio* config section index
Deal with gaps by iterating over existing sections instead of counting Signed-off-by: Felix Fietkau <nbd@nbd.name>
Diffstat (limited to 'package/kernel')
-rw-r--r--package/kernel/mac80211/files/lib/wifi/mac80211.sh15
1 files changed, 10 insertions, 5 deletions
diff --git a/package/kernel/mac80211/files/lib/wifi/mac80211.sh b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
index 6aa46b0c74..c46498b0d4 100644
--- a/package/kernel/mac80211/files/lib/wifi/mac80211.sh
+++ b/package/kernel/mac80211/files/lib/wifi/mac80211.sh
@@ -135,14 +135,19 @@ get_band_defaults() {
done
}
+check_devidx() {
+ case "$1" in
+ radio[0-9]*)
+ local idx="${1#radio}"
+ [ "$devidx" -ge "${1#radio}" ] && devidx=$((idx + 1))
+ ;;
+ esac
+}
+
detect_mac80211() {
devidx=0
config_load wireless
- while :; do
- config_get type "radio$devidx" type
- [ -n "$type" ] || break
- devidx=$(($devidx + 1))
- done
+ config_foreach check_devidx wifi-device
for _dev in /sys/class/ieee80211/*; do
[ -e "$_dev" ] || continue