mirror of
https://git.FreeBSD.org/src.git
synced 2025-02-05 18:05:16 +00:00
traceroute: move from contrib to usr.sbin
traceroute hasn't had a vendor import since 2002, while since then it's had several significant FreeBSD-specific commits. Since it's unlikely another vendor import will happen, and to make the merge of traceroute6 into traceroute easier, import traceroute into usr.sbin. Reviewed by: imp Pull Request: https://github.com/freebsd/freebsd-src/pull/1100
This commit is contained in:
parent
fe05296fc3
commit
9b7a920a12
@ -1,148 +0,0 @@
|
||||
@(#) $Id: CHANGES,v 1.23 2000/12/14 06:53:11 leres Exp $ (LBL)
|
||||
|
||||
v1.4 Wed Dec 13 22:50:35 PST 2000
|
||||
|
||||
- Add an option to use icmp echo instead of udp datagrams.
|
||||
|
||||
- Add HPUX and Linux support.
|
||||
|
||||
- Handle hex argument values as suggested by John Hawkinson
|
||||
(jhawk@mit.edu)
|
||||
|
||||
- Added flags to set the first ttl and to set the don't fragment bit.
|
||||
|
||||
- Add a local autoconf macro to check for routines in libraries; the
|
||||
autoconf version is broken (it only puts the library name in the
|
||||
cache variable name). Thanks to John Hawkinson.
|
||||
|
||||
- Add a local autoconf macro to check for types; the autoconf version
|
||||
is broken (it uses grep instead of actually compiling a code fragment).
|
||||
|
||||
- Attempt to detect "egcs" versions of gcc.
|
||||
|
||||
- Fix problems caused by savestr().
|
||||
|
||||
- Detect when there are more interfaces than we can deal with. Thanks
|
||||
to Guy Harris guy@netapp.com.
|
||||
|
||||
- Accommodate changes made to FreeBSD 3.2-RELEASE network headers files.
|
||||
|
||||
- The ip header offset needs to be byte swapped under Solaris on the
|
||||
intel as well. Reported by John McDermott (jjm@jkintl.com) Also byte
|
||||
ip length and offset for linux.
|
||||
|
||||
- In wait_for_reply(), use passed socket instead of global one. Thanks
|
||||
to Richard Kettlewell (richard.kettlewell@kewill.com)
|
||||
|
||||
- Check for IFF_LOOPBACK as a define or an enum (concession to linux).
|
||||
Reported by Robert Bihlmeyer (robbe@orcus.priv.at)
|
||||
|
||||
- Increase size of SIOCGIFCONF buffer to accommodate systems with lots
|
||||
of virtual interfaces. Ignore sun virtual interfaces. Suggested by
|
||||
Ian Donaldson (iand@aone.com.au)
|
||||
|
||||
- Always calculate icmp checksums when using -I. Reported by Soumen
|
||||
(sbiswas@novell.com)
|
||||
|
||||
- Documentation fix for description of -p. Thanks to Jeffrey C Honig
|
||||
(jch@bsdi.com)
|
||||
|
||||
- Enable ip checksums for Solaris 2.6 and higher (since they seem to
|
||||
work correctly now).
|
||||
|
||||
- Avoid problems when broken routers return 0.0.0.0 as their source
|
||||
address. Thanks to John Hawkinson (jhawk@bbnplanet.com)
|
||||
|
||||
- Canonicalize hostname if gethostname() doesn't return a domain.
|
||||
|
||||
- Add -z flag (pause msecs) to allow optional pause between probes.
|
||||
Suggested by Dave Morrison (drmorris@uplanet.com)
|
||||
|
||||
- Fix max packet length test.
|
||||
|
||||
- Use "/dev/null" instead of "." for file descriptor fodder.
|
||||
Suggested by Tim Robbins (fyre@box3n.gumbynet.org)
|
||||
|
||||
- Watch for a NULL argv[0]. Suggested by Tim Robbins.
|
||||
|
||||
- Be careful with hostname legnths.
|
||||
|
||||
- Print RFC1191 Path MTU Discovery value on "needfrag" unreachables.
|
||||
|
||||
- Limit port size to 16 bits. Suggested by Tim Robbins.
|
||||
|
||||
- Limit wait time to 24 hours.
|
||||
|
||||
- Modified linux specific struct ipovly definition to avoid problems
|
||||
with 64 bit systems. Problem reported by Uros Prestor
|
||||
(uros@turbolinux.com)
|
||||
|
||||
- Use kernel routing tables to determine correct source address.
|
||||
Three styles are supported: bsd/socket, solaris/mib and linux.
|
||||
|
||||
- Fix configure to recognize older versions of Solaris.
|
||||
|
||||
v1.3.2 Thu Sep 26 18:06:16 PDT 1996
|
||||
|
||||
- Rewrite source routing code to eliminate a number of problems on
|
||||
systems using raw ip options. Also pad options with a noop so gateway
|
||||
addresses are aligned.
|
||||
|
||||
- Don't call inet_ntoa() twice in the same printf(). Thanks to NetBSD
|
||||
via Bill Fenner (fenner@parc.xerox.com)
|
||||
|
||||
- Decode "administratively prohibited filter" icmp code and print
|
||||
numeric value for unknown codes. Thanks to Bill Fenner.
|
||||
|
||||
v1.3.1 Wed Sep 18 21:08:16 PDT 1996
|
||||
|
||||
- Some systems (e.g. AIX) need sys/select.h. Thanks to Brett Hogden
|
||||
(hogden@rge.com)
|
||||
|
||||
- Byte swap ip header length under Solaris. (This has no effect on the
|
||||
sparc but is required on the i386.)
|
||||
|
||||
- Made optional packet length control total size of packet.
|
||||
|
||||
v1.3 Mon Sep 16 14:55:44 PDT 1996
|
||||
|
||||
- Overrun buffer security fixes. Thanks to Bill Fenner
|
||||
(fenner@parc.xerox.com)
|
||||
|
||||
- Wait for response packet relative to start of probe. Thanks to Bill
|
||||
Fenner.
|
||||
|
||||
- Fix bug that prevented changing the packet size. Thanks to Gregory
|
||||
Decker (gdecker@nate.dcrt.nih.gov)
|
||||
|
||||
- Add support for RAW_OPTIONS (e.g. 4.4 BSD systems such as BSD/OS and
|
||||
FreeBSD) thanks to Jeffrey C Honig (jch@bsdi.com)
|
||||
|
||||
- Remove ip header byte swap fix from v1.2; most kernels swap the ip
|
||||
header length in the kernel (and it causes OSF3 to crash).
|
||||
|
||||
- Fix to not exit when the number of probes is set to 1 (i.e. "-q 1")
|
||||
|
||||
- Improve autoconf configuration.
|
||||
|
||||
v1.2 Tue Oct 17 23:50:05 PDT 1995
|
||||
|
||||
- Convert to autoconf and ansify.
|
||||
|
||||
- Byte swap ip header length for little endian machines. Fix thanks to
|
||||
Y Badri (yb@greybox.demon.co.uk).
|
||||
|
||||
v1.1 Thu Jun 15 02:32:55 PDT 1995
|
||||
|
||||
- Check for too many arguments.
|
||||
|
||||
- Recode to make timing of packet's round trip more obvious and to
|
||||
tighten up code.
|
||||
|
||||
- Ifdef IP_OPTIONS code.
|
||||
|
||||
- Display time in microseconds.
|
||||
|
||||
v1.0 Tue Feb 28 23:50:05 PDT 1989
|
||||
|
||||
- Initial public release.
|
@ -1,37 +0,0 @@
|
||||
CHANGES
|
||||
FILES
|
||||
INSTALL
|
||||
Makefile.in
|
||||
README
|
||||
VERSION
|
||||
aclocal.m4
|
||||
config.guess
|
||||
config.sub
|
||||
configure
|
||||
configure.in
|
||||
findsaddr-generic.c
|
||||
findsaddr-linux.c
|
||||
findsaddr-mib.c
|
||||
findsaddr-socket.c
|
||||
findsaddr.h
|
||||
ifaddrlist.c
|
||||
ifaddrlist.h
|
||||
install-sh
|
||||
lbl/gnuc.h
|
||||
lbl/os-solaris2.h
|
||||
lbl/os-sunos4.h
|
||||
linux-include/netinet/in_systm.h
|
||||
linux-include/netinet/ip.h
|
||||
linux-include/netinet/ip_icmp.h
|
||||
linux-include/netinet/ip_var.h
|
||||
linux-include/netinet/udp.h
|
||||
linux-include/netinet/udp_var.h
|
||||
mean.awk
|
||||
median.awk
|
||||
mkdep
|
||||
rip_output.c
|
||||
strerror.c
|
||||
traceroute.8
|
||||
traceroute.c
|
||||
traceroute.h
|
||||
usleep.c
|
@ -1,36 +0,0 @@
|
||||
This directory contains virgin copies of the original distribution files
|
||||
on a "vendor" branch. Do not, under any circumstances, attempt to upgrade
|
||||
the files in this directory via patches and a cvs commit.
|
||||
|
||||
To upgrade to a newer version of traceroute, when it is available:
|
||||
|
||||
1. Unpack the new version into an empty directory.
|
||||
[Do not make ANY changes to the files.]
|
||||
|
||||
2. Use the command:
|
||||
cvs import -I linux-include \
|
||||
-m 'Virgin import of LBL traceroute v<version>' \
|
||||
src/contrib/traceroute LBL v<version>
|
||||
|
||||
For example, to do the import of version 1.3.2, I might have typed:
|
||||
cvs import -I linux-include \
|
||||
-m 'Virgin import of LBL traceroute v1.3.2' \
|
||||
src/contrib/traceroute LBL v1_3_2
|
||||
|
||||
3. Follow the instructions printed out in step 2 to resolve any
|
||||
conflicts between local FreeBSD changes and the newer version.
|
||||
|
||||
Do not, under any circumstances, deviate from this procedure.
|
||||
|
||||
To make local changes to traceroute, simply patch and commit to the main
|
||||
branch (aka HEAD). Never make local changes on the LBL branch.
|
||||
|
||||
All local changes should be submitted to "traceroute@ee.lbl.gov" for
|
||||
inclusion in the next vendor release of traceroute.
|
||||
|
||||
(The "SANE_PRECISION" patch has been submitted and rejected.)
|
||||
|
||||
(The extensive modifications for TCP and GRE probes have not been
|
||||
submitted.)
|
||||
|
||||
fenner@freebsd.org - 30 Sep 1996
|
@ -1,105 +0,0 @@
|
||||
@(#) $Id: INSTALL,v 1.13 2000/11/23 20:07:29 leres Exp $ (LBL)
|
||||
|
||||
Traceroute is known to build and run under SunOS 4.1.4 and Solaris 5.4.
|
||||
If you are running a really old kernel, see the instructions under the
|
||||
title "KERNEL MODIFICATIONS" further down.
|
||||
|
||||
To build traceroute, first customize any paths in Makefile.in, then run
|
||||
"./configure" (a shell script). The configure script will determine
|
||||
your system attributes and generate an appropriate Makefile from
|
||||
Makefile.in. Next run "make". If everything goes well you can su to
|
||||
root and run "make install" and "make install-man". Note that traceroute
|
||||
must be installed setuid to root or run as root.
|
||||
|
||||
If configure fails for some reason and decide to submit a bug report to
|
||||
traceroute@ee.lbl.gov, please include a copy of config.log.
|
||||
|
||||
You will need an ANSI C compiler to build libpcap. The configure script
|
||||
will abort if your compiler is not ANSI compliant. If this happens, use
|
||||
the GNU C compiler, available via anonymous ftp:
|
||||
|
||||
ftp://prep.ai.mit.edu/pub/gnu/gcc-*.tar.gz
|
||||
|
||||
If you get the error message:
|
||||
|
||||
traceroute: unknown protocol icmp
|
||||
|
||||
it usually means you're missing the icmp line in /etc/protocols.
|
||||
|
||||
If you are using Solaris 2.5.1 (and possibly higher), traceroute cannot
|
||||
calculate checksums; configure automatically changes the default to
|
||||
reflect this. The kernel updates the ip_id field with some unknown
|
||||
value and the ip_off field with the IP_DF bit. Also, if the the udp
|
||||
uh_sum field is non-zero, it gets updated with the value of the uh_ulen
|
||||
field... This means that the icmp echo option (-I flag) is not as
|
||||
useful.
|
||||
|
||||
KERNEL MODIFICATIONS
|
||||
--------------------
|
||||
If yor have a really old system, it may be necessary to modify your
|
||||
kernel before traceroute will work. If you want to hack on your kernel,
|
||||
a modified version of the routine rip_output (normally found in the
|
||||
file /sys/netinet/raw_ip.c) can be found in rip_output.c. This code may
|
||||
or may not resemble the code in your kernel. It may offer you a place
|
||||
to start but we make no promises. If you do hack your kernel, remember
|
||||
to test everything that uses raw ip sockets (e.g., ping and
|
||||
egpup/gated) & make sure they still work. We wish you the best of luck
|
||||
and you're on your own.
|
||||
|
||||
Some older kernels forward icmp packets that have a ttl of zero. If
|
||||
your system has this bug, you might want to fix it while you're in the
|
||||
kernel. (This bug appears in all releases of BSD up to but not
|
||||
including 4.3tahoe. If your version of netinet/ip_icmp.c is any earlier
|
||||
than 7.3 (April, '87), it has the bug.) The fix is just to add the
|
||||
line:
|
||||
|
||||
ip->ip_ttl = MAXTTL;
|
||||
|
||||
after the line:
|
||||
|
||||
ip->ip_src = t;
|
||||
|
||||
(or anywhere before the call to icmp_send) in routine icmp_reflect.
|
||||
|
||||
If you're running this on a pre-4.3bsd system (e.g., SunOS 3) that
|
||||
strips ip headers from icmp messages, add -DARCHAIC to CFLAGS in the
|
||||
Makefile. Also note that rip_output contains a conditional for a
|
||||
4.2/4.3 change in the location of a raw socket's protocol number. I've
|
||||
checked this under 4.3 & SunOS 3 but you should double-check your
|
||||
system to make sure the appropriate branch of the #if is taken (check
|
||||
the line that assigned to ip->ip_p in your system's original
|
||||
rip_output).
|
||||
|
||||
|
||||
FILES
|
||||
-----
|
||||
CHANGES - description of differences between releases
|
||||
FILES - list of files exported as part of the distribution
|
||||
INSTALL - this file
|
||||
Makefile.in - compilation rules (input to the configure script)
|
||||
README - description of distribution
|
||||
VERSION - version of this release
|
||||
aclocal.m4 - autoconf macros
|
||||
config.guess - autoconf support
|
||||
config.sub - autoconf support
|
||||
configure - configure script (run this first)
|
||||
configure.in - configure script source
|
||||
findsaddr-generic.c - generic source address code
|
||||
findsaddr-linux.c - linux source address code
|
||||
findsaddr-socket.c - socket based soruce address code
|
||||
findsaddr.h - source address prototypes
|
||||
ifaddrlist.c - inet address routines
|
||||
ifaddrlist.h - inet address prototypes
|
||||
install-sh - BSD style install script
|
||||
lbl/gnuc.h - gcc macros and defines
|
||||
lbl/os-*.h - os dependent defines and prototypes
|
||||
linux-include/* - network include files missing on Linux
|
||||
mean.awk - awk script to print out the mean time along a route
|
||||
median.awk - awk script to print out the median time along a route
|
||||
mkdep - construct Makefile dependency list
|
||||
rip_output.c - sample rip_output() from /sys/netinet/raw_ip.c
|
||||
strerror.c - emulation routine
|
||||
traceroute.8 - manual entry
|
||||
traceroute.c - main program
|
||||
traceroute.h - global prototypes
|
||||
usleep.c - missing system call emulation
|
@ -1,29 +0,0 @@
|
||||
@(#) $Id: README,v 1.9 2000/09/16 05:32:01 leres Exp $ (LBL)
|
||||
|
||||
TRACEROUTE 1.4
|
||||
Lawrence Berkeley National Laboratory
|
||||
Network Research Group
|
||||
traceroute@ee.lbl.gov
|
||||
ftp://ftp.ee.lbl.gov/traceroute.tar.gz
|
||||
|
||||
Traceroute is a system administrators utility to trace the route
|
||||
ip packets from the current system take in getting to some
|
||||
destination system. See the comments at the front of the
|
||||
program for a description of its use.
|
||||
|
||||
This program uses raw ip sockets and must be run as root (or installed
|
||||
setuid to root).
|
||||
|
||||
A couple of awk programs to massage the traceroute output are
|
||||
included. "mean.awk" and "median.awk" compute the mean and median time
|
||||
to each hop, respectively. I've found that something like
|
||||
|
||||
traceroute -q 7 foo.somewhere >t
|
||||
awk -f median.awk t | xgraph
|
||||
|
||||
can give you a quick picture of the bad spots on a long path (median is
|
||||
usually a better noise filter than mean).
|
||||
|
||||
Problems, bugs, questions, desirable enhancements, source code
|
||||
contributions, etc., should be sent to the email address
|
||||
"traceroute@ee.lbl.gov".
|
@ -1 +0,0 @@
|
||||
1.4a12+FreeBSD
|
@ -1,12 +0,0 @@
|
||||
/^ *[0-9]/ {
|
||||
# print out the average time to each hop along a route.
|
||||
tottime = 0; n = 0;
|
||||
for (f = 5; f <= NF; ++f) {
|
||||
if ($f == "ms") {
|
||||
tottime += $(f - 1)
|
||||
++n
|
||||
}
|
||||
}
|
||||
if (n > 0)
|
||||
print $1, tottime/n, median
|
||||
}
|
@ -1,29 +0,0 @@
|
||||
/^ *[0-9]/ {
|
||||
# print out the median time to each hop along a route.
|
||||
tottime = 0; n = 0;
|
||||
for (f = 5; f <= NF; ++f) {
|
||||
if ($f == "ms") {
|
||||
++n
|
||||
time[n] = $(f - 1)
|
||||
}
|
||||
}
|
||||
if (n > 0) {
|
||||
# insertion sort the times to find the median
|
||||
for (i = 2; i <= n; ++i) {
|
||||
v = time[i]; j = i - 1;
|
||||
while (time[j] > v) {
|
||||
time[j+1] = time[j];
|
||||
j = j - 1;
|
||||
if (j < 0)
|
||||
break;
|
||||
}
|
||||
time[j+1] = v;
|
||||
}
|
||||
if (n > 1 && (n % 2) == 0)
|
||||
median = (time[n/2] + time[(n/2) + 1]) / 2
|
||||
else
|
||||
median = time[(n+1)/2]
|
||||
|
||||
print $1, median
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
/* A sample version of rip_output() from /sys/netinet/raw_ip.c */
|
||||
|
||||
rip_output(m, so)
|
||||
register struct mbuf *m;
|
||||
struct socket *so;
|
||||
{
|
||||
register struct ip *ip;
|
||||
int error;
|
||||
struct rawcb *rp = sotorawcb(so);
|
||||
struct sockaddr_in *sin;
|
||||
#if BSD>=43
|
||||
short proto = rp->rcb_proto.sp_protocol;
|
||||
#else
|
||||
short proto = so->so_proto->pr_protocol;
|
||||
#endif
|
||||
/*
|
||||
* if the protocol is IPPROTO_RAW, the user handed us a
|
||||
* complete IP packet. Otherwise, allocate an mbuf for a
|
||||
* header and fill it in as needed.
|
||||
*/
|
||||
if (proto != IPPROTO_RAW) {
|
||||
/*
|
||||
* Calculate data length and get an mbuf
|
||||
* for IP header.
|
||||
*/
|
||||
int len = 0;
|
||||
struct mbuf *m0;
|
||||
|
||||
for (m0 = m; m; m = m->m_next)
|
||||
len += m->m_len;
|
||||
|
||||
m = m_get(M_DONTWAIT, MT_HEADER);
|
||||
if (m == 0) {
|
||||
m = m0;
|
||||
error = ENOBUFS;
|
||||
goto bad;
|
||||
}
|
||||
m->m_off = MMAXOFF - sizeof(struct ip);
|
||||
m->m_len = sizeof(struct ip);
|
||||
m->m_next = m0;
|
||||
|
||||
ip = mtod(m, struct ip *);
|
||||
ip->ip_tos = 0;
|
||||
ip->ip_off = 0;
|
||||
ip->ip_p = proto;
|
||||
ip->ip_len = sizeof(struct ip) + len;
|
||||
ip->ip_ttl = MAXTTL;
|
||||
} else
|
||||
ip = mtod(m, struct ip *);
|
||||
|
||||
if (rp->rcb_flags & RAW_LADDR) {
|
||||
sin = (struct sockaddr_in *)&rp->rcb_laddr;
|
||||
if (sin->sin_family != AF_INET) {
|
||||
error = EAFNOSUPPORT;
|
||||
goto bad;
|
||||
}
|
||||
ip->ip_src.s_addr = sin->sin_addr.s_addr;
|
||||
} else
|
||||
ip->ip_src.s_addr = 0;
|
||||
|
||||
ip->ip_dst = ((struct sockaddr_in *)&rp->rcb_faddr)->sin_addr;
|
||||
|
||||
#if BSD>=43
|
||||
return (ip_output(m, rp->rcb_options, &rp->rcb_route,
|
||||
(so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST));
|
||||
#else
|
||||
return (ip_output(m, (struct mbuf *)0, &rp->rcb_route,
|
||||
(so->so_options & SO_DONTROUTE) | IP_ALLOWBROADCAST));
|
||||
#endif
|
||||
bad:
|
||||
m_freem(m);
|
||||
return (error);
|
||||
}
|
@ -1,16 +1,12 @@
|
||||
|
||||
.include <src.opts.mk>
|
||||
|
||||
TRACEROUTE_DISTDIR?= ${SRCTOP}/contrib/traceroute
|
||||
.PATH: ${TRACEROUTE_DISTDIR}
|
||||
|
||||
PACKAGE= runtime
|
||||
PROG= traceroute
|
||||
MAN= traceroute.8
|
||||
SRCS= as.c version.c traceroute.c ifaddrlist.c findsaddr-udp.c
|
||||
SRCS= as.c traceroute.c ifaddrlist.c findsaddr-udp.c
|
||||
BINOWN= root
|
||||
BINMODE=4555
|
||||
CLEANFILES= version.c
|
||||
|
||||
CFLAGS+= -DHAVE_SYS_SELECT_H=1 -DHAVE_SYS_SOCKIO_H=1 \
|
||||
-DHAVE_NET_ROUTE_H=1 -DHAVE_NET_IF_DL_H=1 \
|
||||
@ -36,14 +32,6 @@ LIBADD+= cap_dns
|
||||
CFLAGS+=-DWITH_CASPER
|
||||
.endif
|
||||
|
||||
CFLAGS+= -I${TRACEROUTE_DISTDIR}
|
||||
|
||||
WARNS?= 3
|
||||
|
||||
version.c: ${TRACEROUTE_DISTDIR}/VERSION
|
||||
@rm -f ${.TARGET}
|
||||
head -1 ${TRACEROUTE_DISTDIR}/VERSION | \
|
||||
sed -e 's/.*/char version[] = "&";/' \
|
||||
> ${.TARGET}
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -2146,9 +2146,6 @@ pkt_compare(const u_char *a, int la, const u_char *b, int lb) {
|
||||
void
|
||||
usage(void)
|
||||
{
|
||||
extern char version[];
|
||||
|
||||
Fprintf(stderr, "Version %s\n", version);
|
||||
Fprintf(stderr,
|
||||
"Usage: %s [-adDeEFInrSvx] [-A as_server] [-f first_ttl] [-g gateway]\n"
|
||||
"\t[-i iface] [-m max_ttl] [-M first_ttl] [-p port] [-P proto]\n"
|
Loading…
x
Reference in New Issue
Block a user