[openwrt/openwrt] airoha: support openwrt,netdev-name for renaming interfaces
LEDE Commits
lede-commits at lists.infradead.org
Wed Oct 29 14:01:27 PDT 2025
robimarko pushed a commit to openwrt/openwrt.git, branch main:
https://git.openwrt.org/130306fab93656865178c5a9d40a08885f9d70d6
commit 130306fab93656865178c5a9d40a08885f9d70d6
Author: Kenneth Kasilag <kenneth at kasilag.me>
AuthorDate: Mon Oct 20 22:53:09 2025 +0000
airoha: support openwrt,netdev-name for renaming interfaces
Add support to the airoha target for the OpenWrt-specific DT property
`openwrt,netdev-name`. In particular, this is for interfaces under
non-DSA `airoha_eth` interfaces.
This will avoid conflicts with upstream code[1]; and maintain forward
compatibility with OpenWrt configurations if/when `airoha_eth` becomes
a full DSA driver.
[1] https://lore.kernel.org/netdev/20240709124503.pubki5nwjfbedhhy@skbuf/
Borrowed from d4d6c48 (mediatek: filogic: support openwrt,netdev-name for renaming interfaces)
Signed-off-by: Kenneth Kasilag <kenneth at kasilag.me>
Link: https://github.com/openwrt/openwrt/pull/20475
Signed-off-by: Robert Marko <robimarko at gmail.com>
---
.../airoha/base-files/lib/preinit/04_set_netdev_label | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/target/linux/airoha/base-files/lib/preinit/04_set_netdev_label b/target/linux/airoha/base-files/lib/preinit/04_set_netdev_label
new file mode 100755
index 0000000000..2042d56315
--- /dev/null
+++ b/target/linux/airoha/base-files/lib/preinit/04_set_netdev_label
@@ -0,0 +1,15 @@
+set_netdev_labels() {
+ local dir
+ local label
+ local netdev
+
+ 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
More information about the lede-commits
mailing list