sync with routed 2.27
This commit is contained in:
parent
d8c7cd31c5
commit
f93fe60ac0
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: defs.h,v 1.21 2001/11/02 05:30:56 lukem Exp $ */
|
||||
/* $NetBSD: defs.h,v 1.22 2002/11/30 04:04:23 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1988, 1993
|
||||
@ -35,7 +35,7 @@
|
||||
* @(#)defs.h 8.1 (Berkeley) 6/5/93
|
||||
*
|
||||
* $FreeBSD$
|
||||
* "Revision: 2.23 "
|
||||
* "Revision: 2.27 "
|
||||
*/
|
||||
|
||||
/* Definitions for RIPv2 routing process.
|
||||
@ -133,7 +133,7 @@
|
||||
|
||||
/* Turn on if IP_DROP_MEMBERSHIP and IP_ADD_MEMBERSHIP do not look at
|
||||
* the dstaddr of point-to-point interfaces.
|
||||
#undef MCAST_PPP_BUG
|
||||
* #define MCAST_PPP_BUG
|
||||
*/
|
||||
#ifdef MCAST_IFINDEX
|
||||
#undef MCAST_PPP_BUG
|
||||
@ -303,7 +303,9 @@ struct interface {
|
||||
time_t int_query_time;
|
||||
u_short int_transitions; /* times gone up-down */
|
||||
char int_metric;
|
||||
char int_d_metric; /* for faked default route */
|
||||
u_char int_d_metric; /* for faked default route */
|
||||
u_char int_adj_inmetric; /* adjust advertised metrics */
|
||||
u_char int_adj_outmetric; /* instead of interface metric */
|
||||
struct int_data {
|
||||
u_int ipackets; /* previous network stats */
|
||||
u_int ierrors;
|
||||
@ -412,7 +414,9 @@ extern struct parm {
|
||||
naddr parm_net;
|
||||
naddr parm_mask;
|
||||
|
||||
char parm_d_metric;
|
||||
u_char parm_d_metric;
|
||||
u_char parm_adj_inmetric;
|
||||
u_char parm_adj_outmetric;
|
||||
u_int parm_int_state;
|
||||
int parm_rdisc_pref; /* signed IRDP preference */
|
||||
int parm_rdisc_int; /* IRDP advertising interval */
|
||||
@ -470,6 +474,7 @@ extern int rt_sock; /* routing socket */
|
||||
extern int rt_sock_seqno;
|
||||
extern int rdisc_sock; /* router-discovery raw socket */
|
||||
|
||||
extern int seqno; /* sequence number for messages */
|
||||
extern int supplier; /* process should supply updates */
|
||||
extern int supplier_set; /* -s or -q requested */
|
||||
extern int lookforinterfaces; /* 1=probe for new up interfaces */
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: if.c,v 1.23 2001/11/02 05:30:56 lukem Exp $ */
|
||||
/* $NetBSD: if.c,v 1.24 2002/11/30 04:04:23 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -37,12 +37,12 @@
|
||||
#include "pathnames.h"
|
||||
|
||||
#ifdef __NetBSD__
|
||||
__RCSID("$NetBSD: if.c,v 1.23 2001/11/02 05:30:56 lukem Exp $");
|
||||
__RCSID("$NetBSD: if.c,v 1.24 2002/11/30 04:04:23 christos Exp $");
|
||||
#elif defined(__FreeBSD__)
|
||||
__RCSID("$FreeBSD$");
|
||||
#else
|
||||
__RCSID("Revision: 2.24 ");
|
||||
#ident "Revision: 2.24 "
|
||||
__RCSID("Revision: 2.27 ");
|
||||
#ident "Revision: 2.27 "
|
||||
#endif
|
||||
|
||||
struct interface *ifnet; /* all interfaces */
|
||||
@ -745,9 +745,8 @@ ifinit(void)
|
||||
ifam2 = (struct ifa_msghdr*)((char*)ifam + ifam->ifam_msglen);
|
||||
|
||||
#ifdef RTM_OIFINFO
|
||||
if (ifam->ifam_type == RTM_OIFINFO) {
|
||||
continue; /* just ignore compat message */
|
||||
}
|
||||
if (ifam->ifam_type == RTM_OIFINFO)
|
||||
continue; /* just ignore compat message */
|
||||
#endif
|
||||
if (ifam->ifam_type == RTM_IFINFO) {
|
||||
struct sockaddr_dl *sdl;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: input.c,v 1.27 2001/03/10 23:52:45 christos Exp $ */
|
||||
/* $NetBSD: input.c,v 1.28 2002/11/30 04:04:23 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1988, 1993
|
||||
@ -36,12 +36,12 @@
|
||||
#include "defs.h"
|
||||
|
||||
#ifdef __NetBSD__
|
||||
__RCSID("$NetBSD: input.c,v 1.27 2001/03/10 23:52:45 christos Exp $");
|
||||
__RCSID("$NetBSD: input.c,v 1.28 2002/11/30 04:04:23 christos Exp $");
|
||||
#elif defined(__FreeBSD__)
|
||||
__RCSID("$FreeBSD$");
|
||||
#else
|
||||
__RCSID("Revision: 2.23 ");
|
||||
#ident "Revision: 2.23 "
|
||||
__RCSID("Revision: 2.26 ");
|
||||
#ident "Revision: 2.26 "
|
||||
#endif
|
||||
|
||||
static void input(struct sockaddr_in *, struct interface *, struct interface *,
|
||||
@ -329,9 +329,14 @@ input(struct sockaddr_in *from, /* received from this IP address */
|
||||
v12buf.n->n_family = RIP_AF_INET;
|
||||
v12buf.n->n_dst = RIP_DEFAULT;
|
||||
i = aifp->int_d_metric;
|
||||
if (0 != (rt = rtget(RIP_DEFAULT, 0)))
|
||||
i = MIN(i, (rt->rt_metric
|
||||
+aifp->int_metric+1));
|
||||
if (0 != (rt = rtget(RIP_DEFAULT, 0))) {
|
||||
j = (rt->rt_metric
|
||||
+aifp->int_metric
|
||||
+aifp->int_adj_outmetric
|
||||
+1);
|
||||
if (i > j)
|
||||
i = j;
|
||||
}
|
||||
v12buf.n->n_metric = htonl(i);
|
||||
v12buf.n++;
|
||||
break;
|
||||
@ -397,11 +402,15 @@ input(struct sockaddr_in *from, /* received from this IP address */
|
||||
*/
|
||||
v12buf.n->n_family = RIP_AF_INET;
|
||||
v12buf.n->n_dst = dst;
|
||||
v12buf.n->n_metric = (rt->rt_metric+1
|
||||
+ ((aifp!=0)
|
||||
? aifp->int_metric
|
||||
: 1));
|
||||
if (v12buf.n->n_metric > HOPCNT_INFINITY)
|
||||
j = rt->rt_metric+1;
|
||||
if (!aifp)
|
||||
++j;
|
||||
else
|
||||
j += (aifp->int_metric
|
||||
+ aifp->int_adj_outmetric);
|
||||
if (j < HOPCNT_INFINITY)
|
||||
v12buf.n->n_metric = j;
|
||||
else
|
||||
v12buf.n->n_metric = HOPCNT_INFINITY;
|
||||
if (v12buf.buf->rip_vers != RIPv1) {
|
||||
v12buf.n->n_tag = rt->rt_tag;
|
||||
@ -666,7 +675,8 @@ input(struct sockaddr_in *from, /* received from this IP address */
|
||||
|
||||
/* Adjust metric according to incoming interface..
|
||||
*/
|
||||
n->n_metric += aifp->int_metric;
|
||||
n->n_metric += (aifp->int_metric
|
||||
+ aifp->int_adj_inmetric);
|
||||
if (n->n_metric > HOPCNT_INFINITY)
|
||||
n->n_metric = HOPCNT_INFINITY;
|
||||
|
||||
@ -979,12 +989,12 @@ ck_passwd(struct interface *aifp,
|
||||
*/
|
||||
if (TRACEPACKETS) {
|
||||
if (NA->au.a_md5.md5_auth_len
|
||||
!= RIP_AUTH_MD5_LEN)
|
||||
!= RIP_AUTH_MD5_HASH_LEN)
|
||||
msglim(use_authp, from,
|
||||
"unknown MD5 RIPv2 auth len %#x"
|
||||
" instead of %#x from %s",
|
||||
NA->au.a_md5.md5_auth_len,
|
||||
RIP_AUTH_MD5_LEN,
|
||||
RIP_AUTH_MD5_HASH_LEN,
|
||||
naddr_ntoa(from));
|
||||
if (na2->a_family != RIP_AF_AUTH)
|
||||
msglim(use_authp, from,
|
||||
@ -1001,8 +1011,9 @@ ck_passwd(struct interface *aifp,
|
||||
}
|
||||
|
||||
MD5Init(&md5_ctx);
|
||||
MD5Update(&md5_ctx, (u_char *)rip, len);
|
||||
MD5Update(&md5_ctx, ap->key, RIP_AUTH_MD5_LEN);
|
||||
MD5Update(&md5_ctx, (u_char *)rip,
|
||||
len + RIP_AUTH_MD5_HASH_XTRA);
|
||||
MD5Update(&md5_ctx, ap->key, RIP_AUTH_MD5_KEY_LEN);
|
||||
MD5Final(hash, &md5_ctx);
|
||||
if (!memcmp(hash, na2->au.au_pw, sizeof(hash)))
|
||||
return 1;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: main.c,v 1.30 2001/11/02 05:30:56 lukem Exp $ */
|
||||
/* $NetBSD: main.c,v 1.31 2002/11/30 04:04:23 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1988, 1993
|
||||
@ -46,12 +46,12 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993\n"
|
||||
"The Regents of the University of California."
|
||||
" All rights reserved.\n");
|
||||
#ifdef __NetBSD__
|
||||
__RCSID("$NetBSD: main.c,v 1.30 2001/11/02 05:30:56 lukem Exp $");
|
||||
__RCSID("$NetBSD: main.c,v 1.31 2002/11/30 04:04:23 christos Exp $");
|
||||
#elif defined(__FreeBSD__)
|
||||
__RCSID("$FreeBSD$");
|
||||
#else
|
||||
__RCSID("Revision: 2.24 ");
|
||||
#ident "Revision: 2.24 "
|
||||
__RCSID("Revision: 2.27 ");
|
||||
#ident "Revision: 2.27 "
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
@ -226,7 +226,7 @@ main(int argc,
|
||||
case 'v':
|
||||
/* display version */
|
||||
verbose++;
|
||||
msglog("version 2.24");
|
||||
msglog("version 2.25");
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: output.c,v 1.21 2001/11/02 05:30:56 lukem Exp $ */
|
||||
/* $NetBSD: output.c,v 1.22 2002/11/30 04:04:23 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1988, 1993
|
||||
@ -36,12 +36,12 @@
|
||||
#include "defs.h"
|
||||
|
||||
#ifdef __NetBSD__
|
||||
__RCSID("$NetBSD: output.c,v 1.21 2001/11/02 05:30:56 lukem Exp $");
|
||||
__RCSID("$NetBSD: output.c,v 1.22 2002/11/30 04:04:23 christos Exp $");
|
||||
#elif defined(__FreeBSD__)
|
||||
__RCSID("$FreeBSD$");
|
||||
#else
|
||||
__RCSID("Revision: 2.23 ");
|
||||
#ident "Revision: 2.23 "
|
||||
__RCSID("Revision: 2.27 ");
|
||||
#ident "Revision: 2.27 "
|
||||
#endif
|
||||
|
||||
|
||||
@ -286,7 +286,7 @@ clr_ws_buf(struct ws_buf *wb,
|
||||
na->a_family = RIP_AF_AUTH;
|
||||
na->a_type = RIP_AUTH_MD5;
|
||||
na->au.a_md5.md5_keyid = ap->keyid;
|
||||
na->au.a_md5.md5_auth_len = RIP_AUTH_MD5_LEN;
|
||||
na->au.a_md5.md5_auth_len = RIP_AUTH_MD5_KEY_LEN;
|
||||
na->au.a_md5.md5_seqno = htonl(clk.tv_sec);
|
||||
wb->n++;
|
||||
wb->lim--; /* make room for trailer */
|
||||
@ -310,8 +310,8 @@ end_md5_auth(struct ws_buf *wb,
|
||||
na2->a_type = htons(1);
|
||||
na->au.a_md5.md5_pkt_len = htons(len);
|
||||
MD5Init(&md5_ctx);
|
||||
MD5Update(&md5_ctx, (u_char *)wb->buf, len);
|
||||
MD5Update(&md5_ctx, ap->key, RIP_AUTH_MD5_LEN);
|
||||
MD5Update(&md5_ctx, (u_char *)wb->buf, len + RIP_AUTH_MD5_HASH_XTRA);
|
||||
MD5Update(&md5_ctx, ap->key, RIP_AUTH_MD5_KEY_LEN);
|
||||
MD5Final(na2->au.au_pw, &md5_ctx);
|
||||
wb->n++;
|
||||
}
|
||||
@ -554,8 +554,7 @@ walk_supply(struct radix_node *rn,
|
||||
* without confusing RIPv1 listeners into thinking the
|
||||
* network routes are host routes.
|
||||
*/
|
||||
if ((ws.state & WS_ST_AG)
|
||||
&& !(ws.state & WS_ST_RIP2_ALL))
|
||||
if ((ws.state & WS_ST_AG) && (ws.state & WS_ST_RIP2_ALL))
|
||||
ags |= AGS_AGGREGATE;
|
||||
|
||||
} else {
|
||||
@ -599,6 +598,11 @@ walk_supply(struct radix_node *rn,
|
||||
*
|
||||
* Notice spare routes with the same metric that we are about to
|
||||
* advertise, to split the horizon on redundant, inactive paths.
|
||||
*
|
||||
* Do not suppress advertisements of interface-related addresses on
|
||||
* non-point-to-point interfaces. This ensures that we have something
|
||||
* to say every 30 seconds to help detect broken Ethernets or
|
||||
* other interfaces where one packet every 30 seconds costs nothing.
|
||||
*/
|
||||
if (ws.ifp != 0
|
||||
&& !(ws.state & WS_ST_QUERY)
|
||||
@ -718,7 +722,7 @@ supply(struct sockaddr_in *dst,
|
||||
/* Adjust the advertised metric by the outgoing interface
|
||||
* metric.
|
||||
*/
|
||||
ws.metric = ifp->int_metric+1;
|
||||
ws.metric = ifp->int_metric + 1 + ifp->int_adj_outmetric;
|
||||
}
|
||||
|
||||
ripv12_buf.rip.rip_vers = vers;
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: parms.c,v 1.16 2002/08/08 15:10:51 itojun Exp $ */
|
||||
/* $NetBSD: parms.c,v 1.17 2002/11/30 04:04:23 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1993
|
||||
@ -38,12 +38,12 @@
|
||||
#include <sys/stat.h>
|
||||
|
||||
#ifdef __NetBSD__
|
||||
__RCSID("$NetBSD: parms.c,v 1.16 2002/08/08 15:10:51 itojun Exp $");
|
||||
__RCSID("$NetBSD: parms.c,v 1.17 2002/11/30 04:04:23 christos Exp $");
|
||||
#elif defined(__FreeBSD__)
|
||||
__RCSID("$FreeBSD$");
|
||||
#else
|
||||
__RCSID("Revision: 2.24 ");
|
||||
#ident "Revision: 2.24 "
|
||||
__RCSID("Revision: 2.26 ");
|
||||
#ident "Revision: 2.26 "
|
||||
#endif
|
||||
|
||||
|
||||
@ -87,8 +87,10 @@ get_parms(struct interface *ifp)
|
||||
ifp->int_rdisc_pref = parmp->parm_rdisc_pref;
|
||||
if (parmp->parm_rdisc_int != 0)
|
||||
ifp->int_rdisc_int = parmp->parm_rdisc_int;
|
||||
if (parmp->parm_d_metric != 0)
|
||||
ifp->int_d_metric = parmp->parm_d_metric;
|
||||
if (parmp->parm_adj_inmetric != 0)
|
||||
ifp->int_adj_inmetric = parmp->parm_adj_inmetric;
|
||||
if (parmp->parm_adj_outmetric != 0)
|
||||
ifp->int_adj_outmetric = parmp->parm_adj_outmetric;
|
||||
}
|
||||
}
|
||||
|
||||
@ -783,10 +785,24 @@ parse_parms(char *line,
|
||||
} else if (PARSEQ("fake_default")) {
|
||||
if (parm.parm_d_metric != 0
|
||||
|| IS_RIP_OUT_OFF(parm.parm_int_state)
|
||||
|| (parm.parm_d_metric = (int)strtoul(buf,&p,0),
|
||||
*p != '\0')
|
||||
|| parm.parm_d_metric > HOPCNT_INFINITY-1)
|
||||
|| (i = strtoul(buf,&p,0), *p != '\0')
|
||||
|| i > HOPCNT_INFINITY-1)
|
||||
return bad_str(tgt);
|
||||
parm.parm_d_metric = i;
|
||||
|
||||
} else if (PARSEQ("adj_inmetric")) {
|
||||
if (parm.parm_adj_inmetric != 0
|
||||
|| (i = strtoul(buf,&p,0), *p != '\0')
|
||||
|| i > HOPCNT_INFINITY-1)
|
||||
return bad_str(tgt);
|
||||
parm.parm_adj_inmetric = i;
|
||||
|
||||
} else if (PARSEQ("adj_outmetric")) {
|
||||
if (parm.parm_adj_outmetric != 0
|
||||
|| (i = strtoul(buf,&p,0), *p != '\0')
|
||||
|| i > HOPCNT_INFINITY-1)
|
||||
return bad_str(tgt);
|
||||
parm.parm_adj_outmetric = i;
|
||||
|
||||
} else if (PARSEQ("trust_gateway")) {
|
||||
/* look for trust_gateway=x.y.z|net/mask|...) */
|
||||
@ -874,11 +890,11 @@ check_parms(struct parm *new)
|
||||
if ((0 != (new->parm_int_state & GROUP_IS_SOL_OUT)
|
||||
&& 0 != (parmp->parm_int_state & GROUP_IS_SOL_OUT)
|
||||
&& 0 != ((new->parm_int_state ^ parmp->parm_int_state)
|
||||
& GROUP_IS_SOL_OUT))
|
||||
&& GROUP_IS_SOL_OUT))
|
||||
|| (0 != (new->parm_int_state & GROUP_IS_ADV_OUT)
|
||||
&& 0 != (parmp->parm_int_state & GROUP_IS_ADV_OUT)
|
||||
&& 0 != ((new->parm_int_state ^ parmp->parm_int_state)
|
||||
& GROUP_IS_ADV_OUT))
|
||||
&& GROUP_IS_ADV_OUT))
|
||||
|| (new->parm_rdisc_pref != 0
|
||||
&& parmp->parm_rdisc_pref != 0
|
||||
&& new->parm_rdisc_pref != parmp->parm_rdisc_pref)
|
||||
@ -896,9 +912,23 @@ check_parms(struct parm *new)
|
||||
return ("conflicting, duplicate poor man's router"
|
||||
" discovery or fake default metric");
|
||||
}
|
||||
|
||||
if (new->parm_adj_inmetric != 0
|
||||
&& parmp->parm_adj_inmetric != 0
|
||||
&& new->parm_adj_inmetric != parmp->parm_adj_inmetric) {
|
||||
return ("conflicting interface input "
|
||||
"metric adjustments");
|
||||
}
|
||||
|
||||
if (new->parm_adj_outmetric != 0
|
||||
&& parmp->parm_adj_outmetric != 0
|
||||
&& new->parm_adj_outmetric != parmp->parm_adj_outmetric) {
|
||||
return ("conflicting interface output "
|
||||
"metric adjustments");
|
||||
}
|
||||
}
|
||||
|
||||
/* link new entry on the so that when the entries are scanned,
|
||||
/* link new entry on the list so that when the entries are scanned,
|
||||
* they affect the result in the order the operator specified.
|
||||
*/
|
||||
parmp = (struct parm*)rtmalloc(sizeof(*parmp), "check_parms");
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rdisc.c,v 1.13 2001/11/02 05:30:57 lukem Exp $ */
|
||||
/* $NetBSD: rdisc.c,v 1.14 2002/11/30 04:04:23 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1995
|
||||
@ -39,7 +39,7 @@
|
||||
#include <netinet/ip_icmp.h>
|
||||
|
||||
#ifdef __NetBSD__
|
||||
__RCSID("$NetBSD: rdisc.c,v 1.13 2001/11/02 05:30:57 lukem Exp $");
|
||||
__RCSID("$NetBSD: rdisc.c,v 1.14 2002/11/30 04:04:23 christos Exp $");
|
||||
#elif defined(__FreeBSD__)
|
||||
__RCSID("$FreeBSD$");
|
||||
#else
|
||||
@ -99,8 +99,9 @@ struct dr { /* accumulated advertisements */
|
||||
#define UNSIGN_PREF(p) SIGN_PREF(p)
|
||||
/* adjust unsigned preference by interface metric,
|
||||
* without driving it to infinity */
|
||||
#define PREF(p, ifp) ((int)(p) <= (ifp)->int_metric ? ((p) != 0 ? 1 : 0) \
|
||||
: (p) - ((ifp)->int_metric))
|
||||
#define PREF(p, ifp) ((int)(p) <= ((ifp)->int_metric+(ifp)->int_adj_outmetric)\
|
||||
? ((p) != 0 ? 1 : 0) \
|
||||
: (p) - ((ifp)->int_metric+(ifp)->int_adj_outmetric))
|
||||
|
||||
static void rdisc_sort(void);
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: routed.8,v 1.38 2002/10/03 15:41:46 wiz Exp $
|
||||
.\" $NetBSD: routed.8,v 1.39 2002/11/30 04:04:23 christos Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1983, 1991, 1993
|
||||
.\" The Regents of the University of California. All rights reserved.
|
||||
@ -114,11 +114,18 @@ The
|
||||
packet generated contains a list of known routes, each marked
|
||||
with a "hop count" metric (a count of 16 or greater is
|
||||
considered "infinite").
|
||||
Advertised metrics reflect the metric associated with interface
|
||||
The advertised metric for a route reflects the metrics associated
|
||||
with interfaces
|
||||
(see
|
||||
.Xr ifconfig 8 ) ,
|
||||
.Xr ifconfig 8 )
|
||||
though which it is received and sent,
|
||||
so setting the metric on an interface
|
||||
is an effective way to steer traffic.
|
||||
See also
|
||||
.Cm adj_inmetric
|
||||
and
|
||||
.Cm adj_outmetric
|
||||
parameters below.
|
||||
.Pp
|
||||
Responses do not include routes with a first hop on the requesting
|
||||
network to implement in part
|
||||
@ -206,10 +213,11 @@ It continues listening to RIP while using Router Discovery
|
||||
if multi-homed to ensure all interfaces are used.
|
||||
.Pp
|
||||
The Router Discovery standard requires that advertisements
|
||||
have a default "lifetime" of 30 minutes.
|
||||
That means should something happen,
|
||||
a client can be without a good route for 30 minutes.
|
||||
It is a good idea to reduce the default to 45 seconds using
|
||||
have a default "lifetime" of 30 minutes. That means should
|
||||
something happen, a client can be without a good route for
|
||||
30 minutes. It is a good idea to reduce the default to 45
|
||||
seconds using
|
||||
.Fl P Cm rdisc_interval=45
|
||||
on the command line or
|
||||
.Cm rdisc_interval=45
|
||||
@ -223,7 +231,7 @@ is received), there is a single default route and a variable number of
|
||||
redirected host routes in the kernel table.
|
||||
On a host with more than one network interface,
|
||||
this default route will be via only one of the interfaces.
|
||||
Thus, multi-homed hosts running with
|
||||
Thus, multi-homed hosts running with \f3\-q\f1 might need
|
||||
.Fl q
|
||||
might need
|
||||
.Cm no_rdisc
|
||||
@ -247,7 +255,6 @@ The following options are available:
|
||||
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 sysctl
|
||||
net.inet.ip.forwarding=1.
|
||||
.It Fl q
|
||||
@ -280,8 +287,8 @@ default route.
|
||||
This is typically used on a gateway to the Internet,
|
||||
or on a gateway that uses another routing protocol whose routes
|
||||
are not reported to other local routers.
|
||||
Notice that because a metric of 1 is used, this feature is dangerous.
|
||||
It is more commonly accidentally used to create chaos with a
|
||||
Notice that because a metric of 1 is used, this feature is
|
||||
dangerous. It is more commonly accidentally used to create chaos with a
|
||||
routing loop than to solve problems.
|
||||
.It Fl h
|
||||
cause host or point-to-point routes to not be advertised,
|
||||
@ -428,7 +435,7 @@ to the same destination.
|
||||
.Pp
|
||||
The
|
||||
.Pa /etc/gateways
|
||||
file consists of a series of lines, each in
|
||||
file is comprised of a series of lines, each in
|
||||
one of the following two formats or consist of parameters described later.
|
||||
Blank lines and lines starting with '#' are comments.
|
||||
.Pp
|
||||
@ -508,6 +515,7 @@ a line starting with
|
||||
.Cm if=alias(Hname) ,
|
||||
.Cm if=remote(Hname) ,
|
||||
etc. should be used.
|
||||
.Ss Parameters
|
||||
.Pp
|
||||
Lines that start with neither "net" nor "host" must consist of one
|
||||
or more of the following parameter settings, separated by commas or
|
||||
@ -528,8 +536,7 @@ This parameter must appear by itself on a line.
|
||||
The network number must specify a full, 32-bit value, as in 192.0.2.0
|
||||
instead of 192.0.2.
|
||||
.Pp
|
||||
Do not use this feature unless necessary.
|
||||
It is dangerous.
|
||||
Do not use this feature unless necessary. It is dangerous.
|
||||
.It Cm ripv1_mask Ns \&= Ns Ar nname/mask1,mask2
|
||||
specifies that netmask of the network of which
|
||||
.Cm nname/mask1
|
||||
@ -564,7 +571,8 @@ all passwords have expired, in which case the password that expired most
|
||||
recently is used, or unless no passwords are valid yet, in which case
|
||||
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.
|
||||
be valid within the next 24 hours, or that was valid within the preceding
|
||||
24 hours.
|
||||
To protect the secrets, the passwd settings are valid only in the
|
||||
.Em /etc/gateways
|
||||
file and only when that file is readable only by UID 0.
|
||||
@ -651,18 +659,49 @@ Unless modified with
|
||||
.Cm fake_default ,
|
||||
the default route is broadcast with a metric of 14.
|
||||
That serves as a "poor man's router discovery" protocol.
|
||||
.It Cm adj_inmetric Ns \&= Ns Ar delta
|
||||
adjusts the hop count or metric of received RIP routes by
|
||||
.Ar delta .
|
||||
The metric of every received RIP route is increased by the sum
|
||||
of two values associated with the interface.
|
||||
One is the adj_inmetric value and the other is the interface
|
||||
metric set with
|
||||
.Xr ifconfig 8 .
|
||||
.It Cm adj_outmetric Ns \&= Ns Ar delta
|
||||
adjusts the hop count or metric of advertised RIP routes by
|
||||
.Ar delta .
|
||||
The metric of every received RIP route is increased by the metric
|
||||
associated with the interface by which it was received, or by 1 if
|
||||
the interface does not have a non-zero metric.
|
||||
The metric of the received route is then increased by the
|
||||
adj_outmetric associated with the interface.
|
||||
Every advertised route is increased by a total of four
|
||||
values,
|
||||
the metric set for the interface by which it was received with
|
||||
.Xr ifconfig 8 ,
|
||||
the
|
||||
.Cm adj_inmetric Ar delta
|
||||
of the receiving interface,
|
||||
the metric set for the interface by which it is transmitted with
|
||||
.Xr ifconfig 8 ,
|
||||
and the
|
||||
.Cm adj_outmetric Ar delta
|
||||
of the transmitting interface.
|
||||
.It Cm trust_gateway Ns \&= Ns Ar rname[|net1/mask1|net2/mask2|...]
|
||||
causes RIP packets from that router and other routers named in
|
||||
other
|
||||
causes RIP packets from router
|
||||
.Ar rname
|
||||
and other routers named in other
|
||||
.Cm trust_gateway
|
||||
keywords to be accepted, and packets from other routers to be ignored.
|
||||
If networks are specified, then routes to other networks will be ignored
|
||||
from that router.
|
||||
.It Cm redirect_ok
|
||||
causes RIP to allow ICMP Redirect messages when the system is acting
|
||||
allows the kernel to listen ICMP Redirect messages when the system is acting
|
||||
as a router and forwarding packets.
|
||||
Otherwise, ICMP Redirect messages are overridden.
|
||||
Otherwise, ICMP Redirect messages are overridden and deleted when the
|
||||
system is acting as a router.
|
||||
.El
|
||||
.Pp
|
||||
.Sh FILES
|
||||
.Bl -tag -width /etc/gateways -compact
|
||||
.It Pa /etc/gateways
|
||||
@ -677,11 +716,11 @@ for distant gateways
|
||||
.%R XSIS 028112
|
||||
.%Q Xerox System Integration Standard
|
||||
.Re
|
||||
.Sh BUGS
|
||||
It does not always detect unidirectional failures in network interfaces,
|
||||
for example, when the output side fails.
|
||||
.Sh HISTORY
|
||||
The
|
||||
.Nm
|
||||
command appeared in
|
||||
.Bx 4.2 .
|
||||
.Sh BUGS
|
||||
It does not always detect unidirectional failures in network interfaces,
|
||||
for example, when the output side fails.
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: rtquery.c,v 1.15 2001/04/06 11:13:46 wiz Exp $ */
|
||||
/* $NetBSD: rtquery.c,v 1.16 2002/11/30 04:04:24 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1982, 1986, 1993
|
||||
@ -33,6 +33,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/protosw.h>
|
||||
#include <sys/socket.h>
|
||||
@ -63,19 +64,33 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1988, 1993\n"
|
||||
"The Regents of the University of California."
|
||||
" All rights reserved.\n");
|
||||
#ifdef __NetBSD__
|
||||
__RCSID("$NetBSD: rtquery.c,v 1.15 2001/04/06 11:13:46 wiz Exp $");
|
||||
__RCSID("$NetBSD: rtquery.c,v 1.16 2002/11/30 04:04:24 christos Exp $");
|
||||
#elif defined(__FreeBSD__)
|
||||
__RCSID("$FreeBSD$");
|
||||
#else
|
||||
__RCSID("Revision: 2.23 ");
|
||||
#ident "Revision: 2.23 "
|
||||
__RCSID("Revision: 2.26 ");
|
||||
#ident "Revision: 2.26 "
|
||||
#endif
|
||||
#include <md5.h>
|
||||
|
||||
#ifndef sgi
|
||||
#define _HAVE_SIN_LEN
|
||||
#endif
|
||||
|
||||
#ifdef __NetBSD__
|
||||
#include <md5.h>
|
||||
#else
|
||||
#define MD5_DIGEST_LEN 16
|
||||
typedef struct {
|
||||
u_int32_t state[4]; /* state (ABCD) */
|
||||
u_int32_t count[2]; /* # of bits, modulo 2^64 (LSB 1st) */
|
||||
unsigned char buffer[64]; /* input buffer */
|
||||
} MD5_CTX;
|
||||
extern void MD5Init(MD5_CTX*);
|
||||
extern void MD5Update(MD5_CTX*, u_char*, u_int);
|
||||
extern void MD5Final(u_char[MD5_DIGEST_LEN], MD5_CTX*);
|
||||
#endif
|
||||
|
||||
|
||||
#define WTIME 15 /* Time to wait for all responses */
|
||||
#define STIME (250*1000) /* usec to wait for another response */
|
||||
|
||||
@ -385,7 +400,7 @@ query_loop(char *argv[], int argc)
|
||||
NA0.a_family = RIP_AF_AUTH;
|
||||
NA0.a_type = RIP_AUTH_MD5;
|
||||
NA0.au.a_md5.md5_keyid = (int8_t)keyid;
|
||||
NA0.au.a_md5.md5_auth_len = RIP_AUTH_MD5_LEN;
|
||||
NA0.au.a_md5.md5_auth_len = RIP_AUTH_MD5_KEY_LEN;
|
||||
NA0.au.a_md5.md5_seqno = 0;
|
||||
cc = (char *)&NA2-(char *)&OMSG;
|
||||
NA0.au.a_md5.md5_pkt_len = htons(cc);
|
||||
@ -395,7 +410,7 @@ query_loop(char *argv[], int argc)
|
||||
MD5Update(&md5_ctx,
|
||||
(u_char *)&OMSG, cc);
|
||||
MD5Update(&md5_ctx,
|
||||
(u_char *)passwd, RIP_AUTH_MD5_LEN);
|
||||
(u_char *)passwd, RIP_AUTH_MD5_HASH_LEN);
|
||||
MD5Final(NA2.au.au_pw, &md5_ctx);
|
||||
omsg_len += 2*sizeof(OMSG.rip_nets[0]);
|
||||
}
|
||||
@ -592,7 +607,7 @@ rip_input(struct sockaddr_in *from,
|
||||
struct in_addr in;
|
||||
const char *name;
|
||||
char net_buf[80];
|
||||
u_char hash[RIP_AUTH_MD5_LEN];
|
||||
u_char hash[RIP_AUTH_MD5_KEY_LEN];
|
||||
MD5_CTX md5_ctx;
|
||||
u_char md5_authed = 0;
|
||||
u_int mask, dmask;
|
||||
@ -732,9 +747,10 @@ rip_input(struct sockaddr_in *from,
|
||||
&& na->a_type == ntohs(1)) {
|
||||
MD5Init(&md5_ctx);
|
||||
MD5Update(&md5_ctx, (u_char *)&IMSG,
|
||||
(char *)na-(char *)&IMSG);
|
||||
(char *)na-(char *)&IMSG
|
||||
+RIP_AUTH_MD5_HASH_XTRA);
|
||||
MD5Update(&md5_ctx, (u_char *)passwd,
|
||||
RIP_AUTH_MD5_LEN);
|
||||
RIP_AUTH_MD5_KEY_LEN);
|
||||
MD5Final(hash, &md5_ctx);
|
||||
(void)printf(" %s hash\n",
|
||||
memcmp(hash, na->au.au_pw,
|
||||
@ -746,10 +762,10 @@ rip_input(struct sockaddr_in *from,
|
||||
} else {
|
||||
(void)sprintf(net_buf, "(af %#x) %d.%d.%d.%d",
|
||||
ntohs(n->n_family),
|
||||
(unsigned char)(n->n_dst >> 24),
|
||||
(unsigned char)(n->n_dst >> 16),
|
||||
(unsigned char)(n->n_dst >> 8),
|
||||
(unsigned char)n->n_dst);
|
||||
(u_char)(n->n_dst >> 24),
|
||||
(u_char)(n->n_dst >> 16),
|
||||
(u_char)(n->n_dst >> 8),
|
||||
(u_char)n->n_dst);
|
||||
}
|
||||
|
||||
(void)printf(" %-18s metric %2d %-10s",
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: table.c,v 1.15 2001/11/02 05:30:57 lukem Exp $ */
|
||||
/* $NetBSD: table.c,v 1.16 2002/11/30 04:04:24 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1988, 1993
|
||||
@ -36,12 +36,12 @@
|
||||
#include "defs.h"
|
||||
|
||||
#ifdef __NetBSD__
|
||||
__RCSID("$NetBSD: table.c,v 1.15 2001/11/02 05:30:57 lukem Exp $");
|
||||
__RCSID("$NetBSD: table.c,v 1.16 2002/11/30 04:04:24 christos Exp $");
|
||||
#elif defined(__FreeBSD__)
|
||||
__RCSID("$FreeBSD$");
|
||||
#else
|
||||
__RCSID("Revision: 2.23 ");
|
||||
#ident "Revision: 2.23 "
|
||||
__RCSID("Revision: 2.27 ");
|
||||
#ident "Revision: 2.27 "
|
||||
#endif
|
||||
|
||||
static struct rt_spare *rts_better(struct rt_entry *);
|
||||
@ -255,8 +255,6 @@ ag_flush(naddr lim_dst_h, /* flush routes to here */
|
||||
* then mark the suppressor redundant.
|
||||
*/
|
||||
if (ag_cors->ag_pref <= ag->ag_pref) {
|
||||
if (ag_cors->ag_seqno > ag->ag_seqno)
|
||||
ag_cors->ag_seqno = ag->ag_seqno;
|
||||
if (AG_IS_REDUN(ag->ag_state)
|
||||
&& ag_cors->ag_mask==ag->ag_mask<<1) {
|
||||
if (ag_cors->ag_dst_h == dst_h)
|
||||
@ -291,7 +289,7 @@ ag_check(naddr dst,
|
||||
naddr nhop,
|
||||
char metric,
|
||||
char pref,
|
||||
u_int seqno,
|
||||
u_int new_seqno,
|
||||
u_short tag,
|
||||
u_short state,
|
||||
void (*out)(struct ag_info *)) /* output using this */
|
||||
@ -318,7 +316,7 @@ ag_check(naddr dst,
|
||||
nc_ag.ag_pref = pref;
|
||||
nc_ag.ag_tag = tag;
|
||||
nc_ag.ag_state = state;
|
||||
nc_ag.ag_seqno = seqno;
|
||||
nc_ag.ag_seqno = new_seqno;
|
||||
out(&nc_ag);
|
||||
return;
|
||||
}
|
||||
@ -348,8 +346,6 @@ ag_check(naddr dst,
|
||||
&& (ag_cors->ag_gate == ag->ag_gate
|
||||
|| (ag->ag_state & AGS_FINE_GATE)
|
||||
|| (ag_cors->ag_state & AGS_CORS_GATE))) {
|
||||
if (ag_cors->ag_seqno > ag->ag_seqno)
|
||||
ag_cors->ag_seqno = ag->ag_seqno;
|
||||
/* If the suppressed target was redundant,
|
||||
* then mark the suppressor redundant.
|
||||
*/
|
||||
@ -408,17 +404,13 @@ ag_check(naddr dst,
|
||||
ag->ag_tag = tag;
|
||||
ag->ag_metric = metric;
|
||||
ag->ag_pref = pref;
|
||||
if (ag->ag_seqno < new_seqno)
|
||||
ag->ag_seqno = new_seqno;
|
||||
x = ag->ag_state;
|
||||
ag->ag_state = state;
|
||||
state = x;
|
||||
}
|
||||
|
||||
/* The sequence number controls flash updating,
|
||||
* and should be the smaller of the two.
|
||||
*/
|
||||
if (ag->ag_seqno > seqno)
|
||||
ag->ag_seqno = seqno;
|
||||
|
||||
/* Some bits are set if they are set on either route,
|
||||
* except when the route is for an interface.
|
||||
*/
|
||||
@ -458,8 +450,8 @@ ag_check(naddr dst,
|
||||
*
|
||||
* Combine and promote (aggregate) the pair of routes.
|
||||
*/
|
||||
if (seqno > ag->ag_seqno)
|
||||
seqno = ag->ag_seqno;
|
||||
if (new_seqno < ag->ag_seqno)
|
||||
new_seqno = ag->ag_seqno;
|
||||
if (!AG_IS_REDUN(state))
|
||||
state &= ~AGS_REDUN1;
|
||||
if (AG_IS_REDUN(ag->ag_state))
|
||||
@ -520,10 +512,10 @@ ag_check(naddr dst,
|
||||
pref = x;
|
||||
|
||||
/* take the newest sequence number */
|
||||
if (seqno >= ag->ag_seqno)
|
||||
seqno = ag->ag_seqno;
|
||||
if (new_seqno <= ag->ag_seqno)
|
||||
new_seqno = ag->ag_seqno;
|
||||
else
|
||||
ag->ag_seqno = seqno;
|
||||
ag->ag_seqno = new_seqno;
|
||||
|
||||
} else {
|
||||
if (!(state & AGS_AGGREGATE))
|
||||
@ -539,10 +531,10 @@ ag_check(naddr dst,
|
||||
if (!AG_IS_REDUN(state))
|
||||
state &= ~AGS_REDUN1;
|
||||
state &= ~AGS_REDUN0;
|
||||
if (seqno > ag->ag_seqno)
|
||||
seqno = ag->ag_seqno;
|
||||
if (new_seqno < ag->ag_seqno)
|
||||
new_seqno = ag->ag_seqno;
|
||||
else
|
||||
ag->ag_seqno = seqno;
|
||||
ag->ag_seqno = new_seqno;
|
||||
}
|
||||
|
||||
mask <<= 1;
|
||||
@ -603,7 +595,7 @@ ag_check(naddr dst,
|
||||
nag->ag_pref = pref;
|
||||
nag->ag_tag = tag;
|
||||
nag->ag_state = state;
|
||||
nag->ag_seqno = seqno;
|
||||
nag->ag_seqno = new_seqno;
|
||||
|
||||
nag->ag_fine = ag;
|
||||
if (ag != 0)
|
||||
@ -649,7 +641,7 @@ rtm_type_name(u_char type)
|
||||
|
||||
if (type > sizeof(rtm_types)/sizeof(rtm_types[0])
|
||||
|| type == 0) {
|
||||
sprintf(name0, "RTM type %#x", type);
|
||||
snprintf(name0, sizeof(name0), NEW_RTM_PAT, type);
|
||||
return name0;
|
||||
} else {
|
||||
return rtm_types[type-1];
|
||||
@ -1120,6 +1112,13 @@ flush_kern(void)
|
||||
if (rtm->rtm_flags & RTF_LLINFO)
|
||||
continue;
|
||||
|
||||
#if defined(RTF_CLONED) && defined(__bsdi__)
|
||||
/* ignore cloned routes
|
||||
*/
|
||||
if (rtm->rtm_flags & RTF_CLONED)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
/* ignore multicast addresses
|
||||
*/
|
||||
if (IN_MULTICAST(ntohl(S_ADDR(INFO_DST(&info)))))
|
||||
@ -1228,9 +1227,8 @@ read_rt(void)
|
||||
continue;
|
||||
}
|
||||
#ifdef RTM_OIFINFO
|
||||
if (m.r.rtm.rtm_type == RTM_OIFINFO) {
|
||||
continue; /* ignore compat message */
|
||||
}
|
||||
if (m.r.rtm.rtm_type == RTM_OIFINFO)
|
||||
continue; /* ignore compat message */
|
||||
#endif
|
||||
|
||||
strcpy(str, rtm_type_name(m.r.rtm.rtm_type));
|
||||
@ -1271,6 +1269,13 @@ read_rt(void)
|
||||
continue;
|
||||
}
|
||||
|
||||
#if defined(RTF_CLONED) && defined(__bsdi__)
|
||||
if (m.r.rtm.rtm_flags & RTF_CLONED) {
|
||||
trace_act("ignore cloned %s", str);
|
||||
continue;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (get_info_gate(&INFO_GATE(&info), &gate_sin)) {
|
||||
gate = S_ADDR(INFO_GATE(&info));
|
||||
strp += sprintf(strp, " --> %s", naddr_ntoa(gate));
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: trace.c,v 1.26 2001/09/24 13:22:32 wiz Exp $ */
|
||||
/* $NetBSD: trace.c,v 1.27 2002/11/30 04:04:24 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1983, 1988, 1993
|
||||
@ -41,14 +41,15 @@
|
||||
#include <fcntl.h>
|
||||
|
||||
#ifdef __NetBSD__
|
||||
__RCSID("$NetBSD: trace.c,v 1.26 2001/09/24 13:22:32 wiz Exp $");
|
||||
__RCSID("$NetBSD: trace.c,v 1.27 2002/11/30 04:04:24 christos Exp $");
|
||||
#elif defined(__FreeBSD__)
|
||||
__RCSID("$FreeBSD$");
|
||||
#else
|
||||
__RCSID("Revision: 2.23 ");
|
||||
#ident "Revision: 2.23 "
|
||||
__RCSID("Revision: 2.27 ");
|
||||
#ident "Revision: 2.27 "
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef sgi
|
||||
/* use *stat64 for files on large filesystems */
|
||||
#define stat stat64
|
||||
@ -646,9 +647,15 @@ trace_if(const char *act,
|
||||
ifp->int_mask, 1));
|
||||
if (ifp->int_metric != 0)
|
||||
(void)fprintf(ftrace, "metric=%d ", ifp->int_metric);
|
||||
if (ifp->int_adj_inmetric != 0)
|
||||
(void)fprintf(ftrace, "adj_inmetric=%u ",
|
||||
ifp->int_adj_inmetric);
|
||||
if (ifp->int_adj_outmetric != 0)
|
||||
(void)fprintf(ftrace, "adj_outmetric=%u ",
|
||||
ifp->int_adj_outmetric);
|
||||
if (!IS_RIP_OUT_OFF(ifp->int_state)
|
||||
&& ifp->int_d_metric != 0)
|
||||
(void)fprintf(ftrace, "fake_default=%d ", ifp->int_d_metric);
|
||||
(void)fprintf(ftrace, "fake_default=%u ", ifp->int_d_metric);
|
||||
trace_bits(if_bits, ifp->int_if_flags, 0);
|
||||
trace_bits(is_bits, ifp->int_state, 0);
|
||||
(void)fputc('\n',ftrace);
|
||||
|
Loading…
Reference in New Issue
Block a user