diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2000-04-20 07:49:48 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2000-04-20 07:49:48 +0000 |
commit | c19906fb4f34ad2de4d179ff790096b9eeb5c6e7 (patch) | |
tree | 99dab8d30c5ec56636b962ac7150b955f021ad03 /usr.sbin/traceroute6 | |
parent | a6dab56afc8916de5dc2d0b5e264b7204eae6b91 (diff) |
Same as the traceroute commit just now; add an option for skipping
nodes at the beginning of the trace.
Diffstat (limited to 'usr.sbin/traceroute6')
-rw-r--r-- | usr.sbin/traceroute6/traceroute6.8 | 5 | ||||
-rw-r--r-- | usr.sbin/traceroute6/traceroute6.c | 22 |
2 files changed, 21 insertions, 6 deletions
diff --git a/usr.sbin/traceroute6/traceroute6.8 b/usr.sbin/traceroute6/traceroute6.8 index b6a23186b8c..55170c8e6b6 100644 --- a/usr.sbin/traceroute6/traceroute6.8 +++ b/usr.sbin/traceroute6/traceroute6.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: traceroute6.8,v 1.3 2000/04/12 21:47:58 aaron Exp $ +.\" $OpenBSD: traceroute6.8,v 1.4 2000/04/20 07:49:47 angelos Exp $ .\" .\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. .\" All rights reserved. @@ -40,6 +40,7 @@ .Sh SYNOPSIS .Nm .Op Fl dlnrv +.Op Fl b Ar minhops .Op Fl m Ar hoplimit .Op Fl p Ar port .Op Fl q Ar probes @@ -52,6 +53,8 @@ .Bl -tag -width Ds .It Fl d Debug mode. +.It Fl b Ar minhops +Specify how many hops to skip in trace. .It Fl m Ar hoplimit Specify maximum hoplimit. .It Fl l diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index 6ef16ddd434..8f9ee4b36da 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: traceroute6.c,v 1.3 2000/03/12 03:56:44 itojun Exp $ */ +/* $OpenBSD: traceroute6.c,v 1.4 2000/04/20 07:49:47 angelos Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -348,6 +348,7 @@ char *source = 0; char *hostname; int nprobes = 3; +int min_hops = 1; int max_hops = 30; u_short ident; u_short port = 32768+666; /* start udp dest port # for probe packets */ @@ -380,7 +381,7 @@ main(argc, argv) on = 1; seq = 0; - while ((ch = getopt(argc, argv, "dlm:np:q:rs:w:vg:")) != EOF) + while ((ch = getopt(argc, argv, "b:dlm:np:q:rs:w:vg:")) != EOF) switch(ch) { case 'd': options |= SO_DEBUG; @@ -428,11 +429,19 @@ main(argc, argv) #endif freehostent(hp); break; + case 'b': + min_hops = atoi(optarg); + if (min_hops > max_hops) { + Fprintf(stderr, + "traceroute6: min hoplimit must be <= %d.\n", max_hops); + exit(1); + } + break; case 'm': max_hops = atoi(optarg); - if (max_hops <= 1) { + if (max_hops < min_hops) { Fprintf(stderr, - "traceroute6: max hoplimit must be >1.\n"); + "traceroute6: max hoplimit must be >= %d.\n", min_hops); exit(1); } break; @@ -768,10 +777,13 @@ main(argc, argv) Fprintf(stderr, ", %d hops max, %d byte packets\n", max_hops, datalen); (void) fflush(stderr); + if (min_hops > 1) + Printf("Skipping %d intermediate hops", min_hops - 1); + /* * Main loop */ - for (hops = 1; hops <= max_hops; ++hops) { + for (hops = min_hops; hops <= max_hops; ++hops) { struct in6_addr lastaddr; int got_there = 0; int unreachable = 0; |