/[base]/head/contrib/traceroute/traceroute.c
ViewVC logotype

Log of /head/contrib/traceroute/traceroute.c

Parent Directory Parent Directory | Revision Log Revision Log


Links to HEAD: (view) (download) (annotate)
Sticky Revision:

Revision 340363 - (view) (download) (annotate) - [select for diffs]
Modified Mon Nov 12 15:52:45 2018 UTC (2 years, 5 months ago) by oshogbo
File length: 56020 byte(s)
Diff to previous 328488
libcasper: ange the name of limits in cap_dns so the intentions are obvious.

Reported by:	pjd
MFC after:	3 weeks


Revision 328488 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jan 27 19:23:42 2018 UTC (3 years, 3 months ago) by tuexen
File length: 56010 byte(s)
Diff to previous 323866
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


Revision 323866 - (view) (download) (annotate) - [select for diffs]
Modified Thu Sep 21 14:41:41 2017 UTC (3 years, 7 months ago) by oshogbo
File length: 54291 byte(s)
Diff to previous 315411
We use a few different ifdef's names to check if we are using Casper or not,
let's standardize this. Now we are always use WITH_CASPER name.

Discussed with:	emaste@
MFC after:	1 month


Revision 315411 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 16 13:01:23 2017 UTC (4 years, 1 month ago) by mmel
File length: 54321 byte(s)
Diff to previous 314949
Unbreak traceroute on system built without CAPSICUM


Revision 314949 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 9 06:41:00 2017 UTC (4 years, 1 month ago) by oshogbo
File length: 54249 byte(s)
Diff to previous 314000
Cache NLS data for strerror(3).


Revision 314000 - (view) (download) (annotate) - [select for diffs]
Modified Mon Feb 20 23:48:50 2017 UTC (4 years, 2 months ago) by oshogbo
File length: 54194 byte(s)
Diff to previous 283819
Capsicumize traceroute.

PR:		 193973
Submitted by:	 Mikhail <mp39590@gmail.com>
Reviewed by:	 pjd, bapt, emaste, AllanJude
Differential Revision:	https://reviews.freebsd.org/D9303


Revision 283819 - (view) (download) (annotate) - [select for diffs]
Modified Sun May 31 12:11:05 2015 UTC (5 years, 11 months ago) by tuexen
File length: 51994 byte(s)
Diff to previous 283817
A TCP checksum of 0 is completely valid. Mapping 0 to 0xffff only
applies to UDP and UDP-Lite.

MFC after: 3 days


Revision 283817 - (view) (download) (annotate) - [select for diffs]
Modified Sun May 31 12:03:38 2015 UTC (5 years, 11 months ago) by tuexen
File length: 52040 byte(s)
Diff to previous 283813
Don't send illegal packets when using UDP-Lite.

MFC after: 3 days


Revision 283813 - (view) (download) (annotate) - [select for diffs]
Modified Sun May 31 10:51:36 2015 UTC (5 years, 11 months ago) by tuexen
File length: 51141 byte(s)
Diff to previous 283808
Use an empty string for field descriptions of unknown protocols.

MFC after: 3 days


Revision 283808 - (view) (download) (annotate) - [select for diffs]
Modified Sun May 31 09:12:46 2015 UTC (5 years, 11 months ago) by tuexen
File length: 51143 byte(s)
Diff to previous 283806
Don't send malformed SCTP probe packets.

MFC after: 3 days


Revision 283806 - (view) (download) (annotate) - [select for diffs]
Modified Sun May 31 08:10:35 2015 UTC (5 years, 11 months ago) by tuexen
File length: 45774 byte(s)
Diff to previous 283786
When the packet verification fails in verbose mode, print the correct
number of words in host byte order. Also remove a stray 'x'.

MFC after: 3 days


