summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSami Kerola <kerolasa@iki.fi>2019-08-28 20:05:22 +0100
committerSami Kerola <kerolasa@iki.fi>2019-08-28 20:13:36 +0100
commitf6e2622549770eca8e55d1817de40e650a3c9aab (patch)
tree6e25b5b0f60cc79bbea35454555d886ca4ca4081
parent18f14be80466ddc8fb17a400be82764a779c8dcd (diff)
downloadiputils-bugfix-211.tar.gz
arping: fix -f quit on first reply regressionbugfix-211
When arping runs together with -f 'quit on first reply' and -w <timeout> 'how long to wait for a reply' the command needs to exit if replies are not received after wait period. Notice that the exit in case of lost packages will be 1 signifying failure. Getting a reply results to 0 exit value. Addresses: https://bugs.debian.org/935946 Reported-by: Lucas Nussbaum <lucas@debian.org> Addresses: https://github.com/iputils/iputils/issues/211 Reported-by: Noah Meyerhans <noahm@debian.org> Broken-since: 67e070d08dcbec990e1178360f82b3e2ca4f6d5f Signed-off-by: Sami Kerola <kerolasa@iki.fi>
-rw-r--r--arping.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/arping.c b/arping.c
index 2c87c15..30884f6 100644
--- a/arping.c
+++ b/arping.c
@@ -764,7 +764,8 @@ static int event_loop(struct run_state *ctl)
continue;
}
total_expires += exp;
- if (0 < ctl->count && (uint64_t)ctl->count < total_expires) {
+ if ((0 < ctl->count && (uint64_t)ctl->count < total_expires) ||
+ (ctl->quit_on_reply && ctl->timeout < total_expires)) {
exit_loop = 1;
continue;
}