Red Hat Bugzilla – Bug 10426
ping -c hangs indefinitly if no packets received
Last modified: 2008-05-01 11:37:55 EDT
The new version of ping in 6.2 will not exit properly if it does not
receive any packets back.
% ping -c 2 -w 10 192.168.1.2
The '-c 2' option alone should cause ping to exit after approx. 2 seconds.
The '-w 10', according to the man page should stop execution after 10
seconds, regardless of results.
If the target host is up, all works fine. If something send back an error,
such as Host Unreachable, it exits properly as well. However, if the
target host is down and no router (or the local machine) sends an error
back, ping blocks until it is killed.
This causes problems with scripts which use ping to test whether a host
is up or down, something we use heavily at our office for monitoring
network health. I could spend a few hours rewriting my code to work
around the problem, but it is still a bug.
This seems to work in 6.2 and rawhide, but not with 6.1.
*** Bug 17121 has been marked as a duplicate of this bug. ***