History log of /freebsd-current/usr.sbin/traceroute6/traceroute6.c
Revision Date Author Comments
# ba09352b 05-Nov-2023 Jose Luis Duran <jlduran@gmail.com>

traceroute: Standardize usage

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/901


# 00aa6353 05-Nov-2023 Jose Luis Duran <jlduran@gmail.com>

traceroute: Update values in examples

Standardize the documentation and update it to reflect the current
values.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/901


# 0a49be72 02-Feb-2024 Lexi Winter <lexi@le-Fay.ORG>

traceroute6: remove -l flag

The -l flag was used to tell traceroute6(8) to show both hostname and
address for each hop. However, traceroute(8) already does this by
default, and there's no reason for traceroute6 to behave differently.

Make this the default behaviour, and accept -l for backward
compatibility as a no-op flag.

Reviewed by: imp
Pull Request: https://github.com/freebsd/freebsd-src/pull/1023


# 0c2218d1 27-Oct-2023 Jose Luis Duran <jlduran@gmail.com>

traceroute6: Implement ECN bleaching detection

Explicit Congestion Notification (ECN) is a mechanism that allows
end-to-end notification of network congestion without dropping packets
by explicitly setting the ECN code point (2 bits).

Per RFC 8087, section 3.5, network devices should not be configured to
change the ECN code point in the packets that they forward, except to
set the CE (Congestion Experienced) code point ('11') to signal
incipient congestion.

The current commit adds an -E flag to traceroute6 that crafts a packet
with an ECT(1) code point ('01').

If the packet is received back with a zero ECN code point ('00'), it
outputs that the hop in question erases or "bleaches" the ECN code point
values. Bleaching may occur for various reasons (including normalizing
packets to hide which equipment supports ECN). This policy prevents the
use of ECN by applications.

If the packet is received back with an all-ones ECN code point ('11'),
it outputs that the hop in question is experiencing "congestion".

If the packet is received back with a different ECN code point ('10'),
it outputs that the hop in question changes or "mangles" the ECN code
point values.

If the packet is received with the same ECN code point that was sent
('01'), it outputs that the hop has "passed" the ECN bits appropriately.

Inspired by: Darwin
Reviewed by: imp, markj
MFC after: 1 month
Pull Request: https://github.com/freebsd/freebsd-src/pull/879


# 777e494a 27-Oct-2023 Jose Luis Duran <jlduran@gmail.com>

traceroute6: style(9) fixes

No functional change intended.

Reviewed by: imp, markj
MFC after: 1 week
Pull Request: https://github.com/freebsd/freebsd-src/pull/879


# 0b8224d1 24-Nov-2023 Warner Losh <imp@FreeBSD.org>

Remove copyright strings ifdef'd out

We've ifdef'd out the copyright strings for some time now. Go ahead and
remove the ifdefs. Plus whatever other detritis was left over from other
recent removals. These copyright strings are present in the comments and
are largely from CSRG's attempt at adding their copyright to every
binary file (which modern interpretations of the license doesn't
require).

Sponsored by: Netflix


# 8a7b6120 23-Nov-2023 Warner Losh <imp@FreeBSD.org>

usr.sbin: Remove ancient SCCS tags.

Remove ancient SCCS tags from the tree, automated scripting, with two
minor fixup to keep things compiling. All the common forms in the tree
were removed with a perl script.

Sponsored by: Netflix


# eba230af 25-Sep-2023 John Baldwin <jhb@FreeBSD.org>

Purge more stray embedded $FreeBSD$ strings

These do not use __FBSDID but instead use bare char arrays.

Reviewed by: imp, emaste
Differential Revision: https://reviews.freebsd.org/D41957


# 8ff4fc03 04-Oct-2022 Michael Tuexen <tuexen@FreeBSD.org>

traceroute6: fix capabilities for the rcv socket

On the receive socket, recvmsg() and poll()/select() is called.
Therefore, CAP_EVENT is needed in addition to CAP_RECV..

