1
0
Fork 0
mirror of https://github.com/Ysurac/openmptcprouter-feeds.git synced 2025-03-09 15:40:03 +00:00

Use ping instead of dig for tracker and change default tracker ip

This commit is contained in:
Ycarus 2018-01-29 09:57:52 +01:00
parent 7f5d5735f7
commit 31cfef1e81
2 changed files with 10 additions and 10 deletions

View file

@ -86,7 +86,6 @@ while true; do
if [ -d "/sys/class/net/$OMR_TRACKER_DEVICE" ]; then
# retrieve iface ip and gateway
#OMR_TRACKER_DEVICE_IP=$(ip -4 -o addr show "$OMR_TRACKER_DEVICE" | awk '{ print substr($4, 1, length($4) - 3) }')
OMR_TRACKER_DEVICE_IP=$(ip -4 -br addr ls dev "$OMR_TRACKER_DEVICE" | awk -F'[ /]+' '{print $3}')
# execute specific tracker
@ -95,13 +94,14 @@ while true; do
tries="$OMR_TRACKER_TRIES"
# loop until tries attempts have been reached
while [ "$tries" -gt 0 ]; do
ret=$(dig @"$OMR_TRACKER_HOST" \
-b "$OMR_TRACKER_DEVICE_IP" \
+time="$OMR_TRACKER_TIMEOUT" \
+tries=1 \
ret=$(ping "$OMR_TRACKER_HOST" \
-I "$OMR_TRACKER_DEVICE_IP" \
-w "$OMR_TRACKER_TIMEOUT" \
-c 1 \
-q \
"$@"
) && echo "$ret" | grep -sq "127.6.8.4" && {
OMR_TRACKER_LATENCY=$(echo "$ret" | awk '/Query time/{print $4}')
) && echo "$ret" | grep -sq "0% packet loss" && {
OMR_TRACKER_LATENCY=$(echo "$ret" | cut -d "/" -s -f4 | cut -d "." -f1)
_update_rto "$OMR_TRACKER_LATENCY"
OMR_TRACKER_STATUS="OK"
break

View file

@ -1,8 +1,8 @@
config defaults 'defaults'
list hosts '51.254.49.132'
list hosts '51.254.49.133'
list hosts '4.2.2.1'
list hosts '8.8.8.8'
option timeout '1'
option tries '3'
option tries '4'
option interval '2'
option options 'tracker.overthebox.ovh'