ref: 7137060d85fe04cce4a1984550a636672df7df7d
parent: b8604dd760f808c8a1a6caeb529eaf065f971db2
author: cinap_lenrek <[email protected]>
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