While there, check the socket for readbility before calling recvmsg().

Reviewed by: markj@
MFC after: 3 days
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D36878


# 1d712c05 02-May-2021 Zhenlei Huang <zlei.huang@gmail.com>

traceroute6: Properly calculate UDP checksum

The revision D25604 capsicumize traceroute6. For UDP the send socket was
changed from SOCK_DGRAM to SOCK_RAW and thus the UDP checksum need be
calculated by application itself other than the kernel.

outpacket is filled with zeros by line 707, thus the first round the UDP
checksum is correct. But subsequent rounds outudp->uh_sum will be left
with garbage.

PR: 255507
Reviewed by: ae, markj, tuexen
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D30042


# b8ae450f 01-Apr-2021 Mark Johnston <markj@FreeBSD.org>

traceroute6: Fix Capsicum rights for rcvsock

- Always use distinct sockets for send and recv
- Limit rights on the recv socket

For ICMP6 we were using the same socket for both send and receive, and
we limited rights on the socket such that it's impossible to receive
anything.

PR: 254623
Diagnosed by: Zhenlei Huang <zlei.huang@gmail.com>
Reviewed by: oshogbo
MFC after: 3 days
Differential Revision: https://reviews.freebsd.org/D29523


# 5c3bf25f 13-Oct-2020 Adrian Chadd <adrian@FreeBSD.org>

[traceroute6] Don't do the casper bits when we're not doing casper

This with the previous patch I committed makes traceroute6/traceroute
compile fine when libcasper isn't enabled.

This complains strongly with unused variables and such when compiled
with gcc-6 on mips32.

Tested:

* compiled/run on mips32 hardware (AR9344)

Reviewed by: emaste
Differential Revision: https://reviews.freebsd.org/D26773


# c7090651 13-Sep-2020 Michael Tuexen <tuexen@FreeBSD.org>

Add a -t option to traceroute6 to control the traffic class used when
sending probe packets.

Reviewed by: rscheff
MFC after: 1 week
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D26410


# 3303e9bc 12-Sep-2020 Michael Tuexen <tuexen@FreeBSD.org>

Fix the length of probe packets when using UDP.
Since https://svnweb.freebsd.org/changeset/base/365378 a raw socket is
used for sending UDP probe packets instead of a UDP socket. So don't
compensate for the UDP header anymore.


# 2d0fb1b3 12-Sep-2020 Michael Tuexen <tuexen@FreeBSD.org>

Simplify code, no functional change.

Since https://svnweb.freebsd.org/base?view=revision&revision=365378
UDP is handled the same way as SCTP and TCP (using a raw socket).
Therefore use the same code path.


# cc432e23 06-Sep-2020 Mariusz Zaborski <oshogbo@FreeBSD.org>

traceroute6: capsicumize it

Submitted by: Shubh Gupta <shubh@freebsd.org>
Sponsored by: Google (GSOC 2020)
Differential Revision: https://reviews.freebsd.org/D25604


# ca19d0d7 21-Jul-2020 Mark Johnston <markj@FreeBSD.org>

traceroute6: Fix most warnings at the default WARNS level.

Fix some style issues as well. Leave -Wno-cast-aligned set for now, as
most of the warnings come casts of CMSG_DATA(), which does provide
sufficient alignment in practice.

Submitted by: Shubh Gupta <shubh@freebsd.org>
Sponsored by: Google (GSOC 2020)
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D25603


# af58a3c6 22-Jul-2019 Alan Somers <asomers@FreeBSD.org>

Remove the USE_RFC2292BIS option and reap dead code

This option was imported as part of the KAME project in r62627 (in 2000).
It was turned on unconditionally in r121472 (in 2003) and has been on ever
since. The old alternative code has bitrotted. Reap the dead code.

Reported by: Ján Sučan <jansucan@gmail.com>
MFC after: 2 weeks
Differential Revision: https://reviews.freebsd.org/D20938


# 1f69b3fb 15-Jul-2019 Michael Tuexen <tuexen@FreeBSD.org>

