mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-02-15 03:51:51 +00:00
commit
83d7ae8aa2
8 changed files with 1109 additions and 882 deletions
|
@ -8,7 +8,7 @@ LUCI_DESCRIPTION:=Luci interface for the SQM scripts queue management package wi
|
||||||
|
|
||||||
PKG_MAINTAINER:=Toke Høiland-Jørgensen <toke@toke.dk>
|
PKG_MAINTAINER:=Toke Høiland-Jørgensen <toke@toke.dk>
|
||||||
|
|
||||||
LUCI_DEPENDS:=+sqm-scripts +bash
|
LUCI_DEPENDS:=+sqm-scripts +bash +tsping
|
||||||
LUCI_PKGARCH:=all
|
LUCI_PKGARCH:=all
|
||||||
|
|
||||||
include $(TOPDIR)/feeds/luci/luci.mk
|
include $(TOPDIR)/feeds/luci/luci.mk
|
||||||
|
|
|
@ -29,8 +29,9 @@ _config_autorate() {
|
||||||
config_get upload "$1" upload
|
config_get upload "$1" upload
|
||||||
config_get max_upload "$1" max_upload
|
config_get max_upload "$1" max_upload
|
||||||
[ "${min_upload}" == "0" ] || [ "${max_upload}" == "0" ] || [ "${upload}" == "0" ] && return
|
[ "${min_upload}" == "0" ] || [ "${max_upload}" == "0" ] || [ "${upload}" == "0" ] && return
|
||||||
config_get interface "$1" interface
|
# config_get interface "$1" interface
|
||||||
cp /usr/share/sqm-autorate/cake-autorate_template.sh /usr/share/sqm-autorate/cake-autorate_config.${interface}.sh
|
# cp /usr/share/sqm-autorate/cake-autorate_template.sh /usr/share/sqm-autorate/cake-autorate_config.${interface}.sh
|
||||||
|
cp /usr/share/sqm-autorate/cake-autorate_template.sh /usr/share/sqm-autorate/cake-autorate_config.$1.sh
|
||||||
}
|
}
|
||||||
|
|
||||||
_launch_autorate() {
|
_launch_autorate() {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -7,8 +7,6 @@
|
||||||
# Author: @Lynx (OpenWrt forum)
|
# Author: @Lynx (OpenWrt forum)
|
||||||
# Inspiration taken from: @moeller0 (OpenWrt forum)
|
# Inspiration taken from: @moeller0 (OpenWrt forum)
|
||||||
|
|
||||||
cake_autorate_version="2.0.0"
|
|
||||||
|
|
||||||
# *** OUTPUT AND LOGGING OPTIONS ***
|
# *** OUTPUT AND LOGGING OPTIONS ***
|
||||||
|
|
||||||
output_processing_stats=1 # enable (1) or disable (0) output monitoring lines showing processing stats
|
output_processing_stats=1 # enable (1) or disable (0) output monitoring lines showing processing stats
|
||||||
|
@ -44,7 +42,7 @@ ul_if=wan # upload interface
|
||||||
# fping - round robin pinging (rtts)
|
# fping - round robin pinging (rtts)
|
||||||
# ping - (iputils-ping) individual pinging (rtts)
|
# ping - (iputils-ping) individual pinging (rtts)
|
||||||
# hping3 - individidual pinging (owds)
|
# hping3 - individidual pinging (owds)
|
||||||
pinger_binary=ping
|
pinger_binary=fping
|
||||||
|
|
||||||
# list of reflectors to use and number of pingers to initiate
|
# list of reflectors to use and number of pingers to initiate
|
||||||
# pingers will be initiated with reflectors in the order specified in the list
|
# pingers will be initiated with reflectors in the order specified in the list
|
||||||
|
@ -187,9 +185,9 @@ reflector_misbehaving_detection_thr=3
|
||||||
|
|
||||||
reflector_replacement_interval_mins=60 # how often to replace a random reflector from the present list
|
reflector_replacement_interval_mins=60 # how often to replace a random reflector from the present list
|
||||||
|
|
||||||
reflector_comparison_interval_mins=1 # how often to compare reflectors
|
reflector_comparison_interval_mins=1 # how often to compare reflectors
|
||||||
reflector_owd_baseline_delta_thr_ms=10 # max increase from min baseline before reflector rotated
|
reflector_sum_owd_baselines_delta_thr_ms=20 # max increase from min sum owd baselines before reflector rotated
|
||||||
reflector_owd_delta_ewma_delta_thr_ms=10 # mac increase from min delta ewma before reflector rotated
|
reflector_owd_delta_ewma_delta_thr_ms=10 # max increase from min delta ewma before reflector rotated
|
||||||
|
|
||||||
# stall is detected when the following two conditions are met:
|
# stall is detected when the following two conditions are met:
|
||||||
# 1) no reflector responses within $stall_detection_thr*$ping_response_interval_us; and
|
# 1) no reflector responses within $stall_detection_thr*$ping_response_interval_us; and
|
||||||
|
|
|
@ -24,17 +24,22 @@ sleep_s()
|
||||||
# - https://github.com/lynxthecat/cake-autorate/issues/174#issuecomment-1460057382
|
# - https://github.com/lynxthecat/cake-autorate/issues/174#issuecomment-1460057382
|
||||||
# - https://github.com/lynxthecat/cake-autorate/issues/174#issuecomment-1460074498
|
# - https://github.com/lynxthecat/cake-autorate/issues/174#issuecomment-1460074498
|
||||||
|
|
||||||
|
log_msg "DEBUG" "sleep_s"
|
||||||
local sleep_duration_s=${1} # (seconds, e.g. 0.5, 1 or 1.5)
|
local sleep_duration_s=${1} # (seconds, e.g. 0.5, 1 or 1.5)
|
||||||
read -r -t "${sleep_duration_s}" -u "${__sleep_fd}" || : &
|
log_msg "DEBUG" "sleep_s read ${sleep_duration_s} - ${__sleep_fd}"
|
||||||
wait "${!}"
|
# read -r -t "${sleep_duration_s}" -u "${__sleep_fd}" || :
|
||||||
|
read -r -t "${sleep_duration_s}" -u "${__sleep_fd}" || true
|
||||||
|
log_msg "DEBUG" "sleep_s read done"
|
||||||
}
|
}
|
||||||
|
|
||||||
sleep_us()
|
sleep_us()
|
||||||
{
|
{
|
||||||
|
log_msg "DEBUG" "WTF ?"
|
||||||
local sleep_duration_us=${1} # (microseconds)
|
local sleep_duration_us=${1} # (microseconds)
|
||||||
|
log_msg "DEBUG" "sleep_us"
|
||||||
sleep_duration_s=000000${sleep_duration_us}
|
sleep_duration_s=000000${sleep_duration_us}
|
||||||
sleep_duration_s=$((10#${sleep_duration_s::-6})).${sleep_duration_s: -6}
|
sleep_duration_s=$((10#${sleep_duration_s::-6})).${sleep_duration_s: -6}
|
||||||
|
log_msg "DEBUG" "go to sleep_s"
|
||||||
sleep_s "${sleep_duration_s}"
|
sleep_s "${sleep_duration_s}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,6 +58,19 @@ sleep_remaining_tick_time()
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_remaining_tick_time()
|
||||||
|
{
|
||||||
|
# updates sleep_duration_s remaining to end of tick duration
|
||||||
|
|
||||||
|
local t_start_us=${1} # (microseconds)
|
||||||
|
local tick_duration_us=${2} # (microseconds)
|
||||||
|
|
||||||
|
sleep_duration_us=$(( t_start_us + tick_duration_us - ${EPOCHREALTIME/./} ))
|
||||||
|
((sleep_duration_us<0)) && sleep_duration_us=0
|
||||||
|
sleep_duration_s=000000${sleep_duration_us}
|
||||||
|
sleep_duration_s=$((10#${sleep_duration_s::-6})).${sleep_duration_s: -6}
|
||||||
|
}
|
||||||
|
|
||||||
randomize_array()
|
randomize_array()
|
||||||
{
|
{
|
||||||
local -n array=${1}
|
local -n array=${1}
|
||||||
|
@ -85,171 +103,32 @@ unlock()
|
||||||
rm -f "${path:?}"
|
rm -f "${path:?}"
|
||||||
}
|
}
|
||||||
|
|
||||||
_proc_man_set_key()
|
terminate()
|
||||||
{
|
{
|
||||||
local key=${1}
|
# Send regular kill to processes and monitor terminations;
|
||||||
local value=${2}
|
# return as soon as all of the active processes terminate;
|
||||||
|
# if any processes remain active after one second, kill with fire using kill -9;
|
||||||
|
# and, finally, call wait on all processes to reap any zombie processes.
|
||||||
|
|
||||||
lock "${PROC_STATE_FILE_LOCK:?}"
|
local pids=("${@:-}")
|
||||||
trap 'unlock "${PROC_STATE_FILE_LOCK:?}"' RETURN
|
|
||||||
|
kill "${pids[@]}" 2> /dev/null
|
||||||
|
|
||||||
local entered=0
|
for((i=0; i<10; i++))
|
||||||
while read -r line; do
|
do
|
||||||
if [[ ${line} =~ ^${key}= ]]; then
|
for process in "${!pids[@]}"
|
||||||
printf '%s\n' "${key}=${value}"
|
do
|
||||||
entered=1
|
kill -0 "${pids[${process}]}" 2> /dev/null || unset "pids[${process}]"
|
||||||
else
|
done
|
||||||
printf '%s\n' "${line}"
|
[[ "${pids[*]}" ]] || return
|
||||||
fi
|
sleep_s 0.1
|
||||||
done < "${PROC_STATE_FILE:?}" > "${PROC_STATE_FILE:?}.tmp"
|
done
|
||||||
if (( entered == 0 )); then
|
|
||||||
printf '%s\n' "${key}=${value}" >> "${PROC_STATE_FILE:?}.tmp"
|
kill -9 "${pids[@]}" 2> /dev/null
|
||||||
fi
|
|
||||||
mv "${PROC_STATE_FILE:?}.tmp" "${PROC_STATE_FILE:?}"
|
wait "${@:-}"
|
||||||
return 0
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_proc_man_get_key_value()
|
|
||||||
{
|
|
||||||
local key=${1}
|
|
||||||
|
|
||||||
lock "${PROC_STATE_FILE_LOCK:?}"
|
|
||||||
trap 'unlock "${PROC_STATE_FILE_LOCK:?}"' RETURN
|
|
||||||
|
|
||||||
while read -r line; do
|
|
||||||
if [[ ${line} =~ ^${key}= ]]; then
|
|
||||||
printf '%s\n' "${line#*=}"
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
done < "${PROC_STATE_FILE:?}"
|
|
||||||
return 1
|
|
||||||
}
|
|
||||||
|
|
||||||
proc_man()
|
|
||||||
{
|
|
||||||
local action=${1}
|
|
||||||
local name=${2}
|
|
||||||
shift 2
|
|
||||||
|
|
||||||
if [[ ! -f "${PROC_STATE_FILE:?}" ]]; then
|
|
||||||
return 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# shellcheck disable=SC2311
|
|
||||||
case "${action}" in
|
|
||||||
"start")
|
|
||||||
pid=$(_proc_man_get_key_value "${name}")
|
|
||||||
if (( pid && pid > 0 )) && kill -0 "${pid}" 2> /dev/null; then
|
|
||||||
return 1;
|
|
||||||
fi
|
|
||||||
|
|
||||||
"${@}" &
|
|
||||||
local pid=${!}
|
|
||||||
_proc_man_set_key "${name}" "${pid}"
|
|
||||||
;;
|
|
||||||
"stop")
|
|
||||||
local pid
|
|
||||||
pid=$(_proc_man_get_key_value "${name}")
|
|
||||||
if ! (( pid && pid > 0 )); then
|
|
||||||
return 0;
|
|
||||||
fi
|
|
||||||
|
|
||||||
kill "${pid}" 2> /dev/null || true
|
|
||||||
|
|
||||||
# wait for process to die
|
|
||||||
killed=0
|
|
||||||
for ((i=0; i<10; i++));
|
|
||||||
do
|
|
||||||
if kill -0 "${pid}" 2> /dev/null; then
|
|
||||||
sleep_us 100000
|
|
||||||
else
|
|
||||||
killed=1
|
|
||||||
break
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# if process still alive, kill it with fire
|
|
||||||
if (( killed == 0 )); then
|
|
||||||
kill -9 "${pid}" 2> /dev/null || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
_proc_man_set_key "${name}" "-1" "${PROC_STATE_FILE:?}"
|
|
||||||
;;
|
|
||||||
"status")
|
|
||||||
local pid
|
|
||||||
pid=$(_proc_man_get_key_value "${name}")
|
|
||||||
if (( pid && pid > 0 )); then
|
|
||||||
if kill -0 "${pid}" 2> /dev/null; then
|
|
||||||
printf '%s\n' "running"
|
|
||||||
else
|
|
||||||
printf '%s\n' "dead"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
printf '%s\n' "stopped"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
"wait")
|
|
||||||
local pid
|
|
||||||
pid=$(_proc_man_get_key_value "${name}")
|
|
||||||
if (( pid && pid > 0 )); then
|
|
||||||
wait "${pid}" && return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
"signal")
|
|
||||||
shift 3
|
|
||||||
|
|
||||||
local pid
|
|
||||||
pid=$(_proc_man_get_key_value "${name}")
|
|
||||||
if (( pid && pid > 0 )); then
|
|
||||||
kill -s "${1}" "${pid}" 2>/dev/null && return 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
"initialize")
|
|
||||||
proc_man_initialize
|
|
||||||
return $?
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
printf '%s\n' "unknown action: ${action}" >&2
|
|
||||||
return 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
proc_man_initialize()
|
|
||||||
{
|
|
||||||
true > "${PROC_STATE_FILE:?}"
|
|
||||||
}
|
|
||||||
|
|
||||||
proc_man_start()
|
|
||||||
{
|
|
||||||
proc_man start "${@}"
|
|
||||||
}
|
|
||||||
|
|
||||||
proc_man_stop()
|
|
||||||
{
|
|
||||||
proc_man stop "${@}"
|
|
||||||
}
|
|
||||||
|
|
||||||
proc_man_status()
|
|
||||||
{
|
|
||||||
proc_man status "${@}"
|
|
||||||
}
|
|
||||||
|
|
||||||
proc_man_wait()
|
|
||||||
{
|
|
||||||
proc_man wait "${@}"
|
|
||||||
}
|
|
||||||
|
|
||||||
proc_man_signal()
|
|
||||||
{
|
|
||||||
proc_man signal "${@}"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (( __set_e == 1 )); then
|
if (( __set_e == 1 )); then
|
||||||
set +e
|
set +e
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
# Author: @Lynx (OpenWrt forum)
|
# Author: @Lynx (OpenWrt forum)
|
||||||
# Inspiration taken from: @moeller0 (OpenWrt forum)
|
# Inspiration taken from: @moeller0 (OpenWrt forum)
|
||||||
|
|
||||||
INTERFACE=$(basename "$0" | cut -d. -f2)
|
INTERFACE=$(basename "$1" | cut -d. -f2)
|
||||||
|
|
||||||
cake_autorate_version="2.0.0"
|
cake_autorate_version="2.0.0"
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ log_DEBUG_messages_to_syslog=0 # enable (1) or disable (0) logging of all DEBUG
|
||||||
# every write the cumulative write time and bytes associated with each log line are checked
|
# every write the cumulative write time and bytes associated with each log line are checked
|
||||||
# and if either exceeds the configured values below, the log log file is rotated
|
# and if either exceeds the configured values below, the log log file is rotated
|
||||||
log_to_file=1 # enable (1) or disable (0) output logging to file (/tmp/cake-autorate.log)
|
log_to_file=1 # enable (1) or disable (0) output logging to file (/tmp/cake-autorate.log)
|
||||||
log_file_max_time_mins=10 # maximum time between log file rotations
|
log_file_max_time_mins=10000 # maximum time between log file rotations
|
||||||
log_file_max_size_KB=2000 # maximum KB (i.e. bytes/1024) worth of log lines between log file rotations
|
log_file_max_size_KB=2000 # maximum KB (i.e. bytes/1024) worth of log lines between log file rotations
|
||||||
|
|
||||||
# log file path defaults to /var/log/
|
# log file path defaults to /var/log/
|
||||||
|
@ -46,7 +46,7 @@ ul_if=$(uci -q get sqm.${INTERFACE}.interface) # upload interface
|
||||||
# fping - round robin pinging (rtts)
|
# fping - round robin pinging (rtts)
|
||||||
# ping - (iputils-ping) individual pinging (rtts)
|
# ping - (iputils-ping) individual pinging (rtts)
|
||||||
# hping3 - individidual pinging (owds)
|
# hping3 - individidual pinging (owds)
|
||||||
pinger_binary=ping
|
pinger_binary=tsping
|
||||||
|
|
||||||
# list of reflectors to use and number of pingers to initiate
|
# list of reflectors to use and number of pingers to initiate
|
||||||
# pingers will be initiated with reflectors in the order specified in the list
|
# pingers will be initiated with reflectors in the order specified in the list
|
||||||
|
@ -54,16 +54,16 @@ pinger_binary=ping
|
||||||
# so e.g. if 6 reflectors are specified and the number of pingers is set to 4, the first 4 reflectors will be used initially
|
# so e.g. if 6 reflectors are specified and the number of pingers is set to 4, the first 4 reflectors will be used initially
|
||||||
# and the remaining 2 reflectors in the list will be used in the event any of the first 4 go bad
|
# and the remaining 2 reflectors in the list will be used in the event any of the first 4 go bad
|
||||||
# a bad reflector will go to the back of the queue on reflector rotation
|
# a bad reflector will go to the back of the queue on reflector rotation
|
||||||
reflectors=($(uci -q get omr-tracker.defaults.hosts))
|
#reflectors=$(uci -q get omr-tracker.defaults.hosts)
|
||||||
#reflectors=(
|
reflectors=(
|
||||||
#"1.1.1.1" "1.0.0.1" # Cloudflare
|
"1.1.1.1" "1.0.0.1" # Cloudflare
|
||||||
#"8.8.8.8" "8.8.4.4" # Google
|
"8.8.8.8" "8.8.4.4" # Google
|
||||||
#"9.9.9.9" "9.9.9.10" "9.9.9.11" # Quad9
|
"9.9.9.9" "9.9.9.10" "9.9.9.11" # Quad9
|
||||||
#"94.140.14.15" "94.140.14.140" "94.140.14.141" "94.140.15.15" "94.140.15.16" # AdGuard
|
"94.140.14.15" "94.140.14.140" "94.140.14.141" "94.140.15.15" "94.140.15.16" # AdGuard
|
||||||
#"64.6.65.6" "156.154.70.1" "156.154.70.2" "156.154.70.3" "156.154.70.4" "156.154.70.5" "156.154.71.1" "156.154.71.2" "156.154.71.3" "156.154.71.4" "156.154.71.5" # Neustar
|
"64.6.65.6" "156.154.70.1" "156.154.70.2" "156.154.70.3" "156.154.70.4" "156.154.70.5" "156.154.71.1" "156.154.71.2" "156.154.71.3" "156.154.71.4" "156.154.71.5" # Neustar
|
||||||
#"208.67.220.2" "208.67.220.123" "208.67.220.220" "208.67.222.2" "208.67.222.123" # OpenDNS
|
"208.67.220.2" "208.67.220.123" "208.67.220.220" "208.67.222.2" "208.67.222.123" # OpenDNS
|
||||||
#"185.228.168.9" "185.228.168.10" # CleanBrowsing
|
"185.228.168.9" "185.228.168.10" # CleanBrowsing
|
||||||
#)
|
)
|
||||||
|
|
||||||
randomize_reflectors=1 # enable (1) or disable (0) randomization of reflectors on startup
|
randomize_reflectors=1 # enable (1) or disable (0) randomization of reflectors on startup
|
||||||
|
|
||||||
|
@ -71,14 +71,18 @@ randomize_reflectors=1 # enable (1) or disable (0) randomization of reflectors o
|
||||||
# to avoid excessive CPU use (proportional with ping interval / number of pingers)
|
# to avoid excessive CPU use (proportional with ping interval / number of pingers)
|
||||||
# and to avoid abusive network activity (excessive ICMP frequency to one reflector)
|
# and to avoid abusive network activity (excessive ICMP frequency to one reflector)
|
||||||
# The author has found an ICMP rate of 1/(0.2/4) = 20 Hz to give satisfactory performance on 4G
|
# The author has found an ICMP rate of 1/(0.2/4) = 20 Hz to give satisfactory performance on 4G
|
||||||
no_pingers=$(uci -q get sqm.${INTERFACE}.no_pingers || echo "6") # number of pingers to maintain
|
no_pingers=$(uci -q get sqm.${INTERFACE}.no_pingers || echo "4") # number of pingers to maintain
|
||||||
reflector_ping_interval_s=$(uci -q get sqm.${INTERFACE}.reflector_ping_interval_s || echo "0.3") # (seconds, e.g. 0.2s or 2s)
|
reflector_ping_interval_s=$(uci -q get sqm.${INTERFACE}.reflector_ping_interval_s || echo "0.5") # (seconds, e.g. 0.2s or 2s)
|
||||||
|
|
||||||
# delay threshold in ms is the extent of OWD increase to classify as a delay
|
# delay threshold in ms is the extent of OWD increase to classify as a delay
|
||||||
# these are automatically adjusted based on maximum on the wire packet size
|
# these are automatically adjusted based on maximum on the wire packet size
|
||||||
# (adjustment significant at sub 12Mbit/s rates, else negligible)
|
# (adjustment significant at sub 12Mbit/s rates, else negligible)
|
||||||
dl_delay_thr_ms=$(uci -q get sqm.${INTERFACE}.delay_thr_ms || echo "30") # (milliseconds)
|
latency=$(uci -q get sqm.${INTERFACE}.delay_thr_ms)
|
||||||
ul_delay_thr_ms=$(uci -q get sqm.${INTERFACE}.delay_thr_ms || echo "30") # (milliseconds)
|
[ -z "$latency" ] && latency="$(($(ping -B -w 5 -c 5 -I ${ul_if} 1.1.1.1 | cut -d '/' -s -f6 | cut -d '.' -f1 | tr -d '\n' 2>/dev/null)+30))"
|
||||||
|
[ -z "$latency" ] && latency="100"
|
||||||
|
logger -t "sqm" "latency $INTERFACE: $latency"
|
||||||
|
dl_delay_thr_ms="$latency" # (milliseconds)
|
||||||
|
ul_delay_thr_ms="$latency" # (milliseconds)
|
||||||
|
|
||||||
# Set either of the below to 0 to adjust one direction only
|
# Set either of the below to 0 to adjust one direction only
|
||||||
# or alternatively set both to 0 to simply use cake-autorate to monitor a connection
|
# or alternatively set both to 0 to simply use cake-autorate to monitor a connection
|
||||||
|
@ -97,11 +101,11 @@ max_ul_shaper_rate_kbps=$(uci -q get sqm.${INTERFACE}.max_upload || echo "35000"
|
||||||
# pausing all active pingers when connection is not in active use
|
# pausing all active pingers when connection is not in active use
|
||||||
enable_sleep_function=$(uci -q get sqm.${INTERFACE}.enable_sleep_functions || echo "1") # enable (1) or disable (0) sleep functonality
|
enable_sleep_function=$(uci -q get sqm.${INTERFACE}.enable_sleep_functions || echo "1") # enable (1) or disable (0) sleep functonality
|
||||||
connection_active_thr_kbps=$(uci -q get sqm.${INTERFACE}.connection_active_thr_kpbs || echo "1000") # threshold in Kbit/s below which dl/ul is considered idle
|
connection_active_thr_kbps=$(uci -q get sqm.${INTERFACE}.connection_active_thr_kpbs || echo "1000") # threshold in Kbit/s below which dl/ul is considered idle
|
||||||
sustained_idle_sleep_thr_s=$(uci -q get sqm.${INTERFACE}.sustained_idle_sleep_thr || echo "60.0") # time threshold to put pingers to sleep on sustained dl/ul achieved rate < idle_thr (seconds)
|
sustained_idle_sleep_thr_s=$(uci -q get sqm.${INTERFACE}.sustained_idle_sleep_thr || echo "150.0") # time threshold to put pingers to sleep on sustained dl/ul achieved rate < idle_thr (seconds)
|
||||||
|
|
||||||
min_shaper_rates_enforcement=$(uci -q get sqm.${INTERFACE}.min_shaper_rates_enforcement || echo "0") # enable (1) or disable (0) dropping down to minimum shaper rates on connection idle or stall
|
min_shaper_rates_enforcement=$(uci -q get sqm.${INTERFACE}.min_shaper_rates_enforcement || echo "0") # enable (1) or disable (0) dropping down to minimum shaper rates on connection idle or stall
|
||||||
|
|
||||||
startup_wait_s=$(uci -q get sqm.${INTERFACE}.startup_wait_s || echo "60.0") # number of seconds to wait on startup (e.g. to wait for things to settle on router reboot)
|
startup_wait_s=$(uci -q get sqm.${INTERFACE}.startup_wait_s || echo "0.0") # number of seconds to wait on startup (e.g. to wait for things to settle on router reboot)
|
||||||
|
|
||||||
# *** ADVANCED CONFIGURATION OPTIONS ***
|
# *** ADVANCED CONFIGURATION OPTIONS ***
|
||||||
|
|
||||||
|
@ -126,7 +130,8 @@ log_file_export_compress=1 # compress log file exports using gzip and append .gz
|
||||||
# Unfortunately, fping does not offer a command line switch to set
|
# Unfortunately, fping does not offer a command line switch to set
|
||||||
# the firewall mark.
|
# the firewall mark.
|
||||||
# WARNING: no error checking so use at own risk!
|
# WARNING: no error checking so use at own risk!
|
||||||
ping_extra_args="- B -I ${INTERFACE}"
|
#ping_extra_args="-B -I ${INTERFACE}"
|
||||||
|
ping_extra_args="-i ${ul_if}"
|
||||||
|
|
||||||
# a wrapper for ping binary - used as a prefix for the real command
|
# a wrapper for ping binary - used as a prefix for the real command
|
||||||
# e.g., when using mwan3, it is recommended to set it like this:
|
# e.g., when using mwan3, it is recommended to set it like this:
|
||||||
|
@ -172,13 +177,13 @@ high_load_thr=0.75 # % of currently set bandwidth for detecting high load
|
||||||
# the bufferbloat refractory period should be greater than the
|
# the bufferbloat refractory period should be greater than the
|
||||||
# average time it would take to replace the bufferbloat
|
# average time it would take to replace the bufferbloat
|
||||||
# detection window with new samples upon a bufferbloat event
|
# detection window with new samples upon a bufferbloat event
|
||||||
bufferbloat_refractory_period_ms=300 # (milliseconds)
|
bufferbloat_refractory_period_ms=2000 # (milliseconds)
|
||||||
decay_refractory_period_ms=1000 # (milliseconds)
|
decay_refractory_period_ms=1000 # (milliseconds)
|
||||||
|
|
||||||
# interval for checking reflector health
|
# interval for checking reflector health
|
||||||
reflector_health_check_interval_s=1.0 # (seconds)
|
reflector_health_check_interval_s=1.0 # (seconds)
|
||||||
# deadline for reflector response not to be classified as an offence against reflector
|
# deadline for reflector response not to be classified as an offence against reflector
|
||||||
reflector_response_deadline_s=1.0 # (seconds)
|
reflector_response_deadline_s=2.0 # (seconds)
|
||||||
|
|
||||||
# reflector misbehaving is detected when $reflector_misbehaving_detection_thr samples
|
# reflector misbehaving is detected when $reflector_misbehaving_detection_thr samples
|
||||||
# out of the last (reflector misbehaving detection window) samples are offences
|
# out of the last (reflector misbehaving detection window) samples are offences
|
||||||
|
@ -190,7 +195,7 @@ reflector_misbehaving_detection_thr=3
|
||||||
reflector_replacement_interval_mins=60 # how often to replace a random reflector from the present list
|
reflector_replacement_interval_mins=60 # how often to replace a random reflector from the present list
|
||||||
|
|
||||||
reflector_comparison_interval_mins=1 # how often to compare reflectors
|
reflector_comparison_interval_mins=1 # how often to compare reflectors
|
||||||
reflector_owd_baseline_delta_thr_ms=10 # max increase from min baseline before reflector rotated
|
reflector_sum_owd_baseline_delta_thr_ms=30 # max increase from min sum owd baselines before reflector rotated
|
||||||
reflector_owd_delta_ewma_delta_thr_ms=10 # mac increase from min delta ewma before reflector rotated
|
reflector_owd_delta_ewma_delta_thr_ms=10 # mac increase from min delta ewma before reflector rotated
|
||||||
|
|
||||||
# stall is detected when the following two conditions are met:
|
# stall is detected when the following two conditions are met:
|
||||||
|
@ -199,7 +204,7 @@ reflector_owd_delta_ewma_delta_thr_ms=10 # mac increase from min delta ewma be
|
||||||
stall_detection_thr=5
|
stall_detection_thr=5
|
||||||
connection_stall_thr_kbps=10
|
connection_stall_thr_kbps=10
|
||||||
|
|
||||||
global_ping_response_timeout_s=10.0 # timeout to set shaper rates to min on no ping response whatsoever (seconds)
|
global_ping_response_timeout_s=100.0 # timeout to set shaper rates to min on no ping response whatsoever (seconds)
|
||||||
|
|
||||||
if_up_check_interval_s=10.0 # time to wait before re-checking if rx/tx bytes files exist (e.g. from boot state or sleep recovery)
|
if_up_check_interval_s=10.0 # time to wait before re-checking if rx/tx bytes files exist (e.g. from boot state or sleep recovery)
|
||||||
|
|
||||||
|
|
|
@ -1752,7 +1752,7 @@ if [ "$(pgrep -f openmptcprouter-vps)" = "" ] && ([ "$(uci -q show openmptcprout
|
||||||
sleep 5
|
sleep 5
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$(uci -q get sqm.${OMR_TRACKER_INTERFACE}.enabled)" = "1" ] && [ "$(uci -q get sqm.${OMR_TRACKER_INTERFACE}.autorate)" = "1" ] && [ -n "$OMR_TRACKER_DEVICE" ] && [ -z $(pgrep -f "autorate.*${OMR_TRACKER_DEVICE}") ]; then
|
if [ "$(uci -q get sqm.${OMR_TRACKER_INTERFACE}.enabled)" = "1" ] && [ "$(uci -q get sqm.${OMR_TRACKER_INTERFACE}.autorate)" = "1" ] && [ -n "$OMR_TRACKER_DEVICE" ] && [ -z $(pgrep -f "autorate_config.${OMR_TRACKER_INTERFACE}") ]; then
|
||||||
/etc/init.d/sqm-autorate restart >/dev/null 2>&1
|
/etc/init.d/sqm-autorate restart >/dev/null 2>&1
|
||||||
sleep 5
|
sleep 5
|
||||||
fi
|
fi
|
||||||
|
|
38
tsping/Makefile
Normal file
38
tsping/Makefile
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
|
PKG_NAME:=tsping
|
||||||
|
PKG_VERSION:=0.2.3
|
||||||
|
PKG_RELEASE:=1
|
||||||
|
|
||||||
|
PKG_SOURCE_PROTO:=git
|
||||||
|
PKG_SOURCE_URL:=https://github.com/Lochnair/tsping
|
||||||
|
PKG_SOURCE_VERSION:=2560d79c95154d2e2c9aa6725135f6fc5cf091d7
|
||||||
|
|
||||||
|
PKG_MAINTAINER:=Nils Andreas Svee <contact@lochnair.net>
|
||||||
|
PKG_LICENSE:=BSD-3-Clause
|
||||||
|
PKG_LICENSE_FILES:=LICENSE.md
|
||||||
|
|
||||||
|
PKG_INSTALL:=1
|
||||||
|
PKG_BUILD_PARALLEL:=1
|
||||||
|
PKG_BUILD_DEPENDS:=!USE_GLIBC:argp-standalone
|
||||||
|
|
||||||
|
include $(INCLUDE_DIR)/package.mk
|
||||||
|
include $(INCLUDE_DIR)/meson.mk
|
||||||
|
|
||||||
|
define Package/tsping
|
||||||
|
SECTION:=utils
|
||||||
|
CATEGORY:=Utilities
|
||||||
|
TITLE:=Utility for sending timestamp pings
|
||||||
|
URL:=https://github.com/Lochnair/tsping
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/tsping/description
|
||||||
|
A simple application to send ICMP echo/timestamp requests
|
||||||
|
endef
|
||||||
|
|
||||||
|
define Package/tsping/install
|
||||||
|
$(INSTALL_DIR) $(1)/usr/sbin
|
||||||
|
$(INSTALL_BIN) $(MESON_BUILD_DIR)/tsping $(1)/usr/sbin/
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,tsping))
|
Loading…
Reference in a new issue