Revision 283786 - (view) (download) (annotate) - [select for diffs]
Modified Sat May 30 20:39:19 2015 UTC (5 years, 11 months ago) by tuexen
File length: 45754 byte(s)
Diff to previous 283785
There is no payload anymore. So compute the minimum packet length
correctly and use 40 as the default (if the minumum allows it), as
specified in the man page.

MFC after: 3 days


Revision 283785 - (view) (download) (annotate) - [select for diffs]
Modified Sat May 30 19:52:28 2015 UTC (5 years, 11 months ago) by tuexen
File length: 45764 byte(s)
Diff to previous 283784
Require the embedded packet to contain 8 bytes after the IP header instead
of only 4. This is guaranteed by RFC 792 and the verification of GRE, ICMP
and TCP packets use 8 bytes.

MFC after: 3 days


Revision 283784 - (view) (download) (annotate) - [select for diffs]
Modified Sat May 30 19:48:40 2015 UTC (5 years, 11 months ago) by tuexen
File length: 45764 byte(s)
Diff to previous 234701
Remove trailing whitespaces.


Revision 234701 - (view) (download) (annotate) - [select for diffs]
Modified Thu Apr 26 13:45:17 2012 UTC (9 years ago) by tuexen
File length: 45776 byte(s)
Diff to previous 223579
Fix a bug in the TCP tracerouting which resulted in not accepting any
incoming packets. So all packets seemed to be lost.

MFC after: 1 week


Revision 223579 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jun 26 19:03:33 2011 UTC (9 years, 10 months ago) by dim
File length: 45807 byte(s)
Diff to previous 220968
For some reason, contrib/traceroute/traceroute.c ensures MAXHOSTNAMELEN
is defined, but then proceeds to use a hardcoded maximum hostname length
of 64 anyway.  Fix this by checking against MAXHOSTNAMELEN instead.

PR:		bin/157732
MFC after:	3 days


Revision 220968 - (view) (download) (annotate) - [select for diffs]
Modified Sat Apr 23 13:07:35 2011 UTC (10 years ago) by simon
File length: 45794 byte(s)
Diff to previous 216184
Check return code of setuid() in traceroute.

While it will not fail in normal circumstances, better safe than sorry.

Reported by:	LLVM's clang static analyzer
MFC after:	3 days


Revision 216184 - (view) (download) (annotate) - [select for diffs]
Modified Sat Dec 4 14:19:27 2010 UTC (10 years, 4 months ago) by uqs
File length: 45747 byte(s)
Diff to previous 215937
traceroute(8): make WARNS=3 clean

Also fixes an operator precedence bug for TCP tracerouting


Revision 215937 - (view) (download) (annotate) - [select for diffs]
Modified Sat Nov 27 09:26:46 2010 UTC (10 years, 5 months ago) by uqs
File length: 45821 byte(s)
Diff to previous 211062
Remove unused traceroute(8) contrib code from head

It still lives on under vendor/traceroute.


Revision 211062 - (view) (download) (annotate) - [select for diffs]
Modified Sun Aug 8 08:22:53 2010 UTC (10 years, 8 months ago) by ed
File length: 45892 byte(s)
Diff to previous 196475
Remove unneeded struct timezone passed to gettimeofday().


Revision 196475 - (view) (download) (annotate) - [select for diffs]
Modified Sun Aug 23 17:00:16 2009 UTC (11 years, 8 months ago) by ume
File length: 45933 byte(s)
Diff to previous 176428
- 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.


Revision 176428 - (view) (download) (annotate) - [select for diffs]
Modified Wed Feb 20 23:29:53 2008 UTC (13 years, 2 months ago) by rpaulo
File length: 45896 byte(s)
Diff to previous 171135
Add AS lookup functionality. On each hop we query a whois server to
find the corresponding AS for that IP (-a switch).
We can also choose a different whois server with the -A switch. The
default is whois.radb.net.

Obtained from:	       NetBSD
Reviewed by:	       bms, njl (mentor)
Approved by:	       njl (mentor)