Add support for ICMPv6 messages indicating a parameter problem related
to an unrecognized next header.

MFC after: 2 weeks


# 64694fdc 15-Jul-2019 Michael Tuexen <tuexen@FreeBSD.org>

Let packet_op() explicitly return the type and code instead of doing
this implicitly by encoding it in a number space.

No functional change intended.

This is done as a preparation to add support for ICMPv6 mesages
indicating a parameter problem related to the next header.

MFC after: 2 weeks


# 83c022b5 16-Jul-2019 Michael Tuexen <tuexen@FreeBSD.org>

Whitespace change. No functional change.

MFC after: 2 weeks


# 51eff8ef 27-Jan-2018 Michael Tuexen <tuexen@FreeBSD.org>

When using SCTP for sending probe packets, use INIT chunks for payloads
larger than or equal to 32 bytes. For smaller probe packets, keep using
SHUTDOWN-ACK chunks, possibly bundled with a PAD chunk.
Packets with INIT chunks more likely pass through firewalls. Therefore,
use them when possible.

MFC after: 1 week


# 8a16b7a1 20-Nov-2017 Pedro F. Giffuni <pfg@FreeBSD.org>

General further adoption of SPDX licensing ID tags.

Mainly focus on files that use BSD 3-Clause license.

The Software Package Data Exchange (SPDX) group provides a specification
to make it easier for automated tools to detect and summarize well known
opensource licenses. We are gradually adopting the specification, noting
that the tags are considered only advisory and do not, in any way,
superceed or replace the license texts.

Special thanks to Wind River for providing access to "The Duke of
Highlander" tool: an older (2014) run over FreeBSD tree was useful as a
starting point.


# d55fae02 29-Sep-2017 Michael Tuexen <tuexen@FreeBSD.org>

Fix reporting of probing size. This bug was introduced in r324119.

MFC after: 4 weeks


# 9d8b46c8 30-Sep-2017 Michael Tuexen <tuexen@FreeBSD.org>

Add SCTP and TCP as protocols for sending probe packets.

MFC after: 4 weeks


# aa96470c 30-Sep-2017 Michael Tuexen <tuexen@FreeBSD.org>

* Update function definitions.
* Ensure that the datalen always describes the length after the IPv6
header consistently, not matter which protocol us used for probes..
* Document that the default length is 20, not 12.
* Don't send inormation in probe packets which is not needed or
even checked when the responses are processed.
* Address CID 978587.

This is mainly a cleanup preparing the addition of SCTP and TCP
as possible probe packet protocols.

MFC after: 4 weeks


# fbbd9655 28-Feb-2017 Warner Losh <imp@FreeBSD.org>

Renumber copyright clause 4

Renumber cluase 4 to 3, per what everybody else did when BSD granted
them permission to remove clause 3. My insistance on keeping the same
numbering for legal reasons is too pedantic, so give up on that point.

Submitted by: Jan Schaumann <jschauma@stevens.edu>
Pull Request: https://github.com/freebsd/freebsd/pull/96


# 161ab37d 05-Nov-2016 Hiroki Sato <hrs@FreeBSD.org>

Fix an infinite loop at an non-responding hop when other echo replies
are kept arriving in the waittime time window.

Submitted by: Denny Page
PR: 210286
MFC after: 3 days


# ac97203f 11-May-2016 Pedro F. Giffuni <pfg@FreeBSD.org>

traceroute6(8): use NULL instead of zero for initializing a pointer.


# 0d7d117c 08-May-2012 Hajimu UMEMOTO <ume@FreeBSD.org>

Add -a and -A option to the usage.

MFC after: 1 week


# 914e11a7 11-Dec-2010 Joel Dahl <joel@FreeBSD.org>

Remove the advertising clause from UCB copyrighted files in usr.sbin. This
is in accordance with the information provided at
ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change


# f42640a3 04-Dec-2010 Ulrich Spörlein <uqs@FreeBSD.org>

