From: kstailey Date: Sat, 22 Feb 1997 20:39:19 +0000 (+0000) Subject: add "-l" flag see NetBSD PR #3227 X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=ea4a10ddb7b0f8487a76439dddc8b34d13c8f75d;p=openbsd add "-l" flag see NetBSD PR #3227 --- diff --git a/usr.sbin/traceroute/traceroute.8 b/usr.sbin/traceroute/traceroute.8 index 85b16fc0acc..3c2aa8bd9fd 100644 --- a/usr.sbin/traceroute/traceroute.8 +++ b/usr.sbin/traceroute/traceroute.8 @@ -47,6 +47,7 @@ .Op Fl d .Op Fl D .Op Fl g Ar gateway_addr +.Op Fl l .Op Fl m Ar max_ttl .Op Fl n .Op Fl p Ar port @@ -87,6 +88,9 @@ Add .Ar gateway_addr to the list of addresses in the IP Loose Source Record Route (LSRR) option. If no gateways are specified, the LSRR option is omitted. +.It Fl l +Display the ttl value of the returned packet. This is useful for +checking for assymetric routing. .It Fl m Ar max_ttl Set the max time-to-live (max number of hops) used in outgoing probe packets. The default is 30 hops (the same default used for diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c index c04acfe7820..8a4b6c3ff62 100644 --- a/usr.sbin/traceroute/traceroute.c +++ b/usr.sbin/traceroute/traceroute.c @@ -301,7 +301,7 @@ main(argc, argv) struct hostent *hp; struct protoent *pe; struct sockaddr_in from, to; - int ch, i, lsrr, on, probe, seq, tos, ttl; + int ch, i, lsrr, on, probe, seq, tos, ttl, ttl_flag; struct ip *ip; if ((pe = getprotobyname("icmp")) == NULL) { @@ -317,10 +317,11 @@ main(argc, argv) seteuid(getuid()); setuid(getuid()); + ttl_flag = 0; lsrr = 0; on = 1; seq = tos = 0; - while ((ch = getopt(argc, argv, "dDg:m:np:q:rs:t:w:v")) != -1) + while ((ch = getopt(argc, argv, "dDg:m:np:q:rs:t:w:vl")) != -1) switch (ch) { case 'd': options |= SO_DEBUG; @@ -341,6 +342,9 @@ main(argc, argv) lsrrlen = 4; lsrrlen += 4; break; + case 'l': + ttl_flag++; + break; case 'm': max_ttl = atoi(optarg); if (max_ttl < 1 || max_ttl > MAXTTL) @@ -507,7 +511,10 @@ main(argc, argv) 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