realtek: sort the port list numerically
authorBjørn Mork <bjorn@mork.no>
Mon, 29 Nov 2021 13:18:14 +0000 (14:18 +0100)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 5 Dec 2021 17:49:14 +0000 (18:49 +0100)
Mac adresses are assigned in the order given by the port list.  The
interfaces are also brought up in this order.  This target supports
devices with up to 52 ports.  Sorting these alphabetically is very
confusing, and assigning mac addresses in alphabetic order does not
match stock firmware behaviour.

Suggested-by: Sander Vanheule <sander@svanheule.net>
Signed-off-by: Bjørn Mork <bjorn@mork.no>
target/linux/realtek/base-files/etc/board.d/02_network

index 93d6d4bd1e73c76f31a5253dd4db823c57c44854..e8e3f6035d569ac682de7b1ae7a66996cc6bf435 100644 (file)
@@ -17,10 +17,7 @@ ucidef_set_poe() {
 board=$(board_name)
 board_config_update
 
-lan_list=""
-for lan in /sys/class/net/lan*; do
-       lan_list="$lan_list $(basename $lan)"
-done
+lan_list=$(ls -1 -v -d /sys/class/net/lan* | xargs -n1 basename | xargs)
 ucidef_set_bridge_device switch
 ucidef_set_interface_lan "$lan_list"