Revision 171135 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jul 1 12:08:08 2007 UTC (13 years, 10 months ago) by gnn
File length: 45363 byte(s)
Diff to previous 169144
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


Revision 169144 - (view) (download) (annotate) - [select for diffs]
Modified Mon Apr 30 19:08:13 2007 UTC (14 years ago) by maxim
File length: 45363 byte(s)
Diff to previous 163388
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


Revision 163388 - (view) (download) (annotate) - [select for diffs]
Modified Sun Oct 15 17:44:49 2006 UTC (14 years, 6 months ago) by dwmalone
File length: 45363 byte(s)
Diff to previous 163387
Make it so that the synopsis and usage message almost agree.

MFC after:	3 weeks


Revision 163387 - (view) (download) (annotate) - [select for diffs]
Modified Sun Oct 15 17:34:51 2006 UTC (14 years, 6 months ago) by dwmalone
File length: 45362 byte(s)
Diff to previous 159576
Add a -D option to traceroute that prints the differences between
the probe packet we sent and the packet quoted by the ICMP response.
Can be useful for spotting hops that change the packet in-flight
or have problems generating correct ICMP responses.

MFC after:	3 weeks


Revision 159576 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jun 13 14:59:07 2006 UTC (14 years, 10 months ago) by dwmalone
File length: 44164 byte(s)
Diff to previous 158424
Make traceroute decode all the ICMP unreachable messages defined
in http://www.iana.org/assignments/icmp-parameters. Thankfully
IANA's list aggrees with <netinet/ip_icmp.h>.

I've tried to do this in a way which is mostly consistent with
tcptraceroute and Debian's version of traceroute. However, sometimes
a letter is used twice by these versions, so I've gone with:

                                LBL     tcptr   Debian          (chosen)
ICMP_UNREACH_NET                !N      !N      !N              !N
ICMP_UNREACH_HOST               !H      !H      !H              !H
ICMP_UNREACH_PROTOCOL           !P      !P      !P              !P
ICMP_UNREACH_PORT               !       !p      !               !
ICMP_UNREACH_NEEDFRAG           !F-%d   !F      !F-<%d>         !F-<%d>
ICMP_UNREACH_SRCFAIL            !S      !S      !S              !S
ICMP_UNREACH_NET_UNKNOWN        !<%d>   !U      !<%d>           !U
ICMP_UNREACH_HOST_UNKNOWN       !<%d>   !U      !<%d>           !W
ICMP_UNREACH_ISOLATED           !<%d>   !I      !I              !I
ICMP_UNREACH_NET_PROHIB         !<%d>   !A      !A              !A
ICMP_UNREACH_HOST_PROHIB        !<%d>   !C      !C              !Z
ICMP_UNREACH_TOSNET             !<%d>   !T      !T              !Q
ICMP_UNREACH_TOSHOST            !<%d>   !T      !T              !T
ICMP_UNREACH_FILTER_PROHIB      !X      !A      !A              !X
ICMP_UNREACH_HOST_PRECEDENCE    !V      !<%d>   !V              !V
ICMP_UNREACH_PRECEDENCE_CUTOFF  !C      !<%d>   !C              !C

Graham Wilson is planning to use the same codes in Debian's version.

MFC after:	3 weeks


Revision 158424 - (view) (download) (annotate) - [select for diffs]
Modified Thu May 11 06:30:18 2006 UTC (14 years, 11 months ago) by cjc
File length: 43560 byte(s)
Diff to previous 154192
Option for setting a fixed destination port. This is useful for tracing
to a host behind a firewall where only specific services are allowed.
For example, to trace the hops to an HTTP server behind a firewall,

  $ traceroute -e -P tcp -p 80 www-firewalled.example.com

MFC after:	1 week


Revision 154192 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jan 10 16:48:52 2006 UTC (15 years, 3 months ago) by pav
File length: 43228 byte(s)
Diff to previous 149509
- Update pretty print of multipath routes to better handle timeout of first
  probe

  Before:
   5  *
    freebsd (195.250.137.134)  19.086 ms  24.694 ms

  After:
   5  * freebsd (195.250.137.134)  19.086 ms  24.694 ms

