additional check on routes for correct gateway, not just interface because now i have more than 1 static route for that wan

master
Thomas Lynch 3 years ago
parent 0e3fcfc244
commit 0fdce44be8
  1. 5
      failover.sh

@ -14,6 +14,8 @@ WAN1_IFACE_NAME="eth0"
WAN2_IFACE_NAME="wwan0"
WAN1_LUCI_NAME="wan"
WAN2_LUCI_NAME="wanb" #currently unused
#vpn gareway
VPN_GATEWAY="139.99.201.65"
#get the current active wan interface, in case the script is started during failover
function get_active_wan {
@ -23,9 +25,10 @@ function get_active_wan {
while [ $ROUTE -le 100 ]
do
ROUTE_IFACE=`uci get network.@route[$ROUTE].interface`
ROUTE_TARGET=`uci get network.@route[$ROUTE].target`
if [ "$ROUTE_IFACE" == "uci: Entry not found" ]; then
break
elif [ "$ROUTE_IFACE" == "$WAN1_LUCI_NAME" ]; then
elif [ "$ROUTE_IFACE" == "$WAN1_LUCI_NAME" ] && [ "$ROUTE_TARGET" == "$VPN_GATEWAY" ]; then
CURRENT_METRIC=`uci get network.@route[$ROUTE].metric`
break
fi

Loading…
Cancel
Save