traceroute6(8): make WARNS=3 clean


# a7d5f7eb 19-Oct-2010 Jamie Gritton <jamie@FreeBSD.org>

A new jail(8) with a configuration file, to replace the work currently done
by /etc/rc.d/jail.


# fe0506d7 09-Mar-2010 Marcel Moolenaar <marcel@FreeBSD.org>

Create the altix project branch. The altix project will add support
for the SGI Altix 350 to FreeBSD/ia64. The hardware used for porting
is a two-module system, consisting of a base compute module and a
CPU expansion module. SGI's NUMAFlex architecture can be an excellent
platform to test CPU affinity and NUMA-aware features in FreeBSD.


# 43ea76c9 13-Sep-2009 Hajimu UMEMOTO <ume@FreeBSD.org>

MFC r196475:
- Add AS lookup functionality to traceroute6(8) as well.
- Support for IPv6 transport for AS lookup.
- Introduce $RA_SERVER to set whois server.
- Support for 4 byte ASN.
- ANSIfy function declaration in as.c.

Approved by: re (kib)


# d429d720 23-Aug-2009 Hajimu UMEMOTO <ume@FreeBSD.org>

- Add AS lookup functionality to traceroute6(8) as well.
- Support for IPv6 transport for AS lookup.
- Introduce $RA_SERVER to set whois server.
- Support for 4 byte ASN.
- ANSIfy function declaration in as.c.

Tested by: IHANet folks.


# d7f03759 19-Oct-2008 Ulf Lilleengen <lulf@FreeBSD.org>

- Import the HEAD csup code which is the basis for the cvsmode work.


# d7b63faf 10-Feb-2008 David Malone <dwmalone@FreeBSD.org>

Give traceroute6 the ability to traceroute with packets with no
upper layer header (IP PROTO = 59). Useful for testing firewalls.

MFC after: 2 months


# 784bddbc 07-Nov-2007 Kevin Lo <kevlo@FreeBSD.org>

Cleanup of userland __P use


# 59876f93 23-Oct-2007 Christian S.J. Peron <csjp@FreeBSD.org>

When processing multi-path ip6 routers, place each router entry on its
own line. We made this change in traceroute(8) some time ago. This
is particularly useful when you are not resolving hostnames since ip6
addresses can be quite long, and lines wrap fairly easily in the
multi-path router case.

Discussed with: bz
MFC after: 1 month


# 8409aedf 30-Jun-2007 George V. Neville-Neil <gnn@FreeBSD.org>

Commit IPv6 support for FAST_IPSEC to the tree.
This commit includes all remaining changes for the time being including
user space updates.

Submitted by: bz
Approved by: re


# eea319c4 30-Apr-2007 Maxim Konovalov <maxim@FreeBSD.org>

o I failed to find a suitable explanation why traceroute(8) and
traceroute6(8) force -w flag (wait time) to be > 1 sec. Make it
possible to use 1 sec wait time.

PR: bin/110933
Submitted by: Dmitry Marakasov
Reviewed by: freebsd-net (silence)
MFC after: 1 month


# 19c7ed84 07-Mar-2007 Kevin Lo <kevlo@FreeBSD.org>

Use setresuid for simple privilege dropping.


# e961704a 13-Jun-2004 David Malone <dwmalone@FreeBSD.org>

Sync up with KAME. The main change is to try to avoid exposing
exposing information about the endianness and alighment requirements
in the packets sent by traceroute6.

Obtained from: KAME


# 84a1a4cf 12-Nov-2003 Hajimu UMEMOTO <ume@FreeBSD.org>

- setsockopt/sysctl takes int, not u_long.
- be more picky about argument parsing - like ERANGE.
- use u_long for args, not to lose accuracy/prevent overflow.
- socklen_t audit.
- Add -I (use icmp) option.
- warn if multiple addresses are present for dest.
- no need to pass tz.
- type pedant. check -p range.
- grab hlim from sysctl.
- typo in port number setting.

