From: Arne Fitzenreiter Date: Mon, 28 Jul 2008 07:18:07 +0000 (+0200) Subject: Use correct ping binary for pingtest X-Git-Tag: v2.3-beta2~1 X-Git-Url: http://git.ipfire.org/?p=people%2Fpmueller%2Fipfire-2.x.git;a=commitdiff_plain;h=b2e3aa9de8250708eb1cb42748ede52597bf2e97;hp=fc1e05c014d2aae03eeb0e05837fe4d29d9861ed Use correct ping binary for pingtest --- diff --git a/src/ppp/ip-up b/src/ppp/ip-up index ec4fc82b5f..65284b0381 100644 --- a/src/ppp/ip-up +++ b/src/ppp/ip-up @@ -44,35 +44,27 @@ echo -n "$1" > /var/ipfire/red/iface echo -n "$4" > /var/ipfire/red/local-ipaddress echo -n "$5" > /var/ipfire/red/remote-ipaddress -grep -v "gateway" /etc/hosts > /tmp/hosts -echo "$5 gateway" >> /tmp/hosts -touch /var/ipfire/red/active -mv /tmp/hosts /etc/hosts - -#Start pingtest in background and store the pid -ping -c 2 $5 > /tmp/gatewayping & -PINGPID=$! - run_subdir ${rc_base}/init.d/networking/red.up/ -[ -e "/var/ipfire/ppp/nobeeps" ] || /etc/rc.d/init.d/beep up - -#Make sure that pingtest has enough time -sleep 3 - -#Kill the pingtest -kill $PINGPID >/dev/null 2>&1 - #Check if gateway has answerd to ping, if not replace with ping.ipfire.org -TEST=`cat /tmp/gatewayping | tail -2 | head -1 | cut -d"," -f2`; +TEST=`/usr/bin/ping -c 2 $5 2>/dev/null | tail -2 | head -1 | cut -d"," -f2`; + +grep -v "gateway" /etc/hosts > /tmp/hosts if [ "$TEST" == " 2 packets received" ]; then - echo Ping gateway + #ping the ppp-gateway + echo "$5 gateway" >> /tmp/hosts else - echo Ping ipfire + #no answer FIRE=`nslookup ping.ipfire.org | tail -2 | head -1 | cut -d" " -f2`; - grep -v "gateway" /etc/hosts > /tmp/hosts - echo "$FIRE gateway" >> /tmp/hosts - mv /tmp/hosts /etc/hosts + if [ "$FIRE" == "server" ]; then + #DNS lookup failed use direct ip + echo "85.88.28.124 gateway" >> /tmp/hosts + else + #use ping.ipfire.org + echo "$FIRE gateway" >> /tmp/hosts + fi fi -rm -f /tmp/gatewayping +mv /tmp/hosts /etc/hosts + +[ -e "/var/ipfire/ppp/nobeeps" ] || /etc/rc.d/init.d/beep up