Date: Sat, 2 Aug 1997 16:31:07 -0700 (PDT) From: bkogawa@primenet.com To: FreeBSD-gnats-submit@FreeBSD.ORG Subject: bin/4218: change in ping behavior: -c now counts _received_ packets Message-ID: <199708022331.QAA05164@foo.primenet.com> Resent-Message-ID: <199708022330.QAA21626@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 4218
>Category: bin
>Synopsis: change in ping behavior: -c now counts _received_ packets
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: freebsd-bugs
>State: open
>Class: change-request
>Submitter-Id: current-users
>Arrival-Date: Sat Aug 2 16:30:00 PDT 1997
>Last-Modified:
>Originator: Bryan K. Ogawa
>Organization:
>Release: FreeBSD 2.2-STABLE i386
>Environment:
Using 2.2-stable as of August 1-2 with kernel from July 30.
>Description:
/sbin/ping -c <count> now pings until <count> pings are _received_,
not until <count> pings are sent. This behavior is problematic if
you are using ping in scripts to test for a working network:
previously, you could supply a count to ping in a script, and expect
the script to return after a finite time, even if the network is
down--e.g.:
if ( ping -q -c 3 206.165.96.21 | grep " 0% packet loss" )
then
echo network good
else
echo network bad
fi
With ping's new behavior, however, this script will run forever if no
packets are received (e.g. in a network failure condition).
>How-To-Repeat:
Do a ping -c <count> <host> where the hostname is unreachable (e.g. no
route to host errors). I presume this will also happen for hosts
which do not return ping packets, but I have not tested it.
>Fix:
Suggested, in order of preference:
(Is there a POSIX reason for the behavior?)
1. Revert the -c behavior to count sent packets and add a new flag which
counts only received packets.
2. Add another flag which only counts sent packets.
3. Revert to the -c behavior, removing the current behavior.
>Audit-Trail:
>Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199708022331.QAA05164>
