base-files: use "ports" array in board.json network for bridges
[openwrt/openwrt.git] / package / base-files / files / lib / functions / uci-defaults.sh
index 134c527d8d5576a5626c7d747e12c26ee1dd0ff8..407a9c710ff72ffafd5162e427e2da2d73bbcd55 100644 (file)
@@ -39,7 +39,13 @@ ucidef_set_interface() {
 
                [ -n "$opt" -a -n "$val" ] || break
 
-               json_add_string "$opt" "$val"
+               [ "$opt" = "ifname" -a "$val" != "${val/ //}" ] && {
+                       json_select_array "ports"
+                       for e in $val; do json_add_string "" "$e"; done
+                       json_close_array
+               } || {
+                       json_add_string "$opt" "$val"
+               }
        done
 
        if ! json_is_a protocol string; then