bin/52750: formatting of RTT wrong in traceroute6

David Greenman-Lawrence dg at dglawrence.com
Wed May 28 03:00:29 PDT 2003


>Number:         52750
>Category:       bin
>Synopsis:       formatting of RTT wrong in traceroute6
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed May 28 03:00:25 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     David G. Lawrence
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
Download Technologies, Inc.
>Environment:
System: FreeBSD nexus.dglawrence.com 4.8-STABLE FreeBSD 4.8-STABLE #0: Tue Apr 29 08:52:57 PDT 2003 dg at nexus.dglawrence.com:/a/src/sys/compile/NEXUS i386


	
>Description:
The output format specifier for the round-trip time in traceroute6 should be
changed to %.3f instead of %g since %g doesn't accurately represent the
precision of the number being output. In particular, %g truncates trailing
zeroes. 0.01 ms does not mean the same thing as 0.010 ms. Although they
are numerically identical, they do not have the same precision. This was
fixed by me in IPv4 traceroute in rev 1.2, almost 9 years ago.
See also PR 52324 for the same problem in ping6.

	
>How-To-Repeat:
Use IPv6 and traceroute6 a host. Notice occasional truncated precision when
the RTT ends in one or more zeroes.
>Fix:

Index: traceroute6.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/traceroute6/traceroute6.c,v
retrieving revision 1.4.2.4
diff -c -r1.4.2.4 traceroute6.c
*** traceroute6.c	3 Jul 2001 11:02:18 -0000	1.4.2.4
--- traceroute6.c	28 May 2003 09:45:33 -0000
***************
*** 867,873 ****
  						print(&rcvmhdr, cc);
  						lastaddr = Rcv.sin6_addr;
  					}
! 					Printf("  %g ms", deltaT(&t1, &t2));
  					switch(i - 1) {
  					case ICMP6_DST_UNREACH_NOROUTE:
  						++unreachable;
--- 867,873 ----
  						print(&rcvmhdr, cc);
  						lastaddr = Rcv.sin6_addr;
  					}
! 					Printf("  %.3f ms", deltaT(&t1, &t2));
  					switch(i - 1) {
  					case ICMP6_DST_UNREACH_NOROUTE:
  						++unreachable;

>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list