History log of /openbsd-current/usr.sbin/traceroute/worker.c
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.8 03-Sep-2021 florian

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@


# 1.7 31-Aug-2021 florian

Make includes follow style(9).


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.6 28-Jun-2019 deraadt

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 tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.5 03-Aug-2017 florian

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


# 1.4 28-May-2017 benno

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


# 1.3 28-May-2017 benno

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 tags: OPENBSD_6_1_BASE
# 1.2 13-Jan-2017 florian

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@


# 1.1 03-Sep-2016 benno

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@


# 1.7 31-Aug-2021 florian

Make includes follow style(9).


Revision tags: OPENBSD_6_6_BASE OPENBSD_6_7_BASE OPENBSD_6_8_BASE OPENBSD_6_9_BASE
# 1.6 28-Jun-2019 deraadt

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 tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.5 03-Aug-2017 florian

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


# 1.4 28-May-2017 benno

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


# 1.3 28-May-2017 benno

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 tags: OPENBSD_6_1_BASE
# 1.2 13-Jan-2017 florian

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@


# 1.1 03-Sep-2016 benno

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@


# 1.6 28-Jun-2019 deraadt

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 tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.5 03-Aug-2017 florian

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


# 1.4 28-May-2017 benno

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


# 1.3 28-May-2017 benno

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 tags: OPENBSD_6_1_BASE
# 1.2 13-Jan-2017 florian

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@


# 1.1 03-Sep-2016 benno

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@


Revision tags: OPENBSD_6_2_BASE
# 1.5 03-Aug-2017 florian

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


# 1.4 28-May-2017 benno

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


# 1.3 28-May-2017 benno

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 tags: OPENBSD_6_1_BASE
# 1.2 13-Jan-2017 florian

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@


# 1.1 03-Sep-2016 benno

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@