Bug 38573 - ping -o option (exit after one reply)
Summary: ping -o option (exit after one reply)
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 5.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-05-26 16:50 UTC by davidt
Modified: 2002-10-02 04:24 UTC (History)
0 users

See Also:


Attachments
ping_o_option.diff (2.05 KB, patch)
2002-05-26 16:50 UTC, davidt
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description davidt 2002-05-26 16:50:01 UTC
Whilst trying to make a script written for NetBSD run on FreeBSD, I
discovered the script used a non-existant (on FreeBSD) ping option ``-o''.

ping -o will exit after receiving a single reply packet, which is useful
for trying to see if a host/link is alive at all (which is what the script
was attempting to to do :).

I checked cvsweb, and discovered the changes required to implement -o were
pretty simple, so created the patch below, and decided it might be useful
to the FreeBSD community.

How-To-Repeat: 	N/A
Comment 1 Dima Dorfman 2002-05-27 00:07:33 UTC
David Taylor <davidt@yadt.co.uk> wrote:
> ping -o will exit after receiving a single reply packet, which is useful
> for trying to see if a host/link is alive at all (which is what the script
> was attempting to to do :).

Isn't this the same as `ping -c 1`?
Comment 2 davidt 2002-05-27 08:19:57 UTC
On Sun, 26 May 2002, Dima Dorfman wrote:
> David Taylor <davidt@yadt.co.uk> wrote:
> > ping -o will exit after receiving a single reply packet, which is useful
> > for trying to see if a host/link is alive at all (which is what the script
> > was attempting to to do :).
> 
> Isn't this the same as `ping -c 1`?

No, ping -c 1 will exit after *sending* one packet, whether it is received
or not.

ping -o -c 10 will send (up to) 10 packets, exiting sucessfully after
receiving the first reply, or exit(2)'ing if it fails to receive a reply
from any packet.

-- 
David Taylor
davidt@yadt.co.uk
"The future just ain't what it used to be"
Comment 3 dd freebsd_committer freebsd_triage 2002-10-02 04:24:29 UTC
State Changed
From-To: open->closed

Committed to -current, thanks!  I'll MFC this after 4.7.