summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHajimu UMEMOTO <ume@FreeBSD.org>2009-08-23 17:00:16 +0000
committerHajimu UMEMOTO <ume@FreeBSD.org>2009-08-23 17:00:16 +0000
commitd429d7201e8f70b30b132ee07b2aef42bc46c608 (patch)
treeed9630d75b8bf64e28c5ab5abefdd3666898f3d8 /usr.sbin
parent2f1ff7669c16de65bd70a0316ddc269a1cf54aea (diff)
downloadsrc-test2-d429d7201e8f70b30b132ee07b2aef42bc46c608.tar.gz
src-test2-d429d7201e8f70b30b132ee07b2aef42bc46c608.zip
Notes
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/traceroute6/Makefile5
-rw-r--r--usr.sbin/traceroute6/traceroute6.811
-rw-r--r--usr.sbin/traceroute6/traceroute6.c29
3 files changed, 42 insertions, 3 deletions
diff --git a/usr.sbin/traceroute6/Makefile b/usr.sbin/traceroute6/Makefile
index 6ff72d2bf0ca..60618a2ad408 100644
--- a/usr.sbin/traceroute6/Makefile
+++ b/usr.sbin/traceroute6/Makefile
@@ -13,12 +13,17 @@
# A PARTICULAR PURPOSE.
# $FreeBSD$
+TRACEROUTE_DISTDIR?= ${.CURDIR}/../../contrib/traceroute
+.PATH: ${TRACEROUTE_DISTDIR}
+
PROG= traceroute6
MAN= traceroute6.8
+SRCS= as.c traceroute6.c
BINOWN= root
BINMODE= 4555
CFLAGS+= -DIPSEC -DUSE_RFC2292BIS -DHAVE_POLL
+CFLAGS+= -I${.CURDIR} -I${TRACEROUTE_DISTDIR} -I.
DPADD= ${LIBIPSEC}
LDADD= -lipsec
diff --git a/usr.sbin/traceroute6/traceroute6.8 b/usr.sbin/traceroute6/traceroute6.8
index b6116f0aa1a4..884ad6dc339c 100644
--- a/usr.sbin/traceroute6/traceroute6.8
+++ b/usr.sbin/traceroute6/traceroute6.8
@@ -29,7 +29,7 @@
.\"
.\" $FreeBSD$
.\"
-.Dd May 17, 1998
+.Dd August 24, 2009
.Dt TRACEROUTE6 8
.Os
.\"
@@ -40,7 +40,7 @@
.Sh SYNOPSIS
.Nm
.Bk -words
-.Op Fl dIlnNrvU
+.Op Fl adIlnNrvU
.Ek
.Bk -words
.Op Fl f Ar firsthop
@@ -64,6 +64,9 @@
.Op Fl w Ar waittime
.Ek
.Bk -words
+.Op Fl A Ar as_server
+.Ek
+.Bk -words
.Ar target
.Op Ar datalen
.Ek
@@ -84,6 +87,10 @@ after the destination host name.
.Pp
Other options are:
.Bl -tag -width Ds
+.It Fl a
+Turn on AS# lookups for each hop encountered.
+.It Fl A Ar as_server
+Turn on AS# lookups and use the given server instead of the default.
.It Fl d
Debug mode.
.It Fl f Ar firsthop
diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c
index d06502f076f6..699af68c1ddd 100644
--- a/usr.sbin/traceroute6/traceroute6.c
+++ b/usr.sbin/traceroute6/traceroute6.c
@@ -282,6 +282,8 @@ static const char rcsid[] =
#include <netipsec/ipsec.h>
#endif
+#include "as.h"
+
#define DUMMY_PORT 10010
#define MAXPACKET 65535 /* max ip packet size */
@@ -359,6 +361,9 @@ int waittime = 5; /* time to wait for response (in seconds) */
int nflag; /* print addresses numerically */
int useproto = IPPROTO_UDP; /* protocol to use to send packet */
int lflag; /* print both numerical address & hostname */
+int as_path; /* print as numbers for each hop */
+char *as_server = NULL;
+void *asn;
int
main(argc, argv)
@@ -411,8 +416,15 @@ main(argc, argv)
seq = 0;
- while ((ch = getopt(argc, argv, "df:g:Ilm:nNp:q:rs:Uvw:")) != -1)
+ while ((ch = getopt(argc, argv, "aA:df:g:Ilm:nNp:q:rs:Uvw:")) != -1)
switch (ch) {
+ case 'a':
+ as_path = 1;
+ break;
+ case 'A':
+ as_path = 1;
+ as_server = optarg;
+ break;
case 'd':
options |= SO_DEBUG;
break;
@@ -867,6 +879,17 @@ main(argc, argv)
srcport = ntohs(Src.sin6_port);
}
+ if (as_path) {
+ asn = as_setup(as_server);
+ if (asn == NULL) {
+ fprintf(stderr,
+ "traceroute6: as_setup failed, AS# lookups"
+ " disabled\n");
+ (void)fflush(stderr);
+ as_path = 0;
+ }
+ }
+
/*
* Message to users
*/
@@ -948,6 +971,8 @@ main(argc, argv)
exit(0);
}
}
+ if (as_path)
+ as_shutdown(asn);
exit(0);
}
@@ -1361,6 +1386,8 @@ print(mhdr, cc)
if (getnameinfo((struct sockaddr *)from, from->sin6_len,
hbuf, sizeof(hbuf), NULL, 0, NI_NUMERICHOST) != 0)
strlcpy(hbuf, "invalid", sizeof(hbuf));
+ if (as_path)
+ printf(" [AS%u]", as_lookup(asn, hbuf, AF_INET6));
if (nflag)
printf(" %s", hbuf);
else if (lflag)