base-files: use "ports" array in board.json network for bridges

Bridge aggregates multiple ports so use a more accurate name ("ports")
and format (array) for storing them in board.json.

Example:

"network": {
	"lan": {
		"ports": [
			"lan1",
			"lan2",
			"lan3",
			"lan4"
		],
		"protocol": "static"
	},
	"wan": {
		"ifname": "wan",
		"protocol": "dhcp"
	}
}

Signed-off-by: Rafał Miłecki <rafal@milecki.pl>
This commit is contained in:
Rafał Miłecki
2021-05-14 11:09:57 +02:00
parent 097dc943f1
commit d42640e389
2 changed files with 20 additions and 7 deletions

View 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