Fixes:		bin/90098
Reported by:	Jeremy Chadwick <freebsd@jdc.parodius.com>
Approved by:	andre
MFC after:	1 day


Revision 149509 - (view) (download) (annotate) - [select for diffs]
Modified Fri Aug 26 18:08:24 2005 UTC (15 years, 8 months ago) by andre
File length: 43226 byte(s)
Diff to previous 128365
Pretty print multipath routes.

Before (backslash in c syntax meaning):
 6  p16-2-0-0.r21.sttlwa01.us.bb.verio.net (129.250.2.180)  71.027 ms \
p16-1-1-3.r20.sttlwa01.us.bb.verio.net (129.250.2.6)  66.730 ms  66.535 ms
 7  xe-0-2-0.r20.sttlwa01.us.bb.verio.net (129.250.4.16)  71.092 ms \
xe-3-1.r00.sttlwa01.us.bb.verio.net (129.250.2.205)  66.598 ms \
xe-0-2-0.r20.sttlwa01.us.bb.verio.net (129.250.4.16)  71.024 ms

After:
 6  p16-2-0-0.r21.sttlwa01.us.bb.verio.net (129.250.2.180)  71.027 ms
    p16-1-1-3.r20.sttlwa01.us.bb.verio.net (129.250.2.6)  66.730 ms  66.535 ms
 7  xe-0-2-0.r20.sttlwa01.us.bb.verio.net (129.250.4.16)  71.092 ms
    xe-3-1.r00.sttlwa01.us.bb.verio.net (129.250.2.205)  66.598 ms
    xe-0-2-0.r20.sttlwa01.us.bb.verio.net (129.250.4.16)  71.024 ms

Submitted by:	Richard A Steenbergen <ras at e-gerbil.net>
MFC after:	3 days


Revision 128365 - (view) (download) (annotate) - [select for diffs]
Modified Sat Apr 17 18:44:23 2004 UTC (17 years ago) by pb
File length: 43189 byte(s)
Diff to previous 124859
Check -s option source address for validity.

PR:		bin/29026
MFC after:	1 week


Revision 124859 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jan 23 06:55:15 2004 UTC (17 years, 3 months ago) by cperciva
File length: 43159 byte(s)
Diff to previous 100789
Fix traceroute where [number of hops] * [number of packets per hop] > 255.

PR:		misc/61336
Submitted by:	Mike Hibler <mike@cs.utah.edu>
Approved by:	rwatson (mentor)


Revision 100789 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jul 28 02:34:39 2002 UTC (18 years, 9 months ago) by fenner
File length: 43142 byte(s)
Diff to previous 100787
Calculate checksums correctly when LSRR is in effect by passing the
 IP header and protocol header seperately.
Also calculate TCP checksums.

Submitted by:	orion


Revision 100787 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jul 28 02:26:31 2002 UTC (18 years, 9 months ago) by fenner
File length: 42969 byte(s)
Diff to previous 100567
Merge 1.4a12


Revision 100567 - (view) (download) (annotate) - [select for diffs]
Modified Tue Jul 23 12:25:34 2002 UTC (18 years, 9 months ago) by dcs
File length: 35624 byte(s)
Diff to previous 100535
s/ifdef/ifndef/.

Fenner got this inverted through a misunderstanding between us.


Revision 100535 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jul 22 23:01:11 2002 UTC (18 years, 9 months ago) by fenner
File length: 35623 byte(s)
Diff to previous 100533
Add an ICMP protocol handler, partly based on LBL's traceroute 1.4 .

Submitted by:	dcs


Revision 100533 - (view) (download) (annotate) - [select for diffs]
Modified Mon Jul 22 22:07:23 2002 UTC (18 years, 9 months ago) by fenner
File length: 34464 byte(s)
Diff to previous 98709
Actually use gen_prep() and gen_check(), instead of udp_prep() and
 udp_check(), for unknown protocols.


