git: 9front

Download patch

ref: 783500051f14c2295c5aa44fc71c1bb25274a2d8
parent: 2402ff9eb2782f676bf7c143035391e94d1393aa
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Dec 7 09:48:49 EST 2023

ethermultilink: ignore link-status of primary

when link-status on secondary is lost, always switch
back to the primary regardless of if it has a link.

this works around some ethernet driver not setting
link-status consistently and wifi's that might
only indicate a link when connected to an ap.

--- a/rc/bin/ethermultilink
+++ b/rc/bin/ethermultilink
@@ -25,6 +25,7 @@
 
 # first interface is the primary
 primary=$1
+shift
 
 net=`{echo $primary | sed 's!/*[^/]*$!!g'}
 test -r $net/arp || missing $net/arp
@@ -32,9 +33,9 @@
 # now select secondary from the list depending on link status
 @{
 old=/dev/null
-new=$old
 while(){
 	# interfaces are in increasing priority order
+	new=$primary
 	for(i){
 		if(grep -s 'link: 1' $i/stats)
 			new=$i
--