mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2025-01-01 00:18:15 +01:00
Use err(3). Add usage(). Rewrote man pages in mdoc format.
This commit is contained in:
parent
7c92864437
commit
6ee8ae607a
@ -6,8 +6,6 @@
|
||||
* The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
|
||||
* Leland Stanford Junior University.
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -20,6 +18,12 @@
|
||||
*/
|
||||
|
||||
|
||||
#ifndef lint
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#include <err.h>
|
||||
#include "defs.h"
|
||||
#ifdef __STDC__
|
||||
#include <stdarg.h>
|
||||
@ -32,11 +36,6 @@
|
||||
#include "snmp.h"
|
||||
#endif
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] =
|
||||
"@(#) $Id$";
|
||||
#endif
|
||||
|
||||
extern char *configfilename;
|
||||
char versionstring[100];
|
||||
|
||||
@ -75,6 +74,7 @@ static void restart __P((int));
|
||||
static void timer __P((void));
|
||||
static void cleanup __P((void));
|
||||
static void resetlogging __P((void *));
|
||||
static void usage __P((void));
|
||||
|
||||
/* To shut up gcc -Wstrict-prototypes */
|
||||
int main __P((int argc, char **argv));
|
||||
@ -115,10 +115,8 @@ main(argc, argv)
|
||||
|
||||
setlinebuf(stderr);
|
||||
|
||||
if (geteuid() != 0) {
|
||||
fprintf(stderr, "mrouted: must be root\n");
|
||||
exit(1);
|
||||
}
|
||||
if (geteuid() != 0)
|
||||
errx(1, "must be root");
|
||||
|
||||
argv++, argc--;
|
||||
while (argc > 0 && *argv[0] == '-') {
|
||||
@ -133,7 +131,7 @@ main(argc, argv)
|
||||
argv++, argc--;
|
||||
configfilename = *argv;
|
||||
} else
|
||||
goto usage;
|
||||
usage();
|
||||
} else if (strcmp(*argv, "-p") == 0) {
|
||||
pruning = 0;
|
||||
#ifdef SNMP
|
||||
@ -145,15 +143,12 @@ main(argc, argv)
|
||||
dest_port = DEFAULT_PORT;
|
||||
#endif
|
||||
} else
|
||||
goto usage;
|
||||
usage();
|
||||
argv++, argc--;
|
||||
}
|
||||
|
||||
if (argc > 0) {
|
||||
usage: fprintf(stderr,
|
||||
"usage: mrouted [-p] [-c configfile] [-d [debug_level]]\n");
|
||||
exit(1);
|
||||
}
|
||||
if (argc > 0)
|
||||
usage();
|
||||
|
||||
if (debug == 0) {
|
||||
/*
|
||||
@ -179,7 +174,7 @@ usage: fprintf(stderr,
|
||||
}
|
||||
#else
|
||||
if (setsid() < 0)
|
||||
perror("setsid");
|
||||
warn("setsid");
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
@ -389,6 +384,13 @@ usage: fprintf(stderr,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr,
|
||||
"usage: mrouted [-p] [-c configfile] [-d [debug_level]]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/*
|
||||
* routine invoked every second. Its main goal is to cycle through
|
||||
|
@ -1,89 +1,80 @@
|
||||
.TH MAP-MBONE 8
|
||||
.Dd May 8, 1995
|
||||
.Dt MAP-MBONE 8
|
||||
.UC 5
|
||||
.SH NAME
|
||||
map-mbone \- Multicast connection mapper
|
||||
.SH SYNOPSIS
|
||||
.B /usr/sbin/map-mbone
|
||||
[
|
||||
.B \-d
|
||||
.I debug_level
|
||||
] [
|
||||
.B \-f
|
||||
] [
|
||||
.B \-g
|
||||
] [
|
||||
.B \-n
|
||||
] [
|
||||
.B \-r
|
||||
.I retry_count
|
||||
] [
|
||||
.B \-t
|
||||
.I timeout_count
|
||||
] [
|
||||
.B starting_router
|
||||
]
|
||||
.SH DESCRIPTION
|
||||
.I map-mbone
|
||||
.Sh NAME
|
||||
.Nm map-mbone
|
||||
.Nd multicast connection mapper
|
||||
.Sh SYNOPSIS
|
||||
.Nm map-mbone
|
||||
.Op Fl d Ar debug_level
|
||||
.Op Fl f
|
||||
.Op Fl g
|
||||
.Op Fl n
|
||||
.Op Fl r Ar retry_count
|
||||
.Op Fl t Ar timeout_count
|
||||
.Op Ar starting_router
|
||||
.Sh DESCRIPTION
|
||||
.Nm Map-mbone
|
||||
attempts to display all multicast routers that are reachable from the multicast
|
||||
.I starting_router.
|
||||
.Ar starting_router .
|
||||
If not specified on the command line, the default multicast
|
||||
.I starting_router
|
||||
.Ar starting_router
|
||||
is the localhost.
|
||||
.PP
|
||||
.I map-mbone
|
||||
.Pp
|
||||
.Nm Map-mbone
|
||||
traverses neighboring multicast routers by sending the ASK_NEIGHBORS IGMP
|
||||
message to the multicast starting_router. If this multicast router responds,
|
||||
the version number and a list of their neighboring multicast router addresses is
|
||||
part of that response. If the responding router has recent multicast version
|
||||
number, then
|
||||
.I map-mbone
|
||||
.Nm
|
||||
requests additional information such as metrics, thresholds, and flags from the
|
||||
multicast router. For each new occurrence of neighboring multicast router in
|
||||
the reply and provided the flooding option has been selected, then
|
||||
.I map-mbone
|
||||
.Nm
|
||||
asks each of this multicast router for a list of neighbors. This search
|
||||
for unique routers will continue until no new neighboring multicast routers
|
||||
are reported.
|
||||
.br
|
||||
.ne 5
|
||||
.SH INVOCATION
|
||||
.PP
|
||||
"\-d" option sets the debug level. When the debug level is greater than the
|
||||
.Pp
|
||||
The following options are available:
|
||||
.Bl -tag -width indent
|
||||
.It Fl d
|
||||
Set the debug level. When the debug level is greater than the
|
||||
default value of 0, addition debugging messages are printed. Regardless of
|
||||
the debug level, an error condition, will always write an error message and will
|
||||
cause
|
||||
.I map-mbone
|
||||
.Nm
|
||||
to terminate.
|
||||
Non-zero debug levels have the following effects:
|
||||
.IP "level 1"
|
||||
.Bl -tag -width indent
|
||||
.It "level 1"
|
||||
packet warnings are printed to stderr.
|
||||
.IP "level 2"
|
||||
.It "level 2"
|
||||
all level 1 messages plus notifications down networks are printed to stderr.
|
||||
.IP "level 3"
|
||||
.It "level 3"
|
||||
all level 2 messages plus notifications of all packet
|
||||
timeouts are printed to stderr.
|
||||
.PP
|
||||
"\-f" option sets flooding option. Flooding allows the recursive search
|
||||
.El
|
||||
.It Fl f
|
||||
Set flooding option. Flooding allows the recursive search
|
||||
of neighboring multicast routers and is enable by default when starting_router
|
||||
is not used.
|
||||
.PP
|
||||
"\-g" option sets graphing in GraphEd format.
|
||||
.PP
|
||||
"\-n" option disables the DNS lookup for the multicast routers names.
|
||||
.PP
|
||||
"\-r retry_count" sets the neighbor query retry limit. Default is 1 retry.
|
||||
.PP
|
||||
"\-t timeout_count" sets the number of seconds to wait for a neighbor query
|
||||
.It Fl g
|
||||
Set graphing in GraphEd format.
|
||||
.It Fl n
|
||||
Disable the DNS lookup for the multicast routers names.
|
||||
.It Fl r Ar retry_count
|
||||
Set the neighbor query retry limit. Default is 1 retry.
|
||||
.It Fl t Ar timeout_count
|
||||
Set the number of seconds to wait for a neighbor query
|
||||
reply before retrying. Default timeout is 2 seconds.
|
||||
.PP
|
||||
.SH IMPORTANT NOTE
|
||||
.I map-mbone
|
||||
.El
|
||||
.Sh IMPORTANT NOTE
|
||||
.Nm Map-mbone
|
||||
must be run as root.
|
||||
.PP
|
||||
.SH SEE ALSO
|
||||
.BR mrouted (8) ,
|
||||
.BR mrinfo (8) ,
|
||||
.BR mtrace (8)
|
||||
.PP
|
||||
.SH AUTHOR
|
||||
Pavel Curtis
|
||||
.Sh SEE ALSO
|
||||
.Xr mrouted 8 ,
|
||||
.Xr mrinfo 8 ,
|
||||
.Xr mtrace 8
|
||||
.Sh AUTHOR
|
||||
.An Pavel Curtis
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* Mapper for connections between MRouteD multicast routers.
|
||||
* Written by Pavel Curtis <Pavel@PARC.Xerox.Com>
|
||||
*
|
||||
* $Id$
|
||||
* $Id: mapper.c,v 1.10 1997/02/22 16:06:57 peter Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -21,6 +21,7 @@
|
||||
* These notices must be retained in any copies of any part of this software.
|
||||
*/
|
||||
|
||||
#include <err.h>
|
||||
#include <string.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/time.h>
|
||||
@ -90,6 +91,7 @@ void graph_map __P((void));
|
||||
int get_number __P((int *var, int deflt, char ***pargv,
|
||||
int *pargc));
|
||||
u_int32 host_addr __P((char *name));
|
||||
static void usage __P((void));
|
||||
|
||||
|
||||
Node *find_node(addr, ptr)
|
||||
@ -844,10 +846,8 @@ int main(argc, argv)
|
||||
{
|
||||
int flood = FALSE, graph = FALSE;
|
||||
|
||||
if (geteuid() != 0) {
|
||||
fprintf(stderr, "map-mbone: must be root\n");
|
||||
exit(1);
|
||||
}
|
||||
if (geteuid() != 0)
|
||||
errx(1, "must be root");
|
||||
|
||||
init_igmp();
|
||||
setuid(getuid());
|
||||
@ -859,7 +859,7 @@ int main(argc, argv)
|
||||
switch (argv[0][1]) {
|
||||
case 'd':
|
||||
if (!get_number(&debug, DEFAULT_DEBUG, &argv, &argc))
|
||||
goto usage;
|
||||
usage();
|
||||
break;
|
||||
case 'f':
|
||||
flood = TRUE;
|
||||
@ -872,32 +872,22 @@ int main(argc, argv)
|
||||
break;
|
||||
case 'r':
|
||||
if (!get_number(&retries, -1, &argv, &argc))
|
||||
goto usage;
|
||||
usage();
|
||||
break;
|
||||
case 't':
|
||||
if (!get_number(&timeout, -1, &argv, &argc))
|
||||
goto usage;
|
||||
usage();
|
||||
break;
|
||||
default:
|
||||
goto usage;
|
||||
usage();
|
||||
}
|
||||
argv++, argc--;
|
||||
}
|
||||
|
||||
if (argc > 1) {
|
||||
usage:
|
||||
fprintf(stderr,
|
||||
"Usage: map-mbone [-f] [-g] [-n] [-t timeout] %s\n\n",
|
||||
"[-r retries] [-d [debug-level]] [router]");
|
||||
fprintf(stderr, "\t-f Flood the routing graph with queries\n");
|
||||
fprintf(stderr, "\t (True by default unless `router' is given)\n");
|
||||
fprintf(stderr, "\t-g Generate output in GraphEd format\n");
|
||||
fprintf(stderr, "\t-n Don't look up DNS names for routers\n");
|
||||
exit(1);
|
||||
} else if (argc == 1 && !(target_addr = host_addr(argv[0]))) {
|
||||
fprintf(stderr, "Unknown host: %s\n", argv[0]);
|
||||
exit(2);
|
||||
}
|
||||
usage();
|
||||
} else if (argc == 1 && !(target_addr = host_addr(argv[0])))
|
||||
errx(2, "unknown host: %s", argv[0]);
|
||||
|
||||
if (debug)
|
||||
fprintf(stderr, "Debug level %u\n", debug);
|
||||
@ -915,10 +905,8 @@ int main(argc, argv)
|
||||
addr.sin_port = htons(2000); /* any port over 1024 will do... */
|
||||
if ((udp = socket(AF_INET, SOCK_DGRAM, 0)) < 0
|
||||
|| connect(udp, (struct sockaddr *) &addr, sizeof(addr)) < 0
|
||||
|| getsockname(udp, (struct sockaddr *) &addr, &addrlen) < 0) {
|
||||
perror("Determining local address");
|
||||
exit(-1);
|
||||
}
|
||||
|| getsockname(udp, (struct sockaddr *) &addr, &addrlen) < 0)
|
||||
err(-1, "determining local address");
|
||||
close(udp);
|
||||
our_addr = addr.sin_addr.s_addr;
|
||||
}
|
||||
@ -951,7 +939,7 @@ int main(argc, argv)
|
||||
|
||||
if (count < 0) {
|
||||
if (errno != EINTR)
|
||||
perror("select");
|
||||
warn("select");
|
||||
continue;
|
||||
} else if (count == 0) {
|
||||
log(LOG_DEBUG, 0, "Timed out receiving neighbor lists");
|
||||
@ -966,7 +954,7 @@ int main(argc, argv)
|
||||
if (recvlen >= 0)
|
||||
accept_igmp(recvlen);
|
||||
else if (errno != EINTR)
|
||||
perror("recvfrom");
|
||||
warn("recvfrom");
|
||||
}
|
||||
|
||||
printf("\n");
|
||||
@ -982,6 +970,15 @@ int main(argc, argv)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "%s\n%s\n",
|
||||
"usage: map-mbone [-f] [-g] [-n] [-t timeout] [-r retries]",
|
||||
" [-d [debug-level]] [router]");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* dummies */
|
||||
void accept_prune(src, dst, p, datalen)
|
||||
u_int32 src, dst;
|
||||
|
@ -1,83 +1,76 @@
|
||||
.TH MRINFO 8
|
||||
.Dd May 8, 1995
|
||||
.Dt MRINFO 8
|
||||
.UC 5
|
||||
.SH NAME
|
||||
mrinfo \- Displays configuration info from a multicast router
|
||||
.SH SYNOPSIS
|
||||
.B /usr/sbin/mrinfo
|
||||
[
|
||||
.B \-d
|
||||
.I debug_level
|
||||
] [
|
||||
.B \-r
|
||||
.I retry_count
|
||||
] [
|
||||
.B \-t
|
||||
.I timeout_count
|
||||
]
|
||||
.B multicast_router
|
||||
|
||||
.SH DESCRIPTION
|
||||
.I mrinfo
|
||||
.Sh NAME
|
||||
.Nm mrinfo
|
||||
.Nd display configuration info from a multicast router
|
||||
.Sh SYNOPSIS
|
||||
.Nm mrinfo
|
||||
.Op Fl d Ar debug_level
|
||||
.Op Fl r Ar retry_count
|
||||
.Op Fl t Ar timeout_count
|
||||
.Ar multicast_router
|
||||
.Sh DESCRIPTION
|
||||
.Nm Mrinfo
|
||||
attempts to display the configuration information from the multicast router
|
||||
.I multicast_router.
|
||||
.PP
|
||||
.I mrinfo
|
||||
.Ar multicast_router .
|
||||
.Pp
|
||||
.Nm Mrinfo
|
||||
uses the ASK_NEIGHBORS IGMP message to the specified multicast router. If this
|
||||
multicast router responds, the version number and a list of their neighboring
|
||||
multicast router addresses is part of that response. If the responding router
|
||||
has a recent multicast version number, then
|
||||
.I mrinfo
|
||||
.Nm
|
||||
requests additional information such as metrics, thresholds, and flags from the
|
||||
multicast router. Once the specified multicast router responds, the
|
||||
configuration is displayed to the standard output.
|
||||
.br
|
||||
.ne 5
|
||||
.SH INVOCATION
|
||||
.PP
|
||||
"\-d" option sets the debug level. When the debug level is greater than the
|
||||
.Pp
|
||||
The following options are available:
|
||||
.Bl -tag -width indent
|
||||
.It Fl d Ar debug_level
|
||||
Set the debug level. When the debug level is greater than the
|
||||
default value of 0, addition debugging messages are printed. Regardless of
|
||||
the debug level, an error condition, will always write an error message and will
|
||||
cause
|
||||
.I mrinfo
|
||||
.Nm
|
||||
to terminate.
|
||||
Non-zero debug levels have the following effects:
|
||||
.IP "level 1"
|
||||
.Bl -tag -width indent
|
||||
.It "level 1"
|
||||
packet warnings are printed to stderr.
|
||||
.IP "level 2"
|
||||
.It "level 2"
|
||||
all level 1 messages plus notifications down networks are printed to stderr.
|
||||
.IP "level 3"
|
||||
.It "level 3"
|
||||
all level 2 messages plus notifications of all packet
|
||||
timeouts are printed to stderr.
|
||||
.PP
|
||||
"\-r retry_count" sets the neighbor query retry limit. Default is 3 retry.
|
||||
.PP
|
||||
"\-t timeout_count" sets the number of seconds to wait for a neighbor query
|
||||
.El
|
||||
.It Fl r Ar retry_count
|
||||
Set the neighbor query retry limit. Default is 3 retries.
|
||||
.It Fl t Ar timeout_count
|
||||
Set the number of seconds to wait for a neighbor query
|
||||
reply. Default timeout is 4 seconds.
|
||||
.PP
|
||||
.SH SAMPLE OUTPUT
|
||||
.El
|
||||
.Sh SAMPLE OUTPUT
|
||||
.nf
|
||||
.I mrinfo mbone.phony.dom.net
|
||||
.Nm mrinfo mbone.phony.dom.net
|
||||
127.148.176.10 (mbone.phony.dom.net) [version 3.3]:
|
||||
127.148.176.10 -> 0.0.0.0 (?) [1/1/querier]
|
||||
127.148.176.10 -> 127.0.8.4 (mbone2.phony.dom.net) [1/45/tunnel]
|
||||
127.148.176.10 -> 105.1.41.9 (momoney.com) [1/32/tunnel/down]
|
||||
127.148.176.10 -> 143.192.152.119 (mbone.dipu.edu) [1/32/tunnel]
|
||||
.fi
|
||||
.PP
|
||||
.Pp
|
||||
For each neighbor of the queried multicast router, the IP of the queried router
|
||||
is displayed, followed by the IP and name of the neighbor. In square brackets
|
||||
the metric (cost of connection), the treashold (multicast ttl) is displayed. If
|
||||
the queried multicast router has a newer version number, the type (tunnel,
|
||||
srcrt) and status (disabled, down) of the connection is displayed.
|
||||
.PP
|
||||
.SH IMPORTANT NOTE
|
||||
.I mrinfo
|
||||
.Sh IMPORTANT NOTE
|
||||
.Nm Mrinfo
|
||||
must be run as root.
|
||||
.PP
|
||||
.SH SEE ALSO
|
||||
.BR mrouted (8) ,
|
||||
.BR map-mbone (8) ,
|
||||
.BR mtrace (8)
|
||||
.PP
|
||||
.SH AUTHOR
|
||||
Van Jacobson
|
||||
.Sh SEE ALSO
|
||||
.Xr mrouted 8 ,
|
||||
.Xr map-mbone 8 ,
|
||||
.Xr mtrace 8
|
||||
.Sh AUTHOR
|
||||
.An Van Jacobson
|
||||
|
@ -60,13 +60,14 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] =
|
||||
"@(#) $Id$";
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
/* original rcsid:
|
||||
"@(#) Header: mrinfo.c,v 1.6 93/04/08 15:14:16 van Exp (LBL)";
|
||||
*/
|
||||
#endif
|
||||
|
||||
#include <err.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/time.h>
|
||||
#include "defs.h"
|
||||
@ -95,7 +96,7 @@ void ask2 __P((u_int32 dst));
|
||||
int get_number __P((int *var, int deflt, char ***pargv,
|
||||
int *pargc));
|
||||
u_int32 host_addr __P((char *name));
|
||||
void usage __P((void));
|
||||
static void usage __P((void));
|
||||
|
||||
/* to shut up -Wstrict-prototypes */
|
||||
int main __P((int argc, char *argv[]));
|
||||
@ -312,11 +313,11 @@ get_number(var, deflt, pargv, pargc)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr,
|
||||
"Usage: mrinfo [-n] [-t timeout] [-r retries] [router]\n");
|
||||
"usage: mrinfo [-n] [-t timeout] [-r retries] [router]\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
@ -333,10 +334,8 @@ main(argc, argv)
|
||||
char *host;
|
||||
int curaddr;
|
||||
|
||||
if (geteuid() != 0) {
|
||||
fprintf(stderr, "mrinfo: must be root\n");
|
||||
exit(1);
|
||||
}
|
||||
if (geteuid() != 0)
|
||||
errx(1, "must be root");
|
||||
|
||||
init_igmp();
|
||||
setuid(getuid());
|
||||
@ -383,10 +382,8 @@ main(argc, argv)
|
||||
} else
|
||||
hp = gethostbyname(host);
|
||||
|
||||
if (hp == NULL || hp->h_length != sizeof(target_addr)) {
|
||||
fprintf(stderr, "mrinfo: %s: no such host\n", argv[0]);
|
||||
exit(1);
|
||||
}
|
||||
if (hp == NULL || hp->h_length != sizeof(target_addr))
|
||||
errx(1, "%s: no such host", argv[0]);
|
||||
if (debug)
|
||||
fprintf(stderr, "Debug level %u\n", debug);
|
||||
|
||||
@ -407,10 +404,8 @@ main(argc, argv)
|
||||
* do... */
|
||||
if ((udp = socket(AF_INET, SOCK_DGRAM, 0)) < 0
|
||||
|| connect(udp, (struct sockaddr *) & addr, sizeof(addr)) < 0
|
||||
|| getsockname(udp, (struct sockaddr *) & addr, &addrlen) < 0) {
|
||||
perror("Determining local address");
|
||||
exit(-1);
|
||||
}
|
||||
|| getsockname(udp, (struct sockaddr *) & addr, &addrlen) < 0)
|
||||
err(-1, "determining local address");
|
||||
close(udp);
|
||||
our_addr = addr.sin_addr.s_addr;
|
||||
}
|
||||
@ -455,7 +450,7 @@ main(argc, argv)
|
||||
|
||||
if (count < 0) {
|
||||
if (errno != EINTR)
|
||||
perror("select");
|
||||
warn("select");
|
||||
continue;
|
||||
} else if (count == 0) {
|
||||
log(LOG_DEBUG, 0, "Timed out receiving neighbor lists");
|
||||
@ -478,7 +473,7 @@ main(argc, argv)
|
||||
0, NULL, &dummy);
|
||||
if (recvlen <= 0) {
|
||||
if (recvlen && errno != EINTR)
|
||||
perror("recvfrom");
|
||||
warn("recvfrom");
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -517,10 +512,8 @@ main(argc, argv)
|
||||
case DVMRP_NEIGHBORS:
|
||||
case DVMRP_NEIGHBORS2:
|
||||
if (src != target_addr) {
|
||||
fprintf(stderr, "mrinfo: got reply from %s",
|
||||
inet_fmt(src, s1));
|
||||
fprintf(stderr, " instead of %s\n",
|
||||
inet_fmt(target_addr, s1));
|
||||
warnx("got reply from %s instead of %s",
|
||||
inet_fmt(src, s1), inet_fmt(target_addr, s1));
|
||||
/*continue;*/
|
||||
}
|
||||
break;
|
||||
|
@ -1,30 +1,25 @@
|
||||
'\"COPYRIGHT 1989 by The Board of Trustees of Leland Stanford Junior University.
|
||||
'\"$Id$
|
||||
.TH MROUTED 8
|
||||
.\"COPYRIGHT 1989 by The Board of Trustees of Leland Stanford Junior University.
|
||||
.\"$Id: mrouted.8,v 1.9 1997/02/22 16:06:59 peter Exp $
|
||||
.Dd May 8, 1995
|
||||
.Dt MROUTED 8
|
||||
.UC 5
|
||||
.SH NAME
|
||||
mrouted \- IP multicast routing daemon
|
||||
.SH SYNOPSIS
|
||||
.B mrouted
|
||||
[
|
||||
.B \-p
|
||||
] [
|
||||
.B \-c
|
||||
.I config_file
|
||||
] [
|
||||
.B \-d
|
||||
[
|
||||
.I debug_level
|
||||
]]
|
||||
.SH DESCRIPTION
|
||||
.I Mrouted
|
||||
.Sh NAME
|
||||
.Nm mrouted
|
||||
.Nd IP multicast routing daemon
|
||||
.Sh SYNOPSIS
|
||||
.Nm mrouted
|
||||
.Op Fl c Ar config_file
|
||||
.Op Fl d Op Ar debug_level
|
||||
.Op Fl p
|
||||
.Sh DESCRIPTION
|
||||
.Nm Mrouted
|
||||
is an implementation of the Distance-Vector Multicast Routing
|
||||
Protocol (DVMRP), an earlier version of which is specified in RFC-1075.
|
||||
It maintains topological knowledge via a distance-vector routing protocol
|
||||
(like RIP, described in RFC-1058), upon which it implements a multicast
|
||||
datagram forwarding algorithm called Reverse Path Multicasting.
|
||||
.PP
|
||||
.I Mrouted
|
||||
.Pp
|
||||
.Nm Mrouted
|
||||
forwards a multicast datagram along a shortest (reverse) path tree
|
||||
rooted at the subnet on which the datagram originates. The multicast
|
||||
delivery tree may be thought of as a broadcast delivery tree that has
|
||||
@ -33,13 +28,13 @@ that have members of the destination group. Hence, datagrams
|
||||
are not forwarded along those branches which have no listeners of the
|
||||
multicast group. The IP time-to-live of a multicast datagram can be
|
||||
used to limit the range of multicast datagrams.
|
||||
.PP
|
||||
.Pp
|
||||
In order to support multicasting among subnets that are separated by (unicast)
|
||||
routers that do not support IP multicasting,
|
||||
.I mrouted
|
||||
.Nm
|
||||
includes support for
|
||||
"tunnels", which are virtual point-to-point links between pairs of
|
||||
.IR mrouted s
|
||||
.Nm mrouted Ns s
|
||||
located anywhere in an internet. IP multicast packets are encapsulated for
|
||||
transmission through tunnels, so that they look like normal unicast datagrams
|
||||
to intervening routers and subnets. The encapsulation
|
||||
@ -48,67 +43,84 @@ on exit from a tunnel.
|
||||
By default, the packets are encapsulated using the IP-in-IP protocol
|
||||
(IP protocol number 4).
|
||||
Older versions of
|
||||
.I mrouted
|
||||
.Nm
|
||||
tunnel using IP source routing, which puts a heavy load on some
|
||||
types of routers.
|
||||
This version does not support IP source route tunnelling.
|
||||
.PP
|
||||
.Pp
|
||||
The tunnelling mechanism allows
|
||||
.I mrouted
|
||||
.Nm
|
||||
to establish a virtual internet, for
|
||||
the purpose of multicasting only, which is independent of the physical
|
||||
internet, and which may span multiple Autonomous Systems. This capability
|
||||
is intended for experimental support of internet multicasting only, pending
|
||||
widespread support for multicast routing by the regular (unicast) routers.
|
||||
.I Mrouted
|
||||
.Nm Mrouted
|
||||
suffers from the well-known scaling problems of any distance-vector
|
||||
routing protocol, and does not (yet) support hierarchical multicast routing.
|
||||
.PP
|
||||
.I Mrouted
|
||||
.Pp
|
||||
.Nm Mrouted
|
||||
handles multicast routing only; there may or may not be unicast routing
|
||||
software running on the same machine as
|
||||
.IR mrouted .
|
||||
.Nm mrouted .
|
||||
With the use of tunnels, it
|
||||
is not necessary for
|
||||
.I mrouted
|
||||
.Nm
|
||||
to have access to more than one physical subnet
|
||||
in order to perform multicast forwarding.
|
||||
.br
|
||||
.ne 5
|
||||
.SH INVOCATION
|
||||
.PP
|
||||
If no "\-d" option is given, or if the debug level is specified as 0,
|
||||
.I mrouted
|
||||
.Pp
|
||||
The following options are available:
|
||||
.Bl -tag -width indent
|
||||
.It Fl c Ar config_file
|
||||
Specify an alternative file for configuration commands. Default is
|
||||
.Pa /etc/mrouted.conf .
|
||||
.It Fl d Op Ar debug_level
|
||||
If no
|
||||
.Fl d
|
||||
option is given, or if the debug level is specified as 0,
|
||||
.Nm
|
||||
detaches from the invoking terminal. Otherwise, it remains attached to the
|
||||
invoking terminal and responsive to signals from that terminal. If "\-d" is
|
||||
given with no argument, the debug level defaults to 2. Regardless of the
|
||||
invoking terminal and responsive to signals from that terminal.
|
||||
If
|
||||
.Fl d
|
||||
is given with no argument, the debug level defaults to 2. Regardless of the
|
||||
debug level,
|
||||
.I mrouted
|
||||
.Nm
|
||||
always writes warning and error messages to the system
|
||||
log demon. Non-zero debug levels have the following effects:
|
||||
.IP "level 1"
|
||||
.Bl -tag -width indent
|
||||
.It "level 1"
|
||||
all syslog'ed messages are also printed to stderr.
|
||||
.IP "level 2"
|
||||
.It "level 2"
|
||||
all level 1 messages plus notifications of "significant"
|
||||
events are printed to stderr.
|
||||
.IP "level 3"
|
||||
.It "level 3"
|
||||
all level 2 messages plus notifications of all packet
|
||||
arrivals and departures are printed to stderr.
|
||||
.PP
|
||||
Upon startup, mrouted writes its pid to the file /var/run/mrouted.pid .
|
||||
.SH CONFIGURATION
|
||||
.PP
|
||||
.I Mrouted
|
||||
.El
|
||||
.It Fl p
|
||||
Disable pruning.
|
||||
.El
|
||||
.Pp
|
||||
Upon startup,
|
||||
.Nm
|
||||
writes its pid to the file
|
||||
.Pa /var/run/mrouted.pid .
|
||||
.Sh CONFIGURATION
|
||||
.Nm Mrouted
|
||||
automatically configures itself to forward on all multicast-capable
|
||||
interfaces, i.e., interfaces that have the IFF_MULTICAST flag set (excluding
|
||||
the loopback "interface"), and it finds other
|
||||
.IR mrouted s
|
||||
.Nm mrouted Ns s
|
||||
directly reachable
|
||||
via those interfaces. To override the default configuration, or to add
|
||||
tunnel links to other
|
||||
.IR mrouted s,
|
||||
.Nm mrouted Ns s,
|
||||
configuration commands may be placed in
|
||||
/etc/mrouted.conf (or an alternative file, specified by the "\-c" option).
|
||||
.Pa /etc/mrouted.conf
|
||||
(or an alternative file, specified by the
|
||||
.Fl c
|
||||
option).
|
||||
There are four types of configuration commands:
|
||||
.nf
|
||||
|
||||
@ -126,15 +138,15 @@ There are four types of configuration commands:
|
||||
name <boundary-name> <scoped-addr>/<mask-len>
|
||||
|
||||
.fi
|
||||
.PP
|
||||
.Pp
|
||||
The file format is free-form; whitespace (including newlines) is not
|
||||
significant.
|
||||
The
|
||||
.I boundary
|
||||
.Em boundary
|
||||
and
|
||||
.I altnet
|
||||
.Em altnet
|
||||
options may be specified as many times as necessary.
|
||||
.PP
|
||||
.Pp
|
||||
The phyint command can be used to disable multicast routing on the physical
|
||||
interface identified by local IP address <local-addr>, or to associate a
|
||||
non-default metric or threshold with the specified physical interface.
|
||||
@ -143,7 +155,7 @@ interface name (e.g le0).
|
||||
If a phyint is attached to multiple IP subnets, describe each additional subnet
|
||||
with the altnet keyword.
|
||||
Phyint commands must precede tunnel commands.
|
||||
.PP
|
||||
.Pp
|
||||
The tunnel command can be used to establish a tunnel link between local
|
||||
IP address <local-addr> and remote IP address <remote-addr>, and to associate
|
||||
a non-default metric or threshold with that tunnel.
|
||||
@ -152,61 +164,62 @@ interface name (e.g. le0). The remote IP address <remote-addr> may
|
||||
be replaced by a host name, if and only if the host name has a single
|
||||
IP address associated with it.
|
||||
The tunnel must be set
|
||||
up in the mrouted.conf files of both routers before it can be used.
|
||||
.PP
|
||||
up in the
|
||||
.Pa mrouted.conf
|
||||
files of both routers before it can be used.
|
||||
.Pp
|
||||
The cache_lifetime is a value that determines the amount of time that a
|
||||
cached multicast route stays in kernel before timing out. The value of this
|
||||
entry should lie between 300 (5 min) and 86400 (1 day). It defaults to 300.
|
||||
.PP
|
||||
.Pp
|
||||
You may assign names to boundaries to make configuration easier with
|
||||
the name keyword. The boundary option on phyint or tunnel commands
|
||||
can accept either a name or a boundary.
|
||||
.PP
|
||||
.Pp
|
||||
The metric is the "cost" associated with sending a datagram on the given
|
||||
interface or tunnel; it may be used to influence the choice of routes.
|
||||
The metric defaults to 1. Metrics should be kept as small as possible,
|
||||
because
|
||||
.I mrouted
|
||||
.Nm
|
||||
cannot route along paths with a sum of metrics greater
|
||||
than 31.
|
||||
.PP
|
||||
.Pp
|
||||
The advert_metric is the "cost" associated with receiving a datagram
|
||||
on the given interface or tunnel; it may be used to influence the choice
|
||||
of routes. The advert_metric defaults to 0. Note that the effective
|
||||
metric of a link is one end's metric plus the other end's advert_metric.
|
||||
.LP
|
||||
.Pp
|
||||
The threshold is the minimum IP time-to-live required for a multicast datagram
|
||||
to be forwarded to the given interface or tunnel. It is used to control the
|
||||
scope of multicast datagrams. (The TTL of forwarded packets is only compared
|
||||
to the threshold, it is not decremented by the threshold. Every multicast
|
||||
router decrements the TTL by 1.) The default threshold is 1.
|
||||
.LP
|
||||
.Pp
|
||||
In general, all
|
||||
.IR mrouted s
|
||||
.Nm mrouted Ns s
|
||||
connected to a particular subnet or tunnel should
|
||||
use the same metric and threshold for that subnet or tunnel.
|
||||
.PP
|
||||
.Pp
|
||||
The rate_limit option allows the network administrator to specify a
|
||||
certain bandwidth in Kbits/second which would be allocated to multicast
|
||||
traffic. It defaults to 500Kbps on tunnels, and 0 (unlimited) on physical
|
||||
interfaces.
|
||||
.PP
|
||||
.Pp
|
||||
The boundary option allows an interface
|
||||
to be configured as an administrative boundary for the specified
|
||||
scoped address. Packets belonging to this address will not
|
||||
be forwarded on a scoped interface. The boundary option accepts either
|
||||
a name or a boundary spec.
|
||||
.PP
|
||||
.I Mrouted
|
||||
.Pp
|
||||
.Nm Mrouted
|
||||
will not initiate execution if it has fewer than two enabled vifs,
|
||||
where a vif (virtual interface) is either a physical multicast-capable
|
||||
interface or a tunnel. It will log a warning if all of its vifs are
|
||||
tunnels; such an
|
||||
.I mrouted
|
||||
.Nm
|
||||
configuration would be better replaced by more
|
||||
direct tunnels (i.e., eliminate the middle man).
|
||||
.SH "EXAMPLE CONFIGURATION"
|
||||
.PP
|
||||
.Sh "EXAMPLE CONFIGURATION"
|
||||
This is an example configuration for a mythical multicast router at a big
|
||||
school.
|
||||
.sp
|
||||
@ -244,34 +257,37 @@ tunnel 192.168.5.4 192.168.55.101 metric 1 threshold 1
|
||||
tunnel 192.168.5.4 10.11.12.13 metric 1 threshold 32
|
||||
boundary LOCAL boundary EE
|
||||
.fi
|
||||
.SH SIGNALS
|
||||
.PP
|
||||
.I Mrouted
|
||||
.Sh SIGNALS
|
||||
.Nm Mrouted
|
||||
responds to the following signals:
|
||||
.IP HUP
|
||||
restarts
|
||||
.I mrouted .
|
||||
.Bl -tag -width indent
|
||||
.It HUP
|
||||
Restarts
|
||||
.Nm mrouted .
|
||||
The configuration file is reread every time this signal is evoked.
|
||||
.IP INT
|
||||
terminates execution gracefully (i.e., by sending
|
||||
.It INT
|
||||
Terminate execution gracefully (i.e., by sending
|
||||
good-bye messages to all neighboring routers).
|
||||
.IP TERM
|
||||
same as INT
|
||||
.IP USR1
|
||||
dumps the internal routing tables to /var/tmp/mrouted.dump.
|
||||
.IP USR2
|
||||
dumps the internal cache tables to /var/tmp/mrouted.cache.
|
||||
.IP QUIT
|
||||
dumps the internal routing tables to stderr (only if
|
||||
.I mrouted
|
||||
.It TERM
|
||||
Same as INT.
|
||||
.It USR1
|
||||
Dump the internal routing tables to
|
||||
.Pa /var/tmp/mrouted.dump .
|
||||
.It USR2
|
||||
Dump the internal cache tables to
|
||||
.Pa /var/tmp/mrouted.cache .
|
||||
.It QUIT
|
||||
Dump the internal routing tables to stderr (only if
|
||||
.Nm
|
||||
was invoked with a non-zero debug level).
|
||||
.PP
|
||||
.El
|
||||
.Pp
|
||||
For convenience in sending signals,
|
||||
.I mrouted
|
||||
writes its pid to /var/run/mrouted.pid upon startup.
|
||||
.bp
|
||||
.SH EXAMPLE
|
||||
.PP
|
||||
.Nm
|
||||
writes its pid to
|
||||
.Pa /var/run/mrouted.pid
|
||||
upon startup.
|
||||
.Sh EXAMPLE
|
||||
The routing tables look like this:
|
||||
.nf
|
||||
|
||||
@ -313,13 +329,13 @@ In this example, there are four vifs connecting to two subnets and two
|
||||
tunnels. The vif 3 tunnel is not in use (no peer address). The vif 0 and
|
||||
vif 1 subnets have some groups present; tunnels never have any groups. This
|
||||
instance of
|
||||
.I mrouted
|
||||
.Nm
|
||||
is the one responsible for sending periodic group
|
||||
membership queries on the vif 0 and vif 1 subnets, as indicated by the
|
||||
"querier" flags. The list of boundaries indicate the scoped addresses on that
|
||||
interface. A count of the no. of incoming and outgoing packets is also
|
||||
shown at each interface.
|
||||
.PP
|
||||
.Pp
|
||||
Associated with each subnet from which a multicast datagram can originate
|
||||
is the address of the previous hop router (unless the subnet is directly-
|
||||
connected), the metric of the path back to the origin, the amount of time
|
||||
@ -328,13 +344,12 @@ multicasts from that origin, and a list of outgoing vifs. "*" means that
|
||||
the outgoing vif is connected to a leaf of the broadcast tree rooted at the
|
||||
origin, and a multicast datagram from that origin will be forwarded on that
|
||||
outgoing vif only if there are members of the destination group on that leaf.
|
||||
.bp
|
||||
.PP
|
||||
.I Mrouted
|
||||
.Pp
|
||||
.Nm Mrouted
|
||||
also maintains a copy of the kernel forwarding cache table. Entries
|
||||
are created and deleted by
|
||||
.I mrouted.
|
||||
.PP
|
||||
.Nm mrouted .
|
||||
.Pp
|
||||
The cache tables look like this:
|
||||
.nf
|
||||
|
||||
@ -352,44 +367,54 @@ Multicast Routing Cache Table (147 entries)
|
||||
|
||||
.fi
|
||||
Each entry is characterized by the origin subnet number and mask and the
|
||||
destination multicast group. The 'CTmr' field indicates the lifetime
|
||||
destination multicast group.
|
||||
.Pp
|
||||
The 'CTmr' field indicates the lifetime
|
||||
of the entry. The entry is deleted from the cache table
|
||||
when the timer decrements to zero. The 'Age' field is the time since
|
||||
when the timer decrements to zero.
|
||||
.Pp
|
||||
The 'Age' field is the time since
|
||||
this cache entry was originally created. Since cache entries get refreshed
|
||||
if traffic is flowing, routing entries can grow very old.
|
||||
.Pp
|
||||
The 'Ptmr' field is simply a dash if no prune was sent upstream, or the
|
||||
amount of time until the upstream prune will time out.
|
||||
.Pp
|
||||
The 'Ivif' field indicates the
|
||||
incoming vif for multicast packets from that origin. Each router also
|
||||
maintains a record of the number of prunes received from neighboring
|
||||
routers for a particular source and group. If there are no members of
|
||||
a multicast group on any downward link of the multicast tree for a
|
||||
subnet, a prune message is sent to the upstream router. They are
|
||||
indicated by a "P" after the vif number. The Forwvifs field shows the
|
||||
indicated by a "P" after the vif number.
|
||||
.Pp
|
||||
The Forwvifs field shows the
|
||||
interfaces along which datagrams belonging to the source-group are
|
||||
forwarded. A "p" indicates that no datagrams are being forwarded along
|
||||
that interface. An unlisted interface is a leaf subnet with are no
|
||||
members of the particular group on that subnet. A "b" on an interface
|
||||
indicates that it is a boundary interface, i.e. traffic will not be
|
||||
forwarded on the scoped address on that interface.
|
||||
.Pp
|
||||
An additional line with a ">" as the first character is printed for
|
||||
each source on the subnet. Note that there can be many sources in
|
||||
one subnet.
|
||||
.SH FILES
|
||||
/etc/mrouted.conf
|
||||
.br
|
||||
/var/run/mrouted.pid
|
||||
.br
|
||||
/var/tmp/mrouted.dump
|
||||
.br
|
||||
/var/tmp/mrouted.cache
|
||||
.SH SEE ALSO
|
||||
.BR mrinfo (8) ,
|
||||
.BR mtrace (8) ,
|
||||
.BR map-mbone (8)
|
||||
.sp
|
||||
.Sh FILES
|
||||
.Bl -tag -width /var/tmp/mrouted.cache -compact
|
||||
.It Pa /etc/mrouted.conf
|
||||
.It Pa /var/run/mrouted.pid
|
||||
.It Pa /var/tmp/mrouted.dump
|
||||
.It Pa /var/tmp/mrouted.cache
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr mrinfo 8 ,
|
||||
.Xr mtrace 8 ,
|
||||
.Xr map-mbone 8
|
||||
.Pp
|
||||
DVMRP is described, along with other multicast routing algorithms, in the
|
||||
paper "Multicast Routing in Internetworks and Extended LANs" by S. Deering,
|
||||
in the Proceedings of the ACM SIGCOMM '88 Conference.
|
||||
.SH AUTHORS
|
||||
Steve Deering, Ajit Thyagarajan, Bill Fenner
|
||||
.Sh AUTHORS
|
||||
.An Steve Deering ,
|
||||
.An Ajit Thyagarajan ,
|
||||
.An Bill Fenner .
|
||||
|
@ -31,271 +31,225 @@
|
||||
.\"
|
||||
.\" mtrace.8,v 5.1 1996/12/19 21:31:26 fenner Exp
|
||||
.\"
|
||||
.TH MTRACE 8 "May 8, 1995"
|
||||
.Dd May 8, 1995
|
||||
.Dt MTRACE 8
|
||||
.UC 6
|
||||
.SH NAME
|
||||
mtrace \- print multicast path from a source to a receiver
|
||||
.SH SYNOPSIS
|
||||
.B mtrace
|
||||
[
|
||||
.B \-e
|
||||
.I extrahops
|
||||
] [
|
||||
.B \-g
|
||||
.I gateway
|
||||
] [
|
||||
.B \-i
|
||||
.I if_addr
|
||||
] [
|
||||
.B \-l
|
||||
] [
|
||||
.B \-M
|
||||
] [
|
||||
.B \-m
|
||||
.I max_hops
|
||||
] [
|
||||
.B \-n
|
||||
] [
|
||||
.B \-O
|
||||
] [
|
||||
.B \-p
|
||||
] [
|
||||
.B \-P
|
||||
] [
|
||||
.B \-q
|
||||
.I nqueries
|
||||
] [
|
||||
.B \-r
|
||||
.I resp_dest
|
||||
] [
|
||||
.B \-s
|
||||
] [
|
||||
.B \-S
|
||||
.I stat_int
|
||||
] [
|
||||
.B \-t
|
||||
.I ttl
|
||||
] [
|
||||
.B \-T
|
||||
] [
|
||||
.B \-U
|
||||
] [
|
||||
.B \-v
|
||||
] [
|
||||
.B \-w
|
||||
.I waittime
|
||||
]
|
||||
.I source
|
||||
[
|
||||
.I receiver
|
||||
] [
|
||||
.I group
|
||||
]
|
||||
.SH DESCRIPTION
|
||||
.Sh NAME
|
||||
.Nm mtrace
|
||||
.Nd print multicast path from a source to a receiver
|
||||
.Sh SYNOPSIS
|
||||
.Nm mtrace
|
||||
.Op Fl e Ar extrahops
|
||||
.Op Fl g Ar gateway
|
||||
.Op Fl i Ar if_addr
|
||||
.Op Fl l
|
||||
.Op Fl M
|
||||
.Op Fl m Ar max_hops
|
||||
.Op Fl n
|
||||
.Op Fl O
|
||||
.Op Fl p
|
||||
.Op Fl P
|
||||
.Op Fl q Ar nqueries
|
||||
.Op Fl r Ar resp_dest
|
||||
.Op Fl s
|
||||
.Op Fl S Ar stat_int
|
||||
.Op Fl t Ar ttl
|
||||
.Op Fl T
|
||||
.Op Fl U
|
||||
.Op Fl v
|
||||
.Op Fl w Ar waittime
|
||||
.Ar source
|
||||
.Op Ar receiver
|
||||
.Op Ar group
|
||||
.Sh DESCRIPTION
|
||||
Assessing problems in the distribution of IP multicast traffic
|
||||
can be difficult.
|
||||
.B mtrace
|
||||
.Nm Mtrace
|
||||
utilizes a tracing feature implemented in multicast routers that is
|
||||
accessed via an extension to the IGMP protocol. A trace query is
|
||||
passed hop-by-hop along the reverse path from the
|
||||
.I receiver
|
||||
.Ar receiver
|
||||
to the
|
||||
.IR source ,
|
||||
.Ar source ,
|
||||
collecting hop addresses, packet counts, and routing error conditions
|
||||
along the path, and then the response is returned to the requestor.
|
||||
.PP
|
||||
.Pp
|
||||
The only required parameter is the
|
||||
.I source
|
||||
.Ar source
|
||||
host name or address. The default
|
||||
.I receiver
|
||||
.Ar receiver
|
||||
is the host running mtrace, and the default
|
||||
.I group
|
||||
.Ar group
|
||||
is "MBone Audio" (224.2.0.1), which is sufficient if packet loss
|
||||
statistics for a particular multicast group are not needed. These two
|
||||
optional parameters may be specified to test the path to some other
|
||||
receiver in a particular group, subject to some constraints as
|
||||
detailed below. The two parameters can be distinguished because the
|
||||
.I receiver
|
||||
.Ar receiver
|
||||
is a unicast address and the
|
||||
.I group
|
||||
.Ar group
|
||||
is a multicast address.
|
||||
If the
|
||||
.B \-g
|
||||
.Fl g
|
||||
flag is specified, the source address defaults to the host running
|
||||
mtrace, and the receiver defaults to the router being addressed with
|
||||
.Nm mtrace ,
|
||||
and the receiver defaults to the router being addressed with
|
||||
the
|
||||
.B \-g
|
||||
.Fl g
|
||||
flag. In this case, there are no required parameters.
|
||||
.PP
|
||||
.Pp
|
||||
NOTE: For Solaris 2.4/2.5, if the multicast interface is not the default
|
||||
interface, the -i option must be used to set the local address.
|
||||
.SH OPTIONS
|
||||
.TP 8 8
|
||||
.BI \-e\ extrahops
|
||||
interface, the
|
||||
.Fl i
|
||||
option must be used to set the local address.
|
||||
.Pp
|
||||
The following options are available:
|
||||
.Bl -tag -width indent
|
||||
.It Fl e Ar extrahops
|
||||
Try tracing
|
||||
.I extrahops
|
||||
.Ar extrahops
|
||||
hops past a non-responding router.
|
||||
.TP 8 8
|
||||
.BI \-g\ gwy
|
||||
.It Fl g Ar gwy
|
||||
Send the trace query via unicast directly to the multicast router
|
||||
.I gwy
|
||||
.Ar gwy
|
||||
rather than multicasting the query.
|
||||
This must be the last-hop router on the path from the intended
|
||||
.I source
|
||||
.Ar source
|
||||
to the
|
||||
.IR receiver .
|
||||
.RS 8
|
||||
.TP 12 12
|
||||
.I CAUTION!!
|
||||
.Ar receiver .
|
||||
.Pp
|
||||
.Em CAUTION!!
|
||||
Versions 3.3 and 3.5 of
|
||||
.B mrouted
|
||||
.Nm mrouted
|
||||
will crash if a trace query is received via a
|
||||
unicast packet and
|
||||
.B mrouted
|
||||
.Nm mrouted
|
||||
has no route for the
|
||||
.I source
|
||||
.Ar source
|
||||
address. Therefore, do not use the
|
||||
.B \-g
|
||||
.Fl g
|
||||
option unless the target
|
||||
.B mrouted
|
||||
.Nm mrouted
|
||||
has been verified to be 3.4 or newer than 3.5.
|
||||
.RE
|
||||
.TP 8 8
|
||||
.BI \-i\ addr
|
||||
.It Fl i Ar addr
|
||||
Use
|
||||
.I addr
|
||||
.Ar addr
|
||||
as the local interface address (on a multi-homed host) for sending the
|
||||
trace query and as the default for the
|
||||
.I receiver
|
||||
.Ar receiver
|
||||
and the response destination.
|
||||
.TP 8 8
|
||||
.B \-l
|
||||
.It Fl l
|
||||
Loop indefinitely printing packet rate and loss statistics for the
|
||||
multicast path every 10 seconds (see
|
||||
.B \-S
|
||||
.IR stat_int ).
|
||||
.TP 8 8
|
||||
.B \-M
|
||||
.Fl S Ar stat_int ).
|
||||
.It Fl M
|
||||
Always request the response using multicast rather than attempting
|
||||
unicast for the last half of the tries.
|
||||
.TP 8 8
|
||||
.BI \-m\ n
|
||||
.It Fl m Ar n
|
||||
Set to
|
||||
.I n
|
||||
.Ar n
|
||||
the maximum number of hops that will be traced from the
|
||||
.I receiver
|
||||
.Ar receiver
|
||||
back toward the
|
||||
.IR source .
|
||||
.Ar source .
|
||||
The default is 32 hops (infinity for the DVMRP routing protocol).
|
||||
.TP 8 8
|
||||
.B \-n
|
||||
.It Fl n
|
||||
Print hop addresses numerically rather than symbolically and numerically
|
||||
(saves a nameserver address-to-name lookup for each router found on the
|
||||
path).
|
||||
.TP 8 8
|
||||
.BI \-q\ n
|
||||
.It Fl q Ar n
|
||||
Set the maximum number of query attempts for any hop to
|
||||
.IR n .
|
||||
.Ar n .
|
||||
The default is 3.
|
||||
.TP 8 8
|
||||
.B \-O
|
||||
.It Fl O
|
||||
Do not use the Router-Alert IP option on those requests which need it.
|
||||
Some versions of Cisco's IOS cannot handle
|
||||
multicast traceroutes with IP options, so it may be necessary to use the
|
||||
-O flag if the last-hop router is a Cisco.
|
||||
.TP 8 8
|
||||
.B \-p
|
||||
.Fl O
|
||||
flag if the last-hop router is a Cisco.
|
||||
.It Fl p
|
||||
Listen passively for multicast responses from traces initiated by
|
||||
others. This works best when run on a multicast router.
|
||||
.TP 8 8
|
||||
.B \-P
|
||||
.It Fl P
|
||||
Loop indefinitely collecting the path every 10 seconds (see
|
||||
.B \-S
|
||||
.IR stat_int )
|
||||
.Fl S Ar stat_int )
|
||||
and printing it when it changes. Do not print any statistics.
|
||||
.TP 8 8
|
||||
.BI \-r\ host
|
||||
.It Fl r Ar host
|
||||
Send the trace response to
|
||||
.I host
|
||||
.Ar host
|
||||
rather than to the host on which
|
||||
.B mtrace
|
||||
.Nm
|
||||
is being run, or to a multicast address other than the one registered
|
||||
for this purpose (224.0.1.32).
|
||||
.TP 8 8
|
||||
.B \-s
|
||||
.It Fl s
|
||||
Print a short form output including only the multicast path and not
|
||||
the packet rate and loss statistics.
|
||||
.TP 8 8
|
||||
.BI \-S\ n
|
||||
.It Fl S Ar n
|
||||
Change the interval between statistics gathering traces to
|
||||
.I n
|
||||
.Ar n
|
||||
seconds (default 10 seconds).
|
||||
.TP 8 8
|
||||
.BI \-t\ ttl
|
||||
.It Fl t Ar ttl
|
||||
Set the
|
||||
.I ttl
|
||||
.Ar ttl
|
||||
(time-to-live, or number of hops) for multicast trace queries and
|
||||
responses. The default is 127, except for local queries to the "all
|
||||
routers" multicast group which use ttl 1.
|
||||
.TP 8 8
|
||||
.B \-T
|
||||
.It Fl T
|
||||
"Tunnel statistics" mode; show loss rates for overall traffic.
|
||||
These statistics can be extremely misleading.
|
||||
.TP 8 8
|
||||
.B \-U
|
||||
.It Fl U
|
||||
Always request the response using unicast rather than attempting
|
||||
multicast first.
|
||||
.TP 8 8
|
||||
.B \-v
|
||||
.It Fl v
|
||||
Verbose mode; show hop times on the initial trace and statistics display.
|
||||
Also show the route that was used to forward the initial trace.
|
||||
.TP 8 8
|
||||
.BI \-w\ n
|
||||
.It Fl w Ar n
|
||||
Set the time to wait for a trace response to
|
||||
.I n
|
||||
.Ar n
|
||||
seconds (default 3 seconds).
|
||||
.SH USAGE
|
||||
.El
|
||||
.Sh USAGE
|
||||
.SS How It Works
|
||||
The technique used by the
|
||||
.B traceroute
|
||||
.Nm traceroute
|
||||
tool to trace unicast network paths will not work for IP multicast
|
||||
because ICMP responses are specifically forbidden for multicast traffic.
|
||||
Instead, a tracing feature has been built into the multicast routers.
|
||||
This technique has the advantage that additional information about
|
||||
packet rates and losses can be accumulated while the number of packets
|
||||
sent is minimized.
|
||||
.PP
|
||||
.Pp
|
||||
Since multicast uses
|
||||
reverse path forwarding, the trace is run backwards from the
|
||||
.I receiver
|
||||
.Ar receiver
|
||||
to the
|
||||
.IR source .
|
||||
.Ar source .
|
||||
A trace query packet is sent to the last
|
||||
hop multicast router (the leaf router for the desired
|
||||
.I receiver
|
||||
.Ar receiver
|
||||
address). The last hop router builds a trace response packet, fills in
|
||||
a report for its hop, and forwards the trace packet using unicast to
|
||||
the router it believes is the previous hop for packets originating
|
||||
from the specified
|
||||
.IR source .
|
||||
.Ar source .
|
||||
Each router along the path adds its report and forwards the packet.
|
||||
When the trace response packet reaches the first hop router (the router
|
||||
that is directly connected to the source's net), that router sends the
|
||||
completed response to the response destination address specified in
|
||||
the trace query.
|
||||
.PP
|
||||
.Pp
|
||||
If some multicast router along the path does not implement the
|
||||
multicast traceroute feature or if there is some outage, then no
|
||||
response will be returned. To solve this problem, the trace query
|
||||
includes a maximum hop count field to limit the number of hops traced
|
||||
before the response is returned. That allows a partial path to be
|
||||
traced.
|
||||
.PP
|
||||
.Pp
|
||||
The reports inserted by each router contain not only the address of
|
||||
the hop, but also the ttl required to forward and some flags to indicate
|
||||
routing errors, plus counts of the total number of packets on the
|
||||
incoming and outgoing interfaces and those forwarded for the specified
|
||||
.IR group .
|
||||
.Ar group .
|
||||
Taking differences in these counts for two traces separated in time
|
||||
and comparing the output packet counts from one hop with the input
|
||||
packet counts of the next hop allows the calculation of packet rate
|
||||
@ -304,51 +258,51 @@ problems.
|
||||
.SS Finding the Last-Hop Router
|
||||
The trace query must be sent to the multicast router which is the
|
||||
last hop on the path from the
|
||||
.I source
|
||||
.Ar source
|
||||
to the
|
||||
.IR receiver .
|
||||
.Ar receiver .
|
||||
If the receiver is on the local subnet (as determined using the subnet
|
||||
mask), then the default method is to multicast the trace query to
|
||||
all-routers.mcast.net (224.0.0.2) with a ttl of 1. Otherwise, the
|
||||
trace query is multicast to the
|
||||
.I group
|
||||
.Ar group
|
||||
address since the last hop router will be a member of that group if
|
||||
the receiver is. Therefore it is necessary to specify a group that
|
||||
the intended receiver has joined. This multicast is sent with a
|
||||
default ttl of 127, which may not be sufficient for all cases (changed
|
||||
with the
|
||||
.B \-t
|
||||
.Fl t
|
||||
option).
|
||||
If the last hop router is known, it may also be addressed directly
|
||||
using the
|
||||
.B \-g
|
||||
.Fl g
|
||||
option). Alternatively, if it is desired to trace a group that the
|
||||
receiver has not joined, but it is known that the last-hop router is a
|
||||
member of another group, the
|
||||
.B \-g
|
||||
.Fl g
|
||||
option may also be used to specify a different multicast address for the
|
||||
trace query.
|
||||
.PP
|
||||
.Pp
|
||||
When tracing from a multihomed host or router, the default receiver
|
||||
address may not be the desired interface for the path from the source.
|
||||
In that case, the desired interface should be specified explicitly as
|
||||
the
|
||||
.IR receiver .
|
||||
.Ar receiver .
|
||||
.SS Directing the Response
|
||||
By default,
|
||||
.B mtrace
|
||||
.Nm
|
||||
first attempts to trace the full reverse path, unless the number of
|
||||
hops to trace is explicitly set with the
|
||||
.B \-m
|
||||
.Fl m
|
||||
option. If there is no response within a 3 second timeout interval
|
||||
(changed with the
|
||||
.B \-w
|
||||
.Fl w
|
||||
option), a "*" is printed and the probing switches to hop-by-hop mode.
|
||||
Trace queries are issued starting with a maximum hop count of one and
|
||||
increasing by one until the full path is traced or no response is
|
||||
received. At each hop, multiple probes are sent (default is three,
|
||||
changed with
|
||||
.B \-q
|
||||
.Fl q
|
||||
option). The first half of the attempts (default is two) are made with
|
||||
the reply address set to standard multicast address, mtrace.mcast.net
|
||||
(224.0.1.32) with the ttl set to 32 more than what's needed to pass the
|
||||
@ -357,41 +311,41 @@ additional attempt, the ttl is increased by another 32 each time up to
|
||||
a maximum of 192. Since the desired router may not be able to send a
|
||||
multicast reply, the remainder of the attempts request that the
|
||||
response be sent via unicast to the host running
|
||||
.B mtrace .
|
||||
.Nm mtrace .
|
||||
Alternatively, the multicast ttl may be set explicitly with the
|
||||
.B \-t
|
||||
.Fl t
|
||||
option, the initial multicast attempts can be forced to use unicast
|
||||
instead with the
|
||||
.B \-U
|
||||
.Fl U
|
||||
option, the final unicast attempts can be forced to use multicast
|
||||
isntead with the
|
||||
.B \-M
|
||||
.Fl M
|
||||
option, or if you specify
|
||||
.B \-UM
|
||||
.B mtrace
|
||||
.Fl UM ,
|
||||
.Nm
|
||||
will first attempt using unicast and then multicast. For each attempt,
|
||||
if no response is received within the timeout, a "*" is printed. After
|
||||
the specified number of attempts have failed,
|
||||
.B mtrace
|
||||
.Nm
|
||||
will try to query the next hop router with a DVMRP_ASK_NEIGHBORS2
|
||||
request (as used by the
|
||||
.B mrinfo
|
||||
.Nm mrinfo
|
||||
program) to see what kind of router it is.
|
||||
.B mtrace
|
||||
.Nm
|
||||
will try to query three (changed with the
|
||||
.B \-e
|
||||
.Fl e
|
||||
option) hops past a non-responding router, in the hopes that even
|
||||
though it isn't capable of sending a response, it might be capable of
|
||||
forwarding the request on.
|
||||
.SH EXAMPLES
|
||||
.Sh EXAMPLES
|
||||
The output of
|
||||
.B mtrace
|
||||
.Nm
|
||||
is in two sections. The first section is a short listing of the hops
|
||||
in the order they are queried, that is, in the reverse of the order
|
||||
from the
|
||||
.I source
|
||||
.Ar source
|
||||
to the
|
||||
.IR receiver .
|
||||
.Ar receiver .
|
||||
For each hop, a line is printed showing the hop number (counted
|
||||
negatively to indicate that this is the reverse path); the multicast
|
||||
routing protocol (DVMRP, MOSPF, PIM, etc.); the threshold required to
|
||||
@ -403,7 +357,7 @@ the interval from when the query is issued until the response is
|
||||
received, both derived from the local system clock, and the total
|
||||
ttl required for a packet to travel along this path. A sample use and
|
||||
output might be:
|
||||
.PP
|
||||
.Pp
|
||||
.nf
|
||||
.ft C
|
||||
oak.isi.edu 80# mtrace -l caraway.lcs.mit.edu 224.2.0.3
|
||||
@ -418,16 +372,16 @@ Querying full reverse path...
|
||||
-6 caraway.lcs.mit.edu (18.26.0.170)
|
||||
Round trip time 124 ms; total ttl of 6 required.
|
||||
.fi
|
||||
.PP
|
||||
.Pp
|
||||
If a hop reports that it is using the default route to forward packets,
|
||||
the word
|
||||
.B [default]
|
||||
.Em [default]
|
||||
is printed after that hop. If the
|
||||
.B \-v
|
||||
.Fl v
|
||||
flag is supplied, the route being used to forward packets is printed
|
||||
in the form
|
||||
.B [18.26.0/24] .
|
||||
.PP
|
||||
.Em [18.26.0/24] .
|
||||
.Pp
|
||||
The second section provides a pictorial view of the path in the
|
||||
forward direction with data flow indicated by arrows pointing downward
|
||||
and the query path indicated by arrows pointing upward. For each hop,
|
||||
@ -446,28 +400,28 @@ explained above. The first group shows the statistics for all traffic
|
||||
flowing out the interface at one hop and in the interface at the next
|
||||
hop. The second group shows the statistics only for traffic forwarded
|
||||
from the specified
|
||||
.I source
|
||||
.Ar source
|
||||
to the specified
|
||||
.IR group .
|
||||
.Ar group .
|
||||
The first group of statistics may be expanded to include loss rates
|
||||
using the
|
||||
.B \-T
|
||||
.Fl T
|
||||
option. However, these numbers can be extremely misleading and require
|
||||
detailed knowledge of the routers involved to be interpreted properly.
|
||||
.PP
|
||||
.Pp
|
||||
These statistics are shown on one or two lines for each hop. Without
|
||||
any options, this second section of the output is printed only once,
|
||||
approximately 10 seconds after the initial trace. One line is shown
|
||||
for each hop showing the statistics over that 10-second period. If
|
||||
the
|
||||
.B \-l
|
||||
.Fl l
|
||||
option is given, the second section is repeated every 10 seconds and
|
||||
two lines are shown for each hop. The first line shows the statistics
|
||||
for the last 10 seconds, and the second line shows the cumulative
|
||||
statistics over the period since the initial trace, which is 101
|
||||
seconds in the example below. The second section of the output is
|
||||
omitted if the
|
||||
.B \-s
|
||||
.Fl s
|
||||
option is set or if no multicast group is specified.
|
||||
.ie t \{\
|
||||
.ft C
|
||||
@ -477,7 +431,7 @@ option is set or if no multicast group is specified.
|
||||
and try again.)
|
||||
. \}
|
||||
.\}
|
||||
.PP
|
||||
.Pp
|
||||
.ft C
|
||||
.nf
|
||||
Waiting to accumulate statistics... Results after 101 seconds:
|
||||
@ -509,51 +463,44 @@ Waiting to accumulate statistics... Results after 101 seconds:
|
||||
128.9.160.100 128.9.160.100
|
||||
Receiver Query Source
|
||||
.fi
|
||||
.PP
|
||||
.Pp
|
||||
Because the packet counts may be changing as the trace query is
|
||||
propagating, there may be small errors (off by 1 or 2) in these
|
||||
statistics. However, those errors should not accumulate, so the
|
||||
cumulative statistics line should increase in accuracy as a new trace
|
||||
is run every 10 seconds. There are two sources of larger errors, both
|
||||
of which show up as negative losses:
|
||||
.LP
|
||||
.RS
|
||||
.PD 0
|
||||
.TP 3
|
||||
\(bu
|
||||
.Pp
|
||||
If the input to a node is from a multi-access network with more than
|
||||
one other node attached, then the input count will be (close to) the
|
||||
sum of the output counts from all the attached nodes, but the output
|
||||
count from the previous hop on the traced path will be only part of
|
||||
that. Hence the output count minus the input count will be negative.
|
||||
.TP 3
|
||||
\(bu
|
||||
.Pp
|
||||
In release 3.3 of the DVMRP multicast forwarding software for SunOS
|
||||
and other systems, a multicast packet generated on a router will be
|
||||
counted as having come in an interface even though it did not. This
|
||||
creates the negative loss that can be seen in the example above.
|
||||
.PD
|
||||
.RE
|
||||
.LP
|
||||
.Pp
|
||||
Note that these negative losses may mask positive losses.
|
||||
.PP
|
||||
.Pp
|
||||
In the example, there is also one negative hop time. This simply
|
||||
indicates a lack of synchronization between the system clocks across
|
||||
that hop. This example also illustrates how the percentage loss is
|
||||
shown as two dashes when the number of packets sent is less than 10
|
||||
because the percentage would not be statistically valid.
|
||||
.PP
|
||||
.Pp
|
||||
A second example shows a trace to a receiver that is not local; the
|
||||
query is sent to the last-hop router with the
|
||||
.B \-g
|
||||
.Fl g
|
||||
option. In this example, the trace of the full reverse path resulted
|
||||
in no response because there was a node running an old version of
|
||||
.B mrouted
|
||||
.Nm mrouted
|
||||
that did not implement the multicast traceroute function, so
|
||||
.B mtrace
|
||||
.Nm
|
||||
switched to hop-by-hop mode. The \*(lqOutput pruned\*(rq error code
|
||||
indicates that traffic for group 224.2.143.24 would not be forwarded.
|
||||
.PP
|
||||
.Pp
|
||||
.nf
|
||||
.ft C
|
||||
oak.isi.edu 108# mtrace -g 140.173.48.2 204.62.246.73 \\
|
||||
@ -568,24 +515,36 @@ Querying full reverse path... * switching to hop-by-hop:
|
||||
-5 * * * noc.hpc.org (192.187.8.2) [mrouted 2.2] didn't respond
|
||||
Round trip time 95 ms
|
||||
.fi
|
||||
.SH AUTHOR
|
||||
Implemented by Steve Casner based on an initial prototype written by
|
||||
Ajit Thyagarajan. The multicast traceroute mechanism was designed by
|
||||
Van Jacobson with help from Steve Casner, Steve Deering, Dino
|
||||
Farinacci, and Deb Agrawal; it was implemented in
|
||||
.B mrouted
|
||||
by Ajit Thyagarajan and Bill Fenner. The option syntax and the output
|
||||
format of
|
||||
.B mtrace
|
||||
.Sh AUTHOR
|
||||
Implemented by
|
||||
.An Steve Casner
|
||||
based on an initial prototype written by
|
||||
.An Ajit Thyagarajan .
|
||||
The multicast traceroute mechanism was designed by
|
||||
.An Van Jacobson
|
||||
with help from
|
||||
.An Steve Casner ,
|
||||
.An Steve Deering ,
|
||||
.An Dino Farinacci ,
|
||||
and
|
||||
.An Deb Agrawal ;
|
||||
it was implemented in
|
||||
.Nm mrouted
|
||||
by
|
||||
.An Ajit Thyagarajan
|
||||
and
|
||||
.An Bill Fenner .
|
||||
The option syntax and the output format of
|
||||
.Nm
|
||||
are modeled after the unicast
|
||||
.B traceroute
|
||||
program written by Van Jacobson.
|
||||
.SH SEE ALSO
|
||||
.BR mrouted (8) ,
|
||||
.BR mrinfo (8) ,
|
||||
.BR map-mbone (8) ,
|
||||
.BR traceroute (8)
|
||||
.SH BUGS
|
||||
.PP
|
||||
.Nm traceroute
|
||||
program written by
|
||||
.An Van Jacobson .
|
||||
.Sh SEE ALSO
|
||||
.Xr mrouted 8 ,
|
||||
.Xr mrinfo 8 ,
|
||||
.Xr map-mbone 8 ,
|
||||
.Xr traceroute 8
|
||||
.Sh BUGS
|
||||
Statistics collection in passive mode doesn't always produce the same output
|
||||
as when actively collecting data.
|
||||
|
@ -99,18 +99,20 @@
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
static char rcsid[] =
|
||||
"@(#) mtrace.c,v 5.1.1.1 1996/12/20 00:43:40 fenner Exp";
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif
|
||||
|
||||
#include <ctype.h>
|
||||
#include <err.h>
|
||||
#include <errno.h>
|
||||
#include <memory.h>
|
||||
#include <netdb.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <memory.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <syslog.h>
|
||||
#include <netdb.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@ -336,6 +338,7 @@ void check_vif_state __P((void));
|
||||
|
||||
int main __P((int argc, char *argv[]));
|
||||
void log __P((int, int, char *, ...));
|
||||
static void usage __P((void));
|
||||
|
||||
|
||||
/*
|
||||
@ -864,7 +867,7 @@ get_netmask(s, dst)
|
||||
ifc.ifc_buf = ifbuf;
|
||||
ifc.ifc_len = sizeof(ifbuf);
|
||||
if (ioctl(s, SIOCGIFCONF, (char *) &ifc) < 0) {
|
||||
perror("ioctl (SIOCGIFCONF)");
|
||||
warn("ioctl (SIOCGIFCONF)");
|
||||
return (retval);
|
||||
}
|
||||
i = ifc.ifc_len / sizeof(struct ifreq);
|
||||
@ -1054,7 +1057,7 @@ send_recv(dst, type, code, tries, save)
|
||||
&tv);
|
||||
|
||||
if (count < 0) {
|
||||
if (errno != EINTR) perror("select");
|
||||
if (errno != EINTR) warn("select");
|
||||
continue;
|
||||
} else if (count == 0) {
|
||||
printf("* ");
|
||||
@ -1067,13 +1070,12 @@ send_recv(dst, type, code, tries, save)
|
||||
0, (struct sockaddr *)&recvaddr, &socklen);
|
||||
|
||||
if (recvlen <= 0) {
|
||||
if (recvlen && errno != EINTR) perror("recvfrom");
|
||||
if (recvlen && errno != EINTR) warn("recvfrom");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (recvlen < sizeof(struct ip)) {
|
||||
fprintf(stderr,
|
||||
"packet too short (%u bytes) for IP header", recvlen);
|
||||
warnx("packet too short (%u bytes) for IP header", recvlen);
|
||||
continue;
|
||||
}
|
||||
ip = (struct ip *) recv_buf;
|
||||
@ -1083,8 +1085,7 @@ send_recv(dst, type, code, tries, save)
|
||||
iphdrlen = ip->ip_hl << 2;
|
||||
ipdatalen = ip->ip_len;
|
||||
if (iphdrlen + ipdatalen != recvlen) {
|
||||
fprintf(stderr,
|
||||
"packet shorter (%u bytes) than hdr+data len (%u+%u)\n",
|
||||
warnx("packet shorter (%u bytes) than hdr+data len (%u+%u)",
|
||||
recvlen, iphdrlen, ipdatalen);
|
||||
continue;
|
||||
}
|
||||
@ -1092,8 +1093,7 @@ send_recv(dst, type, code, tries, save)
|
||||
igmp = (struct igmp *) (recv_buf + iphdrlen);
|
||||
igmpdatalen = ipdatalen - IGMP_MINLEN;
|
||||
if (igmpdatalen < 0) {
|
||||
fprintf(stderr,
|
||||
"IP data field too short (%u bytes) for IGMP from %s\n",
|
||||
warnx("IP data field too short (%u bytes) for IGMP from %s",
|
||||
ipdatalen, inet_fmt(ip->ip_src.s_addr, s1));
|
||||
continue;
|
||||
}
|
||||
@ -1172,8 +1172,7 @@ send_recv(dst, type, code, tries, save)
|
||||
* A match, we'll keep this one.
|
||||
*/
|
||||
if (len > code) {
|
||||
fprintf(stderr,
|
||||
"Num hops received (%d) exceeds request (%d)\n",
|
||||
warnx("num hops received (%d) exceeds request (%d)",
|
||||
len, code);
|
||||
}
|
||||
rquery->tr_raddr = query->tr_raddr; /* Insure these are */
|
||||
@ -1223,7 +1222,7 @@ passive_mode()
|
||||
char timebuf[32];
|
||||
int socklen;
|
||||
int ipdatalen, iphdrlen, igmpdatalen;
|
||||
int len, recvlen, dummy = 0;
|
||||
int len, recvlen;
|
||||
u_int32 smask;
|
||||
struct mtrace *remembered = NULL, *m, *n, **nn;
|
||||
int pc = 0;
|
||||
@ -1241,13 +1240,12 @@ passive_mode()
|
||||
gettimeofday(&tr,0);
|
||||
|
||||
if (recvlen <= 0) {
|
||||
if (recvlen && errno != EINTR) perror("recvfrom");
|
||||
if (recvlen && errno != EINTR) warn("recvfrom");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (recvlen < sizeof(struct ip)) {
|
||||
fprintf(stderr,
|
||||
"packet too short (%u bytes) for IP header", recvlen);
|
||||
warnx("packet too short (%u bytes) for IP header", recvlen);
|
||||
continue;
|
||||
}
|
||||
ip = (struct ip *) recv_buf;
|
||||
@ -1257,8 +1255,7 @@ passive_mode()
|
||||
iphdrlen = ip->ip_hl << 2;
|
||||
ipdatalen = ip->ip_len;
|
||||
if (iphdrlen + ipdatalen != recvlen) {
|
||||
fprintf(stderr,
|
||||
"packet shorter (%u bytes) than hdr+data len (%u+%u)\n",
|
||||
warnx("packet shorter (%u bytes) than hdr+data len (%u+%u)",
|
||||
recvlen, iphdrlen, ipdatalen);
|
||||
continue;
|
||||
}
|
||||
@ -1266,8 +1263,7 @@ passive_mode()
|
||||
igmp = (struct igmp *) (recv_buf + iphdrlen);
|
||||
igmpdatalen = ipdatalen - IGMP_MINLEN;
|
||||
if (igmpdatalen < 0) {
|
||||
fprintf(stderr,
|
||||
"IP data field too short (%u bytes) for IGMP from %s\n",
|
||||
warnx("IP data field too short (%u bytes) for IGMP from %s",
|
||||
ipdatalen, inet_fmt(ip->ip_src.s_addr, s1));
|
||||
continue;
|
||||
}
|
||||
@ -1994,16 +1990,14 @@ char *argv[];
|
||||
int seed;
|
||||
int hopbyhop;
|
||||
|
||||
if (geteuid() != 0) {
|
||||
fprintf(stderr, "mtrace: must be root\n");
|
||||
exit(1);
|
||||
}
|
||||
if (geteuid() != 0)
|
||||
errx(1, "must be root");
|
||||
|
||||
init_igmp();
|
||||
setuid(getuid());
|
||||
|
||||
argv++, argc--;
|
||||
if (argc == 0) goto usage;
|
||||
if (argc == 0) usage();
|
||||
|
||||
while (argc > 0 && *argv[0] == '-') {
|
||||
char *p = *argv++; argc--;
|
||||
@ -2024,7 +2018,7 @@ char *argv[];
|
||||
if (arg == argv[0]) argv++, argc--;
|
||||
break;
|
||||
} else
|
||||
goto usage;
|
||||
usage();
|
||||
case 'M': /* Use multicast for reponse */
|
||||
multicast = TRUE;
|
||||
break;
|
||||
@ -2087,7 +2081,7 @@ char *argv[];
|
||||
if (arg == argv[0]) argv++, argc--;
|
||||
break;
|
||||
} else
|
||||
goto usage;
|
||||
usage();
|
||||
case 'm': /* Max number of hops to trace */
|
||||
if (arg && isdigit(*arg)) {
|
||||
qno = atoi(arg);
|
||||
@ -2096,7 +2090,7 @@ char *argv[];
|
||||
if (arg == argv[0]) argv++, argc--;
|
||||
break;
|
||||
} else
|
||||
goto usage;
|
||||
usage();
|
||||
case 'q': /* Number of query retries */
|
||||
if (arg && isdigit(*arg)) {
|
||||
nqueries = atoi(arg);
|
||||
@ -2104,13 +2098,13 @@ char *argv[];
|
||||
if (arg == argv[0]) argv++, argc--;
|
||||
break;
|
||||
} else
|
||||
goto usage;
|
||||
usage();
|
||||
case 'g': /* Last-hop gateway (dest of query) */
|
||||
if (arg && (gwy = host_addr(arg))) {
|
||||
if (arg == argv[0]) argv++, argc--;
|
||||
break;
|
||||
} else
|
||||
goto usage;
|
||||
usage();
|
||||
case 't': /* TTL for query packet */
|
||||
if (arg && isdigit(*arg)) {
|
||||
qttl = atoi(arg);
|
||||
@ -2119,7 +2113,7 @@ char *argv[];
|
||||
if (arg == argv[0]) argv++, argc--;
|
||||
break;
|
||||
} else
|
||||
goto usage;
|
||||
usage();
|
||||
case 'e': /* Extra hops past non-responder */
|
||||
if (arg && isdigit(*arg)) {
|
||||
extrahops = atoi(arg);
|
||||
@ -2127,19 +2121,19 @@ char *argv[];
|
||||
if (arg == argv[0]) argv++, argc--;
|
||||
break;
|
||||
} else
|
||||
goto usage;
|
||||
usage();
|
||||
case 'r': /* Dest for response packet */
|
||||
if (arg && (raddr = host_addr(arg))) {
|
||||
if (arg == argv[0]) argv++, argc--;
|
||||
break;
|
||||
} else
|
||||
goto usage;
|
||||
usage();
|
||||
case 'i': /* Local interface address */
|
||||
if (arg && (lcl_addr = host_addr(arg))) {
|
||||
if (arg == argv[0]) argv++, argc--;
|
||||
break;
|
||||
} else
|
||||
goto usage;
|
||||
usage();
|
||||
case 'S': /* Stat accumulation interval */
|
||||
if (arg && isdigit(*arg)) {
|
||||
statint = atoi(arg);
|
||||
@ -2147,9 +2141,9 @@ char *argv[];
|
||||
if (arg == argv[0]) argv++, argc--;
|
||||
break;
|
||||
} else
|
||||
goto usage;
|
||||
usage();
|
||||
default:
|
||||
goto usage;
|
||||
usage();
|
||||
}
|
||||
} while (*p);
|
||||
}
|
||||
@ -2162,7 +2156,7 @@ char *argv[];
|
||||
qgrp = qsrc;
|
||||
qsrc = 0;
|
||||
} else {
|
||||
goto usage;
|
||||
usage();
|
||||
}
|
||||
}
|
||||
argv++, argc--;
|
||||
@ -2175,8 +2169,8 @@ char *argv[];
|
||||
u_int32 temp = qdst;
|
||||
qdst = qgrp;
|
||||
qgrp = temp;
|
||||
if (IN_MULTICAST(ntohl(qdst))) goto usage;
|
||||
} else if (qgrp && !IN_MULTICAST(ntohl(qgrp))) goto usage;
|
||||
if (IN_MULTICAST(ntohl(qdst))) usage();
|
||||
} else if (qgrp && !IN_MULTICAST(ntohl(qgrp))) usage();
|
||||
}
|
||||
}
|
||||
|
||||
@ -2186,10 +2180,7 @@ char *argv[];
|
||||
}
|
||||
|
||||
if (argc > 0) {
|
||||
usage: printf("\
|
||||
Usage: mtrace [-Mlnps] [-w wait] [-m max_hops] [-q nqueries] [-g gateway]\n\
|
||||
[-S statint] [-t ttl] [-r resp_dest] [-i if_addr] source [receiver] [group]\n");
|
||||
exit(1);
|
||||
usage();
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2204,12 +2195,14 @@ Usage: mtrace [-Mlnps] [-w wait] [-m max_hops] [-q nqueries] [-g gateway]\n\
|
||||
qgrp = defgrp;
|
||||
if (printstats && numstats != 0 && !tunstats) {
|
||||
/* Stats are useless without a group */
|
||||
fprintf(stderr, "mtrace: WARNING: no multicast group specified, so no statistics printed\n");
|
||||
warnx(
|
||||
"WARNING: no multicast group specified, so no statistics printed");
|
||||
numstats = 0;
|
||||
}
|
||||
} else {
|
||||
if (weak)
|
||||
fprintf(stderr, "mtrace: WARNING: group was specified so not performing \"weak\" mtrace\n");
|
||||
warnx(
|
||||
"WARNING: group was specified so not performing \"weak\" mtrace");
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2224,10 +2217,8 @@ Usage: mtrace [-Mlnps] [-w wait] [-m max_hops] [-q nqueries] [-g gateway]\n\
|
||||
|
||||
if (((udp = socket(AF_INET, SOCK_DGRAM, 0)) < 0) ||
|
||||
(connect(udp, (struct sockaddr *) &addr, sizeof(addr)) < 0) ||
|
||||
getsockname(udp, (struct sockaddr *) &addr, &addrlen) < 0) {
|
||||
perror("Determining local address");
|
||||
exit(-1);
|
||||
}
|
||||
getsockname(udp, (struct sockaddr *) &addr, &addrlen) < 0)
|
||||
err(-1, "determining local address");
|
||||
|
||||
#ifdef SUNOS5
|
||||
/*
|
||||
@ -2244,14 +2235,14 @@ Usage: mtrace [-Mlnps] [-w wait] [-m max_hops] [-q nqueries] [-g gateway]\n\
|
||||
|
||||
error = sysinfo(SI_HOSTNAME, myhostname, sizeof(myhostname));
|
||||
if (error == -1) {
|
||||
perror("Getting my hostname");
|
||||
warn("getting my hostname");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
hp = gethostbyname(myhostname);
|
||||
if (hp == NULL || hp->h_addrtype != AF_INET ||
|
||||
hp->h_length != sizeof(addr.sin_addr)) {
|
||||
perror("Finding IP address for my hostname");
|
||||
warn("finding IP address for my hostname");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
@ -2274,7 +2265,7 @@ Usage: mtrace [-Mlnps] [-w wait] [-m max_hops] [-q nqueries] [-g gateway]\n\
|
||||
if (qsrc == 0 && gwy)
|
||||
qsrc = lcl_addr ? lcl_addr : addr.sin_addr.s_addr;
|
||||
if (qsrc == 0)
|
||||
goto usage;
|
||||
usage();
|
||||
dst_netmask = get_netmask(udp, qdst);
|
||||
close(udp);
|
||||
if (lcl_addr == 0) lcl_addr = addr.sin_addr.s_addr;
|
||||
@ -2342,10 +2333,8 @@ Usage: mtrace [-Mlnps] [-w wait] [-m max_hops] [-q nqueries] [-g gateway]\n\
|
||||
if ((qdst & dst_netmask) == (lcl_addr & dst_netmask)) tdst = query_cast;
|
||||
else tdst = qgrp;
|
||||
else tdst = gwy;
|
||||
if (tdst == 0 && weak) {
|
||||
fprintf(stderr, "mtrace: -W requires -g if destination is not local.\n");
|
||||
exit(1);
|
||||
}
|
||||
if (tdst == 0 && weak)
|
||||
errx(1, "-W requires -g if destination is not local");
|
||||
|
||||
if (IN_MULTICAST(ntohl(tdst))) {
|
||||
k_set_loop(1); /* If I am running on a router, I need to hear this */
|
||||
@ -2620,6 +2609,16 @@ printandcontinue:
|
||||
return (0);
|
||||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "%s\n%s\n%s\n",
|
||||
"usage: mtrace [-Mlnps] [-w wait] [-m max_hops] [-q nqueries]",
|
||||
" [-g gateway] [-S statint] [-t ttl] [-r resp_dest]",
|
||||
" [-i if_addr] source [receiver] [group]");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
void
|
||||
check_vif_state()
|
||||
{
|
||||
|
@ -7,7 +7,7 @@
|
||||
* Leland Stanford Junior University.
|
||||
*
|
||||
*
|
||||
* $Id$
|
||||
* $Id: prune.c,v 1.13 1997/02/22 16:07:03 peter Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -810,7 +810,7 @@ reset_neighbor_state(vifi, addr)
|
||||
|
||||
g->gt_prsent_timer = 0;
|
||||
g->gt_grftsnt = 0;
|
||||
while (st = g->gt_srctbl) {
|
||||
while ((st = g->gt_srctbl)) {
|
||||
g->gt_srctbl = st->st_next;
|
||||
k_del_rg(st->st_origin, g);
|
||||
kroutes--;
|
||||
|
Loading…
Reference in New Issue
Block a user