From: Johannes Truschnigg Date: Wed, 16 Mar 2022 21:03:39 +0000 (+0100) Subject: Add config vars for BW_{MIN,MAX}_RX X-Git-Url: https://johannes.truschnigg.info/gitweb/?a=commitdiff_plain;h=a31d867134de22a2f4ca8f12064f8f6ad360d82b;p=sqm_lagthrottle Add config vars for BW_{MIN,MAX}_RX --- diff --git a/lagdetect.sh b/lagdetect.sh index e68d07b..3a36802 100755 --- a/lagdetect.sh +++ b/lagdetect.sh @@ -5,11 +5,13 @@ PING_PEERS='1.1.1.1 8.8.8.8' PING_GW_IPV4=no PING_GW_IPV6=no PING_SLOTS_PER_PEER=5 -PING_INTERVAL=500 +PING_INTERVAL=300 STATS_RX='/sys/class/net/eth1/statistics/rx_bytes' IFACE_RX='eth1' STATS_TX='/sys/class/net/eth1/statistics/tx_bytes' IFACE_TX='eth1' +BW_MIN_RX=10000 #Kbps +BW_MAX_RX=30000 #Kbps @@ -105,6 +107,20 @@ then fi +if ! __is_int "${BW_MIN_RX}" +then + printf 'FATAL: Invalid value for PING_SLOTS_PER_PEER\n' + exit 1 +fi + + +if ! __is_int "${BW_MAX_RX}" +then + printf 'FATAL: Invalid value for PING_SLOTS_PER_PEER\n' + exit 1 +fi + + set -u @@ -114,6 +130,8 @@ fping --loop --retry=1 --size=1280 --period="${PING_INTERVAL}" --random ${PING_P -v IFACE_RX="${IFACE_RX}" \ -v STATS_TX="${STATS_TX}" \ -v IFACE_TX="${IFACE_TX}" \ + -v BW_MIN_RX="${BW_MIN_RX}" \ + -v BW_MAX_RX="${BW_MAX_RX}" \ -v THRESHOLD="${THRESHOLD}" \ -v PINGSLOTS="${PING_SLOTS_PER_PEER}" \ -v FUDGE="${FUDGE_MS}" \