diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2021-05-14 11:09:57 +0200 |
---|---|---|
committer | Rafał Miłecki <rafal@milecki.pl> | 2021-05-24 10:36:28 +0200 |
commit | d9603bbd3e313bf97ae2895e1f03dc9ca048225c (patch) | |
tree | d46b2aa556ae20938ba7fa622a356f50f7ab52bd /package/base-files/files/lib/functions/uci-defaults.sh | |
parent | abc2fff80fe943eb5c9a71edd3e866dc44af2533 (diff) | |
download | upstream-d9603bbd3e313bf97ae2895e1f03dc9ca048225c.tar.gz upstream-d9603bbd3e313bf97ae2895e1f03dc9ca048225c.tar.bz2 upstream-d9603bbd3e313bf97ae2895e1f03dc9ca048225c.zip |
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>
(cherry picked from commit d42640e389a8b22a31fb0061c12cd9dfbddb87b8)
Diffstat (limited to 'package/base-files/files/lib/functions/uci-defaults.sh')
-rw-r--r-- | package/base-files/files/lib/functions/uci-defaults.sh | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh index 134c527d8d..407a9c710f 100644 --- a/package/base-files/files/lib/functions/uci-defaults.sh +++ b/package/base-files/files/lib/functions/uci-defaults.sh @@ -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 |