summaryrefslogtreecommitdiff
path: root/usr.sbin/traceroute
AgeCommit message (Collapse)Author
2022-03-24whitespace niggle noticed during reviewTheo de Raadt
2021-09-15Explain that traceroute compresses * * * lines at the end of theFlorian Obser
output when we never reach the destination. Prompted by & input jmc
2021-09-03Make traceroute(8) faster by sending probes and doing DNS async.Florian Obser
Traditional traceroute would send one probe and then wait for up to 5 seconds for a reply and then send the next probe. On a lossy link that eventually ends in a black hole this would take about 15 minutes and people would hit control-c in anger. This rewrites the traceroute engine to use libevent and asr's async DNS interface. Probes are now send every 30ms or as soon as we get an answer back. With that we got the 15 minute worse case down to about 10 seconds. A minor adjustment that is possible with this is to delay printing a line until we get to a line with answers. This has two effects: 1) If there are intermediate hops that don't answer, output pauses for a bit so we keep the visual cue of "something might be wrong here". 2) If there is a black hole at the end, we don't print out many "* * *" lines and thus scrolling the interesting bits out of the terminal. We collapse those lines and just print 64 * * * at the end. Unfortunately the -c option to send udp probes to a fixed port had to go for now. But we should be able to add it back. "Once you have seen the new one you can't go back to the old one" & enthusiastic OK deraadt@ OK sthen@ "I am very distressed that florian went to bed without committing it" beck@
2021-08-31Make includes follow style(9).Florian Obser
2021-08-30Remove unused filesJob Snijders
OK deraadt@
2021-08-29-w default is now 3;Jason McIntyre
2021-08-28whitespace nitStuart Henderson
2021-08-28Allow traceroute -w values down to 1 second, from John CarmackStuart Henderson
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@
2021-07-12Change the error reporting pattern throughout the tree when unveilBob Beck
fails to report the path that the failure occured on. Suggested by deraadt@ after some tech discussion. Work done and verified by Ashton Fagg <ashton@fagg.id.au> ok deraadt@ semarie@ claudio@
2020-02-11Simplify and unify wording for the -I sourceaddr option in various places.Theo de Raadt
This is somewhat related to the "-b bind_addr" option some programs have, which should get some cleanup also... input florian claudio jmc
2019-08-28At startup, unveil entire filesystem to read-only. If after privdrop, someTheo de Raadt
implausible bug existed in the socket setup (mostly dns-related and setsockopt) it would be largely neutered. of course, a very restrictive pledge is installed soon after that... ok mestre brynet florian
2019-06-28When system calls indicate an error they return -1, not some arbitraryTheo de Raadt
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
2019-04-05fix link URL; pointed out by "openbsduser <at> airmail.cc"Stuart Henderson
2019-03-19delay dropping privs a bit when root so that setrtable works.Ted Unangst
traceroute bits from benno. ok benno claudio
2018-11-12get rid of useless casts on setsockopt callsDavid Gwynne
suggested by kn@ after similar changes to ping
2018-11-10add support for setting the traffic class on ipv6 packets.David Gwynne
it reuses the toskeyword handling that ipv4 uses for setting the tos field, which is equiavlent to traffic class. ok florian@ denis@
2018-10-20Sync root check from pingkn
Sync ping.c r1.217 (20.10.2016) to only drop uid/gid if invoked as root. OK sthen
2018-10-15No need to check ai_addrlen when we already checked ai_family, weFlorian Obser
are copying into the right sized struct. We can also trust the resolver to give us IPv6 if we ask it to. OK kn, deraadt
2017-08-03Since nearly 20 years the correct spelling ofFlorian Obser
ICMP6_DST_UNREACH_NOTNEIGHBOR is ICMP6_DST_UNREACH_BEYONDSCOPE (RFC 1885 was obsoleted). sthen grepped the ports sources to make sure nothing uses it. OK millert, jca
2017-05-28style(9) some variable declarationsSebastian Benoit
ok florian@
2017-05-28check_tos() gets a parameter so i can remove another global var.Sebastian Benoit
ok florian@
2017-05-28introduce struct tr_conf to keep all of the configuration.Sebastian Benoit
Functions needing access to any of those vars get it passed as a parameter. result: even less global vars. ok florian@
2017-05-28move as many globals as possible into the main function - thats theSebastian Benoit
only place where they are used. Only exception: v6flags - make it an argument to usage() ok florian@
2017-01-24Tell traceroute6 to choose source address based on correct routingFlorian Obser
table. From dhill, tweeks by me. OK benno
2017-01-13traceroute never sees a timeout when poll(2) returns when it receivesFlorian Obser
a packet not intended for us. E.g. a ping(8) is running in parallel. In this case we need to account for the time we already waited. Pointed out by Gabriel Nieto <gabnietof AT gmail>, thanks! Looks good to and input millert@
2016-10-21some text cleanup and remove an irrelevant note; ok florianJason McIntyre
2016-10-20some macro fixes for the options list;Jason McIntyre
2016-10-20try to make DESCRIPTION read like it was written for one program, not two;Jason McIntyre
ok florian
2016-09-28Always do the setgroups, setresgid and setresuid even if if theFlorian Obser
unprivileged user is not present instead of erroring out. This lets ping and traceroute work in restricted enviornments like the bgplg chroot. Problem reported by sthen@ input & prodding deraadt@
2016-09-27Drop privileges to newly added _traceroute user/group.Florian Obser
It does not buy us much when called as a unpriv user. But if run as root we can now lose privileges. Input deraadt@ OK benno@, sthen@
2016-09-19Only allow standard dot notation for IPv4 addresses as target.Florian Obser
We can get rid of inet_aton(3) and use the AF independent getaddrinfo(3). OK natano@, krw@, millert@, claudio@
2016-09-03rearrange code: traceroute.c now only contains main() and usage(),Sebastian Benoit
worker.c contains all other functions, and i tracked down which global variables are used in which file and marked them accordingly with static (or not). No functional change, just the basis of further work. ok florian@, deraadt@
2016-03-30for some time now mandoc has not required MLINKS to functionJason McIntyre
correctly - logically complete that now by removing MLINKS from base; authors need only to ensure there is an entry in NAME for any function/ util being added. MLINKS will still work, and remain for perl to ease upgrades; ok nicm (curses) bcook (ssl) ok schwarze, who provided a lot of feedback and assistance ok tb natano jung
2016-02-12pledge for "dns" if -A is passed, even with -n.Sebastien Marie
The -A (Look up the AS number for each hop address) use DNS service. ok jca@ sthen@
2015-11-06"source" doesn't need to be a global. While here, the correct spellingFlorian Obser
is NULL. Noticed while trying to hoist the source address selection from traceroute into ping / ping6.
2015-10-09Change all tame callers to namechange to pledge(2).Theo de Raadt
2015-10-03like ping, traceroute is a setuid root priv-drop which holds a sockraw.Theo de Raadt
we can tame it substantially with "stdio inet", plus "dns" if the -n option is missing. a successful exploit against it then cannot create files, or perform a variety of other operations, as described in the tame(2) man page. florian helped me a fair bit hoisting initization code upwards in ping, ping6, and traceroute, to make tame work here.
2015-09-14Avoid .Ns right after .Pf, it's pointless.Ingo Schwarze
In some cases, do additional cleanup in the immediate vicinity.
2015-08-30warnx(3) has an implicit \n at the end.Florian Obser
pointed out by deraadt@
2015-07-16The return type of memset(3) is void. No need for a cast.Florian Obser
No object change.
2015-03-11port the idea of using clock_gettime(CLOCK_MONOTONIC) for measuringDavid Gwynne
intervals from src/sbin/ping/ping.c r1.115. > use clock_gettime(CLOCK_MONOTONIC) to get timestamps to measure the > interval between sending a ping and getting a reply for it. > > this makes it resistant against local wall clock changes, which can > skew the intervals reported or make them go negative. this version puts clock_getting in a local gettime() function that converts to a struct timeval that all the previous callers of gettimeofday expect to get. requested by deraadt@ florian@
2015-02-11Replace base 10 strtol with strtonum.Florian Obser
OK krw@, tedu@, deraadt@
2015-02-09clean up flags++ instances around getopt()Theo de Raadt
ok florian
2015-01-20HOST_NAME_MAX + 1 is big enough for gethostname(3); this array hasFlorian Obser
been one char too big when it was defined in terms of MAXHOSTNAMELEN. While here, NI_MAXHOST is big enough for getnameinfo(3). OK benno@
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-12-09Use memmove() instead of strlcpy() for an overlapping string copyTodd C. Miller
so we don't rely on undefined behavior. OK deraadt@
2014-10-25Remove unnecessary netinet/in_systm.h include.Lawrence Teo
ok millert@
2014-09-08obvious cases of missing .An;Ingo Schwarze
found with the new mandoc(1) MANDOCERR_AN_MISSING warning; no text changes
2014-06-06Update description of optional argument "datalen" to reality.Florian Obser
Issue pointed out by, tweak and "looks ok" jmc@
2014-06-05Reduce code running as root by trying to create all needed socketsFlorian Obser
first, remember which failed, drop privs and then decide which sockets are needed and close the others. Only error out if the creation of a needed socket failed. That is it is non-fatal if tracerouting an INET4 address and the INET6 socket creations failed. prodding deraadt@; OK benno@