1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-02-15 03:51:51 +00:00

Merge pull request #266 from Ysurac/develop

sync
This commit is contained in:
suyuan 2022-08-18 17:01:29 +08:00 committed by GitHub
commit abe7648771
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 453 additions and 75 deletions

View file

@ -1,12 +1,12 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=bcm27xx-eeprom PKG_NAME:=bcm27xx-eeprom
PKG_VERSION:=47976e4409c6999a8e211976c75c60a97c90275c PKG_VERSION:=v2022.04.26-138a1
PKG_RELEASE:=4 PKG_RELEASE:=$(AUTORELEASE)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://codeload.github.com/raspberrypi/rpi-eeprom/tar.gz/$(PKG_VERSION)? PKG_SOURCE_URL:=https://codeload.github.com/raspberrypi/rpi-eeprom/tar.gz/$(PKG_VERSION)?
PKG_HASH:=skip PKG_HASH:=7c54839e68f226c5853fb63c8a1539b729d84b2e6bac311a51766c601d10a413
PKG_LICENSE:=BSD-3-Clause Custom PKG_LICENSE:=BSD-3-Clause Custom
PKG_LICENSE_FILES:=LICENSE PKG_LICENSE_FILES:=LICENSE
@ -21,7 +21,7 @@ TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)
define Package/bcm27xx-eeprom define Package/bcm27xx-eeprom
SECTION:=utils SECTION:=utils
CATEGORY:=Utilities CATEGORY:=Utilities
DEPENDS:=bcm27xx-userland +blkid +pciutils +python3-light +coreutils +coreutils-od DEPENDS:=bcm27xx-userland +blkid +coreutils +coreutils-od +pciutils +python3-light
TITLE:=BCM27xx EEPROM tools TITLE:=BCM27xx EEPROM tools
endef endef
@ -43,6 +43,7 @@ define Package/bcm27xx-eeprom/install
$(INSTALL_DIR) $(1)/usr/bin $(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/rpi-eeprom-config $(1)/usr/bin $(INSTALL_BIN) $(PKG_BUILD_DIR)/rpi-eeprom-config $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/rpi-eeprom-digest $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/rpi-eeprom-update $(1)/usr/bin $(INSTALL_BIN) $(PKG_BUILD_DIR)/rpi-eeprom-update $(1)/usr/bin
$(INSTALL_DIR) $(1)/lib/firmware/raspberrypi/bootloader $(INSTALL_DIR) $(1)/lib/firmware/raspberrypi/bootloader

View file

@ -0,0 +1,33 @@
From 8376ac74390af0ad736c88615e128b82a75eebc0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=C3=81lvaro=20Fern=C3=A1ndez=20Rojas?= <noltari@gmail.com>
Date: Fri, 19 Feb 2021 10:54:23 +0100
Subject: [PATCH] rpi-eeprom-update: chmod silent (-f) is not supported
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
rpi-eeprom-update | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--- a/rpi-eeprom-update
+++ b/rpi-eeprom-update
@@ -200,7 +200,7 @@ applyRecoveryUpdate()
|| die "Failed to copy ${TMP_EEPROM_IMAGE} to ${BOOTFS}"
# For NFS mounts ensure that the files are readable to the TFTP user
- chmod -f go+r "${BOOTFS}/pieeprom.upd" "${BOOTFS}/pieeprom.sig" \
+ chmod go+r "${BOOTFS}/pieeprom.upd" "${BOOTFS}/pieeprom.sig" \
|| die "Failed to set permissions on eeprom update files"
fi
@@ -211,7 +211,7 @@ applyRecoveryUpdate()
|| die "Failed to copy ${VL805_UPDATE_IMAGE} to ${BOOTFS}/vl805.bin"
# For NFS mounts ensure that the files are readable to the TFTP user
- chmod -f go+r "${BOOTFS}/vl805.bin" "${BOOTFS}/vl805.sig" \
+ chmod go+r "${BOOTFS}/vl805.bin" "${BOOTFS}/vl805.sig" \
|| die "Failed to set permissions on eeprom update files"
fi

View file

@ -1,24 +0,0 @@
--- a/rpi-eeprom-update 2020-11-05 21:58:02.247836497 +0100
+++ b/rpi-eeprom-update 2020-11-05 21:58:36.911266307 +0100
@@ -212,8 +212,8 @@
|| die "Failed to copy ${TMP_EEPROM_IMAGE} to ${BOOTFS}"
# For NFS mounts ensure that the files are readable to the TFTP user
- chmod -f go+r "${BOOTFS}/pieeprom.upd" "${BOOTFS}/pieeprom.sig" \
- || die "Failed to set permissions on eeprom update files"
+ #chmod -f go+r "${BOOTFS}/pieeprom.upd" "${BOOTFS}/pieeprom.sig" \
+ # || die "Failed to set permissions on eeprom update files"
fi
if [ -n "${VL805_UPDATE_IMAGE}" ]; then
@@ -224,8 +224,8 @@
|| die "Failed to copy ${VL805_UPDATE_IMAGE} to ${BOOTFS}/vl805.bin"
# For NFS mounts ensure that the files are readable to the TFTP user
- chmod -f go+r "${BOOTFS}/vl805.bin" "${BOOTFS}/vl805.sig" \
- || die "Failed to set permissions on eeprom update files"
+ #chmod -f go+r "${BOOTFS}/vl805.bin" "${BOOTFS}/vl805.sig" \
+ # || die "Failed to set permissions on eeprom update files"
fi
cp -f "${RECOVERY_BIN}" "${BOOTFS}/recovery.bin" \

View file

@ -0,0 +1,22 @@
--- a/rpi-eeprom-config
+++ b/rpi-eeprom-config
@@ -166,8 +166,8 @@ def edit_config(eeprom=None):
"""
Implements something like 'git commit' for editing EEPROM configs.
"""
- # Default to nano if $EDITOR is not defined.
- editor = 'nano'
+ # Default to vi if $EDITOR is not defined.
+ editor = 'vi'
if 'EDITOR' in os.environ:
editor = os.environ['EDITOR']
@@ -428,7 +428,7 @@ Operating modes:
To cancel the pending update run 'sudo rpi-eeprom-update -r'
- The default text editor is nano and may be overridden by setting the 'EDITOR'
+ The default text editor is vi and may be overridden by setting the 'EDITOR'
environment variable and passing '-E' to 'sudo' to preserve the environment.
6. Signing the bootloader config file.

View file

@ -1,6 +1,6 @@
msgid "" msgid ""
msgstr "" msgstr ""
"PO-Revision-Date: 2022-08-12 12:08+0000\n" "PO-Revision-Date: 2022-08-12 19:29+0000\n"
"Last-Translator: Weblate Admin <contact@openmptcprouter.com>\n" "Last-Translator: Weblate Admin <contact@openmptcprouter.com>\n"
"Language-Team: Chinese (Simplified) <http://weblate.openmptcprouter.com/" "Language-Team: Chinese (Simplified) <http://weblate.openmptcprouter.com/"
"projects/omr/luciapplicationsmptcp/zh_Hans/>\n" "projects/omr/luciapplicationsmptcp/zh_Hans/>\n"
@ -85,7 +85,6 @@ msgid "Grant UCI access for luci-app-mptcp"
msgstr "授予UCI访问luci-app-mptcp的权限" msgstr "授予UCI访问luci-app-mptcp的权限"
#: luci-app-mptcp/luasrc/view/mptcp/mptcp_check.htm:73 #: luci-app-mptcp/luasrc/view/mptcp/mptcp_check.htm:73
#, fuzzy
msgid "" msgid ""
"If you get \"TCPOptionMPTCPCapable [...] Sender's Key\" at the end, then " "If you get \"TCPOptionMPTCPCapable [...] Sender's Key\" at the end, then "
"MPTCP is supported. If there is a \"-TCPOptionMPTCPCapable\", then it's " "MPTCP is supported. If there is a \"-TCPOptionMPTCPCapable\", then it's "
@ -167,7 +166,6 @@ msgstr "多路径TCP调度程序"
#: luci-app-mptcp/luasrc/model/cbi/mptcp.lua:47 #: luci-app-mptcp/luasrc/model/cbi/mptcp.lua:47
#, fuzzy #, fuzzy
#| msgid "Multipath TCP"
msgid "Multipath TCP version" msgid "Multipath TCP version"
msgstr "多路径TCP" msgstr "多路径TCP"

View file

@ -357,7 +357,6 @@ msgstr "SQM aktiv"
#: luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm:952 #: luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm:952
#, fuzzy #, fuzzy
#| msgid "Enable SQM"
msgid "Enable SQM autorate" msgid "Enable SQM autorate"
msgstr "SQM aktiv" msgstr "SQM aktiv"
@ -1418,3 +1417,7 @@ msgstr ""
#~ msgid "Redundant" #~ msgid "Redundant"
#~ msgstr "redundant" #~ msgstr "redundant"
#, fuzzy
#~ msgid "Disable HTTP test on Server API in status page"
#~ msgstr "Server-Ping Status-Prüfung aus"

View file

@ -1560,3 +1560,6 @@ msgstr "whois :"
#~ msgid "MLVPN can replace Glorytun with connection with same latency" #~ msgid "MLVPN can replace Glorytun with connection with same latency"
#~ msgstr "" #~ msgstr ""
#~ "MLVPN peut remplacer Glorytun pour les connexions avec la même latence" #~ "MLVPN peut remplacer Glorytun pour les connexions avec la même latence"
#~ msgid "Disable HTTP test on Server API in status page"
#~ msgstr "Désactiver le test HTTP sur l'API du serveur dans la page d'état"

File diff suppressed because it is too large Load diff

View file

@ -269,7 +269,6 @@ msgstr ""
#: luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm:347 #: luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm:347
#, fuzzy #, fuzzy
#| msgid "Disabled"
msgid "Disable nDPI" msgid "Disable nDPI"
msgstr "Desactivat" msgstr "Desactivat"
@ -364,7 +363,6 @@ msgstr "Active SQM"
#: luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm:952 #: luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm:952
#, fuzzy #, fuzzy
#| msgid "Enable SQM"
msgid "Enable SQM autorate" msgid "Enable SQM autorate"
msgstr "Active SQM" msgstr "Active SQM"
@ -1432,3 +1430,7 @@ msgstr ""
#~ msgid "Redundant" #~ msgid "Redundant"
#~ msgstr "Redondant" #~ msgstr "Redondant"
#, fuzzy
#~ msgid "Disable HTTP test on Server API in status page"
#~ msgstr "Desactivar la pròva ping cap al servidor"

View file

@ -211,7 +211,6 @@ msgstr "设备"
#: luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm:259 #: luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm:259
#, fuzzy #, fuzzy
#| msgid "Disable HTTP test on Server API in status page"
msgid "Disable HTTP test on Server API" msgid "Disable HTTP test on Server API"
msgstr "在状态页面中禁用服务器API上的HTTP测试" msgstr "在状态页面中禁用服务器API上的HTTP测试"
@ -343,7 +342,6 @@ msgstr "开启 SQM"
#: luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm:952 #: luci-app-openmptcprouter/luasrc/view/openmptcprouter/wizard.htm:952
#, fuzzy #, fuzzy
#| msgid "Enable SQM"
msgid "Enable SQM autorate" msgid "Enable SQM autorate"
msgstr "开启 SQM" msgstr "开启 SQM"
@ -1195,7 +1193,6 @@ msgstr "启用后将在外部站点上进行检查以获取每个WAN IP和
#: luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm:301 #: luci-app-openmptcprouter/luasrc/view/openmptcprouter/settings.htm:301
#, fuzzy #, fuzzy
#| msgid "When proxy shadowsocks is used, use it for UDP if VPN down"
msgid "When proxy V2Ray is used, use it for UDP" msgid "When proxy V2Ray is used, use it for UDP"
msgstr "当使用代理shadowsocks时如果VPN关闭将其用于UDP" msgstr "当使用代理shadowsocks时如果VPN关闭将其用于UDP"
@ -1490,3 +1487,6 @@ msgstr "whois查询 :"
#~ msgid "MLVPN can replace Glorytun with connection with same latency" #~ msgid "MLVPN can replace Glorytun with connection with same latency"
#~ msgstr "" #~ msgstr ""
#~ "MLVPN peut remplacer Glorytun pour les connexions avec la même latence" #~ "MLVPN peut remplacer Glorytun pour les connexions avec la même latence"
#~ msgid "Disable HTTP test on Server API in status page"
#~ msgstr "在状态页面中禁用服务器API上的HTTP测试"

View file

@ -1037,7 +1037,8 @@ function interfaces_status()
mArray.openmptcprouter["shadowsocks_enabled"] = true mArray.openmptcprouter["shadowsocks_enabled"] = true
local ss_server = "1" local ss_server = "1"
ucic:foreach("shadowsocks-libev", "server", function(s) ucic:foreach("shadowsocks-libev", "server", function(s)
if uci:get("shadowsocks-libev",s[".name"],"disabled") == "0" then local ss_server_disabled = uci:get("shadowsocks-libev",s[".name"],"disabled") or "0"
if ss_server_disabled == "0" then
ss_server = "0" ss_server = "0"
end end
end) end)

View file

@ -19,7 +19,9 @@ cleanup_and_killall()
echo "Killing all background processes and cleaning up /tmp files." echo "Killing all background processes and cleaning up /tmp files."
trap - INT TERM EXIT trap - INT TERM EXIT
kill $monitor_achieved_rates_pid 2> /dev/null kill $monitor_achieved_rates_pid 2> /dev/null
# Initiate termination of ping processes and wait until complete
kill $maintain_pingers_pid 2> /dev/null kill $maintain_pingers_pid 2> /dev/null
wait $maintain_pingers_pid
[[ -d /tmp/CAKE-autorate-${dl_if} ]] && rm -r /tmp/CAKE-autorate-${dl_if} [[ -d /tmp/CAKE-autorate-${dl_if} ]] && rm -r /tmp/CAKE-autorate-${dl_if}
exit exit
} }
@ -45,35 +47,42 @@ get_next_shaper_rate()
case $load_condition in case $load_condition in
# upload Starlink satelite switching compensation, so drop down to minimum rate for upload through switching period
ul*sss)
shaper_rate_kbps=$min_shaper_rate_kbps
;;
# download Starlink satelite switching compensation, so drop down to base rate for download through switching period
dl*sss)
shaper_rate_kbps=$base_shaper_rate_kbps
;;
# bufferbloat detected, so decrease the rate providing not inside bufferbloat refractory period # bufferbloat detected, so decrease the rate providing not inside bufferbloat refractory period
*delayed) *bb*)
if (( $t_next_rate_us > ($t_last_bufferbloat_us+$bufferbloat_refractory_period_us) )); then if (( $t_next_rate_us > ($t_last_bufferbloat_us+$bufferbloat_refractory_period_us) )); then
adjusted_achieved_rate_kbps=$(( ($achieved_rate_kbps*$achieved_rate_adjust_bufferbloat)/1000 )) adjusted_achieved_rate_kbps=$(( ($achieved_rate_kbps*$achieved_rate_adjust_down_bufferbloat)/1000 ))
adjusted_shaper_rate_kbps=$(( ($shaper_rate_kbps*$shaper_rate_adjust_bufferbloat)/1000 )) adjusted_shaper_rate_kbps=$(( ($shaper_rate_kbps*$shaper_rate_adjust_down_bufferbloat)/1000 ))
shaper_rate_kbps=$(( $adjusted_achieved_rate_kbps < $adjusted_shaper_rate_kbps ? $adjusted_achieved_rate_kbps : $adjusted_shaper_rate_kbps )) shaper_rate_kbps=$(( $adjusted_achieved_rate_kbps < $adjusted_shaper_rate_kbps ? $adjusted_achieved_rate_kbps : $adjusted_shaper_rate_kbps ))
t_last_bufferbloat_us=${EPOCHREALTIME/./} t_last_bufferbloat_us=${EPOCHREALTIME/./}
fi fi
;; ;;
# high load, so increase rate providing not inside bufferbloat refractory period # high load, so increase rate providing not inside bufferbloat refractory period
high) *high*)
if (( $t_next_rate_us > ($t_last_bufferbloat_us+$bufferbloat_refractory_period_us) )); then if (( $t_next_rate_us > ($t_last_bufferbloat_us+$bufferbloat_refractory_period_us) )); then
shaper_rate_kbps=$(( ($shaper_rate_kbps*$shaper_rate_adjust_load_high)/1000 )) shaper_rate_kbps=$(( ($shaper_rate_kbps*$shaper_rate_adjust_up_load_high)/1000 ))
fi fi
;; ;;
# medium load, so just maintain rate as is, i.e. do nothing # medium load, so just maintain rate as is, i.e. do nothing
medium) *med*)
: :
;; ;;
# low or idle load, so determine whether to decay down towards base rate, decay up towards base rate, or set as base rate # low or idle load, so determine whether to decay down towards base rate, decay up towards base rate, or set as base rate
low|idle) *low*|*idle*)
if (($t_next_rate_us > ($t_last_decay_us+$decay_refractory_period_us) )); then if (($t_next_rate_us > ($t_last_decay_us+$decay_refractory_period_us) )); then
if (($shaper_rate_kbps > $base_shaper_rate_kbps)); then if (($shaper_rate_kbps > $base_shaper_rate_kbps)); then
decayed_shaper_rate_kbps=$(( ($shaper_rate_kbps*$shaper_rate_adjust_load_low)/1000 )) decayed_shaper_rate_kbps=$(( ($shaper_rate_kbps*$shaper_rate_adjust_down_load_low)/1000 ))
shaper_rate_kbps=$(( $decayed_shaper_rate_kbps > $base_shaper_rate_kbps ? $decayed_shaper_rate_kbps : $base_shaper_rate_kbps)) shaper_rate_kbps=$(( $decayed_shaper_rate_kbps > $base_shaper_rate_kbps ? $decayed_shaper_rate_kbps : $base_shaper_rate_kbps))
elif (($shaper_rate_kbps < $base_shaper_rate_kbps)); then elif (($shaper_rate_kbps < $base_shaper_rate_kbps)); then
decayed_shaper_rate_kbps=$(( ((2000-$shaper_rate_adjust_load_low)*$shaper_rate_kbps)/1000 )) decayed_shaper_rate_kbps=$(( ($shaper_rate_kbps*$shaper_rate_adjust_up_load_low)/1000 ))
shaper_rate_kbps=$(( $decayed_shaper_rate_kbps < $base_shaper_rate_kbps ? $decayed_shaper_rate_kbps : $base_shaper_rate_kbps)) shaper_rate_kbps=$(( $decayed_shaper_rate_kbps < $base_shaper_rate_kbps ? $decayed_shaper_rate_kbps : $base_shaper_rate_kbps))
fi fi
@ -118,11 +127,11 @@ monitor_achieved_rates()
printf '%s' "$dl_achieved_rate_kbps" > /tmp/CAKE-autorate-${dl_if}/dl_achieved_rate_kbps printf '%s' "$dl_achieved_rate_kbps" > /tmp/CAKE-autorate-${dl_if}/dl_achieved_rate_kbps
printf '%s' "$ul_achieved_rate_kbps" > /tmp/CAKE-autorate-${dl_if}/ul_achieved_rate_kbps printf '%s' "$ul_achieved_rate_kbps" > /tmp/CAKE-autorate-${dl_if}/ul_achieved_rate_kbps
prev_rx_bytes=$rx_bytes prev_rx_bytes=$rx_bytes
prev_tx_bytes=$tx_bytes prev_tx_bytes=$tx_bytes
# read in the max_wire_packet_rtt_us # read in the max_wire_packet_rtt_us
concurrent_read max_wire_packet_rtt_us /tmp/CAKE-autorate-${dl_if}/max_wire_packet_rtt_us concurrent_read_positive_integer max_wire_packet_rtt_us /tmp/CAKE-autorate-${dl_if}/max_wire_packet_rtt_us
compensated_monitor_achieved_rates_interval_us=$(( (($monitor_achieved_rates_interval_us>(10*$max_wire_packet_rtt_us) )) ? $monitor_achieved_rates_interval_us : $((10*$max_wire_packet_rtt_us)) )) compensated_monitor_achieved_rates_interval_us=$(( (($monitor_achieved_rates_interval_us>(10*$max_wire_packet_rtt_us) )) ? $monitor_achieved_rates_interval_us : $((10*$max_wire_packet_rtt_us)) ))
@ -134,8 +143,8 @@ get_loads()
{ {
# read in the dl/ul achived rates and determine the loads # read in the dl/ul achived rates and determine the loads
concurrent_read dl_achieved_rate_kbps /tmp/CAKE-autorate-${dl_if}/dl_achieved_rate_kbps concurrent_read_positive_integer dl_achieved_rate_kbps /tmp/CAKE-autorate-${dl_if}/dl_achieved_rate_kbps
concurrent_read ul_achieved_rate_kbps /tmp/CAKE-autorate-${dl_if}/ul_achieved_rate_kbps concurrent_read_positive_integer ul_achieved_rate_kbps /tmp/CAKE-autorate-${dl_if}/ul_achieved_rate_kbps
dl_load_percent=$(((100*10#${dl_achieved_rate_kbps})/$dl_shaper_rate_kbps)) dl_load_percent=$(((100*10#${dl_achieved_rate_kbps})/$dl_shaper_rate_kbps))
ul_load_percent=$(((100*10#${ul_achieved_rate_kbps})/$ul_shaper_rate_kbps)) ul_load_percent=$(((100*10#${ul_achieved_rate_kbps})/$ul_shaper_rate_kbps))
@ -152,14 +161,25 @@ classify_load()
if (( $load_percent > $high_load_thr_percent )); then if (( $load_percent > $high_load_thr_percent )); then
load_condition="high" load_condition="high"
elif (( $load_percent > $medium_load_thr_percent )); then elif (( $load_percent > $medium_load_thr_percent )); then
load_condition="medium" load_condition="med"
elif (( $achieved_rate_kbps > $connection_active_thr_kbps )); then elif (( $achieved_rate_kbps > $connection_active_thr_kbps )); then
load_condition="low" load_condition="low"
else else
load_condition="idle" load_condition="idle"
fi fi
(($bufferbloat_detected)) && load_condition=$load_condition"_delayed" (($bufferbloat_detected)) && load_condition=$load_condition"_bb"
if ((sss_compensation)); then
for sss_time_us in "${sss_times_us[@]}"
do
((timestamp_usecs_past_minute=${EPOCHREALTIME/./}%60000000))
if (( ($timestamp_usecs_past_minute > ($sss_time_us-$sss_compensation_pre_duration_us)) && ($timestamp_usecs_past_minute < ($sss_time_us+$sss_compensation_post_duration_us)) )); then
load_condition=$load_condition"_sss"
break
fi
done
fi
} }
monitor_reflector_responses() monitor_reflector_responses()
@ -245,7 +265,7 @@ maintain_pingers()
for ((pinger=0; pinger<$no_pingers; pinger++)) for ((pinger=0; pinger<$no_pingers; pinger++))
do do
reflector_check_time_us=${EPOCHREALTIME/./} reflector_check_time_us=${EPOCHREALTIME/./}
concurrent_read reflector_last_timestamp_us /tmp/CAKE-autorate-${dl_if}/reflector_${pinger}_last_timestamp_us concurrent_read_positive_integer reflector_last_timestamp_us /tmp/CAKE-autorate-${dl_if}/reflector_${pinger}_last_timestamp_us
declare -n reflector_offences="reflector_${pinger}_offences" declare -n reflector_offences="reflector_${pinger}_offences"
(( ${reflector_offences[$reflector_offences_idx]} )) && ((sum_reflector_offences[$pinger]--)) (( ${reflector_offences[$reflector_offences_idx]} )) && ((sum_reflector_offences[$pinger]--))
@ -367,7 +387,7 @@ update_max_wire_packet_compensation()
printf '%s' "$max_wire_packet_rtt_us" > /tmp/CAKE-autorate-${dl_if}/max_wire_packet_rtt_us printf '%s' "$max_wire_packet_rtt_us" > /tmp/CAKE-autorate-${dl_if}/max_wire_packet_rtt_us
} }
concurrent_read() concurrent_read_positive_integer()
{ {
# in the context of separate processes writing using > and reading form file # in the context of separate processes writing using > and reading form file
# it seems costly calls to the external flock binary can be avoided # it seems costly calls to the external flock binary can be avoided
@ -376,10 +396,20 @@ concurrent_read()
local -n value=$1 local -n value=$1
local path=$2 local path=$2
read -r value < $path while true
while [[ -z $value ]]; do do
sleep_us $concurrent_read_interval_us
read -r value < $path; read -r value < $path;
if [[ -z "${value##*[!0-9]*}" ]]; then
if (($debug)); then
read -r caller_output< <(caller)
echo "DEBUG concurrent_read_positive_integer() misfire with the following particulars:"
echo "DEBUG caller="$caller_output"; value="$value"; and path="$path
fi
sleep_us $concurrent_read_positive_integer_interval_us
continue
else
break
fi
done done
} }
@ -474,10 +504,11 @@ verify_ifs_up
# Convert human readable parameters to values that work with integer arithmetic # Convert human readable parameters to values that work with integer arithmetic
printf -v alpha_baseline_increase %.0f\\n "${alpha_baseline_increase}e3" printf -v alpha_baseline_increase %.0f\\n "${alpha_baseline_increase}e3"
printf -v alpha_baseline_decrease %.0f\\n "${alpha_baseline_decrease}e3" printf -v alpha_baseline_decrease %.0f\\n "${alpha_baseline_decrease}e3"
printf -v achieved_rate_adjust_bufferbloat %.0f\\n "${achieved_rate_adjust_bufferbloat}e3" printf -v achieved_rate_adjust_down_bufferbloat %.0f\\n "${achieved_rate_adjust_down_bufferbloat}e3"
printf -v shaper_rate_adjust_bufferbloat %.0f\\n "${shaper_rate_adjust_bufferbloat}e3" printf -v shaper_rate_adjust_down_bufferbloat %.0f\\n "${shaper_rate_adjust_down_bufferbloat}e3"
printf -v shaper_rate_adjust_load_high %.0f\\n "${shaper_rate_adjust_load_high}e3" printf -v shaper_rate_adjust_up_load_high %.0f\\n "${shaper_rate_adjust_up_load_high}e3"
printf -v shaper_rate_adjust_load_low %.0f\\n "${shaper_rate_adjust_load_low}e3" printf -v shaper_rate_adjust_down_load_low %.0f\\n "${shaper_rate_adjust_down_load_low}e3"
printf -v shaper_rate_adjust_up_load_low %.0f\\n "${shaper_rate_adjust_up_load_low}e3"
printf -v high_load_thr_percent %.0f\\n "${high_load_thr}e2" printf -v high_load_thr_percent %.0f\\n "${high_load_thr}e2"
printf -v medium_load_thr_percent %.0f\\n "${medium_load_thr}e2" printf -v medium_load_thr_percent %.0f\\n "${medium_load_thr}e2"
printf -v reflector_ping_interval_us %.0f\\n "${reflector_ping_interval_s}e6" printf -v reflector_ping_interval_us %.0f\\n "${reflector_ping_interval_s}e6"
@ -488,9 +519,16 @@ bufferbloat_refractory_period_us=$(( 1000*$bufferbloat_refractory_period_ms ))
decay_refractory_period_us=$(( 1000*$decay_refractory_period_ms )) decay_refractory_period_us=$(( 1000*$decay_refractory_period_ms ))
delay_thr_us=$(( 1000*$delay_thr_ms )) delay_thr_us=$(( 1000*$delay_thr_ms ))
for (( i=0; i<${#sss_times_s[@]}; i++ ));
do
printf -v sss_times_us[i] %.0f\\n "${sss_times_s[i]}e6"
done
printf -v sss_compensation_pre_duration_us %.0f\\n "${sss_compensation_pre_duration_ms}e3"
printf -v sss_compensation_post_duration_us %.0f\\n "${sss_compensation_post_duration_ms}e3"
ping_response_interval_us=$(($reflector_ping_interval_us/$no_pingers)) ping_response_interval_us=$(($reflector_ping_interval_us/$no_pingers))
concurrent_read_interval_us=$(($ping_response_interval_us/4)) concurrent_read_positive_integer_interval_us=$(($ping_response_interval_us/4))
dl_shaper_rate_kbps=$base_dl_shaper_rate_kbps dl_shaper_rate_kbps=$base_dl_shaper_rate_kbps
ul_shaper_rate_kbps=$base_ul_shaper_rate_kbps ul_shaper_rate_kbps=$base_ul_shaper_rate_kbps
@ -533,12 +571,20 @@ monitor_achieved_rates_pid=$!
prev_timestamp=0 prev_timestamp=0
if (($debug)); then
if (( $bufferbloat_refractory_period_us <= ($bufferbloat_detection_window*$ping_response_interval_us) )); then
echo "DEBUG Warning: bufferbloat refractory period: " $bufferbloat_refractory_period_us " us."
echo "DEBUG Warning: but expected time to overwrite samples in bufferbloat detection window is: " $(($bufferbloat_detection_window*$ping_response_interval_us)) " us."
echo "DEBUG Warning: Consider increasing bufferbloat refractory period or decreasing bufferbloat detection window."
fi
fi
while true while true
do do
while read -t $global_ping_response_timeout_s -r timestamp reflector seq rtt_baseline_us rtt_us rtt_delta_us while read -t $global_ping_response_timeout_s -r timestamp reflector seq rtt_baseline_us rtt_us rtt_delta_us
do do
t_start_us=${EPOCHREALTIME/./} t_start_us=${EPOCHREALTIME/./}
if ((($t_start_us - "${timestamp//[[\[\].]}")>500000)); then if ((($t_start_us - 10#"${timestamp//[[\[\].]}")>500000)); then
(($debug)) && echo "DEBUG processed response from [" $reflector "] that is > 500ms old. Skipping." (($debug)) && echo "DEBUG processed response from [" $reflector "] that is > 500ms old. Skipping."
continue continue
fi fi
@ -556,6 +602,9 @@ do
classify_load $dl_load_percent $dl_achieved_rate_kbps dl_load_condition classify_load $dl_load_percent $dl_achieved_rate_kbps dl_load_condition
classify_load $ul_load_percent $ul_achieved_rate_kbps ul_load_condition classify_load $ul_load_percent $ul_achieved_rate_kbps ul_load_condition
dl_load_condition="dl_"$dl_load_condition
ul_load_condition="ul_"$ul_load_condition
get_next_shaper_rate $min_dl_shaper_rate_kbps $base_dl_shaper_rate_kbps $max_dl_shaper_rate_kbps $dl_achieved_rate_kbps $dl_load_condition $t_start_us t_dl_last_bufferbloat_us t_dl_last_decay_us dl_shaper_rate_kbps get_next_shaper_rate $min_dl_shaper_rate_kbps $base_dl_shaper_rate_kbps $max_dl_shaper_rate_kbps $dl_achieved_rate_kbps $dl_load_condition $t_start_us t_dl_last_bufferbloat_us t_dl_last_decay_us dl_shaper_rate_kbps
get_next_shaper_rate $min_ul_shaper_rate_kbps $base_ul_shaper_rate_kbps $max_ul_shaper_rate_kbps $ul_achieved_rate_kbps $ul_load_condition $t_start_us t_ul_last_bufferbloat_us t_ul_last_decay_us ul_shaper_rate_kbps get_next_shaper_rate $min_ul_shaper_rate_kbps $base_ul_shaper_rate_kbps $max_ul_shaper_rate_kbps $ul_achieved_rate_kbps $ul_load_condition $t_start_us t_ul_last_bufferbloat_us t_ul_last_decay_us ul_shaper_rate_kbps
@ -584,8 +633,9 @@ do
ul_shaper_rate_kbps=$min_ul_shaper_rate_kbps ul_shaper_rate_kbps=$min_ul_shaper_rate_kbps
set_shaper_rates set_shaper_rates
# Kill off ping processes # Initiate termination of ping processes and wait until complete
kill $maintain_pingers_pid 2> /dev/null kill $maintain_pingers_pid 2> /dev/null
wait $maintain_pingers_pid
# reset idle timer # reset idle timer
t_sustained_connection_idle_us=0 t_sustained_connection_idle_us=0