aboutsummaryrefslogtreecommitdiffstats
path: root/package/base-files/files/lib/functions/uci-defaults.sh
diff options
context:
space:
mode:
authorMartin Kennedy <hurricos@gmail.com>2022-08-21 20:37:18 -0400
committerPaul Spooren <mail@aparcar.org>2022-09-10 21:16:20 +0200
commitb688bf83f9d6084b00719672ec197faf7adb493e (patch)
treea0dc842780d51cd5b8aafe8b140f24d8cb642357 /package/base-files/files/lib/functions/uci-defaults.sh
parentfee31628c422e71c5ab0985ce10e960dad3c87f2 (diff)
downloadupstream-b688bf83f9d6084b00719672ec197faf7adb493e.tar.gz
upstream-b688bf83f9d6084b00719672ec197faf7adb493e.tar.bz2
upstream-b688bf83f9d6084b00719672ec197faf7adb493e.zip
base-files: rename ethernet devs on known boards
Some platforms lack an established way to name netdevs; for example, on x86, PCIe-based ethernet interfaces will be named starting from eth0 in the order they are probed. This is a problem for many devices supported explicitly by OpenWrt which have hard-wired, standalone or on-CPU NICs not supported by DSA (which is usually used to rename the ports based on their ostensible function). To fix this, add a mapping between ethernet device name and sysfs device path to board.json; this allows us to configure ethernet device names we know about for a given board so that they correspond to external labeling. Signed-off-by: Martin Kennedy <hurricos@gmail.com>
Diffstat (limited to 'package/base-files/files/lib/functions/uci-defaults.sh')
-rw-r--r--package/base-files/files/lib/functions/uci-defaults.sh8
1 files changed, 8 insertions, 0 deletions
diff --git a/package/base-files/files/lib/functions/uci-defaults.sh b/package/base-files/files/lib/functions/uci-defaults.sh
index f96e645e73..4f5b9634bb 100644
--- a/package/base-files/files/lib/functions/uci-defaults.sh
+++ b/package/base-files/files/lib/functions/uci-defaults.sh
@@ -114,6 +114,14 @@ ucidef_set_network_device_mac() {
json_select ..
}
+ucidef_set_network_device_path() {
+ json_select_object "network_device"
+ json_select_object "$1"
+ json_add_string path "$2"
+ json_select ..
+ json_select ..
+}
+
_ucidef_add_switch_port() {
# inherited: $num $device $need_tag $want_untag $role $index $prev_role
# inherited: $n_cpu $n_ports $n_vlan $cpu0 $cpu1 $cpu2 $cpu3 $cpu4 $cpu5