From 2fb92017f596a7195dc469ae935bf56ce6666790 Mon Sep 17 00:00:00 2001 From: delphij Date: Mon, 11 Aug 2014 07:00:57 +0000 Subject: [PATCH] MFC r269180: When interval is set to very small value with limited amount of packets, ping6(8) would quit before the remote side gets a chance to respond. Solve this by resetting the itimer when we have reached the maximum packet number have reached, but let the other handling to continue. PR: bin/151023 Submitted by: tjmao at tjmao.net git-svn-id: svn://svn.freebsd.org/base/stable/9@269802 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sbin/ping6/ping6.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c index 18daba3ce..5b4133f9a 100644 --- a/sbin/ping6/ping6.c +++ b/sbin/ping6/ping6.c @@ -1088,8 +1088,14 @@ main(int argc, char *argv[]) /* signal handling */ if (seenalrm) { /* last packet sent, timeout reached? */ - if (npackets && ntransmitted >= npackets) - break; + if (npackets && ntransmitted >= npackets) { + struct timeval zerotime = {0, 0}; + itimer.it_value = zerotime; + itimer.it_interval = zerotime; + (void)setitimer(ITIMER_REAL, &itimer, NULL); + seenalrm = 0; /* clear flag */ + continue; + } retransmit(); seenalrm = 0; continue; -- 2.45.0