summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/traceroute/traceroute.c10
-rw-r--r--usr.sbin/traceroute6/traceroute6.c8
2 files changed, 15 insertions, 3 deletions
diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c
index 14c37e55bde..6c136ef168f 100644
--- a/usr.sbin/traceroute/traceroute.c
+++ b/usr.sbin/traceroute/traceroute.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: traceroute.c,v 1.42 2002/05/21 00:46:44 deraadt Exp $ */
+/* $OpenBSD: traceroute.c,v 1.43 2002/05/26 13:24:54 deraadt Exp $ */
/* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */
/*-
@@ -47,7 +47,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.42 2002/05/21 00:46:44 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: traceroute.c,v 1.43 2002/05/26 13:24:54 deraadt Exp $";
#endif
#endif /* not lint */
@@ -227,6 +227,7 @@ static char rcsid[] = "$OpenBSD: traceroute.c,v 1.42 2002/05/21 00:46:44 deraadt
#include <sys/socket.h>
#include <sys/file.h>
#include <sys/ioctl.h>
+#include <sys/sysctl.h>
#include <netinet/in_systm.h>
#include <netinet/in.h>
@@ -309,6 +310,8 @@ main(argc, argv)
struct ip *ip;
u_int32_t tmprnd;
int sump = 0;
+ int mib[4] = { CTL_NET, PF_INET, IPPROTO_IP, IPCTL_DEFTTL };
+ size_t size = sizeof(max_ttl);
if ((pe = getprotobyname("icmp")) == NULL) {
fprintf(stderr, "icmp: unknown protocol\n");
@@ -323,6 +326,9 @@ main(argc, argv)
seteuid(getuid());
setuid(getuid());
+ (void) sysctl(mib, sizeof(mib)/sizeof(mib[0]), &max_ttl, &size,
+ NULL, 0);
+
ttl_flag = 0;
lsrr = 0;
on = 1;
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 */