svn commit: r269803 - stable/8/sbin/ping6

Xin LI delphij at FreeBSD.org
Mon Aug 11 07:01:30 UTC 2014


Author: delphij
Date: Mon Aug 11 07:01:29 2014
New Revision: 269803
URL: http://svnweb.freebsd.org/changeset/base/269803

Log:
  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

Modified:
  stable/8/sbin/ping6/ping6.c
Directory Properties:
  stable/8/sbin/ping6/   (props changed)

Modified: stable/8/sbin/ping6/ping6.c
==============================================================================
--- stable/8/sbin/ping6/ping6.c	Mon Aug 11 07:00:57 2014	(r269802)
+++ stable/8/sbin/ping6/ping6.c	Mon Aug 11 07:01:29 2014	(r269803)
@@ -1093,8 +1093,14 @@ main(argc, 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;


More information about the svn-src-all mailing list