From d4d6c48b6e055dca5480d49d44503d1175539485 Mon Sep 17 00:00:00 2001 From: Jonas Jelonek Date: Mon, 25 Nov 2024 23:04:15 +0000 Subject: [PATCH] mediatek: filogic: support openwrt,netdev-name for renaming interfaces Add support in filogic subtarget for our own custom property `openwrt,netdev-name` in the device tree instead of `label` for renaming interfaces. This was suggested upstream to avoid potential conflicts [1]. [1] https://lore.kernel.org/netdev/20240709124503.pubki5nwjfbedhhy@skbuf/ Signed-off-by: Jonas Jelonek --- .../filogic/base-files/lib/preinit/04_set_netdev_label | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/target/linux/mediatek/filogic/base-files/lib/preinit/04_set_netdev_label b/target/linux/mediatek/filogic/base-files/lib/preinit/04_set_netdev_label index 110e023b96..2c5e420f93 100644 --- a/target/linux/mediatek/filogic/base-files/lib/preinit/04_set_netdev_label +++ b/target/linux/mediatek/filogic/base-files/lib/preinit/04_set_netdev_label @@ -10,6 +10,14 @@ set_netdev_labels() { [ "$netdev" = "$label" ] && continue ip link set "$netdev" name "$label" done + + for dir in /sys/class/net/*; do + [ -r "$dir/of_node/openwrt,netdev-name" ] || continue + read -r label < "$dir/of_node/openwrt,netdev-name" + netdev="${dir##*/}" + [ "$netdev" = "$label" ] && continue + ip link set "$netdev" name "$label" + done } boot_hook_add preinit_main set_netdev_labels -- 2.30.2