Bug 6633 - ping's return code is always 0
ping's return code is always 0
Product: Red Hat Linux
Classification: Retired
Component: netkit-base (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
: 9296 (view as bug list)
Depends On:
  Show dependency treegraph
Reported: 1999-11-01 20:06 EST by eugene
Modified: 2008-05-01 11:37 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-01-27 14:44:23 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description eugene 1999-11-01 20:06:28 EST
Even if none of the packets returned, ping still
terminates with 0 error code.
Ex: /bin/ping -c 1 -q (non-existant machine on my
returns 0.
It is a very optimistic ping ;-)

Workaround - get ping from 5.2 (I never tried 6.0)
Comment 1 michael 1999-12-26 14:25:59 EST
Same for me. RH 6.1, netkit-base-0.10-37.

Just a guess, but this could be caused by ping receiving a "destination
host unreachable", and counts the error packet as a reply packet. From
the manpage:
     If ping does not receive any reply packets at all it will exit with code
     1.  On error it exits with code 2. Otherwise it exits with code 0. This
     makes it possible to use the exit code to see if a host is alive or not.
so this is, technically, behaviour as documented, but is not expected (or

$ ping -v -c 1
PING ( from : 56(84) bytes of data.
From Destination Host Unreachable
Vr HL TOS  Len   ID Flg  off TTL Pro  cks      Src      Dst Data
 4  5  00 5400 56a3   0 0000  40  01 c76e

--- ping statistics ---
1 packets transmitted, 0 packets received, +1 errors, 100% packet loss
$ echo $?
Comment 2 Jeff Johnson 2000-01-27 14:44:59 EST
The ping in iputils-991024-2 returns a non-zero return code if host is
Comment 3 Jeff Johnson 2000-02-10 09:24:59 EST
*** Bug 9296 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.