Revision 98709 - (view) (download) (annotate) - [select for diffs]
Modified Sun Jun 23 21:54:18 2002 UTC (18 years, 10 months ago) by robert
File length: 34445 byte(s)
Diff to previous 77816
Allocate and clear the correct number of bytes for a
struct fd_set that should be able to hold sock + 1 bits.
Before, it was apparently assumed that an fd_mask has
the same size as type char.

PR:		bin/39617
Reported by:	Peter N Lewis <peter@stairways.com.au>


Revision 77816 - (view) (download) (annotate) - [select for diffs]
Modified Wed Jun 6 16:12:59 2001 UTC (19 years, 11 months ago) by ru
File length: 34409 byte(s)
Diff to previous 67682
Fetch the default maximum TTL value from the net.inet.ip.ttl MIB.

PR:		bin/19598
MFC after:	1 week


Revision 67682 - (view) (download) (annotate) - [select for diffs]
Modified Fri Oct 27 05:51:59 2000 UTC (20 years, 6 months ago) by obrien
File length: 34106 byte(s)
Diff to previous 66810
Defining usage() "__dead" is just ridiculous.  It also won't compile with
a June 2000 GCC 2.96 snapshot.

Reviewed by:	bde


Revision 66810 - (view) (download) (annotate) - [select for diffs]
Modified Sun Oct 8 07:58:32 2000 UTC (20 years, 6 months ago) by kris
File length: 34120 byte(s)
Diff to previous 66809
Don't write past the end of our fd_set

Obtained from:	OpenBSD, via KAME


Revision 66809 - (view) (download) (annotate) - [select for diffs]
Modified Sun Oct 8 07:54:43 2000 UTC (20 years, 6 months ago) by kris
File length: 34005 byte(s)
Diff to previous 62786
Format string paranoia.


Revision 62786 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jul 7 19:44:36 2000 UTC (20 years, 9 months ago) by ghelmer
File length: 33975 byte(s)
Diff to previous 58835
Document the -S flag (added in rev. 1.4) in the usage() function.

PR:		bin/18153
Prompted by:	Nathan Ahlstrom <nrahlstr@winternet.com>


Revision 58835 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 30 15:23:44 2000 UTC (21 years, 1 month ago) by shin
File length: 33974 byte(s)
Diff to previous 58804
Correct FreeBSD id place. Also correct vendor rcsid.

Specified by: bde

Reviewed by: bde


Revision 58804 - (view) (download) (annotate) - [select for diffs]
Modified Thu Mar 30 01:33:39 2000 UTC (21 years, 1 month ago) by shin
File length: 33981 byte(s)
Diff to previous 48221
Bypass IPsec for traceroute invoked by root.

PR: bin/17606
Submitted by: Louis Mamakos <louie@TransSys.COM


Revision 48221 - (view) (download) (annotate) - [select for diffs]
Modified Fri Jun 25 21:48:40 1999 UTC (21 years, 10 months ago) by archie
File length: 32953 byte(s)
Diff to previous 47071
Fix bug (introduced by me) where UDP port numbers were starting at 1 instead
of 33435 like before.

Reported by:	John Polstra <jdp@polstra.com>


Revision 47071 - (view) (download) (annotate) - [select for diffs]
Modified Wed May 12 17:28:31 1999 UTC (21 years, 11 months ago) by archie
File length: 32791 byte(s)
Diff to previous 46542
Add a min TTL flag to go along with the max TTL flag. That is, this flag
allows you to start tracing at a hop number other than 1.

Submitted by:	Stefan `Sec` Zehl <sec@42.org>


