The problem reported in
        http://www.freebsd.org/cgi/query-pr.cgi?pr=612
was fixed in openbsd's src/usr.sbin/traceroute/traceroute.c
revision 1.5.

Later the same problem was reported in
        http://www.netbsd.org/cgi-bin/query-pr-single.pl?number=2701
offering an inferior fix (sloppy arithmetic; throwing away of already
received data).  It made sense for netbsd to commit it because they
had not taken freebsd's fix.  But it made no sense for openbsd to
commit it (revision 1.8).

I've tweaked freebsd's fix so that it really times out if there's
no time left.

Index: traceroute.c
===================================================================
RCS file: /cvs/src/usr.sbin/traceroute/traceroute.c,v
retrieving revision 1.67
diff -u -r1.67 traceroute.c
--- traceroute.c        5 Jun 2009 00:10:01 -0000       1.67
+++ traceroute.c        3 Jul 2009 09:20:39 -0000
@@ -608,10 +608,6 @@
                        send_probe(++seq, ttl, incflag, &to);
                        while ((cc = wait_for_reply(s, &from, &t1))) {
                                (void) gettimeofday(&t2, NULL);
-                               if (t2.tv_sec - t1.tv_sec > waittime) {
-                                       cc = 0;
-                                       break;
-                               }
                                i = packet_ok(packet, cc, &from, seq, incflag);
                                /* Skip short packet */
                                if (i == 0)
@@ -741,7 +737,7 @@
                wait.tv_sec--;
        }
        if (wait.tv_sec < 0)
-               wait.tv_sec = wait.tv_usec = 0;
+               return (0);
 
        if (select(sock+1, fdsp, (fd_set *)0, (fd_set *)0, &wait) > 0)
                cc = recvfrom(s, (char *)packet, sizeof(packet), 0,

Reply via email to