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

Add Link Quality check support for httping in OMR-Tracker

This commit is contained in:
Ycarus (Yannick Chabanois) 2024-11-15 17:31:15 +01:00
parent d4e18ee799
commit 7a89fb070a

View file

@ -164,6 +164,7 @@ _ping() {
"${host}" 2>&1
)
loss=$(echo "$ret" | awk '/packet loss/ {gsub("%","");print $6}' | tr -d '\n')
if [ -n "$loss" ] && [ "$loss" != "100" ]; then
if [ "$localip" = "yes" ]; then
latency=$(echo "$ret" | awk -F/ '/rtt/ {print int($5)}' | tr -d '\n')
@ -205,7 +206,7 @@ _ping() {
fi
false
}
#'
_httping() {
local host=$1
local deviceip=$2
@ -216,25 +217,41 @@ _httping() {
-y "${deviceip}" \
-t "$OMR_TRACKER_TIMEOUT" \
-c "$OMR_TRACKER_COUNT" 2>&1
) && echo "$ret" | grep -sq "1 ok" && {
)
bindcheck=$(echo "$ret" | grep "Address not available")
[ -n "$bindcheck" ] && OMR_TRACKER_NO_BIND=1
loss=$(echo "$ret" | awk '/failed/ {gsub("%",""); print int($5)}' | tr -d '\n')
if [ -n "$loss" ] && [ "$loss" != "100" ]; then
if [ "$localip" = "yes" ]; then
OMR_TRACKER_LATENCY=$(echo "$ret" | cut -d "/" -s -f5 | cut -d "." -f1 | tr -d '\n')
#_update_rto "$OMR_TRACKER_LATENCY"
latency=$(echo "$ret" | cut -d "/" -s -f5 | cut -d "." -f1 | tr -d '\n')
[ -n "$latency" ] && {
OMR_TRACKER_LATENCY="$latency"
#_update_rto "$OMR_TRACKER_LATENCY"
}
OMR_TRACKER_LOSS="$loss"
fi
return
}
fi
else
ret=$(httping -l "${host}" \
-y "${deviceip}" \
-t "$OMR_TRACKER_TIMEOUT" \
-c "$OMR_TRACKER_COUNT" 2>&1
) && echo "$ret" | grep -sq "1 ok" && {
)
bindcheck=$(echo "$ret" | grep "Address not available")
[ -n "$bindcheck" ] && OMR_TRACKER_NO_BIND=1
loss=$(echo "$ret" | awk '/failed/ {gsub("%",""); print int($5)}' | tr -d '\n')
if [ -n "$loss" ] && [ "$loss" != "100" ]; then
if [ "$localip" = "yes" ]; then
OMR_TRACKER_LATENCY=$(echo "$ret" | cut -d "/" -s -f5 | cut -d "." -f1 | tr -d '\n')
#_update_rto "$OMR_TRACKER_LATENCY"
latency=$(echo "$ret" | cut -d "/" -s -f5 | cut -d "." -f1 | tr -d '\n')
[ -n "$latency" ] && {
OMR_TRACKER_LATENCY="$latency"
#_update_rto "$OMR_TRACKER_LATENCY"
}
OMR_TRACKER_LOSS="$loss"
fi
return
}
fi
fi
false
}