diff options
author | Peter Hessler <phessler@cvs.openbsd.org> | 2013-10-21 08:47:11 +0000 |
---|---|---|
committer | Peter Hessler <phessler@cvs.openbsd.org> | 2013-10-21 08:47:11 +0000 |
commit | ff140a4c92a3eacc5b39594204550c21b6044642 (patch) | |
tree | b90c1a542cfca09d2f987bcbf52079b5bc252747 /usr.sbin | |
parent | 33d8821209c0e386fbcdf7c9aed976840f88af1f (diff) |
More rdomain / rtable support for useful diagnostic tools
OK claudio@ bluhm@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/traceroute6/traceroute6.8 | 8 | ||||
-rw-r--r-- | usr.sbin/traceroute6/traceroute6.c | 24 |
2 files changed, 26 insertions, 6 deletions
diff --git a/usr.sbin/traceroute6/traceroute6.8 b/usr.sbin/traceroute6/traceroute6.8 index 7f6cc632e68..70dd6b83241 100644 --- a/usr.sbin/traceroute6/traceroute6.8 +++ b/usr.sbin/traceroute6/traceroute6.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: traceroute6.8,v 1.15 2012/08/15 19:25:41 jmc Exp $ +.\" $OpenBSD: traceroute6.8,v 1.16 2013/10/21 08:47:10 phessler 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: August 15 2012 $ +.Dd $Mdocdate: October 21 2013 $ .Dt TRACEROUTE6 8 .Os .\" @@ -45,6 +45,7 @@ .Op Fl p Ar port .Op Fl q Ar probes .Op Fl s Ar src +.Op Fl V Ar rtable .Op Fl w Ar waittime .Ar host .Op Ar datalen @@ -106,6 +107,9 @@ that has no route through it Specify the source IPv6 address to be used. .It Fl v Be verbose. +.It Fl V Ar rtable +Set the routing table to be used. +The default is 0. .It Fl w Ar waittime Specify the time delay between probes. .El diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c index f765a6322ce..43a9dfadf6d 100644 --- a/usr.sbin/traceroute6/traceroute6.c +++ b/usr.sbin/traceroute6/traceroute6.c @@ -1,4 +1,4 @@ -/* $OpenBSD: traceroute6.c,v 1.49 2012/04/06 17:43:03 deraadt Exp $ */ +/* $OpenBSD: traceroute6.c,v 1.50 2013/10/21 08:47:10 phessler Exp $ */ /* $KAME: traceroute6.c,v 1.63 2002/10/24 12:53:25 itojun Exp $ */ /* @@ -344,6 +344,8 @@ main(int argc, char *argv[]) struct hostent *hp; size_t size; uid_t uid; + u_int rtableid; + const char *errstr; /* * Receive ICMP @@ -374,7 +376,7 @@ main(int argc, char *argv[]) seq = 0; - while ((ch = getopt(argc, argv, "Adf:g:Ilm:np:q:rs:w:v")) != -1) + while ((ch = getopt(argc, argv, "Adf:g:Ilm:np:q:rs:w:vV:")) != -1) switch (ch) { case 'A': Aflag++; @@ -484,6 +486,16 @@ main(int argc, char *argv[]) case 'v': verbose++; break; + case 'V': + rtableid = (unsigned int)strtonum(optarg, 0, + RT_TABLEID_MAX, &errstr); + if (errstr) + errx(1, "rtable value is %s: %s", + errstr, optarg); + if (setsockopt(rcvsock, SOL_SOCKET, SO_RTABLE, + &rtableid, sizeof(rtableid)) == -1) + err(1, "setsockopt SO_RTABLE"); + break; case 'w': ep = NULL; errno = 0; @@ -613,6 +625,9 @@ main(int argc, char *argv[]) perror("socket(SOCK_DGRAM)"); exit(5); } + if (setsockopt(sndsock, SOL_SOCKET, SO_RTABLE, + &rtableid, sizeof(rtableid)) == -1) + err(1, "setsockopt SO_RTABLE"); } #ifdef SO_SNDBUF i = datalen; @@ -697,7 +712,7 @@ main(int argc, char *argv[]) Src.sin6_port = htons(0); if (bind(sndsock, (struct sockaddr *)&Src, Src.sin6_len) < 0) { - perror("bind"); + perror("bind sndsock"); exit(1); } @@ -1203,6 +1218,7 @@ usage(void) fprintf(stderr, "usage: traceroute6 [-AdIlnrv] [-f firsthop] [-g gateway] [-m hoplimit]\n" -" [-p port] [-q probes] [-s src] [-w waittime] host [datalen]\n"); +" [-p port] [-q probes] [-s src] [-V rtableid] [-w waittime]\n" +" host [datalen]\n"); exit(1); } |