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

DENG Qingfang dqfext at gmail.com
Sun Jun 20 01:32:16 PDT 2021


On Sat, Jun 19, 2021 at 08:36:10PM +0200, Hauke Mehrtens wrote:
> 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.


Hi Hauke,

You may instead backport the upstream commit 9d5ef190e561
("net: dsa: automatically bring up DSA master when opening user port").

> 
> 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



More information about the openwrt-devel mailing list