From 19f5727097a0c7698c4f6b4efb102c51fe96f55b Mon Sep 17 00:00:00 2001 From: sthen Date: Sat, 28 Aug 2021 19:59:28 +0000 Subject: [PATCH] Allow traceroute -w values down to 1 second, from John Carmack Change the default -w from 5 to 3 seconds, reducing the time it waits for a response. John proposed using 1 second for this, but several of us are familiar with networks where that would be likely to remove hops, 3 seems reasonable and still saves 6 seconds on a non-responding hop (there's always mtr if you need faster output). Feedback from various, ok phessler@ kn@ florian@ --- usr.sbin/traceroute/traceroute.8 | 6 +++--- usr.sbin/traceroute/traceroute.c | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/usr.sbin/traceroute/traceroute.8 b/usr.sbin/traceroute/traceroute.8 index 3327dd18628..c61473c5b08 100644 --- a/usr.sbin/traceroute/traceroute.8 +++ b/usr.sbin/traceroute/traceroute.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: traceroute.8,v 1.69 2020/02/11 18:41:39 deraadt Exp $ +.\" $OpenBSD: traceroute.8,v 1.70 2021/08/28 19:59:28 sthen 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: February 11 2020 $ +.Dd $Mdocdate: August 28 2021 $ .Dt TRACEROUTE 8 .Os .Sh NAME @@ -201,7 +201,7 @@ and are listed. .It Fl w Ar waittime Set the time, in seconds, to wait for a response to a probe. -The default is 5. +The default is 3. .It Fl x Print the ICMP extended headers if available. This option is not available for IPv6. diff --git a/usr.sbin/traceroute/traceroute.c b/usr.sbin/traceroute/traceroute.c index b0bcd6cdb0b..a5a2a4091ff 100644 --- a/usr.sbin/traceroute/traceroute.c +++ b/usr.sbin/traceroute/traceroute.c @@ -1,4 +1,4 @@ -/* $OpenBSD: traceroute.c,v 1.164 2021/07/12 15:09:21 beck Exp $ */ +/* $OpenBSD: traceroute.c,v 1.165 2021/08/28 19:59:28 sthen Exp $ */ /* $NetBSD: traceroute.c,v 1.10 1995/05/21 15:50:45 mycroft Exp $ */ /* @@ -351,7 +351,7 @@ main(int argc, char *argv[]) rcvsock4 = rcvsock6 = sndsock4 = sndsock6 = -1; v4sock_errno = v6sock_errno = 0; - conf->waittime = 5 * 1000; + conf->waittime = 3 * 1000; if ((rcvsock6 = socket(AF_INET6, SOCK_RAW, IPPROTO_ICMPV6)) == -1) v6sock_errno = errno; @@ -554,9 +554,9 @@ main(int argc, char *argv[]) err(1, "setsockopt SO_RTABLE"); break; case 'w': - conf->waittime = strtonum(optarg, 2, INT_MAX, &errstr); + conf->waittime = strtonum(optarg, 1, INT_MAX, &errstr); if (errstr) - errx(1, "wait must be >1 sec."); + errx(1, "wait must be >=1 sec."); conf->waittime *= 1000; break; case 'x': -- 2.20.1