Wait after switching WAN to failover connection, in order to reduce link flapping.

This commit is contained in:
Rafal Kupiec 2020-02-29 19:33:32 +01:00
parent 36eafabbca
commit fb9acf3fec
Signed by: belliash
GPG Key ID: 4E829243E0CFE6B4
2 changed files with 3 additions and 0 deletions

View File

@ -1,5 +1,6 @@
config wanmonitor
option check_host '8.8.4.4'
option flapping '60'
option interval '5'
option sleep '0'
option wan_primary 'wan1'

View File

@ -14,6 +14,7 @@ LOGGER_INFO=6
LOGGER_DEBUG=7
CHECK_HOST=$(/sbin/uci -q get wanmonitor.@wanmonitor[0].check_host)
FLAPPING=$(/sbin/uci -q get wanmonitor.@wanmonitor[0].flapping)
INTERVAL=$(/sbin/uci -q get wanmonitor.@wanmonitor[0].interval)
SLEEP=$(/sbin/uci -q get wanmonitor.@wanmonitor[0].sleep)
WAN_PRIMARY=$(/sbin/uci -q get wanmonitor.@wanmonitor[0].wan_primary)
@ -138,6 +139,7 @@ while true; do
/sbin/route add default gw ${GATEWAY_WAN_SECONDARY} metric ${WAN_SECONDARY_METRIC:-0} ${IFNAME_WAN_SECONDARY} &>/dev/null
fi
WAN=2
sleep ${FLAPPING}
fi
else
if [ "${WAN}" = "0" ] || [ "${WAN}" = "2" ]; then