diff options
author | Florian Obser <florian@cvs.openbsd.org> | 2014-03-18 10:06:40 +0000 |
---|---|---|
committer | Florian Obser <florian@cvs.openbsd.org> | 2014-03-18 10:06:40 +0000 |
commit | 4517f8efd8ef42cf16ee4736527450ba056e13d3 (patch) | |
tree | d544fcebafe07a9478c765db64a97b57af2275eb | |
parent | faf056c5ae01f1df76e968b677854961435f3bdd (diff) |
Free -l flag, by default print hostnames and numeric addresses, like
traceroute does.
Immediatly reclaim -l flag to print hop limit of received pkg like
traceroute does.
OK benno
-rw-r--r-- | usr.sbin/traceroute6/traceroute6.8 | 14 | ||||
-rw-r--r-- | usr.sbin/traceroute6/traceroute6.c | 14 |
2 files changed, 11 insertions, 17 deletions
diff --git a/usr.sbin/traceroute6/traceroute6.8 b/usr.sbin/traceroute6/traceroute6.8 index ba3c9163418..1eac65ffeaf 100644 --- a/usr.sbin/traceroute6/traceroute6.8 +++ b/usr.sbin/traceroute6/traceroute6.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: traceroute6.8,v 1.20 2014/02/26 20:52:29 claudio Exp $ +.\" $OpenBSD: traceroute6.8,v 1.21 2014/03/18 10:06:39 florian Exp $ .\" $KAME: traceroute6.8,v 1.9 2002/08/30 03:56:20 onoe Exp $ .\" .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -28,7 +28,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.Dd $Mdocdate: February 26 2014 $ +.Dd $Mdocdate: March 18 2014 $ .Dt TRACEROUTE6 8 .Os .\" @@ -81,14 +81,8 @@ uses a routing header .It Fl I Use ICMP6 ECHO instead of UDP datagrams. .It Fl l -Print both host hostnames and numeric addresses. -Normally -.Nm -prints only hostnames if -.Fl n -is not specified, and only numeric addresses if -.Fl n -is specified. +Display the hop limit value of the returned packet. +This is useful for checking for asymmetric routing. .It Fl m Ar hoplimit Specify a maximum hoplimit. .It Fl n diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index bf11e709bb1..060a547ca07 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: traceroute6.c,v 1.61 2014/03/10 19:58:43 florian Exp $ */ +/* $OpenBSD: traceroute6.c,v 1.62 2014/03/18 10:06:39 florian Exp $ */ /* $KAME: traceroute6.c,v 1.63 2002/10/24 12:53:25 itojun Exp $ */ /* @@ -331,14 +331,13 @@ int waittime = 5; /* time to wait for response (in seconds) */ int nflag; /* print addresses numerically */ int dump; int useicmp; -int lflag; /* print both numerical address & hostname */ int Aflag; /* lookup ASN */ int main(int argc, char *argv[]) { int mib[4] = { CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_DEFHLIM }; - int incflag = 1, sump = 0; + int ttl_flag = 0, incflag = 1, sump = 0; char hbuf[NI_MAXHOST], src0[NI_MAXHOST], *ep; int ch, i, on = 1, seq, probe, rcvcmsglen, error, minlen; struct addrinfo hints, *res; @@ -436,7 +435,7 @@ main(int argc, char *argv[]) ident = htons(getpid() & 0xffff); /* same as ping6 */ break; case 'l': - lflag++; + ttl_flag++; break; case 'm': errno = 0; @@ -741,6 +740,8 @@ main(int argc, char *argv[]) lastaddr = Rcv.sin6_addr; } printf(" %g ms", deltaT(&t1, &t2)); + if (ttl_flag) + printf(" (%u)", rcvhlim); switch (i - 1) { case ICMP6_DST_UNREACH_NOROUTE: ++unreachable; @@ -1114,10 +1115,9 @@ print(struct msghdr *mhdr, int cc) strlcpy(hbuf, "invalid", sizeof(hbuf)); if (nflag) printf(" %s", hbuf); - else if (lflag) - printf(" %s (%s)", inetname((struct sockaddr *)from), hbuf); else - printf(" %s", inetname((struct sockaddr *)from)); + printf(" %s (%s)", inetname((struct sockaddr *)from), hbuf); + if (Aflag) print_asn((struct sockaddr *)from); |