Commit Graph

56 Commits

Author SHA1 Message Date
Mariusz Zaborski
752d135e0d libcasper: ange the name of limits in cap_dns so the intentions are obvious.
Reported by:	pjd
MFC after:	3 weeks
2018-11-12 15:52:45 +00:00
Michael Tuexen
51eff8efd9 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
2018-01-27 19:23:42 +00:00
Mariusz Zaborski
2560d18180 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
2017-09-21 14:41:41 +00:00
Michal Meloun
3c63fe7aa2 Unbreak traceroute on system built without CAPSICUM 2017-03-16 13:01:23 +00:00
Mariusz Zaborski
4529332709 Cache NLS data for strerror(3). 2017-03-09 06:41:00 +00:00
Mariusz Zaborski
7b13366373 Capsicumize traceroute.
PR:		 193973
Submitted by:	 Mikhail <mp39590@gmail.com>
Reviewed by:	 pjd, bapt, emaste, AllanJude
Differential Revision:	https://reviews.freebsd.org/D9303
2017-02-20 23:48:50 +00:00
Michael Tuexen
0239602b83 A TCP checksum of 0 is completely valid. Mapping 0 to 0xffff only
applies to UDP and UDP-Lite.

MFC after: 3 days
2015-05-31 12:11:05 +00:00
Michael Tuexen
3628ed585b Don't send illegal packets when using UDP-Lite.
MFC after: 3 days
2015-05-31 12:03:38 +00:00
Michael Tuexen
4b5a89f438 Use an empty string for field descriptions of unknown protocols.
MFC after: 3 days
2015-05-31 10:51:36 +00:00
Michael Tuexen
027cfc25a9 Don't send malformed SCTP probe packets.
MFC after: 3 days
2015-05-31 09:12:46 +00:00
Michael Tuexen
f826bfc33f 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
2015-05-31 08:10:35 +00:00
Michael Tuexen
a6167a2523 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
2015-05-30 20:39:19 +00:00
Michael Tuexen
3105514edd 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
2015-05-30 19:52:28 +00:00
Michael Tuexen
8dcbd3fed4 Remove trailing whitespaces. 2015-05-30 19:48:40 +00:00
Michael Tuexen
7a7a6331a9 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
2012-04-26 13:45:17 +00:00
Dimitry Andric
4b9414ab92 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
2011-06-26 19:03:33 +00:00
Simon L. B. Nielsen
04e7229db5 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
2011-04-23 13:07:35 +00:00
Ulrich Spörlein
f02cd756de traceroute(8): make WARNS=3 clean
Also fixes an operator precedence bug for TCP tracerouting
2010-12-04 14:19:27 +00:00
Ulrich Spörlein
d8e58d07b3 Remove unused traceroute(8) contrib code from head
It still lives on under vendor/traceroute.
2010-11-27 09:26:46 +00:00
Ed Schouten
6f3e5db886 Remove unneeded struct timezone passed to gettimeofday(). 2010-08-08 08:22:53 +00:00
Hajimu UMEMOTO
d429d7201e - 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.
2009-08-23 17:00:16 +00:00
Rui Paulo
8ea0d8cff1 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)
2008-02-20 23:29:53 +00:00
George V. Neville-Neil
8409aedfa6 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
2007-07-01 12:08:08 +00:00
Maxim Konovalov
eea319c4b7 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
2007-04-30 19:08:13 +00:00
David Malone
eac17f2c6f Make it so that the synopsis and usage message almost agree.
MFC after:	3 weeks
2006-10-15 17:44:49 +00:00
David Malone
2f87bd055e 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
2006-10-15 17:34:51 +00:00
David Malone
e4ad3d8dd8 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
2006-06-13 14:59:07 +00:00
Crist J. Clark
a719d3b931 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
2006-05-11 06:30:18 +00:00
Pav Lucistnik
811c0f2ed0 - 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
2006-01-10 16:48:52 +00:00
Andre Oppermann
9e24bd90fe 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
2005-08-26 18:08:24 +00:00
Pierre Beyssac
bc5cfff933 Check -s option source address for validity.
PR:		bin/29026
MFC after:	1 week
2004-04-17 18:44:23 +00:00
Colin Percival
1939168416 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)
2004-01-23 06:55:15 +00:00
Bill Fenner
edfe5cffff Calculate checksums correctly when LSRR is in effect by passing the
IP header and protocol header seperately.
Also calculate TCP checksums.

Submitted by:	orion
2002-07-28 02:34:39 +00:00
Bill Fenner
0952bc9f4b Merge 1.4a12 2002-07-28 02:26:31 +00:00
Daniel C. Sobral
8f32fe91de s/ifdef/ifndef/.
Fenner got this inverted through a misunderstanding between us.
2002-07-23 12:25:34 +00:00
Bill Fenner
290006640b Add an ICMP protocol handler, partly based on LBL's traceroute 1.4 .
Submitted by:	dcs
2002-07-22 23:01:11 +00:00
Bill Fenner
dbee325068 Actually use gen_prep() and gen_check(), instead of udp_prep() and
udp_check(), for unknown protocols.
2002-07-22 22:07:23 +00:00
Robert Drehmel
eac66622a0 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>
2002-06-23 21:54:18 +00:00
Ruslan Ermilov
3c5021685e Fetch the default maximum TTL value from the net.inet.ip.ttl MIB.
PR:		bin/19598
MFC after:	1 week
2001-06-06 16:12:59 +00:00
David E. O'Brien
a918f16a94 Defining usage() "__dead" is just ridiculous. It also won't compile with
a June 2000 GCC 2.96 snapshot.

Reviewed by:	bde
2000-10-27 05:51:59 +00:00
Kris Kennaway
c9f7579521 Don't write past the end of our fd_set
Obtained from:	OpenBSD, via KAME
2000-10-08 07:58:32 +00:00
Kris Kennaway
d35c03b40d Format string paranoia. 2000-10-08 07:54:43 +00:00
Guy Helmer
671dd36817 Document the -S flag (added in rev. 1.4) in the usage() function.
PR:		bin/18153
Prompted by:	Nathan Ahlstrom <nrahlstr@winternet.com>
2000-07-07 19:44:36 +00:00
Yoshinobu Inoue
a3e1dbab8b Correct FreeBSD id place. Also correct vendor rcsid.
Specified by: bde

Reviewed by: bde
2000-03-30 15:23:44 +00:00
Yoshinobu Inoue
497f9e5a33 Bypass IPsec for traceroute invoked by root.
PR: bin/17606
Submitted by: Louis Mamakos <louie@TransSys.COM
2000-03-30 01:33:39 +00:00
Archie Cobbs
ad0caac41f 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>
1999-06-25 21:48:40 +00:00
Archie Cobbs
255065aa3b 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>
1999-05-12 17:28:31 +00:00
Archie Cobbs
f5004fb09b 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.
1999-05-06 03:23:24 +00:00
Dag-Erling Smørgrav
424a49ef3f Better fix for the traceroute flood bug.
Submitted by:	bde
1999-02-16 14:19:50 +00:00
Dag-Erling Smørgrav
5ade368c37 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.
1999-02-15 08:11:44 +00:00