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 <robimarko@gmail.com>
This commit is contained in:
@@ -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
|
||||
Reference in New Issue
Block a user