|
@ -55,6 +55,7 @@ main() { |
|
|
local recovery_interval down up size |
|
|
local recovery_interval down up size |
|
|
local keep_failure_interval check_quality failure_latency |
|
|
local keep_failure_interval check_quality failure_latency |
|
|
local recovery_latency failure_loss recovery_loss |
|
|
local recovery_latency failure_loss recovery_loss |
|
|
|
|
|
local max_ttl |
|
|
|
|
|
|
|
|
[ -z "$5" ] && echo "Error: should not be started manually" && exit 0 |
|
|
[ -z "$5" ] && echo "Error: should not be started manually" && exit 0 |
|
|
|
|
|
|
|
@ -84,6 +85,7 @@ main() { |
|
|
config_get down $1 down 5 |
|
|
config_get down $1 down 5 |
|
|
config_get up $1 up 5 |
|
|
config_get up $1 up 5 |
|
|
config_get size $1 size 56 |
|
|
config_get size $1 size 56 |
|
|
|
|
|
config_get max_ttl $1 max_ttl 60 |
|
|
config_get failure_interval $1 failure_interval $interval |
|
|
config_get failure_interval $1 failure_interval $interval |
|
|
config_get_bool keep_failure_interval $1 keep_failure_interval 0 |
|
|
config_get_bool keep_failure_interval $1 keep_failure_interval 0 |
|
|
config_get recovery_interval $1 recovery_interval $interval |
|
|
config_get recovery_interval $1 recovery_interval $interval |
|
@ -120,10 +122,10 @@ main() { |
|
|
case "$track_method" in |
|
|
case "$track_method" in |
|
|
ping) |
|
|
ping) |
|
|
if [ $check_quality -eq 0 ]; then |
|
|
if [ $check_quality -eq 0 ]; then |
|
|
ping -I $DEVICE -c $count -W $timeout -s $size -q $track_ip &> /dev/null |
|
|
|
|
|
|
|
|
ping -I $DEVICE -c $count -W $timeout -s $size -t $max_ttl -q $track_ip &> /dev/null |
|
|
result=$? |
|
|
result=$? |
|
|
else |
|
|
else |
|
|
ping_result="$(ping -I $DEVICE -c $count -W $timeout -s $size -q $track_ip | tail -2)" |
|
|
|
|
|
|
|
|
ping_result="$(ping -I $DEVICE -c $count -W $timeout -s $size -t $max_ttl -q $track_ip | tail -2)" |
|
|
loss="$(echo "$ping_result" | grep "packet loss" | cut -d "," -f3 | awk '{print $1}' | sed -e 's/%//')" |
|
|
loss="$(echo "$ping_result" | grep "packet loss" | cut -d "," -f3 | awk '{print $1}' | sed -e 's/%//')" |
|
|
if [ "$loss" -eq 100 ]; then |
|
|
if [ "$loss" -eq 100 ]; then |
|
|
latency=999999 |
|
|
latency=999999 |
|
@ -237,8 +239,10 @@ main() { |
|
|
wait |
|
|
wait |
|
|
|
|
|
|
|
|
if [ "${IFDOWN_EVENT}" -eq 1 ]; then |
|
|
if [ "${IFDOWN_EVENT}" -eq 1 ]; then |
|
|
score=0 |
|
|
|
|
|
echo "offline" > /var/run/mwan3track/$1/STATUS |
|
|
echo "offline" > /var/run/mwan3track/$1/STATUS |
|
|
|
|
|
$LOG notice "Interface $1 ($2) is offline" |
|
|
|
|
|
env -i ACTION="disconnected" INTERFACE="$1" DEVICE="$2" /sbin/hotplug-call iface |
|
|
|
|
|
score=0 |
|
|
IFDOWN_EVENT=0 |
|
|
IFDOWN_EVENT=0 |
|
|
fi |
|
|
fi |
|
|
done |
|
|
done |
|
|