[openwrt/openwrt] base-files: Do not break on non-eth ports

LEDE Commits lede-commits at lists.infradead.org
Tue May 9 13:54:57 PDT 2023


aparcar pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/3da70c64697aa6ebe4e81b162523d68fcff97b32

commit 3da70c64697aa6ebe4e81b162523d68fcff97b32
Author: Olliver Schinagl <oliver at schinagl.nl>
AuthorDate: Thu Sep 22 12:05:00 2022 +0200

    base-files: Do not break on non-eth ports
    
    When using OpenWRT with DSA and 'lan' ports, we could get an empty
    `next_eth`. This is of course not desirable, as this causes `sh: out of
    range` errors when trying to determine which one would be greater.
    
    It turns out, that we don't even need this check at all because, when
    looking for all existin eth*s on a system, and take the highest index
    and then iterate a set of devices and rename to eth${highest_index+n},
    it is guaranteed that there will be no conflict.
    
    Fixes: b688bf83f9d6 ("base-files: rename ethernet devs on known boards")
    Signed-off-by: Olliver Schinagl <oliver at schinagl.nl>
---
 package/base-files/files/lib/preinit/10_indicate_preinit | 2 --
 1 file changed, 2 deletions(-)

diff --git a/package/base-files/files/lib/preinit/10_indicate_preinit b/package/base-files/files/lib/preinit/10_indicate_preinit
index 87a4f4da3e..a8f7758c84 100644
--- a/package/base-files/files/lib/preinit/10_indicate_preinit
+++ b/package/base-files/files/lib/preinit/10_indicate_preinit
@@ -95,8 +95,6 @@ preinit_config_board() {
 		json_select "network_device"
 			json_select "$netdev"
 				json_get_vars path path
-				next_eth="$(echo "$netdev" | grep 'eth[0-9]*' | tr -dc '[0-9]')"
-				[ "$next_eth" -gt "$max_eth" ] && max_eth=$next_eth
 				if [ -n "$path" -a -h "/sys/class/net/$netdev" ]; then
 					ip link set "$netdev" down
 					ip link set "$netdev" name eth$((++max_eth))




More information about the lede-commits mailing list