From: Robert Marko Date: Fri, 5 Jun 2026 19:26:19 +0000 (+0200) Subject: qualcommax: ipq50xx: support interface renaming X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=79443bf6c911fa53a881fad637dcb01ef297fd23;p=thirdparty%2Fopenwrt.git qualcommax: ipq50xx: support interface renaming Import the interface renaming script from filogic so we can use DTS label or openwrt,netdev-name to name interfaces from DTS on non DSA ports. Link: https://github.com/openwrt/openwrt/pull/22381 Signed-off-by: Robert Marko --- diff --git a/target/linux/qualcommax/ipq50xx/base-files/lib/preinit/04_set_netdev_label b/target/linux/qualcommax/ipq50xx/base-files/lib/preinit/04_set_netdev_label new file mode 100755 index 00000000000..29921af627c --- /dev/null +++ b/target/linux/qualcommax/ipq50xx/base-files/lib/preinit/04_set_netdev_label @@ -0,0 +1,23 @@ +set_netdev_labels() { + local dir + local label + local netdev + + for dir in /sys/class/net/*; do + [ -r "$dir/device/of_node/label" ] || continue + read -r label < "$dir/device/of_node/label" + netdev="${dir##*/}" + [ "$netdev" = "$label" ] && continue + ip link set "$netdev" name "$label" + done + + for dir in /sys/class/net/*; do + [ -r "$dir/device/of_node/openwrt,netdev-name" ] || continue + read -r label < "$dir/device/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