Bug 10263 - ping exits with code 0 for unreachable hosts
Summary: ping exits with code 0 for unreachable hosts
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: netkit-base   
(Show other bugs)
Version: 6.1
Hardware: i386
OS: Linux
Target Milestone: ---
Assignee: Jeff Johnson
QA Contact:
Depends On:
TreeView+ depends on / blocked
Reported: 2000-03-20 15:05 UTC by Alexander V. Konstantinou
Modified: 2008-05-01 15:37 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2000-03-20 15:20:17 UTC
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

Description Alexander V. Konstantinou 2000-03-20 15:05:36 UTC
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 15:16:59 UTC
This bug has been fixed in iputils version 000305.

Comment 2 Jeff Johnson 2000-03-20 15:20:59 UTC
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.