diff options
author | Xin LI <delphij@FreeBSD.org> | 2014-07-28 08:22:08 +0000 |
---|---|---|
committer | Xin LI <delphij@FreeBSD.org> | 2014-07-28 08:22:08 +0000 |
commit | dc91b5609a6de147a1e2d0f99939a630fce6d598 (patch) | |
tree | 87bb81b4d6ff9839e0c10df3c29a341b7811c9ad /sbin/ping6/ping6.c | |
parent | adecd05bf0293be427de08c863bf62887c075ef0 (diff) |
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
MFC after: 2 weeks
Notes
Notes:
svn path=/head/; revision=269180
Diffstat (limited to 'sbin/ping6/ping6.c')
-rw-r--r-- | sbin/ping6/ping6.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/sbin/ping6/ping6.c b/sbin/ping6/ping6.c index 01e29a194e3b..b963de176892 100644 --- a/sbin/ping6/ping6.c +++ b/sbin/ping6/ping6.c @@ -1090,8 +1090,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; |