Author: delphij
Date: Mon Jul 28 08:22:08 2014
New Revision: 269180
URL: http://svnweb.freebsd.org/changeset/base/269180

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

Modified:
  head/sbin/ping6/ping6.c

Modified: head/sbin/ping6/ping6.c
==============================================================================
--- head/sbin/ping6/ping6.c     Mon Jul 28 07:20:22 2014        (r269179)
+++ head/sbin/ping6/ping6.c     Mon Jul 28 08:22:08 2014        (r269180)
@@ -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;
_______________________________________________
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

Reply via email to