diff --git a/package/kit-busrouter/files/usr/lib/busrouter/telemetry-synology.sh b/package/kit-busrouter/files/usr/lib/busrouter/telemetry-synology.sh index 8d86ab5..5aec31b 100755 --- a/package/kit-busrouter/files/usr/lib/busrouter/telemetry-synology.sh +++ b/package/kit-busrouter/files/usr/lib/busrouter/telemetry-synology.sh @@ -239,6 +239,18 @@ _ping_iface() { # Extract loss _loss=$(echo "$_out" | sed -n 's/.* \([0-9]*\)% packet loss.*/\1/p') [ -z "$_loss" ] && _loss="null" + # If ICMP reports 100% loss, try HTTP probe — Eyeride NAT blocks ICMP but passes HTTP. + if [ "$_loss" = "100" ]; then + _t0=$(date +%s%3N 2>/dev/null || date +%s) + _hcode=$(curl -s --interface "$_iface" --connect-timeout 5 --max-time 8 \ + -o /dev/null -w "%{http_code}" http://1.1.1.1 2>/dev/null) + _t1=$(date +%s%3N 2>/dev/null || date +%s) + if [ -n "$_hcode" ] && [ "$_hcode" != "000" ]; then + _loss="0" + [ -z "$_avg" ] || [ "$_avg" = "null" ] && \ + _avg=$(awk "BEGIN { printf \"%.0f\", ${_t1} - ${_t0} }" 2>/dev/null) + fi + fi printf '%s %s %s\n' "${_avg}" "${_jitter}" "${_loss}" | tr -d '\n\r' }