Obtained from: KAME


# c449e284 23-Oct-2003 Hajimu UMEMOTO <ume@FreeBSD.org>

- style
- index() -> strchr()
- stop use of MAXHOSTNAMELEN

Obtained from: KAME


# d24cb249 21-Oct-2003 Hajimu UMEMOTO <ume@FreeBSD.org>

stop use of NI_WITHSCOPEID. it was deprecated.

Obtained from: KAME


# 3111be41 21-Jul-2003 Maxim Konovalov <maxim@FreeBSD.org>

Quote from a Problem Report:

The output format specifier for the round-trip time in ping6 should be
changed to %.3f instead of %g since %g doesn't accurately represent the
precision of the number being output. In particular, %g truncates trailing
zeroes. 0.01 ms does not mean the same thing as 0.010 ms. Although they
are numerically identical, they do not have the same precision.

PR: bin/52324, bin/52750
Submitted by: dg
MFC after: 1 week


# 9d5abbdd 01-Jan-2003 Jens Schweikhardt <schweikh@FreeBSD.org>

Correct typos, mostly s/ a / an / where appropriate. Some whitespace cleanup,
especially in troff files.


# c3e36199 09-Sep-2002 Jacques Vidrine <nectar@FreeBSD.org>

Back out previous commit. I was a bit overzealous: the fd_set size is
calculated dynamically here.


# acc00518 09-Sep-2002 Jacques Vidrine <nectar@FreeBSD.org>

Check for FD_SET overrun.


# 33841545 10-Jun-2001 Hajimu UMEMOTO <ume@FreeBSD.org>

Sync with recent KAME.
This work was based on kame-20010528-freebsd43-snap.tgz and some
critical problem after the snap was out were fixed.
There are many many changes since last KAME merge.

TODO:
- The definitions of SADB_* in sys/net/pfkeyv2.h are still different
from RFC2407/IANA assignment because of binary compatibility
issue. It should be fixed under 5-CURRENT.
- ip6po_m member of struct ip6_pktopts is no longer used. But, it
is still there because of binary compatibility issue. It should
be removed under 5-CURRENT.

Reviewed by: itojun
Obtained from: KAME
MFC after: 3 weeks


# 2a1c5efa 08-Oct-2000 Kris Kennaway <kris@FreeBSD.org>

Sync with KAME. Don't write past the end of the fd_set.

Obtained from: KAME


# d94e8c62 05-Aug-2000 Kris Kennaway <kris@FreeBSD.org>

Don't call errx() without a format string, to protect against possible
localized error messages from ipsec_strerror().

Obtained from: OpenBSD


# de68a0da 05-Jul-2000 Kris Kennaway <kris@FreeBSD.org>

Sync with latest KAME code.

Obtained from: KAME


# 53c9088f 24-Feb-2000 Yoshinobu Inoue <shin@FreeBSD.org>

Security fixes. (Just same as sbin/ping and usr.sbin/traceroute)
-Open socket() at first and then setuid() to actual user.
-Allow ping6 preload option only for root.

Approved by: jkh

Submitted by: Neil Blakey-Milner <nbm@mithrandr.moria.org>


# 39865d64 08-Jan-2000 Yoshinobu Inoue <shin@FreeBSD.org>

replace gethostbyname() with getaddrinfo(), and gethostbyaddr() with
getipnodebyaddr().
This resolve 2 problems.
-can specify scope index(@ifname) for IPv6 link local addr
-reverse lookup for IPv6 loopback addr(::1) was strange, but fixed


# 04e87720 07-Jan-2000 Yoshinobu Inoue <shin@FreeBSD.org>

remove redundant ifdef's.

some part is specified by: phantom


# 7d56d374 27-Dec-1999 Yoshinobu Inoue <shin@FreeBSD.org>

Getaddrinfo(), getnameinfo(), and etc support in libc/net.
Several udp and raw apps IPv6 support.

Reviewed by: freebsd-arch, cvs-committers
Obtained from: KAME project