From owner-freebsd-current Mon Jan 14 7: 4:13 2002 Delivered-To: freebsd-current@freebsd.org Received: from whale.sunbay.crimea.ua (whale.sunbay.crimea.ua [212.110.138.65]) by hub.freebsd.org (Postfix) with ESMTP id 576FD37B417; Mon, 14 Jan 2002 07:03:52 -0800 (PST) Received: (from ru@localhost) by whale.sunbay.crimea.ua (8.11.6/8.11.2) id g0EF3gt45879; Mon, 14 Jan 2002 17:03:42 +0200 (EET) (envelope-from ru) Date: Mon, 14 Jan 2002 17:03:42 +0200 From: Ruslan Ermilov To: current@FreeBSD.org Cc: ume@FreeBSD.org Subject: Re: cvs commit: src/sbin/ping ping.c Message-ID: <20020114170342.E21333@sunbay.com> References: <200201141433.g0EEXZV12841@freefall.freebsd.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <200201141433.g0EEXZV12841@freefall.freebsd.org> User-Agent: Mutt/1.3.23i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Jan 14, 2002 at 06:33:35AM -0800, Ruslan Ermilov wrote: > ru 2002/01/14 06:33:35 PST > > Modified files: > sbin/ping ping.c > Log: > Fixed two bugs with the "-l preload" option: > > - first ping after a preload was sent undelayed > - we could send more than -c packets in preload > > PR: bin/32354 > > Revision Changes Path > 1.61 +10 -6 src/sbin/ping/ping.c > Here's a patch for ping6(8). ping6 is not vulnerable to the second problem. Index: ping6.c =================================================================== RCS file: /cvs/FreeBSD/src/sbin/ping6/ping6.c,v retrieving revision 1.14 diff -u -p -u -p -6 -r1.14 ping6.c --- ping6.c 11 Dec 2001 18:36:29 -0000 1.14 +++ ping6.c 14 Jan 2002 14:55:48 -0000 @@ -969,26 +969,29 @@ main(argc, argv) printf("PING6(%lu=40+8+%lu bytes) ", (unsigned long)(40 + pingerlen()), (unsigned long)(pingerlen() - 8)); printf("%s --> ", pr_addr((struct sockaddr *)&src, sizeof(src))); printf("%s\n", pr_addr((struct sockaddr *)&dst, sizeof(dst))); - while (preload--) /* Fire off them quickies. */ - (void)pinger(); + if (preload == 0) + (void)pinger(); /* Send the first packet. */ + else { + while (preload--) /* Fire off them quickies. */ + (void)pinger(); + } (void)signal(SIGINT, onsignal); #ifdef SIGINFO (void)signal(SIGINFO, onsignal); #endif if ((options & F_FLOOD) == 0) { (void)signal(SIGALRM, onsignal); itimer.it_interval = interval; itimer.it_value = interval; (void)setitimer(ITIMER_REAL, &itimer, NULL); - retransmit(); } fdmasks = howmany(s + 1, NFDBITS) * sizeof(fd_mask); if ((fdmaskp = malloc(fdmasks)) == NULL) err(1, "malloc"); -- Ruslan Ermilov Oracle Developer/DBA, ru@sunbay.com Sunbay Software AG, ru@FreeBSD.org FreeBSD committer, +380.652.512.251 Simferopol, Ukraine http://www.FreeBSD.org The Power To Serve http://www.oracle.com Enabling The Information Age To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message