summaryrefslogtreecommitdiff
path: root/usr.sbin/traceroute6
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2002-05-26 13:24:55 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2002-05-26 13:24:55 +0000
commitd765d023e5efaee38cb6b64c35a0b974e59da084 (patch)
treeb5cf6fa2951fc61361102e5b35f1c9014ff93fb6 /usr.sbin/traceroute6
parenta559655f9e30ca92710146b3762228c7069266be (diff)
use sysctl to get ttl from the kernel; itojun ok
Diffstat (limited to 'usr.sbin/traceroute6')
-rw-r--r--usr.sbin/traceroute6/traceroute6.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/usr.sbin/traceroute6/traceroute6.c b/usr.sbin/traceroute6/traceroute6.c
index cb94c5acae8..0c0f00d8fde 100644
--- a/usr.sbin/traceroute6/traceroute6.c
+++ b/usr.sbin/traceroute6/traceroute6.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: traceroute6.c,v 1.20 2002/05/26 13:15:18 itojun Exp $ */
+/* $OpenBSD: traceroute6.c,v 1.21 2002/05/26 13:24:54 deraadt Exp $ */
/* $KAME: traceroute6.c,v 1.50 2002/05/26 13:12:07 itojun Exp $ */
/*
@@ -253,6 +253,7 @@ static char sccsid[] = "@(#)traceroute.c 8.1 (Berkeley) 6/6/93";
#include <sys/uio.h>
#include <sys/file.h>
#include <sys/ioctl.h>
+#include <sys/sysctl.h>
#include <netinet/in.h>
@@ -361,6 +362,8 @@ main(argc, argv)
static u_char *rcvcmsgbuf;
char hbuf[NI_MAXHOST], src0[NI_MAXHOST];
char *ep;
+ int mib[4] = { CTL_NET, PF_INET6, IPPROTO_IPV6, IPV6CTL_DEFHLIM };
+ size_t size = sizeof(max_hops);
/*
* Receive ICMP
@@ -374,6 +377,9 @@ main(argc, argv)
seteuid(getuid());
setuid(getuid());
+ (void) sysctl(mib, sizeof(mib)/sizeof(mib[0]), &max_hops, &size,
+ NULL, 0);
+
/* set a minimum set of socket options */
on = 1;
/* specify to tell receiving interface */