Revision 46542 - (view) (download) (annotate) - [select for diffs]
Modified Thu May 6 03:23:24 1999 UTC (22 years ago) by archie
File length: 32399 byte(s)
Diff to previous 44086
Add the capability for traceroute(8) to send packets of any IP protocol
instead of just UDP; an alternate protocol is specified by '-P proto'.
This is useful for finding routers that are blocking packets based on
IP protocol.  New handlers can be added fairly easily to do protocol-
specific things.


Revision 44086 - (view) (download) (annotate) - [select for diffs]
Modified Tue Feb 16 14:19:50 1999 UTC (22 years, 2 months ago) by des
File length: 28669 byte(s)
Diff to previous 44057
Better fix for the traceroute flood bug.

Submitted by:	bde


Revision 44057 - (view) (download) (annotate) - [select for diffs]
Modified Mon Feb 15 08:11:44 1999 UTC (22 years, 2 months ago) by des
File length: 28444 byte(s)
Diff to previous 36713
If the user provided a large enough argument to the -w option, the sum
would overflow and you'd end up doing select() with a negative timeout.


Revision 36713 - (view) (download) (annotate) - [select for diffs]
Modified Sat Jun 6 23:33:28 1998 UTC (22 years, 11 months ago) by jb
File length: 28378 byte(s)
Diff to previous 18811
Fix an alignment problem on alpha by doing a bytewise copy.


Revision 18811 - (view) (download) (annotate) - [select for diffs]
Modified Tue Oct 8 19:16:24 1996 UTC (24 years, 6 months ago) by sef
File length: 28296 byte(s)
Diff to previous 18803
Fix a typo.  Oops.

Submitted by:	asami


Revision 18803 - (view) (download) (annotate) - [select for diffs]
Modified Tue Oct 8 02:44:26 1996 UTC (24 years, 6 months ago) by sef
File length: 28296 byte(s)
Diff to previous 18695
Paul objected to my previous change.  This adds the same functionality
(implemented better, admittedly) with a new option, '-S'.  If the
maintainers of traceroute (Van?) add a -S option, we will then be in
conflict.

Also added a too-brief description of the option in the man page.  Someone
with a better command of English than I at the moment should probably look
over it and rephrase it.

Reviewed by:	pst, jkh


Revision 18695 - (view) (download) (annotate) - [select for diffs]
Modified Sat Oct 5 01:43:13 1996 UTC (24 years, 7 months ago) by sef
File length: 28243 byte(s)
Diff to previous 18583
Print out a summary of the loss percentages for each hop.  No manual changes
just yet, I know, evil of me.

Reviewed by:	jkh


Revision 18583 - (view) (download) (annotate) - [select for diffs]
Modified Mon Sep 30 19:39:25 1996 UTC (24 years, 7 months ago) by fenner
File length: 28142 byte(s)
Diff to previous 18580
Add FreeBSD modifications
- Move setuid(getuid()) much earlier
- Add "SANE_PRECISION" time printing code


Revision 18580 - (view) (download) (annotate) - [select for diffs]
Modified Mon Sep 30 19:09:55 1996 UTC (24 years, 7 months ago) by fenner
File length: 27614 byte(s)
Copied from: vendor/traceroute/dist/contrib/traceroute/traceroute.c revision 18579
Diff to previous 18579
This commit was generated by cvs2svn to compensate for changes in r18579,
which included commits to RCS files with non-trunk default branches.


Revision 18579 - (view) (download) (annotate) - [select for diffs]
Added Mon Sep 30 19:09:55 1996 UTC (24 years, 7 months ago) by fenner
Original Path: vendor/traceroute/dist/contrib/traceroute/traceroute.c
File length: 27614 byte(s)
Virgin import of LBL traceroute version 1.3.2.
Obtained from: ftp://ftp.ee.lbl.gov/traceroute.tar.Z on 30-Sep-1996.


This form allows you to request diffs between any two revisions of this file. For each of the two "sides" of the diff, enter a numeric revision.

  Diffs between and
  Type of Diff should be a

  ViewVC Help
Powered by ViewVC 1.1.27