OpenBSD CVS

CVS log for src/usr.sbin/traceroute/worker.c


[BACK] Up to [local] / src / usr.sbin / traceroute

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.8 / (download) - annotate - [select for diffs], Fri Sep 3 09:13:00 2021 UTC (2 years, 8 months ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, OPENBSD_7_2_BASE, OPENBSD_7_2, OPENBSD_7_1_BASE, OPENBSD_7_1, OPENBSD_7_0_BASE, OPENBSD_7_0, HEAD
Changes since 1.7: +395 -162 lines
Diff to previous 1.7 (colored)

Make traceroute(8) faster by sending probes and doing DNS async.

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@

Revision 1.7 / (download) - annotate - [select for diffs], Tue Aug 31 18:12:47 2021 UTC (2 years, 9 months ago) by florian
Branch: MAIN
Changes since 1.6: +14 -12 lines
Diff to previous 1.6 (colored)

Make includes follow style(9).

Revision 1.6 / (download) - annotate - [select for diffs], Fri Jun 28 13:32:51 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8, OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.5: +4 -4 lines
Diff to previous 1.5 (colored)

When system calls indicate an error they return -1, not some arbitrary
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.

Revision 1.5 / (download) - annotate - [select for diffs], Thu Aug 3 17:36:06 2017 UTC (6 years, 9 months ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5, OPENBSD_6_4_BASE, OPENBSD_6_4, OPENBSD_6_3_BASE, OPENBSD_6_3, OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.4: +2 -2 lines
Diff to previous 1.4 (colored)

Since nearly 20 years the correct spelling of
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

Revision 1.4 / (download) - annotate - [select for diffs], Sun May 28 10:04:27 2017 UTC (7 years ago) by benno
Branch: MAIN
Changes since 1.3: +4 -4 lines
Diff to previous 1.3 (colored)

check_tos() gets a parameter so i can remove another global var.
ok florian@

Revision 1.3 / (download) - annotate - [select for diffs], Sun May 28 10:01:52 2017 UTC (7 years ago) by benno
Branch: MAIN
Changes since 1.2: +59 -53 lines
Diff to previous 1.2 (colored)

introduce struct tr_conf to keep all of the configuration.
Functions needing access to any of those vars get it passed as a parameter.
result: even less global vars.
ok florian@

Revision 1.2 / (download) - annotate - [select for diffs], Fri Jan 13 18:00:10 2017 UTC (7 years, 4 months ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1
Changes since 1.1: +2 -2 lines
Diff to previous 1.1 (colored)

traceroute never sees a timeout when poll(2) returns when it receives
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@

Revision 1.1 / (download) - annotate - [select for diffs], Sat Sep 3 22:00:06 2016 UTC (7 years, 8 months ago) by benno
Branch: MAIN

rearrange code: traceroute.c now only contains main() and usage(),
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@

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.