Subject: bin/2773: New flag for traceroute
To: None <gnats-bugs@gnats.netbsd.org>
From: None <darcy@druid.com>
List: netbsd-bugs
Date: 09/22/1996 13:09:22
>Number:         2773
>Category:       bin
>Synopsis:       traceroute missing useful -l flag
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sun Sep 22 10:20:01 1996
>Last-Modified:
>Originator:     D'Arcy J.M. Cain
>Organization:
D'Arcy J.M. Cain                           |  Democracy is three wolves
darcy@{druid.com|greenlight.ca}            |  and a sheep voting on
+1 416 943 5281     (DoD#0082)    (eNTP)   |  what's for dinner.
  --  Home: http://www.druid.com/      Work: http://www.greenlight.ca  --
>Release:        1.2_BETA
>Environment:
	
System: NetBSD druid.com 1.2_BETA NetBSD 1.2_BETA (DRUID) #1: Fri Aug 23 06:01:01 EDT 1996 darcy@druid.com:/usr/src/sys/arch/i386/compile/DRUID i386


>Description:
Sun has a flag (-l) to traceroute that shows the ttl of the returning
packet.  This is useful for checking for assymetric routing.
	
>How-To-Repeat:
	
>Fix:
Here are the diffs to impliment this flag.

*** /usr/src.original/usr.sbin/traceroute/traceroute.8  Sun Sep 22 13:00:55 1996
--- traceroute.8        Sun Sep 22 12:58:54 1996
***************
*** 44,49 ****
--- 44,50 ----
  .Nd print the route packets take to network host
  .Sh SYNOPSIS
  .Nm traceroute
+ .Op Fl l
  .Op Fl d
  .Op Fl D
  .Op Fl g Ar gateway_addr
***************
*** 78,83 ****
--- 79,87 ----
  .Pp
  Other options are:
  .Bl -tag -width Ds
+ .It Fl l
+ Display the ttl value of the returned packet.  This is useful for
+ checking for assymetric routing.
  .It Fl d
  Turn on socket-level debugging.
  .It Fl D
*** /usr/src.original/usr.sbin/traceroute/traceroute.c  Sat Oct 14 01:07:28 1995
--- traceroute.c        Thu Sep 19 22:34:30 1996
***************
*** 301,313 ****
        struct hostent *hp;
        struct protoent *pe;
        struct sockaddr_in from, to;
!       int ch, i, lsrr, on, probe, seq, tos, ttl;
        struct ip *ip;
  
        lsrr = 0;
        on = 1;
        seq = tos = 0;
!       while ((ch = getopt(argc, argv, "dDg:m:np:q:rs:t:w:v")) != -1)
                switch (ch) {
                case 'd':
                        options |= SO_DEBUG;
--- 301,314 ----
        struct hostent *hp;
        struct protoent *pe;
        struct sockaddr_in from, to;
!       int ch, i, lsrr, on, probe, seq, tos, ttl, ttl_flag;
        struct ip *ip;
  
+       ttl_flag = 0;
        lsrr = 0;
        on = 1;
        seq = tos = 0;
!       while ((ch = getopt(argc, argv, "dDg:m:np:q:rs:t:w:vl")) != -1)
                switch (ch) {
                case 'd':
                        options |= SO_DEBUG;
***************
*** 369,374 ****
--- 370,378 ----
                        if (waittime <= 1)
                                errx(1, "wait must be >1 sec.");
                        break;
+               case 'l':
+                       ttl_flag++;
+                       break;
                default:
                        usage();
                }
***************
*** 498,504 ****
--- 502,511 ----
                                                print(packet, cc, &from);
                                                lastaddr = from.sin_addr.s_addr;
                                        }
+                                       ip = (struct ip *)packet;
                                        Printf("  %g ms", deltaT(&t1, &t2));
+                                       if (ttl_flag)
+                                               Printf(" (%d)", ip->ip_ttl);
                                        switch(i - 1) {
                                        case ICMP_UNREACH_PORT:
  #ifndef ARCHAIC

>Audit-Trail:
>Unformatted: