[openwrt/openwrt] mediatek: filogic: set wan label in preinit

LEDE Commits lede-commits at lists.infradead.org
Mon Jul 8 13:49:56 PDT 2024


rmilecki pushed a commit to openwrt/openwrt.git, branch openwrt-23.05:
https://git.openwrt.org/1dd9f26183c46f16e78067b4d28b126b548f3f11

commit 1dd9f26183c46f16e78067b4d28b126b548f3f11
Author: Bjørn Mork <bjorn at mork.no>
AuthorDate: Thu May 18 11:56:35 2023 +0200

    mediatek: filogic: set wan label in preinit
    
    Implement the functionality of
    target/linux/ramips/patches-5.15/700-net-ethernet-mediatek-support-net-labels.patch
    in userspace, since the driver patch has been rejected as a generic solution:
    https://github.com/openwrt/openwrt/pull/11435
    
    Signed-off-by: Bjørn Mork <bjorn at mork.no>
    (cherry picked from commit 1dd1ac2c356ad37366dde64b624e5eb489b19393)
---
 .../filogic/base-files/lib/preinit/04_set_netdev_label    | 15 +++++++++++++++
 1 file changed, 15 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
new file mode 100644
index 0000000000..f8b6f155de
--- /dev/null
+++ b/target/linux/mediatek/filogic/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/label" ] || continue
+		label="$(cat "$dir/of_node/label")"
+		netdev="$(basename $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