[PATCH 2/3] realtek: sort the port list numerically
Bjørn Mork
bjorn at mork.no
Mon Apr 12 13:27:24 BST 2021
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.
There are probably better ways to do the numrical sorting, but this
was what I came up with...
Signed-off-by: Bjørn Mork <bjorn at mork.no>
---
target/linux/realtek/base-files/etc/board.d/02_network | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/target/linux/realtek/base-files/etc/board.d/02_network b/target/linux/realtek/base-files/etc/board.d/02_network
index 44f1f0a7a5c1..06293174b0df 100644
--- a/target/linux/realtek/base-files/etc/board.d/02_network
+++ b/target/linux/realtek/base-files/etc/board.d/02_network
@@ -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=$(for lan in /sys/class/net/lan*; do echo "${lan#/sys/class/net/lan}"; done|sort -n|sed -e 's/^/lan/'|xargs)
ucidef_set_bridge_device switch
ucidef_set_interface_lan "$lan_list"
--
2.20.1
More information about the openwrt-devel
mailing list