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,
[EMAIL PROTECTED]           Sunbay Software AG,
[EMAIL PROTECTED]          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 [EMAIL PROTECTED]
with "unsubscribe freebsd-current" in the body of the message

Reply via email to