[PATCH 2/3] base-files: failsafe: Start also CPU interface for DSA

Hauke Mehrtens hauke at hauke-m.de
Sat Jun 19 11:36:10 PDT 2021


On a DSA switch the ports have an upper device, the CPU device, e.g.
eth0. This device has to be in up state to bring up the lower devices
like lan1.

Parse the link device from "ip link show" and bring it into up stated
before bringing up the actual interface.

This is needed to make network in failsafe on systems with DSA work.

Signed-off-by: Hauke Mehrtens <hauke at hauke-m.de>
---
 package/base-files/files/lib/preinit/10_indicate_preinit | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/package/base-files/files/lib/preinit/10_indicate_preinit b/package/base-files/files/lib/preinit/10_indicate_preinit
index ae9fcfecc89e..a3bc289dd663 100644
--- a/package/base-files/files/lib/preinit/10_indicate_preinit
+++ b/package/base-files/files/lib/preinit/10_indicate_preinit
@@ -12,6 +12,12 @@ preinit_ip_config() {
 	fi
 
 	grep -q "$netdev" /proc/net/dev || return
+	
+	# Get the link interface e.g. eth0 in lan1 at eth0
+	iflink=$(ip link show dev ${netdev} |sed -nr 's/.*@([a-zA-Z0-9]*): .*/\1/p')
+	if [ -n "$iflink" ]; then
+		ip link set dev $iflink up
+	fi
 
 	if [ -n "$vid" ]; then
 		ip link add link $netdev name $1 type vlan id $vid
-- 
2.30.2




More information about the openwrt-devel mailing list