base-files: allow setting device and bridge macs

Add code for setting mac addresses inside board.json and rendering
them out to uci. On switches we want to have a unique MAC on each port.
With 48 port switches that would require 48 device sections in
/etc/config/network. Doing so via board.json is easier.

Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
John Crispin
2020-11-28 11:43:47 +01:00
parent f3926d233d
commit 9290539ca9
2 changed files with 42 additions and 9 deletions

View File

@@ -91,7 +91,23 @@ ucidef_set_interfaces_lan_wan() {
}
ucidef_set_bridge_device() {
json_add_string bridge "${1:switch0}"
json_select_object bridge
json_add_string name "${1:switch0}"
json_select ..
}
ucidef_set_bridge_mac() {
json_select_object bridge
json_add_string macaddr "${1}"
json_select ..
}
ucidef_set_network_device_mac() {
json_select_object "network-device"
json_select_object "${1}"
json_add_string macaddr "${2}"
json_select ..
json_select ..
}
_ucidef_add_switch_port() {