Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 57 additions & 1 deletion flexqos.asp
Original file line number Diff line number Diff line change
Expand Up @@ -1185,6 +1185,7 @@ function get_data() {
success: function(response) {
redraw();
draw_conntrack_table();
check_bandwidth_flow();
timedEvent = setTimeout("get_data();", refreshRate * 1000);
}
});
Expand Down Expand Up @@ -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 ) {
Expand Down Expand Up @@ -2743,7 +2794,7 @@ function DelCookie(cookiename){
<iframe name="hidden_frame" id="hidden_frame" width="0" height="0" frameborder="0"></iframe>
<form method="post" name="form" action="/start_apply.htm" target="hidden_frame">
<input type="hidden" name="preferred_lang" id="preferred_lang" value="<% nvram_get(" preferred_lang "); %>">
<input type="hidden" name="firmver" value="<% nvram_get(" firmver "); %>">
<input type="hidden" name="firmver" id="firmver" value="<% nvram_get(" firmver "); %>">
<input type="hidden" name="current_page" value="">
<input type="hidden" name="next_page" value="">
<input type="hidden" name="action_mode" value="apply">
Expand Down Expand Up @@ -2925,6 +2976,11 @@ function DelCookie(cookiename){
</table>
<br>
<div id="no_aqos_notice" style="display:none;font-size:125%;color:#FFCC00;">Note: Adaptive QoS is not enabled.</div>
<div id="noflow_notice"
style="display:none;font-size:125%;color:#FFCC00;">
No bandwidth flow detected.
<span id="noflow_msg"></span>
</div>
<table>
<tr id="dl_tr">
<td style="padding-right:10px;font-size:125%;color:#FFCC00;">
Expand Down
24 changes: 23 additions & 1 deletion flexqos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@ 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')"
# shellcheck disable=SC2155
readonly fwInstalledBuildVers="$(nvram get buildno)"
# shellcheck disable=SC2155
readonly fwInstalledExtendNum="$(nvram get extendno)"
IPv6_enabled="$(nvram get ipv6_service)"

# Update version number in custom_settings.txt for reading in WebUI
Expand Down Expand Up @@ -569,7 +575,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
Expand Down Expand Up @@ -1116,6 +1122,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"
Expand Down Expand Up @@ -1717,11 +1737,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

Expand Down