fix: HTTP fallback probe when ICMP reports 100% loss (Eyeride NAT blocks ICMP)
Eyeride 5G device passes HTTP traffic but drops ICMP, causing false 100% loss. When ping gives 100% loss, try curl --interface to confirm connectivity; if HTTP probe succeeds, correct loss to 0% and derive latency from connect time. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -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'
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user