From cafc42c9e099ffb7d2c280952845960abbc9d70f Mon Sep 17 00:00:00 2001 From: dave14305 <44532942+dave14305@users.noreply.github.com> Date: Thu, 5 Jun 2025 16:30:25 -0400 Subject: [PATCH 1/6] Revert "Cleanup orphaned branch setting" This reverts commit 9a6a9be0ff4a9be9740a103cb0c9a7bc61b59b5b. --- flexqos.sh | 4 ---- 1 file changed, 4 deletions(-) diff --git a/flexqos.sh b/flexqos.sh index 7dadc59..649b804 100644 --- a/flexqos.sh +++ b/flexqos.sh @@ -1472,10 +1472,6 @@ EOF if [ -z "${fccontrol}" ]; then fccontrol="0" # default to Off from GUI fi - # Delete obsolete setting - if [ -n "$(am_settings_get "${SCRIPTNAME}"_branch)" ]; then - sed -i "/^${SCRIPTNAME}_branch /d" /jffs/addons/custom_settings.txt - fi } # get_config validate_iptables_rules() { From 3021a0aa8e174b2b1b939ac0da7a2165be111429 Mon Sep 17 00:00:00 2001 From: dave14305 <44532942+dave14305@users.noreply.github.com> Date: Thu, 5 Jun 2025 16:33:32 -0400 Subject: [PATCH 2/6] Revert "Remove ability to switch between stable and dev branches" This reverts commit 769d8aca7446167751904f0bbd9d136eb67a83e5. --- flexqos.asp | 4 +++- flexqos.sh | 30 +++++++++++++++++++++++++++++- 2 files changed, 32 insertions(+), 2 deletions(-) diff --git a/flexqos.asp b/flexqos.asp index 7d4998d..5f8e28d 100644 --- a/flexqos.asp +++ b/flexqos.asp @@ -2024,6 +2024,8 @@ function set_FlexQoS_mod_vars() { if ( custom_settings.flexqos_ver != undefined ) document.getElementById("flexqos_version").innerText = "v" + custom_settings.flexqos_ver; + if ( custom_settings.flexqos_branch != undefined ) + document.getElementById("flexqos_version").innerText += " Dev"; if ( custom_settings.flexqos_iptables == undefined ) // rules not yet converted to API format { @@ -2503,7 +2505,7 @@ function update_status(){ document.getElementById("versionStatus").style.display = ""; } else { - /* version update available */ + /* version update or hotfix available */ /* toggle update button */ document.getElementById("versionStatus").innerText = " " + verUpdateStatus + " available!"; document.getElementById("versionStatus").style.display = ""; diff --git a/flexqos.sh b/flexqos.sh index 649b804..874dae7 100644 --- a/flexqos.sh +++ b/flexqos.sh @@ -31,7 +31,12 @@ fi # Global variables readonly SCRIPTNAME_DISPLAY="FlexQoS" readonly SCRIPTNAME="flexqos" -readonly GIT_URL="https://raw.githubusercontent.com/AMTM-OSR/${SCRIPTNAME_DISPLAY}/master" +readonly GIT_REPO="https://raw.githubusercontent.com/AMTM-OSR/${SCRIPTNAME_DISPLAY}" +GIT_BRANCH="$(am_settings_get "${SCRIPTNAME}_branch")" +if [ -z "${GIT_BRANCH}" ]; then + GIT_BRANCH="master" +fi +GIT_URL="${GIT_REPO}/${GIT_BRANCH}" readonly ADDON_DIR="/jffs/addons/${SCRIPTNAME}" readonly WEBUIPATH="${ADDON_DIR}/${SCRIPTNAME}.asp" @@ -551,6 +556,9 @@ scriptinfo() { [ "${mode}" = "interactive" ] || return printf "\n" Green "${SCRIPTNAME_DISPLAY} v${version} released ${release}" + if [ "${GIT_BRANCH}" != "master" ]; then + Yellow " Development channel" + fi printf "\n" } # scriptinfo @@ -1755,6 +1763,8 @@ Available commands: ${SCRIPTNAME} -disable disable script but do not delete from disk ${SCRIPTNAME} -backup backup user settings ${SCRIPTNAME} -debug print debug info + ${SCRIPTNAME} -develop switch to development channel + ${SCRIPTNAME} -stable switch to stable channel ${SCRIPTNAME} -menu interactive main menu EOF @@ -1897,6 +1907,24 @@ case "${arg1}" in update*) # updatecheck, updatesilent, or plain update update "${arg1#update}" # strip 'update' from arg1 to pass to update function ;; + 'develop') + if [ "$(am_settings_get "${SCRIPTNAME}_branch")" = "develop" ]; then + printf "Already set to development branch.\n" + else + am_settings_set "${SCRIPTNAME}_branch" "develop" + printf "Set to development branch. Triggering update...\n" + exec "${0}" updatesilent + fi + ;; + 'stable') + if [ -z "$(am_settings_get "${SCRIPTNAME}_branch")" ]; then + printf "Already set to stable branch.\n" + else + sed -i "/^${SCRIPTNAME}_branch /d" /jffs/addons/custom_settings.txt + printf "Set to stable branch. Triggering update...\n" + exec "${0}" updatesilent + fi + ;; 'menu'|'') menu ;; From 5432736ae4b31b1fb17eb5c50cfeeba7529c6e0f Mon Sep 17 00:00:00 2001 From: ExtremeFiretop Date: Thu, 5 Jun 2025 21:50:15 -0400 Subject: [PATCH 3/6] Allow Script to Remain In Update Process Addresses Issue https://github.com/AMTM-OSR/FlexQoS/issues/1 --- flexqos.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/flexqos.sh b/flexqos.sh index 874dae7..7db75df 100644 --- a/flexqos.sh +++ b/flexqos.sh @@ -12,8 +12,8 @@ # Contributors: @maghuro # shellcheck disable=SC1090,SC1091,SC2039,SC2154,SC3043 # amtm NoMD5check -version=1.4.6 -release=2025-05-18 +version=1.4.7 +release=2025-06-05 # Forked from FreshJR_QOS v8.8, written by FreshJR07 https://github.com/FreshJR07/FreshJR_QOS # License # FlexQoS is free to use under the GNU General Public License, version 3 (GPL-3.0). @@ -1075,6 +1075,10 @@ update() { return 0 fi fi + if ! Firmware_Check; then + PressEnter + exit 5 + fi printf "Installing: %s...\n\n" "${SCRIPTNAME_DISPLAY}" download_file "$(basename "${SCRIPTPATH}")" "${SCRIPTPATH}" exec sh "${SCRIPTPATH}" -install "${1}" From 6bd1640694f38c6cf3e66d5cc6c1f41c7f6dc209 Mon Sep 17 00:00:00 2001 From: ExtremeFiretop Date: Sat, 7 Jun 2025 18:22:21 -0400 Subject: [PATCH 4/6] Add Warning Messages for Adaptive QoS Add Warning Messages for Adaptive QoS If Adaptive QoS is not functional, display a warning message to the user in shell and the WebUI --- flexqos.asp | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++- flexqos.sh | 21 ++++++++++++++++++- 2 files changed, 77 insertions(+), 2 deletions(-) diff --git a/flexqos.asp b/flexqos.asp index 5f8e28d..cf0d84e 100644 --- a/flexqos.asp +++ b/flexqos.asp @@ -1185,6 +1185,7 @@ function get_data() { success: function(response) { redraw(); draw_conntrack_table(); + check_bandwidth_flow(); timedEvent = setTimeout("get_data();", refreshRate * 1000); } }); @@ -1297,6 +1298,56 @@ function initialize_charts() { line_obj_ul=line_obj; // actually draws the chart on the page } // initialize_charts +function getFwBase () { + /* "3.0.0.6" → 3006 */ + const ver = document.getElementById('firmver')?.value || ''; + return parseInt(ver.replace(/\./g, ''), 10); // NaN if blank +} + +window.addEventListener('DOMContentLoaded', () => { + const fwBase = getFwBase(); + + const noflowMsg = (fwBase === 3006) + ? 'Adaptive QoS is not functioning correctly on ' + + 'BE-series routers due to a known ASUS / Trend Micro issue. ' + + 'Once ASUS resolves this, FlexQoS should work as expected.' + : 'Adaptive QoS appears to be malfunctioning. ' + + 'FlexQoS cannot apply its rules while the underlying QoS system is malfunctioning.'; + + const span = document.getElementById('noflow_msg'); + if (span) span.innerHTML = noflowMsg; +}); + +/* consider anything below this many *kilobits* per second “idle” */ +const NOFLOW_CUTOFF_KBPS = 1; // feel free to raise/lower +const NOFLOW_THRESHOLD = 5; // 5 × 3s refresh about 15 seconds + +let noFlowCounter = 0; + +function kbpsFromRateString(str) { + if (!str) return 0; + if (str.includes("Mbit")) return parseFloat(str) * 1000; + if (str.includes("Kbit")) return parseFloat(str); + return parseFloat(str) / 1000; +} + +function check_bandwidth_flow () { + let dlRate = 0, ulRate = 0; + + for (const e of tcdata_lan_array) dlRate += kbpsFromRateString(e[2]); + for (const e of tcdata_wan_array) ulRate += kbpsFromRateString(e[2]); + + if (dlRate < NOFLOW_CUTOFF_KBPS && ulRate < NOFLOW_CUTOFF_KBPS) { + noFlowCounter++; + } else { + noFlowCounter = 0; + } + + const warn = document.getElementById('noflow_notice'); + warn.style.display = (noFlowCounter >= NOFLOW_THRESHOLD) ? 'block' + : 'none'; +} + function change_chart_scale(input) { var chart_scale = cookie.get('flexqos_rate_graph_scale'); if ( input == null ) { @@ -2743,7 +2794,7 @@ function DelCookie(cookiename){
"> -"> +"> @@ -2925,6 +2976,11 @@ function DelCookie(cookiename){
+
diff --git a/flexqos.sh b/flexqos.sh index 7db75df..78023ea 100644 --- a/flexqos.sh +++ b/flexqos.sh @@ -42,6 +42,9 @@ readonly ADDON_DIR="/jffs/addons/${SCRIPTNAME}" readonly WEBUIPATH="${ADDON_DIR}/${SCRIPTNAME}.asp" readonly SCRIPTPATH="${ADDON_DIR}/${SCRIPTNAME}.sh" readonly LOCKFILE="/tmp/addonwebui.lock" +readonly fwInstalledBaseVers="$(nvram get firmver | sed 's/\.//g')" +readonly fwInstalledBuildVers="$(nvram get buildno)" +readonly fwInstalledExtendNum="$(nvram get extendno)" IPv6_enabled="$(nvram get ipv6_service)" # Update version number in custom_settings.txt for reading in WebUI @@ -569,7 +572,7 @@ debug() { scriptinfo printf "Debug date : %s\n" "$(date +'%Y-%m-%d %H:%M:%S%z')" printf "Router Model : %s\n" "${RMODEL}" - printf "Firmware Ver : %s_%s\n" "$(nvram get buildno)" "$(nvram get extendno)" + printf "Firmware Ver : %s_%s\n" "$fwInstalledBuildVers" "$fwInstalledExtendNum" printf "DPI/Sig Ver : %s / %s\n" "$(nvram get bwdpi_dpi_ver)" "$(nvram get bwdpi_sig_ver)" get_config set_tc_variables @@ -1116,6 +1119,20 @@ menu() { clear sed -n '2,10p' "${0}" # display banner scriptinfo + if [ -f "/tmp/${SCRIPTNAME}_qos_failed" ]; then + if [ "$fwInstalledBaseVers" -eq 3006 ] + then + Yellow "Adaptive QoS is not functioning correctly on BE series routers" + Yellow "due to a known Asus/Trend Micro issue. Once Asus resolves this," + Yellow "FlexQoS should work as expected." + printf "\n" + else + Yellow "Adaptive QoS appears to be malfunctioning." + Yellow "FlexQoS cannot apply its rules while the underlying QoS issue persists." + Yellow "Please investigate your router’s QoS settings before relying on FlexQoS." + printf "\n" + fi + fi printf " (1) about explain functionality\n" printf " (2) update check for updates\n" printf " (3) debug traffic control parameters\n" @@ -1717,11 +1734,13 @@ startup() { logmsg "TC Modification Delay reached maximum 180 seconds again. Canceling startup!" rm "/tmp/${SCRIPTNAME}_restartonce" 2>/dev/null fi + touch "/tmp/${SCRIPTNAME}_qos_failed" return 1 else sleepdelay=$((sleepdelay+10)) fi done + rm -f "/tmp/${SCRIPTNAME}_qos_failed" [ "${sleepdelay}" -gt "0" ] && logmsg "TC Modification delayed for ${sleepdelay} seconds" rm "/tmp/${SCRIPTNAME}_restartonce" 2>/dev/null From 11e03b861d3dc803bd2bb3c0cc59e2a3936b44f8 Mon Sep 17 00:00:00 2001 From: ExtremeFiretop Date: Sat, 7 Jun 2025 18:29:54 -0400 Subject: [PATCH 5/6] Ignore Shellcheck Ignore annoying Shellcheck --- flexqos.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/flexqos.sh b/flexqos.sh index 78023ea..aa8fe98 100644 --- a/flexqos.sh +++ b/flexqos.sh @@ -42,6 +42,7 @@ readonly ADDON_DIR="/jffs/addons/${SCRIPTNAME}" readonly WEBUIPATH="${ADDON_DIR}/${SCRIPTNAME}.asp" readonly SCRIPTPATH="${ADDON_DIR}/${SCRIPTNAME}.sh" readonly LOCKFILE="/tmp/addonwebui.lock" +# shellcheck disable=SC2155 readonly fwInstalledBaseVers="$(nvram get firmver | sed 's/\.//g')" readonly fwInstalledBuildVers="$(nvram get buildno)" readonly fwInstalledExtendNum="$(nvram get extendno)" From 0432942328ae02b80b0fa856718fa5b7bc022af5 Mon Sep 17 00:00:00 2001 From: ExtremeFiretop Date: Sat, 7 Jun 2025 18:30:45 -0400 Subject: [PATCH 6/6] Ignore Shellcheck x2 Ignore Shellcheck x2 --- flexqos.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/flexqos.sh b/flexqos.sh index aa8fe98..d1b77a0 100644 --- a/flexqos.sh +++ b/flexqos.sh @@ -44,7 +44,9 @@ readonly SCRIPTPATH="${ADDON_DIR}/${SCRIPTNAME}.sh" readonly LOCKFILE="/tmp/addonwebui.lock" # shellcheck disable=SC2155 readonly fwInstalledBaseVers="$(nvram get firmver | sed 's/\.//g')" +# shellcheck disable=SC2155 readonly fwInstalledBuildVers="$(nvram get buildno)" +# shellcheck disable=SC2155 readonly fwInstalledExtendNum="$(nvram get extendno)" IPv6_enabled="$(nvram get ipv6_service)"