base-files: uci-defaults: allow setting the number of MACs a radio can use
authorJohn Crispin <john@phrozen.org>
Sun, 22 Sep 2024 07:06:10 +0000 (09:06 +0200)
committerJohn Crispin <john@phrozen.org>
Wed, 2 Oct 2024 13:41:33 +0000 (15:41 +0200)
Introduce new uci-default functions:
- ucidef_set_wireless_mac_count [count]

Signed-off-by: John Crispin <john@phrozen.org>
package/base-files/files/lib/functions/uci-defaults.sh

index 4a710aab2c9356919b9dc61645ee210b3792ad8a..8355099c35548302076ca3a9a85f696ac0455fad 100644 (file)
@@ -684,6 +684,27 @@ ucidef_set_country() {
        json_select ..
 }
 
+ucidef_set_wireless_mac_count() {
+       local band="$1"
+       local mac_count="$2"
+
+       case "$band" in
+       2g|5g|6g) ;;
+       *) return;;
+       esac
+       [ -z "$mac_count" ] && return
+
+       json_select_object wlan
+               json_select_object defaults
+                       json_select_object ssids
+                               json_select_object "$band"
+                                       json_add_string mac_count "$mac_count"
+                               json_select ..
+                       json_select ..
+               json_select ..
+       json_select ..
+}
+
 ucidef_set_root_password_plain() {
        local passwd="$1"
        json_select_object credentials