Bug 6633
Summary: | ping's return code is always 0 | ||
---|---|---|---|
Product: | [Retired] Red Hat Linux | Reporter: | eugene |
Component: | netkit-base | Assignee: | Jeff Johnson <jbj> |
Status: | CLOSED RAWHIDE | QA Contact: | |
Severity: | medium | Docs Contact: | |
Priority: | medium | ||
Version: | 6.1 | CC: | abrenner, michael |
Target Milestone: | --- | ||
Target Release: | --- | ||
Hardware: | i386 | ||
OS: | Linux | ||
Whiteboard: | |||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2000-01-27 19:44:23 UTC | Type: | --- |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
eugene
1999-11-02 01:06:28 UTC
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 useful). $ ping -v -c 1 10.42.42.55 PING 10.42.42.55 (10.42.42.55) from 10.42.42.1 : 56(84) bytes of data. From 10.42.42.1: 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 10.42.42.1 10.42.42.55 --- 10.42.42.55 ping statistics --- 1 packets transmitted, 0 packets received, +1 errors, 100% packet loss $ echo $? 0 The ping in iputils-991024-2 returns a non-zero return code if host is unreachable. |