Bugzilla will be upgraded to version 5.0 on December 2, 2018. The outage period for the upgrade will start at 0:00 UTC and have a duration of 12 hours
Bug 10263 - ping exits with code 0 for unreachable hosts
ping exits with code 0 for unreachable hosts
Product: Red Hat Linux
Classification: Retired
Component: netkit-base (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Jeff Johnson
Depends On:
  Show dependency treegraph
Reported: 2000-03-20 10:05 EST by Alexander V. Konstantinou
Modified: 2008-05-01 11:37 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-03-20 10:20:17 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 Alexander V. Konstantinou 2000-03-20 10:05:36 EST
The ping man page states :

" 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."

The current (RH 6.1) ping does not return a non-zero exit code for
unreachable hosts :

aqua:akonstan> rpm -qf /bin/ping
aqua:akonstan> /bin/ping -c 1
PING ( from : 56(84) bytes of data.
From aqua.cs.columbia.edu ( Destination Host Unreachable

--- ping statistics ---
1 packets transmitted, 0 packets received, +1 errors, 100% packet loss
aqua:akonstan> echo $?
aqua:akonstan> uname -a
Linux aqua.cs.columbia.edu 2.2.12-20 #1 Mon Sep 27 10:40:35 EDT 1999 i686
Comment 1 Alexander V. Konstantinou 2000-03-20 10:16:59 EST
This bug has been fixed in iputils version 000305.
Comment 2 Jeff Johnson 2000-03-20 10:20:59 EST
Upgrade to the inetd/ping packages from Raw Hide, all known problems with ping
are fixed there. Note carefully that recent versions of Red Hat have changed
the "-c <packets>" to count received (not transmitted) packets, so you will
need to use "-w <secs>" if using ping to test reachability of hosts that may
be down.

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