Skip to content

Commit

Permalink
arping: exit 0 if running in deadline mode and we see replies
Browse files Browse the repository at this point in the history
The arping behavior when running in deadline mode without a packet
count (-w without -c) should match that of ping: any replies indicate
that the host is up and should result in a zero (success) exit status.

Fixes: iputils#392
Closes: iputils#395

Reviewed-by: Petr Vorel <petr.vorel@gmail.com>
Signed-off-by: Noah Meyerhans <noahm@debian.org>
  • Loading branch information
nmeyerhans authored and pevik committed Feb 17, 2022
1 parent 8a6a2ce commit 854873b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 2 additions & 0 deletions arping.c
Original file line number Diff line number Diff line change
Expand Up @@ -848,6 +848,8 @@ static int event_loop(struct run_state *ctl)
else if (ctl->dad && ctl->quit_on_reply)
/* Duplicate address detection mode return value */
rc |= !(ctl->brd_sent != ctl->received);
else if (ctl->timeout && !(ctl->count > 0))
rc |= !(ctl->received > 0);
else
rc |= (ctl->sent != ctl->received);
return rc;
Expand Down
14 changes: 7 additions & 7 deletions doc/arping.xml
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,13 @@ xml:id="man.arping">
<listitem>
<para>Specify a timeout, in seconds, before
<command>arping</command> exits regardless of how many
packets have been sent or received. In this case
<command>arping</command> does not stop after
<emphasis remap='I'>count</emphasis> packet are sent, it
waits either for
<emphasis remap='I'>deadline</emphasis> expire or until
<emphasis remap='I'>count</emphasis> probes are
answered.</para>
packets have been sent or received. If any replies are
received, exit with status 0, otherwise status 1. When
combined with the <emphasis remap="I">count</emphasis>
option, exit with status 0 if <emphasis
remap="I">count</emphasis> replies are received before the
deadline expiration, otherwise status 1.
</para>
</listitem>
</varlistentry>
<varlistentry>
Expand Down

0 comments on commit 854873b

Please sign in to comment.