diff options
author | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-06-05 00:10:02 +0000 |
---|---|---|
committer | Claudio Jeker <claudio@cvs.openbsd.org> | 2009-06-05 00:10:02 +0000 |
commit | 31e1d3f1b48112b75bd30a8ac1973f4bda25b256 (patch) | |
tree | 7a94320ec23bb94fe35fc74f07bf1b52fa204b9a /usr.sbin | |
parent | f529a50ff509043b679016239a6d36d74d4439f8 (diff) |
Use -V to specify an alternate routing domain.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/traceroute/traceroute.8 | 7 | ||||
-rw-r--r-- | usr.sbin/traceroute/traceroute.c | 24 |
2 files changed, 24 insertions, 7 deletions
diff --git a/usr.sbin/traceroute/traceroute.8 b/usr.sbin/traceroute/traceroute.8 index 67dc1355a16..af697990ddc 100644 --- a/usr.sbin/traceroute/traceroute.8 +++ b/usr.sbin/traceroute/traceroute.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: traceroute.8,v 1.39 2007/05/31 19:20:30 jmc Exp $ +.\" $OpenBSD: traceroute.8,v 1.40 2009/06/05 00:10:01 claudio Exp $ .\" $NetBSD: traceroute.8,v 1.6 1995/10/12 03:05:50 mycroft Exp $ .\" .\" Copyright (c) 1990, 1991, 1993 @@ -33,7 +33,7 @@ .\" .\" @(#)traceroute.8 8.1 (Berkeley) 6/6/93 .\" -.Dd $Mdocdate: May 31 2007 $ +.Dd $Mdocdate: June 5 2009 $ .Dt TRACEROUTE 8 .Os .Sh NAME @@ -51,6 +51,7 @@ .Op Fl q Ar nqueries .Op Fl s Ar src_addr .Op Fl t Ar tos +.Op Fl V Ar rdomain .Op Fl w Ar waittime .Ar host .Op Ar packetsize @@ -190,6 +191,8 @@ Useful values are probably (low delay) and .Ql -t 8 (high throughput). +.It Fl V Ar rdomain +Set the routing domain, the default is 0. .It Fl v Verbose output. Received diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c index e2ed7bf7ecd..261988cb384 100644 --- a/usr.sbin/traceroute/traceroute.c +++ b/usr.sbin/traceroute/traceroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: traceroute.c,v 1.66 2008/10/04 02:21:49 deraadt Exp $ */ +/* $OpenBSD: traceroute.c,v 1.67 2009/06/05 00:10:01 claudio Exp $ */ /* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */ /*- @@ -43,7 +43,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)traceroute.c 8.1 (Berkeley) 6/6/93";*/ #else -static char rcsid[] = "$OpenBSD: traceroute.c,v 1.66 2008/10/04 02:21:49 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: traceroute.c,v 1.67 2009/06/05 00:10:01 claudio Exp $"; #endif #endif /* not lint */ @@ -307,8 +307,9 @@ main(int argc, char *argv[]) struct ip *ip; u_int8_t ttl; char *ep; + const char *errstr; long l; - uid_t uid; + uid_t uid, rdomain; if ((s = socket(AF_INET, SOCK_RAW, IPPROTO_ICMP)) < 0) err(5, "icmp socket"); @@ -323,7 +324,7 @@ main(int argc, char *argv[]) (void) sysctl(mib, sizeof(mib)/sizeof(mib[0]), &max_ttl, &size, NULL, 0); - while ((ch = getopt(argc, argv, "SDIdg:f:m:np:q:rs:t:w:vlP:c")) != -1) + while ((ch = getopt(argc, argv, "cDdf:g:Ilm:nP:p:q:rSs:t:V:vw:")) != -1) switch (ch) { case 'S': sump = 1; @@ -436,6 +437,19 @@ main(int argc, char *argv[]) case 'v': verbose++; break; + case 'V': + rdomain = (unsigned int)strtonum(optarg, 0, + RT_TABLEID_MAX, &errstr); + if (errstr) + errx(1, "rdomain value is %s: %s", + errstr, optarg); + if (setsockopt(sndsock, IPPROTO_IP, SO_RDOMAIN, + &rdomain, sizeof(rdomain)) == -1) + err(1, "setsockopt SO_RDOMAIN"); + if (setsockopt(s, IPPROTO_IP, SO_RDOMAIN, + &rdomain, sizeof(rdomain)) == -1) + err(1, "setsockopt SO_RDOMAIN"); + break; case 'w': errno = 0; ep = NULL; @@ -1041,6 +1055,6 @@ usage(void) fprintf(stderr, "usage: %s [-cDdIlnrSv] [-f first_ttl] [-g gateway_addr] [-m max_ttl]\n" "\t[-P proto] [-p port] [-q nqueries] [-s src_addr] [-t tos]\n" - "\t[-w waittime] host [packetsize]\n", __progname); + "\t[-V rdomain] [-w waittime] host [packetsize]\n", __progname); exit(1); } |