diff --git a/files/etc/config/wanmonitor b/files/etc/config/wanmonitor index 86d3529..394a88a 100644 --- a/files/etc/config/wanmonitor +++ b/files/etc/config/wanmonitor @@ -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' diff --git a/files/usr/sbin/wanmonitor b/files/usr/sbin/wanmonitor index 7108f82..b6b6ddc 100755 --- a/files/usr/sbin/wanmonitor +++ b/files/usr/sbin/wanmonitor @@ -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