mirror of
https://git.hardenedbsd.org/hardenedbsd/HardenedBSD.git
synced 2024-11-16 15:44:04 +01:00
Spelling, add rcsid, remove unused #includes.
Convert 1000000 usec to 1 sec 0 usec. Use provided safe malloc (rtmalloc()) instead of malloc(): exit on allocation failure. Correct use of .Nm Add usage() and use errx().
This commit is contained in:
parent
1cc580ef41
commit
90100551e6
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=37908
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)defs.h 8.1 (Berkeley) 6/5/93
|
||||
* $Id$
|
||||
* $Id: defs.h,v 1.9 1997/02/22 14:33:11 peter Exp $
|
||||
*/
|
||||
|
||||
/* Definitions for RIPv2 routing process.
|
||||
@ -50,7 +50,7 @@
|
||||
* tell the kernel hop counts
|
||||
* do not advertise if ipforwarding=0
|
||||
*
|
||||
* The vestigual support for other protocols has been removed. There
|
||||
* The vestigial support for other protocols has been removed. There
|
||||
* is no likelihood that IETF RIPv1 or RIPv2 will ever be used with
|
||||
* other protocols. The result is far smaller, faster, cleaner, and
|
||||
* perhaps understandable.
|
||||
@ -358,7 +358,7 @@ struct ag_info {
|
||||
u_int ag_seqno;
|
||||
u_short ag_tag;
|
||||
u_short ag_state;
|
||||
#define AGS_SUPPRESS 0x001 /* combine with coaser mask */
|
||||
#define AGS_SUPPRESS 0x001 /* combine with coarser mask */
|
||||
#define AGS_PROMOTE 0x002 /* synthesize combined routes */
|
||||
#define AGS_REDUN0 0x004 /* redundant, finer routes output */
|
||||
#define AGS_REDUN1 0x008
|
||||
@ -370,7 +370,7 @@ struct ag_info {
|
||||
#define AGS_FINE_GATE 0x080 /* ignore differing ag_gate when this
|
||||
* has the finer netmask */
|
||||
#define AGS_CORS_GATE 0x100 /* ignore differing gate when this
|
||||
* has the coarser netmaks */
|
||||
* has the coarser netmasks */
|
||||
#define AGS_SPLIT_HZ 0x200 /* suppress for split horizon */
|
||||
|
||||
/* some bits are set if they are set on either route */
|
||||
@ -437,7 +437,7 @@ extern int lookforinterfaces; /* 1=probe for new up interfaces */
|
||||
extern int supplier_set; /* -s or -q requested */
|
||||
extern int ridhosts; /* 1=reduce host routes */
|
||||
extern int mhome; /* 1=want multi-homed host route */
|
||||
extern int advertise_mhome; /* 1=must continue adverising it */
|
||||
extern int advertise_mhome; /* 1=must continue advertising it */
|
||||
extern int auth_ok; /* 1=ignore auth if we do not care */
|
||||
|
||||
extern struct timeval clk; /* system clock's idea of time */
|
||||
|
@ -31,12 +31,13 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(sgi) && !defined(__NetBSD__)
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)if.c 8.1 (Berkeley) 6/5/93";
|
||||
#elif defined(__NetBSD__)
|
||||
static char rcsid[] = "$NetBSD$";
|
||||
#endif
|
||||
#ident "$Revision: 1.1.1.5 $"
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "defs.h"
|
||||
#include "pathnames.h"
|
||||
@ -695,7 +696,7 @@ ifinit(void)
|
||||
? CHECK_ACT_INTERVAL
|
||||
: CHECK_QUIET_INTERVAL);
|
||||
|
||||
/* mark all interfaces so we can get rid of thost that disappear */
|
||||
/* mark all interfaces so we can get rid of those that disappear */
|
||||
for (ifp = ifnet; 0 != ifp; ifp = ifp->int_next)
|
||||
ifp->int_state &= ~(IS_CHECKED | IS_DUP);
|
||||
|
||||
@ -994,7 +995,7 @@ ifinit(void)
|
||||
}
|
||||
ifp->int_data = ifs.int_data;
|
||||
|
||||
/* Withhold judgement when the short error
|
||||
/* Withhold judgment when the short error
|
||||
* counters wrap or the interface is reset.
|
||||
*/
|
||||
if (ierr < 0 || in < 0 || oerr < 0 || out < 0) {
|
||||
|
@ -31,12 +31,13 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(sgi) && !defined(__NetBSD__)
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 6/5/93";
|
||||
#elif defined(__NetBSD__)
|
||||
static char rcsid[] = "$NetBSD$";
|
||||
#endif
|
||||
#ident "$Revision: 1.1.1.5 $"
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
@ -181,7 +182,7 @@ input(struct sockaddr_in *from, /* received from this IP address */
|
||||
*
|
||||
* RIPv2 authentication is lame. Why authenticate queries?
|
||||
* Why should a RIPv2 implementation with authentication disabled
|
||||
* not be able to listen to RIPv2 packets with authenication, while
|
||||
* not be able to listen to RIPv2 packets with authentication, while
|
||||
* RIPv1 systems will listen? Crazy!
|
||||
*/
|
||||
if (!auth_ok
|
||||
@ -231,7 +232,7 @@ input(struct sockaddr_in *from, /* received from this IP address */
|
||||
}
|
||||
}
|
||||
|
||||
/* According to RFC 1723, we should ignore unathenticated
|
||||
/* According to RFC 1723, we should ignore unauthenticated
|
||||
* queries. That is too silly to bother with. Sheesh!
|
||||
* Are forwarding tables supposed to be secret, when
|
||||
* a bad guy can infer them with test traffic? When RIP
|
||||
|
@ -31,23 +31,25 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
char copyright[] =
|
||||
"@(#) Copyright (c) 1983, 1988, 1993\n\
|
||||
The Regents of the University of California. All rights reserved.\n";
|
||||
#if !defined(lint) && !defined(sgi) && !defined(__NetBSD__)
|
||||
#endif /* not lint */
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/5/93";
|
||||
#elif defined(__NetBSD__)
|
||||
static char rcsid[] = "$NetBSD$";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "defs.h"
|
||||
#include "pathnames.h"
|
||||
#ifdef sgi
|
||||
#include "math.h"
|
||||
#endif
|
||||
#include <signal.h>
|
||||
#include <fcntl.h>
|
||||
#include <sys/file.h>
|
||||
|
||||
pid_t mypid;
|
||||
|
||||
@ -62,7 +64,7 @@ int default_gateway; /* 1=advertise default */
|
||||
int background = 1;
|
||||
int ridhosts; /* 1=reduce host routes */
|
||||
int mhome; /* 1=want multi-homed host route */
|
||||
int advertise_mhome; /* 1=must continue adverising it */
|
||||
int advertise_mhome; /* 1=must continue advertising it */
|
||||
int auth_ok = 1; /* 1=ignore auth if we do not care */
|
||||
|
||||
struct timeval epoch; /* when started */
|
||||
@ -197,7 +199,7 @@ main(int argc,
|
||||
break;
|
||||
|
||||
case 'P':
|
||||
/* handle arbirary, (usually) per-interface
|
||||
/* handle arbitrary, (usually) per-interface
|
||||
* parameters.
|
||||
*/
|
||||
p = parse_parms(optarg, 0);
|
||||
@ -749,7 +751,7 @@ rtmalloc(size_t size,
|
||||
char *msg)
|
||||
{
|
||||
void *p = malloc(size);
|
||||
if (p == 0)
|
||||
if (p == NULL)
|
||||
logbad(1,"malloc() failed in %s", msg);
|
||||
return p;
|
||||
}
|
||||
@ -775,7 +777,7 @@ timevaladd(struct timeval *t1,
|
||||
{
|
||||
|
||||
t1->tv_sec += t2->tv_sec;
|
||||
if ((t1->tv_usec += t2->tv_usec) > 1000000) {
|
||||
if ((t1->tv_usec += t2->tv_usec) >= 1000000) {
|
||||
t1->tv_sec++;
|
||||
t1->tv_usec -= 1000000;
|
||||
}
|
||||
|
@ -31,12 +31,13 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(sgi) && !defined(__NetBSD__)
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)output.c 8.1 (Berkeley) 6/5/93";
|
||||
#elif defined(__NetBSD__)
|
||||
static char rcsid[] = "$NetBSD$";
|
||||
#endif
|
||||
#ident "$Revision: 1.21 $"
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
@ -152,7 +153,7 @@ output(enum output_type type,
|
||||
msg = "Send mcast";
|
||||
if (rip_sock_mcast != ifp) {
|
||||
#ifdef MCAST_PPP_BUG
|
||||
/* Do not specifiy the primary interface
|
||||
/* Do not specify the primary interface
|
||||
* explicitly if we have the multicast
|
||||
* point-to-point kernel bug, since the
|
||||
* kernel will do the wrong thing if the
|
||||
@ -212,7 +213,7 @@ output(enum output_type type,
|
||||
|
||||
|
||||
/* Find the first key for a packet to send.
|
||||
* Try for a key that is eligable and has not expired, but settle for
|
||||
* Try for a key that is eligible and has not expired, but settle for
|
||||
* the last key if they have all expired.
|
||||
* If no key is ready yet, give up.
|
||||
*/
|
||||
@ -313,7 +314,7 @@ static void
|
||||
supply_write(struct ws_buf *wb)
|
||||
{
|
||||
/* Output multicast only if legal.
|
||||
* If we would multcast and it would be illegal, then discard the
|
||||
* If we would multicast and it would be illegal, then discard the
|
||||
* packet.
|
||||
*/
|
||||
switch (wb->type) {
|
||||
@ -492,7 +493,7 @@ walk_supply(struct radix_node *rn,
|
||||
|
||||
} else {
|
||||
/* Do not send automatic synthetic network routes
|
||||
* if they are not needed becaus no RIPv1 listeners
|
||||
* if they are not needed because no RIPv1 listeners
|
||||
* can hear them.
|
||||
*/
|
||||
if (ws.state & WS_ST_RIP2_ALL)
|
||||
|
@ -31,18 +31,18 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(sgi) && !defined(__NetBSD__)
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)if.c 8.1 (Berkeley) 6/5/93";
|
||||
#elif defined(__NetBSD__)
|
||||
static char rcsid[] = "$NetBSD$";
|
||||
#endif
|
||||
#ident "$Revision: 1.2 $"
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "defs.h"
|
||||
#include "pathnames.h"
|
||||
#include <sys/stat.h>
|
||||
|
||||
|
||||
struct parm *parms;
|
||||
struct intnet *intnets;
|
||||
struct tgate *tgates;
|
||||
@ -311,7 +311,7 @@ gwkludge(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
ifp = (struct interface *)malloc(sizeof(*ifp));
|
||||
ifp = (struct interface *)rtmalloc(sizeof(*ifp), "gwkludge");
|
||||
bzero(ifp, sizeof(*ifp));
|
||||
|
||||
ifp->int_state = state;
|
||||
@ -558,7 +558,8 @@ parse_parms(char *line,
|
||||
/* "subnet=x.y.z.u/mask,metric" must be alone on the line */
|
||||
if (!strncasecmp(line, "subnet=", sizeof("subnet=")-1)
|
||||
&& *(val = &line[sizeof("subnet=")-1]) != '\0') {
|
||||
intnetp = (struct intnet*)malloc(sizeof(*intnetp));
|
||||
intnetp = (struct intnet*)
|
||||
rtmalloc(sizeof(*intnetp), "parse_parms");
|
||||
intnetp->intnet_metric = 1;
|
||||
if ((p = strrchr(val,','))) {
|
||||
*p++ = '\0';
|
||||
@ -715,7 +716,8 @@ parse_parms(char *line,
|
||||
} else if (PARSEQ("trust_gateway")) {
|
||||
if (!gethost(buf,&addr))
|
||||
return tgt;
|
||||
tg = (struct tgate *)malloc(sizeof(*tg));
|
||||
tg = (struct tgate *)
|
||||
rtmalloc(sizeof(*tg), "parse_parms");
|
||||
tg->tgate_next = tgates;
|
||||
tg->tgate_addr = addr;
|
||||
tgates = tg;
|
||||
@ -802,7 +804,7 @@ check_parms(struct parm *new)
|
||||
/* link new entry on the so that when the entries are scanned,
|
||||
* they affect the result in the order the operator specified.
|
||||
*/
|
||||
parmp = (struct parm*)malloc(sizeof(*parmp));
|
||||
parmp = (struct parm*)rtmalloc(sizeof(*parmp), "check_parms");
|
||||
bcopy(new, parmp, sizeof(*parmp));
|
||||
*parmpp = parmp;
|
||||
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)pathnames.h 8.1 (Berkeley) 6/5/93
|
||||
*
|
||||
* $Id$
|
||||
* $NetBSD$
|
||||
*/
|
||||
|
||||
|
@ -30,18 +30,19 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)radix.c 8.4 (Berkeley) 11/2/94
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)radix.c 8.4 (Berkeley) 11/2/94";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
/*
|
||||
* Routines to build and maintain radix trees for routing lookups.
|
||||
*/
|
||||
#if !defined(lint) && !defined(sgi) && !defined(__NetBSD__)
|
||||
static char sccsid[] = "@(#)rdisc.c 8.1 (Berkeley) x/y/95";
|
||||
#elif defined(__NetBSD__)
|
||||
static char rcsid[] = "$NetBSD$";
|
||||
#endif
|
||||
#ident "$Revision: 1.10 $"
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
@ -442,7 +443,8 @@ rn_addmask(void *n_arg, int search, int skip)
|
||||
x = 0;
|
||||
if (x || search)
|
||||
return (x);
|
||||
R_Malloc(x, struct radix_node *, max_keylen + 2 * sizeof (*x));
|
||||
x = (struct radix_node *)
|
||||
rtmalloc(max_keylen + 2 * sizeof (*x), "rn_addmask");
|
||||
if ((saved_x = x) == 0)
|
||||
return (0);
|
||||
Bzero(x, max_keylen + 2 * sizeof (*x));
|
||||
@ -850,7 +852,7 @@ rn_inithead(void **head, int off)
|
||||
register struct radix_node *t, *tt, *ttt;
|
||||
if (*head)
|
||||
return (1);
|
||||
R_Malloc(rnh, struct radix_node_head *, sizeof (*rnh));
|
||||
rnh = (struct radix_node_head *)rtmalloc(sizeof (*rnh), "rn_inithead");
|
||||
if (rnh == 0)
|
||||
return (0);
|
||||
Bzero(rnh, sizeof (*rnh));
|
||||
@ -881,7 +883,7 @@ rn_init(void)
|
||||
printf("rn_init: radix functions require max_keylen be set\n");
|
||||
return;
|
||||
}
|
||||
R_Malloc(rn_zeros, char *, 3 * max_keylen);
|
||||
rn_zeros = (char *)rtmalloc(3 * max_keylen, "rn_init");
|
||||
if (rn_zeros == NULL)
|
||||
panic("rn_init");
|
||||
Bzero(rn_zeros, 3 * max_keylen);
|
||||
|
@ -31,6 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)radix.h 8.2 (Berkeley) 10/31/94
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
#ifndef __RADIX_H_
|
||||
@ -102,7 +103,7 @@ extern struct radix_mask {
|
||||
m = rn_mkfreelist; \
|
||||
rn_mkfreelist = (m)->rm_mklist; \
|
||||
} else \
|
||||
R_Malloc(m, struct radix_mask *, sizeof (*(m))); }\
|
||||
m = (struct radix_mask *)rtmalloc(sizeof (*(m)), "MKGet"); }\
|
||||
|
||||
#define MKFree(m) { (m)->rm_mklist = rn_mkfreelist; rn_mkfreelist = (m);}
|
||||
|
||||
@ -137,7 +138,6 @@ struct radix_node_head {
|
||||
#define Bcmp(a, b, n) bcmp(((char *)(a)), ((char *)(b)), (n))
|
||||
#define Bcopy(a, b, n) bcopy(((char *)(a)), ((char *)(b)), (unsigned)(n))
|
||||
#define Bzero(p, n) bzero((char *)(p), (int)(n));
|
||||
#define R_Malloc(p, t, n) (p = (t) malloc((unsigned int)(n)))
|
||||
#define Free(p) free((char *)p);
|
||||
|
||||
void rn_init __P((void));
|
||||
|
@ -31,12 +31,13 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(sgi) && !defined(__NetBSD__)
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)rdisc.c 8.1 (Berkeley) x/y/95";
|
||||
#elif defined(__NetBSD__)
|
||||
static char rcsid[] = "$NetBSD$";
|
||||
#endif
|
||||
#ident "$Revision: 1.20 $"
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "defs.h"
|
||||
#include <netinet/in_systm.h>
|
||||
@ -252,7 +253,7 @@ set_supplier(void)
|
||||
if (supplier_set)
|
||||
return;
|
||||
|
||||
trace_act("start suppying routes");
|
||||
trace_act("start supplying routes");
|
||||
|
||||
/* Forget discovered routes.
|
||||
*/
|
||||
@ -294,7 +295,7 @@ rdisc_age(naddr bad_gate)
|
||||
struct dr *drp;
|
||||
|
||||
|
||||
/* If only adverising, then do only that. */
|
||||
/* If only advertising, then do only that. */
|
||||
if (supplier) {
|
||||
/* if switching from client to server, get rid of old
|
||||
* default routes.
|
||||
@ -307,7 +308,7 @@ rdisc_age(naddr bad_gate)
|
||||
|
||||
/* If we are being told about a bad router,
|
||||
* then age the discovered default route, and if there is
|
||||
* no alternative, solicite a replacement.
|
||||
* no alternative, solicit a replacement.
|
||||
*/
|
||||
if (bad_gate != 0) {
|
||||
/* Look for the bad discovered default route.
|
||||
@ -610,7 +611,7 @@ parse_ad(naddr from,
|
||||
new_drp = drp;
|
||||
|
||||
} else if (new_drp->dr_ts != 0) {
|
||||
/* look for the least valueable entry to reuse
|
||||
/* look for the least valuable entry to reuse
|
||||
*/
|
||||
if ((!(new_drp->dr_ifp->int_state & IS_SICK)
|
||||
&& (drp->dr_ifp->int_state & IS_SICK))
|
||||
@ -670,7 +671,7 @@ static void
|
||||
send_rdisc(union ad_u *p,
|
||||
int p_size,
|
||||
struct interface *ifp,
|
||||
naddr dst, /* 0 or unicast destination */
|
||||
naddr dst, /* 0 or UNICAST destination */
|
||||
int type) /* 0=unicast, 1=bcast, 2=mcast */
|
||||
{
|
||||
struct sockaddr_in sin;
|
||||
@ -688,7 +689,7 @@ send_rdisc(union ad_u *p,
|
||||
flags = MSG_DONTROUTE;
|
||||
|
||||
switch (type) {
|
||||
case 0: /* unicast */
|
||||
case 0: /* UNICAST */
|
||||
default:
|
||||
msg = "Send";
|
||||
break;
|
||||
@ -714,7 +715,7 @@ send_rdisc(union ad_u *p,
|
||||
if (rdisc_sock_mcast != ifp) {
|
||||
/* select the right interface. */
|
||||
#ifdef MCAST_PPP_BUG
|
||||
/* Do not specifiy the primary interface explicitly
|
||||
/* Do not specify the primary interface explicitly
|
||||
* if we have the multicast point-to-point kernel
|
||||
* bug, since the kernel will do the wrong thing
|
||||
* if the local address of a point-to-point link
|
||||
@ -764,7 +765,7 @@ send_rdisc(union ad_u *p,
|
||||
*/
|
||||
static void
|
||||
send_adv(struct interface *ifp,
|
||||
naddr dst, /* 0 or unicast destination */
|
||||
naddr dst, /* 0 or UNICAST destination */
|
||||
int type) /* 0=unicast, 1=bcast, 2=mcast */
|
||||
{
|
||||
union ad_u u;
|
||||
|
@ -30,7 +30,7 @@
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" @(#)routed.8 8.2 (Berkeley) 12/11/93
|
||||
.\" $Id: routed.8,v 1.9 1997/03/12 13:22:17 mpp Exp $
|
||||
.\" $Id: routed.8,v 1.10 1998/06/17 13:13:41 jkoshy Exp $
|
||||
.\"
|
||||
.Dd June 1, 1996
|
||||
.Dt ROUTED 8
|
||||
@ -39,7 +39,7 @@
|
||||
.Nm routed
|
||||
.Nd network RIP and router discovery routing daemon
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Nm routed
|
||||
.Op Fl sqdghmAt
|
||||
.Op Fl T Ar tracefile
|
||||
.Oo
|
||||
@ -49,7 +49,7 @@
|
||||
.Op Fl P Ar parms
|
||||
.Sh DESCRIPTION
|
||||
.Nm Routed
|
||||
is a dameon invoked at boot time to manage the network
|
||||
is a daemon invoked at boot time to manage the network
|
||||
routing tables.
|
||||
It uses Routing Information Protocol, RIPv1 (RFC\ 1058),
|
||||
RIPv2 (RFC\ 1723),
|
||||
@ -152,7 +152,7 @@ If an entry has not been updated for 3 minutes, the entry's metric
|
||||
is set to infinity and marked for deletion.
|
||||
Deletions are delayed until the route has been advertised with
|
||||
an infinite metric to insure the invalidation
|
||||
is propagated throughout the local internet.
|
||||
is propagated throughout the local Internet.
|
||||
This is a form of
|
||||
.Em poison reverse .
|
||||
.Pp
|
||||
@ -161,7 +161,7 @@ of ICMP Redirect messages are deleted after a while to minimize
|
||||
.Em black-holes .
|
||||
When a TCP connection suffers a timeout,
|
||||
the kernel tells
|
||||
.Nm routed ,
|
||||
.Nm Ns ,
|
||||
which deletes all redirected routes
|
||||
through the gateway involved, advances the age of all RIP routes through
|
||||
the gateway to allow an alternate to be chosen, and advances of the
|
||||
@ -232,21 +232,20 @@ By default, neither Router Discovery advertisements nor solicitations
|
||||
are sent over point to point links (e.g. PPP).
|
||||
The netmask associated with point-to-point links (such as SLIP
|
||||
or PPP, with the IFF_POINTOPOINT flag) is used by
|
||||
.Nm routed
|
||||
.Nm
|
||||
to infer the netmask used by the remote system when RIPv1 is used.
|
||||
.Pp
|
||||
Options supported by
|
||||
.Nm routed :
|
||||
.Bl -tag -width Ds
|
||||
The following options are available:
|
||||
.Bl -tag -width indent
|
||||
.It Fl s
|
||||
this option forces
|
||||
Force
|
||||
.Nm
|
||||
to supply routing information.
|
||||
This is the default if multiple network interfaces are present on which
|
||||
RIP or Router Discovery have not been disabled, and if the kernel switch
|
||||
ipforwarding=1.
|
||||
.It Fl q
|
||||
is the opposite of the
|
||||
Is the opposite of the
|
||||
.Fl s
|
||||
option.
|
||||
This is the default when only one interface is present.
|
||||
@ -254,7 +253,7 @@ This is the default when only one interface is present.
|
||||
Do not run in the background.
|
||||
This option is meant for interactive use.
|
||||
.It Fl g
|
||||
This flag is used on internetwork routers to offer a route
|
||||
Used on internetwork routers to offer a route
|
||||
to the "default" destination.
|
||||
It is equivalent to
|
||||
.Fl F
|
||||
@ -267,7 +266,7 @@ on the command line or
|
||||
in the
|
||||
.Pa /etc/gateways
|
||||
file.
|
||||
since a larger metric
|
||||
Since a larger metric
|
||||
will be used, reducing the spread of the potentially dangerous
|
||||
default route.
|
||||
This is typically used on a gateway to the Internet,
|
||||
@ -277,13 +276,13 @@ Notice that because a metric of 1 is used, this feature is
|
||||
dangerous. It is more commonly accidentally used to create chaos with routing
|
||||
loop than to solve problems.
|
||||
.It Fl h
|
||||
This causes host or point-to-point routes to not be advertised,
|
||||
Cause host or point-to-point routes to not be advertised,
|
||||
provided there is a network route going the same direction.
|
||||
That is a limited kind of aggregation.
|
||||
This option is useful on gateways to ethernets that have other gateway
|
||||
This option is useful on gateways to Ethernets that have other gateway
|
||||
machines connected with point-to-point links such as SLIP.
|
||||
.It Fl m
|
||||
This causes the machine to advertise a host or point-to-point route to
|
||||
Cause the machine to advertise a host or point-to-point route to
|
||||
its primary interface.
|
||||
It is useful on multi-homed machines such as NFS servers.
|
||||
This option should not be used except when the cost of
|
||||
@ -297,20 +296,20 @@ option overrides the
|
||||
.Fl q
|
||||
option to the limited extent of advertising the host route.
|
||||
.It Fl A
|
||||
do not ignore RIPv2 authentication if we do not care about RIPv2
|
||||
Do not ignore RIPv2 authentication if we do not care about RIPv2
|
||||
authentication.
|
||||
This option is required for conformance with RFC 1723.
|
||||
However, it makes no sense and breaks using RIP as a discovery protocol
|
||||
to ignore all RIPv2 packets that carry authentication when this machine
|
||||
does not care about authentication.
|
||||
.It Fl T Ar tracefile
|
||||
increases the debugging level to at least 1 and
|
||||
Increase the debugging level to at least 1 and
|
||||
causes debugging information to be appended to the trace file.
|
||||
Note that because of security concerns, it is wisest to not run
|
||||
.Nm routed
|
||||
.Nm
|
||||
routinely with tracing directed to a file.
|
||||
.It Fl t
|
||||
increases the debugging level, which causes more information to be logged
|
||||
Increase the debugging level, which causes more information to be logged
|
||||
on the tracefile specified with
|
||||
.Fl T
|
||||
or standard out.
|
||||
@ -323,7 +322,7 @@ signals or with the
|
||||
.Xr rtquery 8
|
||||
command.
|
||||
.It Fl F Ar net[/mask][,metric]
|
||||
minimize routes in transmissions via interfaces with addresses that match
|
||||
Minimize routes in transmissions via interfaces with addresses that match
|
||||
.Em net/mask ,
|
||||
and synthesizes a default route to this machine with the
|
||||
.Em metric .
|
||||
@ -342,7 +341,7 @@ number and mask.
|
||||
See also
|
||||
.Fl g .
|
||||
.It Fl P Ar parms
|
||||
is equivalent to adding the parameter
|
||||
Is equivalent to adding the parameter
|
||||
line
|
||||
.Em parms
|
||||
to the
|
||||
@ -359,7 +358,7 @@ It is better to use
|
||||
instead of
|
||||
appending the name of the trace file to the command.
|
||||
.Pp
|
||||
.Nm
|
||||
.Nm Routed
|
||||
also supports the notion of
|
||||
"distant"
|
||||
.Em passive
|
||||
@ -412,7 +411,7 @@ that another routing process
|
||||
will install such a route if necessary,
|
||||
and that alternate routes to that destination should not be installed
|
||||
by
|
||||
.Nm routed .
|
||||
.Nm Ns .
|
||||
Such entries are only required when both routers may learn of routes
|
||||
to the same destination.
|
||||
.Pp
|
||||
@ -458,9 +457,9 @@ or
|
||||
or
|
||||
.Xr named 8 ,
|
||||
must have been started before
|
||||
.Nm routed Ns .)
|
||||
.Nm Ns .)
|
||||
.Pp
|
||||
.Ar mask
|
||||
.Ar Mask
|
||||
is an optional number between 1 and 32 indicating the netmask associated
|
||||
with
|
||||
.Ar Nname .
|
||||
@ -471,7 +470,7 @@ be forwarded.
|
||||
.Pp
|
||||
.Ar Value
|
||||
is the hop count to the destination host or network.
|
||||
.Ar " host hname "
|
||||
.Ar " Host hname "
|
||||
is equivalent to
|
||||
.Ar " net nname/32 ".
|
||||
.Pp
|
||||
@ -535,7 +534,7 @@ no password is output.
|
||||
Incoming packets can carry any password that is valid, will
|
||||
be valid within 24 hours, or that was valid within 24 hours.
|
||||
.It Cm md5_passwd Ns \&= Ns Ar XXX1|KeyID[start|stop]
|
||||
specifes a RIPv2 MD5 password.
|
||||
specifies a RIPv2 MD5 password.
|
||||
Except that a
|
||||
.Cm KeyID
|
||||
is required, this keyword is similar to
|
||||
@ -562,7 +561,7 @@ discovery advertisements with
|
||||
or
|
||||
.Fl s
|
||||
causes
|
||||
.Nm routed
|
||||
.Nm
|
||||
to act as a client router discovery daemon, not advertising.
|
||||
.It Cm no_ripv1_in
|
||||
causes RIPv1 received responses to be ignored.
|
||||
@ -585,11 +584,11 @@ specifies that Router Discovery solicitations should be sent,
|
||||
even on point-to-point links,
|
||||
which by default only listen to Router Discovery messages.
|
||||
.It Cm no_rdisc_adv
|
||||
disables the transmission of Router Discovery Advertisements
|
||||
disables the transmission of Router Discovery Advertisements.
|
||||
.It Cm rdisc_adv
|
||||
specifies that Router Discovery Advertisements should be sent,
|
||||
even on point-to-point links,
|
||||
which by default only listen to Router Discovery messages
|
||||
which by default only listen to Router Discovery messages.
|
||||
.It Cm bcast_rdisc
|
||||
specifies that Router Discovery packets should be broadcast instead of
|
||||
multicast.
|
||||
@ -602,7 +601,7 @@ are transmitted to N seconds and their lifetime to 3*N.
|
||||
.It Cm fake_default Ns \&= Ns Ar metric
|
||||
has an identical effect to
|
||||
.Fl F Ar net[/mask][=metric]
|
||||
with the network and mask coming from the sepcified interface.
|
||||
with the network and mask coming from the specified interface.
|
||||
.It Cm pm_rdisc
|
||||
is similar to
|
||||
.Cm fake_default .
|
||||
@ -633,7 +632,7 @@ for distant gateways
|
||||
.Xr icmp 4 ,
|
||||
.Xr udp 4 ,
|
||||
.Xr gated 8 ,
|
||||
.Xr rtquery 8 .
|
||||
.Xr rtquery 8
|
||||
.Rs
|
||||
.%T Internet Transport Protocols
|
||||
.%R XSIS 028112
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $Id: rtquery.8,v 1.6 1997/02/22 14:33:13 peter Exp $
|
||||
.\" $Id: rtquery.8,v 1.7 1997/06/13 20:58:09 max Exp $
|
||||
.Dd June 1, 1996
|
||||
.Dt RTQUERY 8
|
||||
.Os BSD 4.4
|
||||
@ -6,16 +6,17 @@
|
||||
.Nm rtquery
|
||||
.Nd query routing daemons for their routing tables
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Nm rtquery
|
||||
.Op Fl np1
|
||||
.Op Fl w Ar timeout
|
||||
.Op Fl r Ar addr
|
||||
.Op Fl a Ar secret
|
||||
.Ar host ...
|
||||
|
||||
.Nm
|
||||
.Ar host
|
||||
.Ar
|
||||
.Nm rtquery
|
||||
.Op Fl t Ar op
|
||||
.Ar host ...
|
||||
.Ar host
|
||||
.Ar
|
||||
.Sh DESCRIPTION
|
||||
.Nm Rtquery
|
||||
is used to query a RIP network routing daemon,
|
||||
@ -30,20 +31,22 @@ command. The routing information in any routing
|
||||
.Em response
|
||||
packets returned is displayed numerically and symbolically.
|
||||
.Pp
|
||||
.Em Rtquery
|
||||
.Nm Rtquery
|
||||
by default uses the
|
||||
.Em request
|
||||
command.
|
||||
When the
|
||||
.Ar -p
|
||||
.Fl p
|
||||
option is specified,
|
||||
.Nm rtquery
|
||||
.Nm
|
||||
uses the
|
||||
.Em poll
|
||||
command, an
|
||||
undocumented extension to the RIP protocol supported by
|
||||
.Xr gated 8 .
|
||||
When querying gated, the
|
||||
When querying
|
||||
.Xr gated 8 ,
|
||||
the
|
||||
.Em poll
|
||||
command is preferred over the
|
||||
.Em request
|
||||
@ -68,9 +71,8 @@ and so answers completely.
|
||||
is also used to turn tracing on or off in
|
||||
.Nm routed .
|
||||
.Pp
|
||||
Options supported by
|
||||
.Nm rtquery :
|
||||
.Bl -tag -width Ds
|
||||
The following options are available:
|
||||
.Bl -tag -width indent
|
||||
.It Fl n
|
||||
Normally network and host numbers are displayed both symbolically
|
||||
and numerically.
|
||||
@ -78,44 +80,44 @@ The
|
||||
.Fl n
|
||||
option displays only the numeric network and host numbers.
|
||||
.It Fl p
|
||||
Uses the
|
||||
Use the
|
||||
.Em Poll
|
||||
command to request full routing information from
|
||||
.Xr gated 8 .
|
||||
This is an undocumented extension RIP protocol supported only by
|
||||
.Xr gated 8 .
|
||||
.It Fl 1
|
||||
query using RIP version 1 instead of RIP version 2.
|
||||
Query using RIP version 1 instead of RIP version 2.
|
||||
.It Fl w Ar timeout
|
||||
changes the delay for an answer from each host.
|
||||
Change the delay for an answer from each host.
|
||||
By default, each host is given 15 seconds to respond.
|
||||
.It Fl r Ar addr
|
||||
ask about the route to destination
|
||||
Ask about the route to destination
|
||||
.Em addr .
|
||||
.It Fl a Ar passwd=XXX
|
||||
.It Fl a Ar md5_passwd=XXX|KeyID
|
||||
cause the query to be sent with the indicated cleartext or MD5 password.
|
||||
Cause the query to be sent with the indicated cleartext or MD5 password.
|
||||
.It Fl t Ar op
|
||||
change tracing, where
|
||||
Change tracing, where
|
||||
.Em op
|
||||
is one of the following.
|
||||
Requests from processes not running with UID 0 or on distant networks
|
||||
are generally ignored by the daemon except for a message in the system log.
|
||||
.Xr gated 8
|
||||
.Xr Gated 8
|
||||
is likely to ignore these debugging requests.
|
||||
.El
|
||||
.Bl -tag -width Ds -offset indent-two
|
||||
.It Em on=tracefile
|
||||
turn tracing on into the specified file. That file must usually
|
||||
Turn tracing on into the specified file. That file must usually
|
||||
have been specified when the daemon was started or be the same
|
||||
as a fixed name, often
|
||||
.Pa /etc/routed.trace .
|
||||
.It Em more
|
||||
increases the debugging level.
|
||||
Increase the debugging level.
|
||||
.It Em off
|
||||
turns off tracing.
|
||||
Turn off tracing.
|
||||
.It Em dump
|
||||
dumps the daemon's routing table to the current tracefile.
|
||||
Dump the daemon's routing table to the current tracefile.
|
||||
.El
|
||||
.Sh SEE ALSO
|
||||
.Xr gated 8 ,
|
||||
|
@ -42,7 +42,7 @@ static const char copyright[] =
|
||||
static char sccsid[] = "@(#)query.c 8.1 (Berkeley) 6/5/93";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id: rtquery.c,v 1.7 1998/01/14 07:17:12 charnier Exp $";
|
||||
"$Id: rtquery.c,v 1.8 1998/07/22 05:49:36 phk Exp $";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -106,9 +106,9 @@ static void query_loop(char *argv[], int);
|
||||
static int getnet(char *, struct netinfo *);
|
||||
static u_int std_mask(u_int);
|
||||
static int parse_quote(char **, char *, char *, char *, int);
|
||||
static void usage(void);
|
||||
|
||||
|
||||
void
|
||||
int
|
||||
main(int argc,
|
||||
char *argv[])
|
||||
{
|
||||
@ -140,21 +140,19 @@ main(int argc,
|
||||
wtime = (int)strtoul(optarg, &p, 0);
|
||||
if (*p != '\0'
|
||||
|| wtime <= 0)
|
||||
goto usage;
|
||||
usage();
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
not_trace = 1;
|
||||
if (rflag)
|
||||
goto usage;
|
||||
usage();
|
||||
rflag = getnet(optarg, &OMSG.rip_nets[0]);
|
||||
if (!rflag) {
|
||||
struct hostent *hp = gethostbyname(optarg);
|
||||
if (hp == 0) {
|
||||
fprintf(stderr, "rtquery: %s:", optarg);
|
||||
herror(0);
|
||||
exit(1);
|
||||
}
|
||||
if (hp == 0)
|
||||
errx(1, "%s: %s",
|
||||
optarg, hstrerror(h_errno));
|
||||
bcopy(hp->h_addr, &OMSG.rip_nets[0].n_dst,
|
||||
sizeof(OMSG.rip_nets[0].n_dst));
|
||||
OMSG.rip_nets[0].n_family = RIP_AF_INET;
|
||||
@ -183,28 +181,28 @@ main(int argc,
|
||||
OMSG.rip_cmd = RIPCMD_TRACEON;
|
||||
if (!value
|
||||
|| strlen(value) > MAXPATHLEN)
|
||||
goto usage;
|
||||
usage();
|
||||
break;
|
||||
case TRACE_MORE:
|
||||
if (value)
|
||||
goto usage;
|
||||
usage();
|
||||
OMSG.rip_cmd = RIPCMD_TRACEON;
|
||||
value = "";
|
||||
break;
|
||||
case TRACE_OFF:
|
||||
if (value)
|
||||
goto usage;
|
||||
usage();
|
||||
OMSG.rip_cmd = RIPCMD_TRACEOFF;
|
||||
value = "";
|
||||
break;
|
||||
case TRACE_DUMP:
|
||||
if (value)
|
||||
goto usage;
|
||||
usage();
|
||||
OMSG.rip_cmd = RIPCMD_TRACEON;
|
||||
value = "dump/../table";
|
||||
break;
|
||||
default:
|
||||
goto usage;
|
||||
usage();
|
||||
}
|
||||
strcpy((char*)OMSG.rip_tracefile, value);
|
||||
omsg_len += strlen(value) - sizeof(OMSG.ripun);
|
||||
@ -215,38 +213,34 @@ main(int argc,
|
||||
not_trace = 1;
|
||||
p = strchr(optarg,'=');
|
||||
if (!p)
|
||||
goto usage;
|
||||
usage();
|
||||
*p++ = '\0';
|
||||
if (!strcasecmp("passwd",optarg))
|
||||
auth_type = RIP_AUTH_PW;
|
||||
else if (!strcasecmp("md5_passwd",optarg))
|
||||
auth_type = RIP_AUTH_MD5;
|
||||
else
|
||||
goto usage;
|
||||
usage();
|
||||
if (0 > parse_quote(&p,"|",&delim,
|
||||
passwd,sizeof(passwd)))
|
||||
goto usage;
|
||||
usage();
|
||||
if (auth_type == RIP_AUTH_MD5
|
||||
&& delim == '|') {
|
||||
keyid = strtoul(p+1,&p,0);
|
||||
if (keyid > 255 || *p != '\0')
|
||||
goto usage;
|
||||
usage();
|
||||
} else if (delim != '\0') {
|
||||
goto usage;
|
||||
usage();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
goto usage;
|
||||
usage();
|
||||
}
|
||||
argv += optind;
|
||||
argc -= optind;
|
||||
if ((not_trace && trace) || argc == 0) {
|
||||
usage: fprintf(stderr, "%s\n%s\n",
|
||||
"usage: rtquery [-np1v] [-r addr] [-w timeout] [-a secret] host ...",
|
||||
" rtquery [-t op] host ...");
|
||||
exit(1);
|
||||
}
|
||||
if ((not_trace && trace) || argc == 0)
|
||||
usage();
|
||||
|
||||
s = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (s < 0)
|
||||
@ -267,9 +261,18 @@ usage: fprintf(stderr, "%s\n%s\n",
|
||||
trace_loop(argv);
|
||||
else
|
||||
query_loop(argv, argc);
|
||||
return(0);
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
static void
|
||||
usage()
|
||||
{
|
||||
fprintf(stderr, "%s\n%s\n",
|
||||
"usage: rtquery [-np1v] [-r addr] [-w timeout] [-a secret] host ...",
|
||||
" rtquery [-t op] host ...");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
/* tell the target hosts about tracing
|
||||
*/
|
||||
|
@ -31,11 +31,13 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(sgi) && !defined(__NetBSD__)
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)tables.c 8.1 (Berkeley) 6/5/93";
|
||||
#elif defined(__NetBSD__)
|
||||
static char rcsid[] = "$NetBSD$";
|
||||
#endif
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#include "defs.h"
|
||||
|
||||
@ -175,11 +177,11 @@ ag_del(struct ag_info *ag)
|
||||
}
|
||||
|
||||
|
||||
/* Flush routes waiting for aggretation.
|
||||
/* Flush routes waiting for aggregation.
|
||||
* This must not suppress a route unless it is known that among all
|
||||
* routes with coarser masks that match it, the one with the longest
|
||||
* mask is appropriate. This is ensured by scanning the routes
|
||||
* in lexical order, and with the most restritive mask first
|
||||
* in lexical order, and with the most restrictive mask first
|
||||
* among routes to the same destination.
|
||||
*/
|
||||
void
|
||||
@ -316,8 +318,8 @@ ag_check(naddr dst,
|
||||
* A route to an address less than the current destination
|
||||
* will not be affected by the current route or any route
|
||||
* seen hereafter. That means it is safe to suppress it.
|
||||
* This check keeps poor routes (eg. with large hop counts)
|
||||
* from preventing suppresion of finer routes.
|
||||
* This check keeps poor routes (e.g. with large hop counts)
|
||||
* from preventing suppression of finer routes.
|
||||
*/
|
||||
if (ag_cors != 0
|
||||
&& ag->ag_dst_h < dst
|
||||
@ -769,7 +771,7 @@ kern_add(naddr dst, naddr mask)
|
||||
if (k != 0)
|
||||
return k;
|
||||
|
||||
k = (struct khash *)malloc(sizeof(*k));
|
||||
k = (struct khash *)rtmalloc(sizeof(*k), "kern_add");
|
||||
|
||||
bzero(k, sizeof(*k));
|
||||
k->k_dst = dst;
|
||||
@ -953,7 +955,7 @@ flush_kern(void)
|
||||
DBGERR(1,"RT_DUMP-sysctl-estimate");
|
||||
return;
|
||||
}
|
||||
buf = malloc(needed);
|
||||
buf = (char *)rtmalloc(needed, "flush_kern");
|
||||
if (sysctl(mib, 6, buf, &needed, 0, 0) < 0)
|
||||
BADERR(1,"RT_DUMP");
|
||||
lim = buf + needed;
|
||||
|
@ -31,21 +31,20 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#if !defined(lint) && !defined(sgi) && !defined(__NetBSD__)
|
||||
#ifndef lint
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)trace.c 8.1 (Berkeley) 6/5/93";
|
||||
#elif defined(__NetBSD__)
|
||||
static char rcsid[] = "$NetBSD$";
|
||||
#endif
|
||||
#ident "$Revision: 1.17 $"
|
||||
static const char rcsid[] =
|
||||
"$Id$";
|
||||
#endif /* not lint */
|
||||
|
||||
#define RIPCMDS
|
||||
#include "defs.h"
|
||||
#include "pathnames.h"
|
||||
#include <sys/stat.h>
|
||||
#include <sys/signal.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
|
||||
#ifdef sgi
|
||||
/* use *stat64 for files on large filesystems */
|
||||
#define stat stat64
|
||||
|
Loading…
Reference in New Issue
Block a user