Update to 980910 from ftp.rhyolite.com
This commit is contained in:
parent
99c0436391
commit
94b2d42842
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: defs.h,v 1.16 1998/06/02 18:02:55 thorpej Exp $ */
|
/* $NetBSD: defs.h,v 1.17 1998/10/25 14:56:06 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1983, 1988, 1993
|
* Copyright (c) 1983, 1988, 1993
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
* must display the following acknowledgement:
|
* must display the following acknowledgment:
|
||||||
* This product includes software developed by the University of
|
* This product includes software developed by the University of
|
||||||
* California, Berkeley and its contributors.
|
* California, Berkeley and its contributors.
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
* tell the kernel hop counts
|
* tell the kernel hop counts
|
||||||
* do not advertise if ipforwarding=0
|
* 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
|
* is no likelihood that IETF RIPv1 or RIPv2 will ever be used with
|
||||||
* other protocols. The result is far smaller, faster, cleaner, and
|
* other protocols. The result is far smaller, faster, cleaner, and
|
||||||
* perhaps understandable.
|
* perhaps understandable.
|
||||||
|
@ -73,6 +73,7 @@
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <syslog.h>
|
#include <syslog.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <sys/cdefs.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
@ -93,6 +94,7 @@
|
||||||
#define RIPVERSION RIPv2
|
#define RIPVERSION RIPv2
|
||||||
#include <protocols/routed.h>
|
#include <protocols/routed.h>
|
||||||
|
|
||||||
|
|
||||||
/* Type of an IP address.
|
/* Type of an IP address.
|
||||||
* Some systems do not like to pass structures, so do not use in_addr.
|
* Some systems do not like to pass structures, so do not use in_addr.
|
||||||
* Some systems think a long has 64 bits, which would be a gross waste.
|
* Some systems think a long has 64 bits, which would be a gross waste.
|
||||||
|
@ -100,7 +102,7 @@
|
||||||
* It should be defined somewhere netinet/in.h, but it is not.
|
* It should be defined somewhere netinet/in.h, but it is not.
|
||||||
*/
|
*/
|
||||||
#ifdef sgi
|
#ifdef sgi
|
||||||
#define naddr __uint32_t
|
#define naddr u_int32_t
|
||||||
#elif defined (__NetBSD__)
|
#elif defined (__NetBSD__)
|
||||||
#define naddr u_int32_t
|
#define naddr u_int32_t
|
||||||
#define _HAVE_SA_LEN
|
#define _HAVE_SA_LEN
|
||||||
|
@ -114,7 +116,7 @@
|
||||||
/* Turn on if IP_DROP_MEMBERSHIP and IP_ADD_MEMBERSHIP do not look at
|
/* Turn on if IP_DROP_MEMBERSHIP and IP_ADD_MEMBERSHIP do not look at
|
||||||
* the dstaddr of point-to-point interfaces.
|
* the dstaddr of point-to-point interfaces.
|
||||||
*/
|
*/
|
||||||
#if defined(__NetBSD__)
|
#ifdef __NetBSD__
|
||||||
#define MCAST_PPP_BUG
|
#define MCAST_PPP_BUG
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -295,7 +297,7 @@ struct interface {
|
||||||
} int_data;
|
} int_data;
|
||||||
# define MAX_AUTH_KEYS 5
|
# define MAX_AUTH_KEYS 5
|
||||||
struct auth { /* authentication info */
|
struct auth { /* authentication info */
|
||||||
u_char type;
|
u_int16_t type;
|
||||||
u_char key[RIP_AUTH_PW_LEN];
|
u_char key[RIP_AUTH_PW_LEN];
|
||||||
u_char keyid;
|
u_char keyid;
|
||||||
time_t start, end;
|
time_t start, end;
|
||||||
|
@ -363,7 +365,7 @@ struct ag_info {
|
||||||
u_int ag_seqno;
|
u_int ag_seqno;
|
||||||
u_short ag_tag;
|
u_short ag_tag;
|
||||||
u_short ag_state;
|
u_short ag_state;
|
||||||
#define AGS_SUPPRESS 0x001 /* combine with coaser mask */
|
#define AGS_SUPPRESS 0x001 /* combine with coarser mask */
|
||||||
#define AGS_AGGREGATE 0x002 /* synthesize combined routes */
|
#define AGS_AGGREGATE 0x002 /* synthesize combined routes */
|
||||||
#define AGS_REDUN0 0x004 /* redundant, finer routes output */
|
#define AGS_REDUN0 0x004 /* redundant, finer routes output */
|
||||||
#define AGS_REDUN1 0x008
|
#define AGS_REDUN1 0x008
|
||||||
|
@ -375,7 +377,7 @@ struct ag_info {
|
||||||
#define AGS_FINE_GATE 0x080 /* ignore differing ag_gate when this
|
#define AGS_FINE_GATE 0x080 /* ignore differing ag_gate when this
|
||||||
* has the finer netmask */
|
* has the finer netmask */
|
||||||
#define AGS_CORS_GATE 0x100 /* ignore differing gate when this
|
#define AGS_CORS_GATE 0x100 /* ignore differing gate when this
|
||||||
* has the coarser netmaks */
|
* has the coarser netmask */
|
||||||
#define AGS_SPLIT_HZ 0x200 /* suppress for split horizon */
|
#define AGS_SPLIT_HZ 0x200 /* suppress for split horizon */
|
||||||
|
|
||||||
/* some bits are set if they are set on either route */
|
/* some bits are set if they are set on either route */
|
||||||
|
@ -394,7 +396,7 @@ extern struct parm {
|
||||||
char parm_d_metric;
|
char parm_d_metric;
|
||||||
u_int parm_int_state;
|
u_int parm_int_state;
|
||||||
int parm_rdisc_pref; /* signed IRDP preference */
|
int parm_rdisc_pref; /* signed IRDP preference */
|
||||||
int parm_rdisc_int; /* IRDP advertising internval */
|
int parm_rdisc_int; /* IRDP advertising interval */
|
||||||
struct auth parm_auth[MAX_AUTH_KEYS];
|
struct auth parm_auth[MAX_AUTH_KEYS];
|
||||||
} *parms;
|
} *parms;
|
||||||
|
|
||||||
|
@ -455,7 +457,7 @@ extern int supplier_set; /* -s or -q requested */
|
||||||
extern int lookforinterfaces; /* 1=probe for new up interfaces */
|
extern int lookforinterfaces; /* 1=probe for new up interfaces */
|
||||||
extern int ridhosts; /* 1=reduce host routes */
|
extern int ridhosts; /* 1=reduce host routes */
|
||||||
extern int mhome; /* 1=want multi-homed host route */
|
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 int auth_ok; /* 1=ignore auth if we do not care */
|
||||||
|
|
||||||
extern struct timeval clk; /* system clock's idea of time */
|
extern struct timeval clk; /* system clock's idea of time */
|
||||||
|
@ -469,7 +471,7 @@ extern struct timeval next_bcast; /* next general broadcast */
|
||||||
extern struct timeval age_timer; /* next check of old routes */
|
extern struct timeval age_timer; /* next check of old routes */
|
||||||
extern struct timeval no_flash; /* inhibit flash update until then */
|
extern struct timeval no_flash; /* inhibit flash update until then */
|
||||||
extern struct timeval rdisc_timer; /* next advert. or solicitation */
|
extern struct timeval rdisc_timer; /* next advert. or solicitation */
|
||||||
extern int rdisc_ok; /* using solicted route */
|
extern int rdisc_ok; /* using solicited route */
|
||||||
|
|
||||||
extern struct timeval ifinit_timer; /* time to check interfaces */
|
extern struct timeval ifinit_timer; /* time to check interfaces */
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: if.c,v 1.15 1998/08/26 17:50:33 christos Exp $ */
|
/* $NetBSD: if.c,v 1.16 1998/10/25 14:56:07 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1983, 1993
|
* Copyright (c) 1983, 1993
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
* must display the following acknowledgement:
|
* must display the following acknowledgment:
|
||||||
* This product includes software developed by the University of
|
* This product includes software developed by the University of
|
||||||
* California, Berkeley and its contributors.
|
* California, Berkeley and its contributors.
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
static char sccsid[] = "@(#)if.c 8.1 (Berkeley) 6/5/93";
|
static char sccsid[] = "@(#)if.c 8.1 (Berkeley) 6/5/93";
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__RCSID("$NetBSD: if.c,v 1.15 1998/08/26 17:50:33 christos Exp $");
|
__RCSID("$NetBSD: if.c,v 1.16 1998/10/25 14:56:07 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
@ -338,7 +338,7 @@ ripv1_mask_net(naddr addr, /* in network byte order */
|
||||||
for (r1p = r1nets; r1p != 0; r1p = r1p->r1net_next) {
|
for (r1p = r1nets; r1p != 0; r1p = r1p->r1net_next) {
|
||||||
if (on_net(addr, r1p->r1net_net, r1p->r1net_match)
|
if (on_net(addr, r1p->r1net_net, r1p->r1net_match)
|
||||||
&& r1p->r1net_mask > mask)
|
&& r1p->r1net_mask > mask)
|
||||||
r1p->r1net_mask = mask;
|
mask = r1p->r1net_mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Otherwise, make the classic A/B/C guess.
|
/* Otherwise, make the classic A/B/C guess.
|
||||||
|
@ -701,7 +701,7 @@ ifinit(void)
|
||||||
? CHECK_ACT_INTERVAL
|
? CHECK_ACT_INTERVAL
|
||||||
: CHECK_QUIET_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)
|
for (ifp = ifnet; 0 != ifp; ifp = ifp->int_next)
|
||||||
ifp->int_state &= ~(IS_CHECKED | IS_DUP);
|
ifp->int_state &= ~(IS_CHECKED | IS_DUP);
|
||||||
|
|
||||||
|
@ -776,7 +776,7 @@ ifinit(void)
|
||||||
* will be an alias.
|
* will be an alias.
|
||||||
* Do not output RIP or Router-Discovery packets via aliases.
|
* Do not output RIP or Router-Discovery packets via aliases.
|
||||||
*/
|
*/
|
||||||
memmove(&ifs, &ifs0, sizeof(ifs));
|
memcpy(&ifs, &ifs0, sizeof(ifs));
|
||||||
ifs0.int_state |= (IS_ALIAS | IS_NO_RIP_OUT | IS_NO_RDISC);
|
ifs0.int_state |= (IS_ALIAS | IS_NO_RIP_OUT | IS_NO_RDISC);
|
||||||
|
|
||||||
if (INFO_IFA(&info) == 0) {
|
if (INFO_IFA(&info) == 0) {
|
||||||
|
@ -1011,7 +1011,7 @@ ifinit(void)
|
||||||
}
|
}
|
||||||
ifp->int_data = ifs.int_data;
|
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.
|
* counters wrap or the interface is reset.
|
||||||
*/
|
*/
|
||||||
if (ierr < 0 || in < 0 || oerr < 0 || out < 0) {
|
if (ierr < 0 || in < 0 || oerr < 0 || out < 0) {
|
||||||
|
@ -1111,7 +1111,7 @@ ifinit(void)
|
||||||
/* It is new and ok. Add it to the list of interfaces
|
/* It is new and ok. Add it to the list of interfaces
|
||||||
*/
|
*/
|
||||||
ifp = (struct interface *)rtmalloc(sizeof(*ifp), "ifinit ifp");
|
ifp = (struct interface *)rtmalloc(sizeof(*ifp), "ifinit ifp");
|
||||||
memmove(ifp, &ifs, sizeof(*ifp));
|
memcpy(ifp, &ifs, sizeof(*ifp));
|
||||||
get_parms(ifp);
|
get_parms(ifp);
|
||||||
if_link(ifp);
|
if_link(ifp);
|
||||||
trace_if("Add", ifp);
|
trace_if("Add", ifp);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: input.c,v 1.23 1998/10/24 18:30:23 christos Exp $ */
|
/* $NetBSD: input.c,v 1.24 1998/10/25 14:56:07 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1983, 1988, 1993
|
* Copyright (c) 1983, 1988, 1993
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
* must display the following acknowledgement:
|
* must display the following acknowledgment:
|
||||||
* This product includes software developed by the University of
|
* This product includes software developed by the University of
|
||||||
* California, Berkeley and its contributors.
|
* California, Berkeley and its contributors.
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 6/5/93";
|
static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 6/5/93";
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__RCSID("$NetBSD: input.c,v 1.23 1998/10/24 18:30:23 christos Exp $");
|
__RCSID("$NetBSD: input.c,v 1.24 1998/10/25 14:56:07 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
@ -185,7 +185,7 @@ input(struct sockaddr_in *from, /* received from this IP address */
|
||||||
*
|
*
|
||||||
* RIPv2 authentication is lame. Why authenticate queries?
|
* RIPv2 authentication is lame. Why authenticate queries?
|
||||||
* Why should a RIPv2 implementation with authentication disabled
|
* 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!
|
* RIPv1 systems will listen? Crazy!
|
||||||
*/
|
*/
|
||||||
if (!auth_ok
|
if (!auth_ok
|
||||||
|
@ -235,7 +235,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!
|
* queries. That is too silly to bother with. Sheesh!
|
||||||
* Are forwarding tables supposed to be secret, when
|
* Are forwarding tables supposed to be secret, when
|
||||||
* a bad guy can infer them with test traffic? When RIP
|
* a bad guy can infer them with test traffic? When RIP
|
||||||
|
@ -620,7 +620,7 @@ input(struct sockaddr_in *from, /* received from this IP address */
|
||||||
*/
|
*/
|
||||||
gate = FROM_NADDR;
|
gate = FROM_NADDR;
|
||||||
if (n->n_nhop != 0) {
|
if (n->n_nhop != 0) {
|
||||||
if (rip->rip_vers == RIPv2) {
|
if (rip->rip_vers == RIPv1) {
|
||||||
n->n_nhop = 0;
|
n->n_nhop = 0;
|
||||||
} else {
|
} else {
|
||||||
/* Use it only if it is valid. */
|
/* Use it only if it is valid. */
|
||||||
|
@ -924,7 +924,7 @@ ck_passwd(struct interface *aifp,
|
||||||
struct auth *ap;
|
struct auth *ap;
|
||||||
MD5_CTX md5_ctx;
|
MD5_CTX md5_ctx;
|
||||||
u_char hash[RIP_AUTH_PW_LEN];
|
u_char hash[RIP_AUTH_PW_LEN];
|
||||||
int i;
|
int i, len;
|
||||||
|
|
||||||
|
|
||||||
if ((void *)NA >= lim || NA->a_family != RIP_AF_AUTH) {
|
if ((void *)NA >= lim || NA->a_family != RIP_AF_AUTH) {
|
||||||
|
@ -942,7 +942,7 @@ ck_passwd(struct interface *aifp,
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (NA->a_type == RIP_AUTH_PW) {
|
if (NA->a_type == RIP_AUTH_PW) {
|
||||||
if (!memcmp(ap->key, NA->au.au_pw, RIP_AUTH_PW_LEN))
|
if (!memcmp(NA->au.au_pw, ap->key, RIP_AUTH_PW_LEN))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -951,28 +951,52 @@ ck_passwd(struct interface *aifp,
|
||||||
if (NA->au.a_md5.md5_keyid != ap->keyid)
|
if (NA->au.a_md5.md5_keyid != ap->keyid)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
na2 = (struct netauth *)((char *)(NA+1)
|
len = ntohs(NA->au.a_md5.md5_pkt_len);
|
||||||
+ NA->au.a_md5.md5_pkt_len);
|
if ((len-sizeof(*rip)) % sizeof(*NA) != 0
|
||||||
if (NA->au.a_md5.md5_pkt_len % sizeof(*NA) != 0
|
|| len != (char *)lim-(char*)rip-sizeof(*NA)) {
|
||||||
|| lim < (void *)(na2+1)) {
|
|
||||||
msglim(use_authp, from,
|
msglim(use_authp, from,
|
||||||
"bad MD5 RIP-II pkt length %d from %s",
|
"wrong MD5 RIPv2 packet length of %d"
|
||||||
NA->au.a_md5.md5_pkt_len,
|
" instead of %d from %s",
|
||||||
|
len, (int)((char *)lim-(char *)rip
|
||||||
|
-sizeof(*NA)),
|
||||||
naddr_ntoa(from));
|
naddr_ntoa(from));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
na2 = (struct netauth *)((char *)rip+len);
|
||||||
|
|
||||||
|
/* Given a good hash value, these are not security
|
||||||
|
* problems so be generous and accept the routes,
|
||||||
|
* after complaining.
|
||||||
|
*/
|
||||||
|
if (TRACEPACKETS) {
|
||||||
|
if (NA->au.a_md5.md5_auth_len
|
||||||
|
!= RIP_AUTH_MD5_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,
|
||||||
|
naddr_ntoa(from));
|
||||||
|
if (na2->a_family != RIP_AF_AUTH)
|
||||||
|
msglim(use_authp, from,
|
||||||
|
"unknown MD5 RIPv2 family %#x"
|
||||||
|
" instead of %#x from %s",
|
||||||
|
na2->a_family, RIP_AF_AUTH,
|
||||||
|
naddr_ntoa(from));
|
||||||
|
if (na2->a_type != ntohs(1))
|
||||||
|
msglim(use_authp, from,
|
||||||
|
"MD5 RIPv2 hash has %#x"
|
||||||
|
" instead of %#x from %s",
|
||||||
|
na2->a_type, ntohs(1),
|
||||||
|
naddr_ntoa(from));
|
||||||
|
}
|
||||||
|
|
||||||
MD5Init(&md5_ctx);
|
MD5Init(&md5_ctx);
|
||||||
MD5Update(&md5_ctx, (u_char *)NA,
|
MD5Update(&md5_ctx, (u_char *)rip, len);
|
||||||
(char *)na2->au.au_pw - (char *)NA);
|
MD5Update(&md5_ctx, ap->key, RIP_AUTH_MD5_LEN);
|
||||||
MD5Update(&md5_ctx,
|
|
||||||
(u_char *)ap->key, sizeof(ap->key));
|
|
||||||
MD5Final(hash, &md5_ctx);
|
MD5Final(hash, &md5_ctx);
|
||||||
if (na2->a_family != RIP_AF_AUTH
|
if (!memcmp(hash, na2->au.au_pw, sizeof(hash)))
|
||||||
|| na2->a_type != 1
|
return 1;
|
||||||
|| NA->au.a_md5.md5_auth_len != RIP_AUTH_PW_LEN
|
|
||||||
|| memcmp(hash, na2->au.au_pw, sizeof(hash)))
|
|
||||||
return 0;
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: main.c,v 1.19 1998/07/06 06:50:28 mrg Exp $ */
|
/* $NetBSD: main.c,v 1.20 1998/10/25 14:56:07 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1983, 1988, 1993
|
* Copyright (c) 1983, 1988, 1993
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
* must display the following acknowledgement:
|
* must display the following acknowledgment:
|
||||||
* This product includes software developed by the University of
|
* This product includes software developed by the University of
|
||||||
* California, Berkeley and its contributors.
|
* California, Berkeley and its contributors.
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
@ -40,7 +40,7 @@ char copyright[] =
|
||||||
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/5/93";
|
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/5/93";
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__RCSID("$NetBSD: main.c,v 1.19 1998/07/06 06:50:28 mrg Exp $");
|
__RCSID("$NetBSD: main.c,v 1.20 1998/10/25 14:56:07 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
@ -73,7 +73,7 @@ int default_gateway; /* 1=advertise default */
|
||||||
int background = 1;
|
int background = 1;
|
||||||
int ridhosts; /* 1=reduce host routes */
|
int ridhosts; /* 1=reduce host routes */
|
||||||
int mhome; /* 1=want multi-homed host route */
|
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 */
|
int auth_ok = 1; /* 1=ignore auth if we do not care */
|
||||||
|
|
||||||
struct timeval epoch; /* when started */
|
struct timeval epoch; /* when started */
|
||||||
|
@ -223,7 +223,7 @@ main(int argc,
|
||||||
case 'v':
|
case 'v':
|
||||||
/* display version */
|
/* display version */
|
||||||
verbose++;
|
verbose++;
|
||||||
msglog("version 2.10");
|
msglog("version 2.15");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -422,7 +422,7 @@ usage:
|
||||||
/* It is desirable to send routing updates
|
/* It is desirable to send routing updates
|
||||||
* regularly. So schedule the next update
|
* regularly. So schedule the next update
|
||||||
* 30 seconds after the previous one was
|
* 30 seconds after the previous one was
|
||||||
* secheduled, instead of 30 seconds after
|
* scheduled, instead of 30 seconds after
|
||||||
* the previous update was finished.
|
* the previous update was finished.
|
||||||
* Even if we just started after discovering
|
* Even if we just started after discovering
|
||||||
* a 2nd interface or were otherwise delayed,
|
* a 2nd interface or were otherwise delayed,
|
||||||
|
@ -809,7 +809,7 @@ timevaladd(struct timeval *t1,
|
||||||
{
|
{
|
||||||
|
|
||||||
t1->tv_sec += t2->tv_sec;
|
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_sec++;
|
||||||
t1->tv_usec -= 1000000;
|
t1->tv_usec -= 1000000;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: output.c,v 1.15 1998/06/02 18:02:55 thorpej Exp $ */
|
/* $NetBSD: output.c,v 1.16 1998/10/25 14:56:08 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1983, 1988, 1993
|
* Copyright (c) 1983, 1988, 1993
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
* must display the following acknowledgement:
|
* must display the following acknowledgment:
|
||||||
* This product includes software developed by the University of
|
* This product includes software developed by the University of
|
||||||
* California, Berkeley and its contributors.
|
* California, Berkeley and its contributors.
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
static char sccsid[] = "@(#)output.c 8.1 (Berkeley) 6/5/93";
|
static char sccsid[] = "@(#)output.c 8.1 (Berkeley) 6/5/93";
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__RCSID("$NetBSD: output.c,v 1.15 1998/06/02 18:02:55 thorpej Exp $");
|
__RCSID("$NetBSD: output.c,v 1.16 1998/10/25 14:56:08 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
@ -153,7 +153,7 @@ output(enum output_type type,
|
||||||
msg = "Send mcast";
|
msg = "Send mcast";
|
||||||
if (rip_sock_mcast != ifp) {
|
if (rip_sock_mcast != ifp) {
|
||||||
#ifdef MCAST_PPP_BUG
|
#ifdef MCAST_PPP_BUG
|
||||||
/* Do not specifiy the primary interface
|
/* Do not specify the primary interface
|
||||||
* explicitly if we have the multicast
|
* explicitly if we have the multicast
|
||||||
* point-to-point kernel bug, since the
|
* point-to-point kernel bug, since the
|
||||||
* kernel will do the wrong thing if the
|
* kernel will do the wrong thing if the
|
||||||
|
@ -213,7 +213,7 @@ output(enum output_type type,
|
||||||
|
|
||||||
|
|
||||||
/* Find the first key for a packet to send.
|
/* 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.
|
* the last key if they have all expired.
|
||||||
* If no key is ready yet, give up.
|
* If no key is ready yet, give up.
|
||||||
*/
|
*/
|
||||||
|
@ -263,23 +263,24 @@ clr_ws_buf(struct ws_buf *wb,
|
||||||
wb->n = wb->base;
|
wb->n = wb->base;
|
||||||
memset(wb->n, 0, NETS_LEN*sizeof(*wb->n));
|
memset(wb->n, 0, NETS_LEN*sizeof(*wb->n));
|
||||||
|
|
||||||
/* install authentication if appropriate
|
/* (start to) install authentication if appropriate
|
||||||
*/
|
*/
|
||||||
if (ap == 0)
|
if (ap == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
na = (struct netauth*)wb->n;
|
na = (struct netauth*)wb->n;
|
||||||
if (ap->type == RIP_AUTH_PW) {
|
if (ap->type == RIP_AUTH_PW) {
|
||||||
na->a_family = RIP_AF_AUTH;
|
na->a_family = RIP_AF_AUTH;
|
||||||
na->a_type = RIP_AUTH_PW;
|
na->a_type = RIP_AUTH_PW;
|
||||||
memmove(na->au.au_pw, ap->key, sizeof(na->au.au_pw));
|
memcpy(na->au.au_pw, ap->key, sizeof(na->au.au_pw));
|
||||||
wb->n++;
|
wb->n++;
|
||||||
|
|
||||||
} else if (ap->type == RIP_AUTH_MD5) {
|
} else if (ap->type == RIP_AUTH_MD5) {
|
||||||
na->a_family = RIP_AF_AUTH;
|
na->a_family = RIP_AF_AUTH;
|
||||||
na->a_type = RIP_AUTH_MD5;
|
na->a_type = RIP_AUTH_MD5;
|
||||||
na->au.a_md5.md5_keyid = ap->keyid;
|
na->au.a_md5.md5_keyid = ap->keyid;
|
||||||
na->au.a_md5.md5_auth_len = RIP_AUTH_PW_LEN;
|
na->au.a_md5.md5_auth_len = RIP_AUTH_MD5_LEN;
|
||||||
na->au.a_md5.md5_seqno = clk.tv_sec;
|
na->au.a_md5.md5_seqno = htonl(clk.tv_sec);
|
||||||
wb->n++;
|
wb->n++;
|
||||||
wb->lim--; /* make room for trailer */
|
wb->lim--; /* make room for trailer */
|
||||||
}
|
}
|
||||||
|
@ -292,17 +293,18 @@ end_md5_auth(struct ws_buf *wb,
|
||||||
{
|
{
|
||||||
struct netauth *na, *na2;
|
struct netauth *na, *na2;
|
||||||
MD5_CTX md5_ctx;
|
MD5_CTX md5_ctx;
|
||||||
|
int len;
|
||||||
|
|
||||||
|
|
||||||
na = (struct netauth*)wb->base;
|
na = (struct netauth*)wb->base;
|
||||||
na2 = (struct netauth*)wb->n;
|
na2 = (struct netauth*)wb->n;
|
||||||
|
len = (char *)na2-(char *)wb->buf;
|
||||||
na2->a_family = RIP_AF_AUTH;
|
na2->a_family = RIP_AF_AUTH;
|
||||||
na2->a_type = 1;
|
na2->a_type = htons(1);
|
||||||
memmove(na2->au.au_pw, ap->key, sizeof(na2->au.au_pw));
|
na->au.a_md5.md5_pkt_len = htons(len);
|
||||||
na->au.a_md5.md5_pkt_len = (char *)na2-(char *)(na+1);
|
|
||||||
MD5Init(&md5_ctx);
|
MD5Init(&md5_ctx);
|
||||||
MD5Update(&md5_ctx, (u_char *)na,
|
MD5Update(&md5_ctx, (u_char *)wb->buf, len);
|
||||||
(char *)(na2+1) - (char *)na);
|
MD5Update(&md5_ctx, ap->key, RIP_AUTH_MD5_LEN);
|
||||||
MD5Final(na2->au.au_pw, &md5_ctx);
|
MD5Final(na2->au.au_pw, &md5_ctx);
|
||||||
wb->n++;
|
wb->n++;
|
||||||
}
|
}
|
||||||
|
@ -314,7 +316,7 @@ static void
|
||||||
supply_write(struct ws_buf *wb)
|
supply_write(struct ws_buf *wb)
|
||||||
{
|
{
|
||||||
/* Output multicast only if legal.
|
/* 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.
|
* packet.
|
||||||
*/
|
*/
|
||||||
switch (wb->type) {
|
switch (wb->type) {
|
||||||
|
@ -446,7 +448,8 @@ supply_out(struct ag_info *ag)
|
||||||
*/
|
*/
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
static int
|
static int
|
||||||
walk_supply(struct radix_node *rn, struct walkarg *argp)
|
walk_supply(struct radix_node *rn,
|
||||||
|
struct walkarg *argp)
|
||||||
{
|
{
|
||||||
#define RT ((struct rt_entry *)rn)
|
#define RT ((struct rt_entry *)rn)
|
||||||
u_short ags;
|
u_short ags;
|
||||||
|
@ -588,7 +591,7 @@ walk_supply(struct radix_node *rn, struct walkarg *argp)
|
||||||
* should knows them as well as we do.
|
* should knows them as well as we do.
|
||||||
*
|
*
|
||||||
* Notice spare routes with the same metric that we are about to
|
* Notice spare routes with the same metric that we are about to
|
||||||
* advertise, to split the horizon on redunant, inactive paths.
|
* advertise, to split the horizon on redundant, inactive paths.
|
||||||
*/
|
*/
|
||||||
if (ws.ifp != 0
|
if (ws.ifp != 0
|
||||||
&& !(ws.state & WS_ST_QUERY)
|
&& !(ws.state & WS_ST_QUERY)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: parms.c,v 1.11 1998/06/02 18:02:55 thorpej Exp $ */
|
/* $NetBSD: parms.c,v 1.12 1998/10/25 14:56:08 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1983, 1993
|
* Copyright (c) 1983, 1993
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
* must display the following acknowledgement:
|
* must display the following acknowledgment:
|
||||||
* This product includes software developed by the University of
|
* This product includes software developed by the University of
|
||||||
* California, Berkeley and its contributors.
|
* California, Berkeley and its contributors.
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
static char sccsid[] = "@(#)if.c 8.1 (Berkeley) 6/5/93";
|
static char sccsid[] = "@(#)if.c 8.1 (Berkeley) 6/5/93";
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__RCSID("$NetBSD: parms.c,v 1.11 1998/06/02 18:02:55 thorpej Exp $");
|
__RCSID("$NetBSD: parms.c,v 1.12 1998/10/25 14:56:08 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
@ -77,7 +77,7 @@ get_parms(struct interface *ifp)
|
||||||
if (parmp->parm_auth[0].type == RIP_AUTH_NONE
|
if (parmp->parm_auth[0].type == RIP_AUTH_NONE
|
||||||
|| num_passwds >= MAX_AUTH_KEYS)
|
|| num_passwds >= MAX_AUTH_KEYS)
|
||||||
break;
|
break;
|
||||||
memmove(&ifp->int_auth[num_passwds++],
|
memcpy(&ifp->int_auth[num_passwds++],
|
||||||
&parmp->parm_auth[i],
|
&parmp->parm_auth[i],
|
||||||
sizeof(ifp->int_auth[0]));
|
sizeof(ifp->int_auth[0]));
|
||||||
}
|
}
|
||||||
|
@ -371,8 +371,7 @@ parse_quote(char **linep, /* look here */
|
||||||
char *buf, /* copy token to here */
|
char *buf, /* copy token to here */
|
||||||
int lim) /* at most this many bytes */
|
int lim) /* at most this many bytes */
|
||||||
{
|
{
|
||||||
char c = '\0';
|
char c = '\0', *pc, *p;
|
||||||
char *pc, *p;
|
|
||||||
|
|
||||||
|
|
||||||
pc = *linep;
|
pc = *linep;
|
||||||
|
@ -384,7 +383,7 @@ parse_quote(char **linep, /* look here */
|
||||||
if (c == '\0')
|
if (c == '\0')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (c == '\\' && pc != '\0') {
|
if (c == '\\' && *pc != '\0') {
|
||||||
if ((c = *pc++) == 'n') {
|
if ((c = *pc++) == 'n') {
|
||||||
c = '\n';
|
c = '\n';
|
||||||
} else if (c == 'r') {
|
} else if (c == 'r') {
|
||||||
|
@ -435,7 +434,9 @@ parse_ts(time_t *tp,
|
||||||
u_int bufsize)
|
u_int bufsize)
|
||||||
{
|
{
|
||||||
struct tm tm;
|
struct tm tm;
|
||||||
|
#if defined(sgi) || defined(__NetBSD__)
|
||||||
char *ptr;
|
char *ptr;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (0 > parse_quote(valp, "| ,\n\r", delimp,
|
if (0 > parse_quote(valp, "| ,\n\r", delimp,
|
||||||
buf,bufsize)
|
buf,bufsize)
|
||||||
|
@ -446,12 +447,25 @@ parse_ts(time_t *tp,
|
||||||
}
|
}
|
||||||
strcat(buf,"\n");
|
strcat(buf,"\n");
|
||||||
memset(&tm, 0, sizeof(tm));
|
memset(&tm, 0, sizeof(tm));
|
||||||
|
#if defined(sgi) || defined(__NetBSD__)
|
||||||
ptr = strptime(buf, "%y/%m/%d@%H:%M\n", &tm);
|
ptr = strptime(buf, "%y/%m/%d@%H:%M\n", &tm);
|
||||||
if (ptr == NULL || *ptr != '\0') {
|
if (ptr == NULL || *ptr != '\0') {
|
||||||
sprintf(buf,"bad timestamp %.25s", val0);
|
sprintf(buf,"bad timestamp %.25s", val0);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
if (5 != sscanf(buf, "%u/%u/%u@%u:%u\n",
|
||||||
|
&tm.tm_year, &tm.tm_mon, &tm.tm_mday,
|
||||||
|
&tm.tm_hour, &tm.tm_min)
|
||||||
|
|| tm.tm_mon < 1 || tm.tm_mon > 12
|
||||||
|
|| tm.tm_mday < 1 || tm.tm_mday > 31) {
|
||||||
|
sprintf(buf,"bad timestamp %.25s", val0);
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
tm.tm_mon--;
|
||||||
|
if (tm.tm_year <= 37) /* assume small years are in the */
|
||||||
|
tm.tm_year += 100; /* 3rd millenium */
|
||||||
|
#endif
|
||||||
|
|
||||||
if ((*tp = mktime(&tm)) == -1) {
|
if ((*tp = mktime(&tm)) == -1) {
|
||||||
sprintf(buf,"bad timestamp %.25s", val0);
|
sprintf(buf,"bad timestamp %.25s", val0);
|
||||||
|
@ -469,7 +483,7 @@ static char * /* 0 or error message */
|
||||||
get_passwd(char *tgt,
|
get_passwd(char *tgt,
|
||||||
char *val,
|
char *val,
|
||||||
struct parm *parmp,
|
struct parm *parmp,
|
||||||
u_char type,
|
u_int16_t type,
|
||||||
int safe) /* 1=from secure file */
|
int safe) /* 1=from secure file */
|
||||||
{
|
{
|
||||||
static char buf[80];
|
static char buf[80];
|
||||||
|
@ -569,11 +583,10 @@ parse_parms(char *line,
|
||||||
struct r1net *r1netp;
|
struct r1net *r1netp;
|
||||||
struct tgate *tg;
|
struct tgate *tg;
|
||||||
naddr addr, mask;
|
naddr addr, mask;
|
||||||
char delim, *val0, *tgt, *val, *p;
|
char delim, *val0 = 0, *tgt, *val, *p;
|
||||||
char buf[BUFSIZ], buf2[BUFSIZ];
|
char buf[BUFSIZ], buf2[BUFSIZ];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
val0 = NULL; /* XXX gcc -Wuninitialized */
|
|
||||||
|
|
||||||
/* "subnet=x.y.z.u/mask[,metric]" must be alone on the line */
|
/* "subnet=x.y.z.u/mask[,metric]" must be alone on the line */
|
||||||
if (!strncasecmp(line, "subnet=", sizeof("subnet=")-1)
|
if (!strncasecmp(line, "subnet=", sizeof("subnet=")-1)
|
||||||
|
@ -602,7 +615,10 @@ parse_parms(char *line,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* "ripv1_mask=x.y.z.u/mask,mask" must be alone on the line */
|
/* "ripv1_mask=x.y.z.u/mask1,mask2" must be alone on the line.
|
||||||
|
* This requires that x.y.z.u/mask1 be considered a subnet of
|
||||||
|
* x.y.z.u/mask2, as if x.y.z.u/mask2 were a class-full network.
|
||||||
|
*/
|
||||||
if (!strncasecmp(line, "ripv1_mask=", sizeof("ripv1_mask=")-1)
|
if (!strncasecmp(line, "ripv1_mask=", sizeof("ripv1_mask=")-1)
|
||||||
&& *(val = &line[sizeof("ripv1_mask=")-1]) != '\0') {
|
&& *(val = &line[sizeof("ripv1_mask=")-1]) != '\0') {
|
||||||
if (0 > parse_quote(&val, ",", &delim, buf, sizeof(buf))
|
if (0 > parse_quote(&val, ",", &delim, buf, sizeof(buf))
|
||||||
|
@ -616,7 +632,7 @@ parse_parms(char *line,
|
||||||
r1netp->r1net_mask = HOST_MASK << (32-i);
|
r1netp->r1net_mask = HOST_MASK << (32-i);
|
||||||
if (!getnet(buf, &r1netp->r1net_net, &r1netp->r1net_match)
|
if (!getnet(buf, &r1netp->r1net_net, &r1netp->r1net_match)
|
||||||
|| r1netp->r1net_net == RIP_DEFAULT
|
|| r1netp->r1net_net == RIP_DEFAULT
|
||||||
|| r1netp->r1net_mask < r1netp->r1net_match) {
|
|| r1netp->r1net_mask > r1netp->r1net_match) {
|
||||||
free(r1netp);
|
free(r1netp);
|
||||||
return bad_str(line);
|
return bad_str(line);
|
||||||
}
|
}
|
||||||
|
@ -778,7 +794,7 @@ parse_parms(char *line,
|
||||||
tg = (struct tgate *)rtmalloc(sizeof(*tg),
|
tg = (struct tgate *)rtmalloc(sizeof(*tg),
|
||||||
"parse_parms"
|
"parse_parms"
|
||||||
"trust_gateway");
|
"trust_gateway");
|
||||||
bzero(tg, sizeof(*tg));
|
memset(tg, 0, sizeof(*tg));
|
||||||
tg->tgate_addr = addr;
|
tg->tgate_addr = addr;
|
||||||
i = 0;
|
i = 0;
|
||||||
/* The default is to trust all routes. */
|
/* The default is to trust all routes. */
|
||||||
|
@ -882,7 +898,7 @@ check_parms(struct parm *new)
|
||||||
* they affect the result in the order the operator specified.
|
* they affect the result in the order the operator specified.
|
||||||
*/
|
*/
|
||||||
parmp = (struct parm*)rtmalloc(sizeof(*parmp), "check_parms");
|
parmp = (struct parm*)rtmalloc(sizeof(*parmp), "check_parms");
|
||||||
memmove(parmp, new, sizeof(*parmp));
|
memcpy(parmp, new, sizeof(*parmp));
|
||||||
*parmpp = parmp;
|
*parmpp = parmp;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -994,7 +1010,7 @@ gethost(char *name,
|
||||||
|
|
||||||
hp = gethostbyname(name);
|
hp = gethostbyname(name);
|
||||||
if (hp) {
|
if (hp) {
|
||||||
memmove(addrp, hp->h_addr, sizeof(*addrp));
|
memcpy(addrp, hp->h_addr, sizeof(*addrp));
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: pathnames.h,v 1.8 1996/09/24 16:24:18 christos Exp $ */
|
/* $NetBSD: pathnames.h,v 1.9 1998/10/25 14:56:08 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1989, 1993
|
* Copyright (c) 1989, 1993
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
* must display the following acknowledgement:
|
* must display the following acknowledgment:
|
||||||
* This product includes software developed by the University of
|
* This product includes software developed by the University of
|
||||||
* California, Berkeley and its contributors.
|
* California, Berkeley and its contributors.
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
*
|
*
|
||||||
* @(#)pathnames.h 8.1 (Berkeley) 6/5/93
|
* @(#)pathnames.h 8.1 (Berkeley) 6/5/93
|
||||||
*
|
*
|
||||||
* $NetBSD: pathnames.h,v 1.8 1996/09/24 16:24:18 christos Exp $
|
* $NetBSD: pathnames.h,v 1.9 1998/10/25 14:56:08 christos Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <paths.h>
|
#include <paths.h>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: radix.c,v 1.6 1997/09/16 07:29:56 lukem Exp $ */
|
/* $NetBSD: radix.c,v 1.7 1998/10/25 14:56:08 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988, 1989, 1993
|
* Copyright (c) 1988, 1989, 1993
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
* must display the following acknowledgement:
|
* must display the following acknowledgment:
|
||||||
* This product includes software developed by the University of
|
* This product includes software developed by the University of
|
||||||
* California, Berkeley and its contributors.
|
* California, Berkeley and its contributors.
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
static char sccsid[] = "@(#)rdisc.c 8.1 (Berkeley) x/y/95";
|
static char sccsid[] = "@(#)rdisc.c 8.1 (Berkeley) x/y/95";
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__RCSID("$NetBSD: radix.c,v 1.6 1997/09/16 07:29:56 lukem Exp $");
|
__RCSID("$NetBSD: radix.c,v 1.7 1998/10/25 14:56:08 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
@ -63,7 +63,7 @@ static char *rn_zeros, *rn_ones;
|
||||||
#define Bcmp(a, b, l) (l == 0 ? 0 \
|
#define Bcmp(a, b, l) (l == 0 ? 0 \
|
||||||
: memcmp((caddr_t)(a), (caddr_t)(b), (size_t)l))
|
: memcmp((caddr_t)(a), (caddr_t)(b), (size_t)l))
|
||||||
|
|
||||||
static int rn_satsifies_leaf(char *, struct radix_node *, int);
|
static int rn_satisfies_leaf(char *, struct radix_node *, int);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The data structure for the keys is a radix tree with one way
|
* The data structure for the keys is a radix tree with one way
|
||||||
|
@ -179,7 +179,7 @@ rn_lookup(void *v_arg, void *m_arg, struct radix_node_head *head)
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
rn_satsifies_leaf(char *trial,
|
rn_satisfies_leaf(char *trial,
|
||||||
struct radix_node *leaf,
|
struct radix_node *leaf,
|
||||||
int skip)
|
int skip)
|
||||||
{
|
{
|
||||||
|
@ -272,7 +272,7 @@ on2:
|
||||||
*/
|
*/
|
||||||
if ((saved_t = t)->rn_mask == 0)
|
if ((saved_t = t)->rn_mask == 0)
|
||||||
t = t->rn_dupedkey;
|
t = t->rn_dupedkey;
|
||||||
for (; t; t = t->rn_dupedkey)
|
for (; t; t = t->rn_dupedkey) {
|
||||||
/*
|
/*
|
||||||
* Even if we don't match exactly as a host,
|
* Even if we don't match exactly as a host,
|
||||||
* we may match if the leaf we wound up at is
|
* we may match if the leaf we wound up at is
|
||||||
|
@ -281,8 +281,10 @@ on2:
|
||||||
if (t->rn_flags & RNF_NORMAL) {
|
if (t->rn_flags & RNF_NORMAL) {
|
||||||
if (rn_b <= t->rn_b)
|
if (rn_b <= t->rn_b)
|
||||||
return t;
|
return t;
|
||||||
} else if (rn_satsifies_leaf(v, t, matched_off))
|
} else if (rn_satisfies_leaf(v, t, matched_off)) {
|
||||||
return t;
|
return t;
|
||||||
|
}
|
||||||
|
}
|
||||||
t = saved_t;
|
t = saved_t;
|
||||||
/* start searching up the tree */
|
/* start searching up the tree */
|
||||||
do {
|
do {
|
||||||
|
@ -304,7 +306,7 @@ on2:
|
||||||
x = rn_search_m(v, t, m->rm_mask);
|
x = rn_search_m(v, t, m->rm_mask);
|
||||||
while (x && x->rn_mask != m->rm_mask)
|
while (x && x->rn_mask != m->rm_mask)
|
||||||
x = x->rn_dupedkey;
|
x = x->rn_dupedkey;
|
||||||
if (x && rn_satsifies_leaf(v, x, off))
|
if (x && rn_satisfies_leaf(v, x, off))
|
||||||
return x;
|
return x;
|
||||||
}
|
}
|
||||||
} while ((m = m->rm_mklist));
|
} while ((m = m->rm_mklist));
|
||||||
|
@ -443,9 +445,9 @@ rn_addmask(void *n_arg, int search, int skip)
|
||||||
x = 0;
|
x = 0;
|
||||||
if (x || search)
|
if (x || search)
|
||||||
return (x);
|
return (x);
|
||||||
R_Malloc(x, struct radix_node *, max_keylen + 2 * sizeof (*x));
|
x = (struct radix_node *)rtmalloc(max_keylen + 2*sizeof(*x),
|
||||||
if ((saved_x = x) == 0)
|
"rn_addmask");
|
||||||
return (0);
|
saved_x = x;
|
||||||
Bzero(x, max_keylen + 2 * sizeof (*x));
|
Bzero(x, max_keylen + 2 * sizeof (*x));
|
||||||
netmask = cp = (caddr_t)(x + 2);
|
netmask = cp = (caddr_t)(x + 2);
|
||||||
Bcopy(addmask_key, cp, mlen);
|
Bcopy(addmask_key, cp, mlen);
|
||||||
|
@ -851,9 +853,7 @@ rn_inithead(void **head, int off)
|
||||||
struct radix_node *t, *tt, *ttt;
|
struct radix_node *t, *tt, *ttt;
|
||||||
if (*head)
|
if (*head)
|
||||||
return (1);
|
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));
|
Bzero(rnh, sizeof (*rnh));
|
||||||
*head = rnh;
|
*head = rnh;
|
||||||
t = rn_newpair(rn_zeros, off, rnh->rnh_nodes);
|
t = rn_newpair(rn_zeros, off, rnh->rnh_nodes);
|
||||||
|
@ -882,9 +882,7 @@ rn_init(void)
|
||||||
printf("rn_init: radix functions require max_keylen be set\n");
|
printf("rn_init: radix functions require max_keylen be set\n");
|
||||||
return;
|
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);
|
Bzero(rn_zeros, 3 * max_keylen);
|
||||||
rn_ones = cp = rn_zeros + max_keylen;
|
rn_ones = cp = rn_zeros + max_keylen;
|
||||||
addmask_key = cplim = rn_ones + max_keylen;
|
addmask_key = cplim = rn_ones + max_keylen;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: radix.h,v 1.4 1997/09/15 10:38:18 lukem Exp $ */
|
/* $NetBSD: radix.h,v 1.5 1998/10/25 14:56:08 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1988, 1989, 1993
|
* Copyright (c) 1988, 1989, 1993
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
* must display the following acknowledgement:
|
* must display the following acknowledgment:
|
||||||
* This product includes software developed by the University of
|
* This product includes software developed by the University of
|
||||||
* California, Berkeley and its contributors.
|
* California, Berkeley and its contributors.
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
@ -104,7 +104,7 @@ extern struct radix_mask {
|
||||||
m = rn_mkfreelist; \
|
m = rn_mkfreelist; \
|
||||||
rn_mkfreelist = (m)->rm_mklist; \
|
rn_mkfreelist = (m)->rm_mklist; \
|
||||||
} else \
|
} 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);}
|
#define MKFree(m) { (m)->rm_mklist = rn_mkfreelist; rn_mkfreelist = (m);}
|
||||||
|
|
||||||
|
@ -139,7 +139,6 @@ struct radix_node_head {
|
||||||
#define Bcmp(a, b, n) memcmp(((void *)(a)), ((void *)(b)), (n))
|
#define Bcmp(a, b, n) memcmp(((void *)(a)), ((void *)(b)), (n))
|
||||||
#define Bcopy(a, b, n) memmove(((void *)(b)), ((void *)(a)), (size_t)(n))
|
#define Bcopy(a, b, n) memmove(((void *)(b)), ((void *)(a)), (size_t)(n))
|
||||||
#define Bzero(p, n) memset((void *)(p), 0, (size_t)(n));
|
#define Bzero(p, n) memset((void *)(p), 0, (size_t)(n));
|
||||||
#define R_Malloc(p, t, n) (p = (t) malloc((size_t)(n)))
|
|
||||||
#define Free(p) free((void *)p);
|
#define Free(p) free((void *)p);
|
||||||
|
|
||||||
void rn_init __P((void));
|
void rn_init __P((void));
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: rdisc.c,v 1.7 1998/06/02 18:02:56 thorpej Exp $ */
|
/* $NetBSD: rdisc.c,v 1.8 1998/10/25 14:56:08 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1995
|
* Copyright (c) 1995
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
* must display the following acknowledgement:
|
* must display the following acknowledgment:
|
||||||
* This product includes software developed by the University of
|
* This product includes software developed by the University of
|
||||||
* California, Berkeley and its contributors.
|
* California, Berkeley and its contributors.
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
static char sccsid[] = "@(#)rdisc.c 8.1 (Berkeley) x/y/95";
|
static char sccsid[] = "@(#)rdisc.c 8.1 (Berkeley) x/y/95";
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__RCSID("$NetBSD: rdisc.c,v 1.7 1998/06/02 18:02:56 thorpej Exp $");
|
__RCSID("$NetBSD: rdisc.c,v 1.8 1998/10/25 14:56:08 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
@ -83,7 +83,7 @@ int rdisc_sock = -1; /* router-discovery raw socket */
|
||||||
struct interface *rdisc_sock_mcast; /* current multicast interface */
|
struct interface *rdisc_sock_mcast; /* current multicast interface */
|
||||||
|
|
||||||
struct timeval rdisc_timer;
|
struct timeval rdisc_timer;
|
||||||
int rdisc_ok; /* using solicted route */
|
int rdisc_ok; /* using solicited route */
|
||||||
|
|
||||||
|
|
||||||
#define MAX_ADS 16 /* at least one per interface */
|
#define MAX_ADS 16 /* at least one per interface */
|
||||||
|
@ -264,7 +264,7 @@ set_supplier(void)
|
||||||
if (supplier_set)
|
if (supplier_set)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
trace_act("start suppying routes");
|
trace_act("start supplying routes");
|
||||||
|
|
||||||
/* Forget discovered routes.
|
/* Forget discovered routes.
|
||||||
*/
|
*/
|
||||||
|
@ -306,7 +306,7 @@ rdisc_age(naddr bad_gate)
|
||||||
struct dr *drp;
|
struct dr *drp;
|
||||||
|
|
||||||
|
|
||||||
/* If only adverising, then do only that. */
|
/* If only advertising, then do only that. */
|
||||||
if (supplier) {
|
if (supplier) {
|
||||||
/* If switching from client to server, get rid of old
|
/* If switching from client to server, get rid of old
|
||||||
* default routes.
|
* default routes.
|
||||||
|
@ -319,7 +319,7 @@ rdisc_age(naddr bad_gate)
|
||||||
|
|
||||||
/* If we are being told about a bad router,
|
/* If we are being told about a bad router,
|
||||||
* then age the discovered default route, and if there is
|
* then age the discovered default route, and if there is
|
||||||
* no alternative, solicite a replacement.
|
* no alternative, solicit a replacement.
|
||||||
*/
|
*/
|
||||||
if (bad_gate != 0) {
|
if (bad_gate != 0) {
|
||||||
/* Look for the bad discovered default route.
|
/* Look for the bad discovered default route.
|
||||||
|
@ -457,15 +457,13 @@ rdisc_sort(void)
|
||||||
struct rt_entry *rt;
|
struct rt_entry *rt;
|
||||||
struct rt_spare new;
|
struct rt_spare new;
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
u_int new_st;
|
u_int new_st = 0;
|
||||||
n_long new_pref;
|
n_long new_pref = 0;
|
||||||
|
|
||||||
|
|
||||||
/* Find the best discovered route.
|
/* Find the best discovered route.
|
||||||
*/
|
*/
|
||||||
new_drp = 0;
|
new_drp = 0;
|
||||||
new_st = 0;
|
|
||||||
new_pref = 0;
|
|
||||||
for (drp = drs; drp < &drs[MAX_ADS]; drp++) {
|
for (drp = drs; drp < &drs[MAX_ADS]; drp++) {
|
||||||
if (drp->dr_ts == 0)
|
if (drp->dr_ts == 0)
|
||||||
continue;
|
continue;
|
||||||
|
@ -543,7 +541,7 @@ rdisc_sort(void)
|
||||||
new_drp->dr_ifp->int_name);
|
new_drp->dr_ifp->int_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
bzero(&new, sizeof(new));
|
memset(&new, 0, sizeof(new));
|
||||||
new.rts_ifp = new_drp->dr_ifp;
|
new.rts_ifp = new_drp->dr_ifp;
|
||||||
new.rts_gate = new_drp->dr_gate;
|
new.rts_gate = new_drp->dr_gate;
|
||||||
new.rts_router = new_drp->dr_gate;
|
new.rts_router = new_drp->dr_gate;
|
||||||
|
@ -637,7 +635,7 @@ parse_ad(naddr from,
|
||||||
new_drp = drp;
|
new_drp = drp;
|
||||||
|
|
||||||
} else if (new_drp->dr_ts != 0) {
|
} 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)
|
if ((!(new_drp->dr_ifp->int_state & IS_SICK)
|
||||||
&& (drp->dr_ifp->int_state & IS_SICK))
|
&& (drp->dr_ifp->int_state & IS_SICK))
|
||||||
|
@ -741,7 +739,7 @@ send_rdisc(union ad_u *p,
|
||||||
if (rdisc_sock_mcast != ifp) {
|
if (rdisc_sock_mcast != ifp) {
|
||||||
/* select the right interface. */
|
/* select the right interface. */
|
||||||
#ifdef MCAST_PPP_BUG
|
#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
|
* if we have the multicast point-to-point kernel
|
||||||
* bug, since the kernel will do the wrong thing
|
* bug, since the kernel will do the wrong thing
|
||||||
* if the local address of a point-to-point link
|
* if the local address of a point-to-point link
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.\" $NetBSD: routed.8,v 1.21 1998/10/21 13:58:32 lukem Exp $
|
.\" $NetBSD: routed.8,v 1.22 1998/10/25 14:56:08 christos Exp $
|
||||||
.\"
|
.\"
|
||||||
.\" Copyright (c) 1983, 1991, 1993
|
.\" Copyright (c) 1983, 1991, 1993
|
||||||
.\" The Regents of the University of California. All rights reserved.
|
.\" The Regents of the University of California. All rights reserved.
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
.\" notice, this list of conditions and the following disclaimer in the
|
.\" notice, this list of conditions and the following disclaimer in the
|
||||||
.\" documentation and/or other materials provided with the distribution.
|
.\" documentation and/or other materials provided with the distribution.
|
||||||
.\" 3. All advertising materials mentioning features or use of this software
|
.\" 3. All advertising materials mentioning features or use of this software
|
||||||
.\" must display the following acknowledgement:
|
.\" must display the following acknowledgment:
|
||||||
.\" This product includes software developed by the University of
|
.\" This product includes software developed by the University of
|
||||||
.\" California, Berkeley and its contributors.
|
.\" California, Berkeley and its contributors.
|
||||||
.\" 4. Neither the name of the University nor the names of its contributors
|
.\" 4. Neither the name of the University nor the names of its contributors
|
||||||
|
@ -165,7 +165,7 @@ of ICMP Redirect messages are deleted after a while to minimize
|
||||||
.Em black-holes .
|
.Em black-holes .
|
||||||
When a TCP connection suffers a timeout,
|
When a TCP connection suffers a timeout,
|
||||||
the kernel tells
|
the kernel tells
|
||||||
.Nm "" ,
|
.Nm Ns ,
|
||||||
which deletes all redirected routes
|
which deletes all redirected routes
|
||||||
through the gateway involved, advances the age of all RIP routes through
|
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
|
the gateway to allow an alternate to be chosen, and advances of the
|
||||||
|
@ -217,6 +217,16 @@ in the
|
||||||
.Pa /etc/gateways
|
.Pa /etc/gateways
|
||||||
file.
|
file.
|
||||||
.Pp
|
.Pp
|
||||||
|
While using Router Discovery (which happens by default when
|
||||||
|
the system has a single network interface and a Router Discover Advertisement
|
||||||
|
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 \f3\-q\f1 might need
|
||||||
|
.Cm no_rdisc
|
||||||
|
described below.
|
||||||
|
.Pp
|
||||||
See the
|
See the
|
||||||
.Cm pm_rdisc
|
.Cm pm_rdisc
|
||||||
facility described below to support "legacy" systems
|
facility described below to support "legacy" systems
|
||||||
|
@ -229,11 +239,10 @@ or PPP, with the IFF_POINTOPOINT flag) is used by
|
||||||
.Nm
|
.Nm
|
||||||
to infer the netmask used by the remote system when RIPv1 is used.
|
to infer the netmask used by the remote system when RIPv1 is used.
|
||||||
.Pp
|
.Pp
|
||||||
Options supported by
|
The following options are available:
|
||||||
.Nm "" :
|
.Bl -tag -width indent
|
||||||
.Bl -tag -width Ds
|
|
||||||
.It Fl s
|
.It Fl s
|
||||||
this option forces
|
force
|
||||||
.Nm
|
.Nm
|
||||||
to supply routing information.
|
to supply routing information.
|
||||||
This is the default if multiple network interfaces are present on which
|
This is the default if multiple network interfaces are present on which
|
||||||
|
@ -245,10 +254,10 @@ is the opposite of the
|
||||||
option.
|
option.
|
||||||
This is the default when only one interface is present.
|
This is the default when only one interface is present.
|
||||||
.It Fl d
|
.It Fl d
|
||||||
Do not run in the background.
|
do not run in the background.
|
||||||
This option is meant for interactive use.
|
This option is meant for interactive use.
|
||||||
.It Fl g
|
.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.
|
to the "default" destination.
|
||||||
It is equivalent to
|
It is equivalent to
|
||||||
.Fl F
|
.Fl F
|
||||||
|
@ -257,7 +266,8 @@ and is present mostly for historical reasons.
|
||||||
A better choice is
|
A better choice is
|
||||||
.Fl P Cm pm_rdisc
|
.Fl P Cm pm_rdisc
|
||||||
on the command line or
|
on the command line or
|
||||||
.Cm pm_rdisc in the
|
.Cm pm_rdisc
|
||||||
|
in the
|
||||||
.Pa /etc/gateways
|
.Pa /etc/gateways
|
||||||
file.
|
file.
|
||||||
since a larger metric
|
since a larger metric
|
||||||
|
@ -270,13 +280,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
|
dangerous. It is more commonly accidentally used to create chaos with routing
|
||||||
loop than to solve problems.
|
loop than to solve problems.
|
||||||
.It Fl h
|
.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.
|
provided there is a network route going the same direction.
|
||||||
That is a limited kind of aggregation.
|
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.
|
machines connected with point-to-point links such as SLIP.
|
||||||
.It Fl m
|
.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.
|
its primary interface.
|
||||||
It is useful on multi-homed machines such as NFS servers.
|
It is useful on multi-homed machines such as NFS servers.
|
||||||
This option should not be used except when the cost of
|
This option should not be used except when the cost of
|
||||||
|
@ -297,7 +307,7 @@ However, it makes no sense and breaks using RIP as a discovery protocol
|
||||||
to ignore all RIPv2 packets that carry authentication when this machine
|
to ignore all RIPv2 packets that carry authentication when this machine
|
||||||
does not care about authentication.
|
does not care about authentication.
|
||||||
.It Fl t
|
.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
|
on the tracefile specified with
|
||||||
.Fl T
|
.Fl T
|
||||||
or standard out.
|
or standard out.
|
||||||
|
@ -313,10 +323,10 @@ command.
|
||||||
increases the debugging level to at least 1 and
|
increases the debugging level to at least 1 and
|
||||||
causes debugging information to be appended to the trace file.
|
causes debugging information to be appended to the trace file.
|
||||||
Note that because of security concerns, it is wisest to not run
|
Note that because of security concerns, it is wisest to not run
|
||||||
.Nm routed
|
.Nm
|
||||||
routinely with tracing directed to a file.
|
routinely with tracing directed to a file.
|
||||||
.It Fl v
|
.It Fl v
|
||||||
displays and logs the version of daemon.
|
display and logs the version of daemon.
|
||||||
.It Fl F Ar net[/mask][,metric]
|
.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 ,
|
.Em net/mask ,
|
||||||
|
@ -406,9 +416,9 @@ routing table nor are they included in routing updates.
|
||||||
The function of external entries is to indicate
|
The function of external entries is to indicate
|
||||||
that another routing process
|
that another routing process
|
||||||
will install such a route if necessary,
|
will install such a route if necessary,
|
||||||
and that alternative routes to that destination should not be installed
|
and that other routes to that destination should not be installed
|
||||||
by
|
by
|
||||||
.Nm "" .
|
.Nm Ns .
|
||||||
Such entries are only required when both routers may learn of routes
|
Such entries are only required when both routers may learn of routes
|
||||||
to the same destination.
|
to the same destination.
|
||||||
.Pp
|
.Pp
|
||||||
|
@ -455,9 +465,9 @@ or
|
||||||
or
|
or
|
||||||
.Xr named 8 ,
|
.Xr named 8 ,
|
||||||
must have been started before
|
must have been started before
|
||||||
.Nm "" Ns .)
|
.Nm Ns .)
|
||||||
.Pp
|
.Pp
|
||||||
.Ar mask
|
.Ar Mask
|
||||||
is an optional number between 1 and 32 indicating the netmask associated
|
is an optional number between 1 and 32 indicating the netmask associated
|
||||||
with
|
with
|
||||||
.Ar Nname .
|
.Ar Nname .
|
||||||
|
@ -468,7 +478,7 @@ be forwarded.
|
||||||
.Pp
|
.Pp
|
||||||
.Ar Value
|
.Ar Value
|
||||||
is the hop count to the destination host or network.
|
is the hop count to the destination host or network.
|
||||||
.Ar " host hname "
|
.Ar " Host hname "
|
||||||
is equivalent to
|
is equivalent to
|
||||||
.Ar " net nname/32 ".
|
.Ar " net nname/32 ".
|
||||||
.Pp
|
.Pp
|
||||||
|
@ -522,7 +532,7 @@ is
|
||||||
a subnet should be
|
a subnet should be
|
||||||
.Cm mask2 .
|
.Cm mask2 .
|
||||||
For example \f2ripv1_mask=192.0.2.16/28,27\f1 marks 192.0.2.16/28
|
For example \f2ripv1_mask=192.0.2.16/28,27\f1 marks 192.0.2.16/28
|
||||||
as a subnet of 192.0.2.0/28 instead of 192.0.2.0/24.
|
as a subnet of 192.0.2.0/27 instead of 192.0.2.0/24.
|
||||||
.It Cm passwd Ns \&= Ns Ar XXX[|KeyID[start|stop]]
|
.It Cm passwd Ns \&= Ns Ar XXX[|KeyID[start|stop]]
|
||||||
specifies a RIPv2 cleartext password that will be included on
|
specifies a RIPv2 cleartext password that will be included on
|
||||||
all RIPv2 responses sent, and checked on all RIPv2 responses received.
|
all RIPv2 responses sent, and checked on all RIPv2 responses received.
|
||||||
|
@ -549,7 +559,7 @@ To protect the secrets, the passwd settings are valid only in the
|
||||||
.Em /etc/gateways
|
.Em /etc/gateways
|
||||||
file and only when that file is readable only by UID 0.
|
file and only when that file is readable only by UID 0.
|
||||||
.It Cm md5_passwd Ns \&= Ns Ar XXX|KeyID[start|stop]
|
.It Cm md5_passwd Ns \&= Ns Ar XXX|KeyID[start|stop]
|
||||||
specifes a RIPv2 MD5 password.
|
specifies a RIPv2 MD5 password.
|
||||||
Except that a
|
Except that a
|
||||||
.Cm KeyID
|
.Cm KeyID
|
||||||
is required, this keyword is similar to
|
is required, this keyword is similar to
|
||||||
|
@ -566,6 +576,7 @@ disables all RIP processing on the specified interface.
|
||||||
If no interfaces are allowed to process RIP packets,
|
If no interfaces are allowed to process RIP packets,
|
||||||
.Nm
|
.Nm
|
||||||
acts purely as a router discovery daemon.
|
acts purely as a router discovery daemon.
|
||||||
|
.Pp
|
||||||
Note that turning off RIP without explicitly turning on router
|
Note that turning off RIP without explicitly turning on router
|
||||||
discovery advertisements with
|
discovery advertisements with
|
||||||
.Cm rdisc_adv
|
.Cm rdisc_adv
|
||||||
|
@ -597,11 +608,11 @@ specifies that Router Discovery solicitations should be sent,
|
||||||
even on point-to-point links,
|
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 no_rdisc_adv
|
.It Cm no_rdisc_adv
|
||||||
disables the transmission of Router Discovery Advertisements
|
disables the transmission of Router Discovery Advertisements.
|
||||||
.It Cm rdisc_adv
|
.It Cm rdisc_adv
|
||||||
specifies that Router Discovery Advertisements should be sent,
|
specifies that Router Discovery Advertisements should be sent,
|
||||||
even on point-to-point links,
|
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
|
.It Cm bcast_rdisc
|
||||||
specifies that Router Discovery packets should be broadcast instead of
|
specifies that Router Discovery packets should be broadcast instead of
|
||||||
multicast.
|
multicast.
|
||||||
|
@ -618,7 +629,7 @@ are transmitted to N seconds and their lifetime to 3*N.
|
||||||
.It Cm fake_default Ns \&= Ns Ar metric
|
.It Cm fake_default Ns \&= Ns Ar metric
|
||||||
has an identical effect to
|
has an identical effect to
|
||||||
.Fl F Ar net[/mask][=metric]
|
.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
|
.It Cm pm_rdisc
|
||||||
is similar to
|
is similar to
|
||||||
.Cm fake_default .
|
.Cm fake_default .
|
||||||
|
@ -648,9 +659,9 @@ Otherwise, ICMP Redirect messages are overridden.
|
||||||
for distant gateways
|
for distant gateways
|
||||||
.El
|
.El
|
||||||
.Sh SEE ALSO
|
.Sh SEE ALSO
|
||||||
.Xr gated 8 ,
|
|
||||||
.Xr udp 4 ,
|
|
||||||
.Xr icmp 4 ,
|
.Xr icmp 4 ,
|
||||||
|
.Xr udp 4 ,
|
||||||
|
.Xr gated 8 ,
|
||||||
.Xr htable 8 ,
|
.Xr htable 8 ,
|
||||||
.Xr rtquery 8 .
|
.Xr rtquery 8 .
|
||||||
.Rs
|
.Rs
|
||||||
|
@ -659,8 +670,8 @@ for distant gateways
|
||||||
.%Q Xerox System Integration Standard
|
.%Q Xerox System Integration Standard
|
||||||
.Re
|
.Re
|
||||||
.Sh BUGS
|
.Sh BUGS
|
||||||
It does not always detect unidirectional failures in network interfaces
|
It does not always detect unidirectional failures in network interfaces,
|
||||||
(e.g. when the output side fails).
|
for example, when the output side fails.
|
||||||
.Sh HISTORY
|
.Sh HISTORY
|
||||||
The
|
The
|
||||||
.Nm
|
.Nm
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
.\" $NetBSD: rtquery.8,v 1.11 1998/08/18 18:03:28 msaitoh Exp $
|
.\" $NetBSD: rtquery.8,v 1.12 1998/10/25 14:56:09 christos Exp $
|
||||||
.\"
|
.\"
|
||||||
.Dd June 1, 1996
|
.Dd June 1, 1996
|
||||||
.Dt RTQUERY 8
|
.Dt RTQUERY 8
|
||||||
|
@ -65,35 +65,31 @@ and so answers completely.
|
||||||
is also used to turn tracing on or off in
|
is also used to turn tracing on or off in
|
||||||
.Xr routed 8 .
|
.Xr routed 8 .
|
||||||
.Pp
|
.Pp
|
||||||
Options supported by
|
The following options are available:
|
||||||
.Nm "" :
|
.Bl -tag -width indent
|
||||||
.Bl -tag -width Ds
|
|
||||||
.It Fl n
|
.It Fl n
|
||||||
Normally network and host numbers are displayed both symbolically
|
displays only the numeric network and host numbers instead of both
|
||||||
and numerically.
|
numeric and and symbolic.
|
||||||
The
|
|
||||||
.Fl n
|
|
||||||
option displays only the numeric network and host numbers.
|
|
||||||
.It Fl p
|
.It Fl p
|
||||||
Uses the
|
uses the
|
||||||
.Em poll
|
.Em poll
|
||||||
command to request full routing information from
|
command to request full routing information from
|
||||||
.Xr gated 8 .
|
.Xr gated 8 .
|
||||||
This is an undocumented extension RIP protocol supported only by
|
This is an undocumented extension RIP protocol supported only by
|
||||||
.Xr gated 8 .
|
.Xr gated 8 .
|
||||||
.It Fl 1
|
.It Fl 1
|
||||||
query using RIP version 1 instead of RIP version 2.
|
queries using RIP version 1 instead of RIP version 2.
|
||||||
.It Fl w Ar timeout
|
.It Fl w Ar timeout
|
||||||
changes the delay for an answer from each host.
|
changes the delay for an answer from each host.
|
||||||
By default, each host is given 15 seconds to respond.
|
By default, each host is given 15 seconds to respond.
|
||||||
.It Fl r Ar addr
|
.It Fl r Ar addr
|
||||||
ask about the route to destination
|
asks about the route to destination
|
||||||
.Em addr .
|
.Em addr .
|
||||||
.It Fl a Ar passwd=XXX
|
.It Fl a Ar passwd=XXX
|
||||||
.It Fl a Ar md5_passwd=XXX|KeyID
|
.It Fl a Ar md5_passwd=XXX|KeyID
|
||||||
cause the query to be sent with the indicated cleartext or MD5 password.
|
causes the query to be sent with the indicated cleartext or MD5 password.
|
||||||
.It Fl t Ar op
|
.It Fl t Ar op
|
||||||
change tracing, where
|
changes tracing, where
|
||||||
.Em op
|
.Em op
|
||||||
is one of the following.
|
is one of the following.
|
||||||
Requests from processes not running with UID 0 or on distant networks
|
Requests from processes not running with UID 0 or on distant networks
|
||||||
|
@ -103,7 +99,7 @@ is likely to ignore these debugging requests.
|
||||||
.El
|
.El
|
||||||
.Bl -tag -width Ds -offset indent-two
|
.Bl -tag -width Ds -offset indent-two
|
||||||
.It Em on=tracefile
|
.It Em on=tracefile
|
||||||
turn tracing on into the specified file.
|
turns tracing on into the specified file.
|
||||||
That file must usually have been specified when the daemon was
|
That file must usually have been specified when the daemon was
|
||||||
started or be the same as a fixed name, often
|
started or be the same as a fixed name, often
|
||||||
.Pa /etc/routed.trace .
|
.Pa /etc/routed.trace .
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: rtquery.c,v 1.8 1998/06/02 18:02:56 thorpej Exp $ */
|
/* $NetBSD: rtquery.c,v 1.9 1998/10/25 14:56:09 christos Exp $ */
|
||||||
|
|
||||||
/*-
|
/*-
|
||||||
* Copyright (c) 1982, 1986, 1993
|
* Copyright (c) 1982, 1986, 1993
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
* must display the following acknowledgement:
|
* must display the following acknowledgment:
|
||||||
* This product includes software developed by the University of
|
* This product includes software developed by the University of
|
||||||
* California, Berkeley and its contributors.
|
* California, Berkeley and its contributors.
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
@ -41,10 +41,11 @@ char copyright[] =
|
||||||
static char sccsid[] = "@(#)query.c 8.1 (Berkeley) 6/5/93";
|
static char sccsid[] = "@(#)query.c 8.1 (Berkeley) 6/5/93";
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__RCSID("$NetBSD: rtquery.c,v 1.8 1998/06/02 18:02:56 thorpej Exp $");
|
__RCSID("$NetBSD: rtquery.c,v 1.9 1998/10/25 14:56:09 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sys/param.h>
|
#include <sys/param.h>
|
||||||
|
#include <sys/cdefs.h>
|
||||||
#include <sys/protosw.h>
|
#include <sys/protosw.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <sys/time.h>
|
#include <sys/time.h>
|
||||||
|
@ -119,6 +120,7 @@ static void query_loop(char *argv[], int) __attribute((__noreturn__));
|
||||||
static int getnet(char *, struct netinfo *);
|
static int getnet(char *, struct netinfo *);
|
||||||
static u_int std_mask(u_int);
|
static u_int std_mask(u_int);
|
||||||
static int parse_quote(char **, char *, char *, char *, int);
|
static int parse_quote(char **, char *, char *, char *, int);
|
||||||
|
static void usage(void);
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -154,13 +156,13 @@ main(int argc,
|
||||||
wtime = (int)strtoul(optarg, &p, 0);
|
wtime = (int)strtoul(optarg, &p, 0);
|
||||||
if (*p != '\0'
|
if (*p != '\0'
|
||||||
|| wtime <= 0)
|
|| wtime <= 0)
|
||||||
goto usage;
|
usage();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
not_trace = 1;
|
not_trace = 1;
|
||||||
if (rflag)
|
if (rflag)
|
||||||
goto usage;
|
usage();
|
||||||
rflag = getnet(optarg, &OMSG.rip_nets[0]);
|
rflag = getnet(optarg, &OMSG.rip_nets[0]);
|
||||||
if (!rflag) {
|
if (!rflag) {
|
||||||
struct hostent *hp = gethostbyname(optarg);
|
struct hostent *hp = gethostbyname(optarg);
|
||||||
|
@ -170,7 +172,7 @@ main(int argc,
|
||||||
herror(0);
|
herror(0);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
memmove(&OMSG.rip_nets[0].n_dst, hp->h_addr,
|
memcpy(&OMSG.rip_nets[0].n_dst, hp->h_addr,
|
||||||
sizeof(OMSG.rip_nets[0].n_dst));
|
sizeof(OMSG.rip_nets[0].n_dst));
|
||||||
OMSG.rip_nets[0].n_family = RIP_AF_INET;
|
OMSG.rip_nets[0].n_family = RIP_AF_INET;
|
||||||
OMSG.rip_nets[0].n_mask = -1;
|
OMSG.rip_nets[0].n_mask = -1;
|
||||||
|
@ -198,28 +200,28 @@ main(int argc,
|
||||||
OMSG.rip_cmd = RIPCMD_TRACEON;
|
OMSG.rip_cmd = RIPCMD_TRACEON;
|
||||||
if (!value
|
if (!value
|
||||||
|| strlen(value) > MAXPATHLEN)
|
|| strlen(value) > MAXPATHLEN)
|
||||||
goto usage;
|
usage();
|
||||||
break;
|
break;
|
||||||
case TRACE_MORE:
|
case TRACE_MORE:
|
||||||
if (value)
|
if (value)
|
||||||
goto usage;
|
usage();
|
||||||
OMSG.rip_cmd = RIPCMD_TRACEON;
|
OMSG.rip_cmd = RIPCMD_TRACEON;
|
||||||
value = "";
|
value = "";
|
||||||
break;
|
break;
|
||||||
case TRACE_OFF:
|
case TRACE_OFF:
|
||||||
if (value)
|
if (value)
|
||||||
goto usage;
|
usage();
|
||||||
OMSG.rip_cmd = RIPCMD_TRACEOFF;
|
OMSG.rip_cmd = RIPCMD_TRACEOFF;
|
||||||
value = "";
|
value = "";
|
||||||
break;
|
break;
|
||||||
case TRACE_DUMP:
|
case TRACE_DUMP:
|
||||||
if (value)
|
if (value)
|
||||||
goto usage;
|
usage();
|
||||||
OMSG.rip_cmd = RIPCMD_TRACEON;
|
OMSG.rip_cmd = RIPCMD_TRACEON;
|
||||||
value = "dump/../table";
|
value = "dump/../table";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
goto usage;
|
usage();
|
||||||
}
|
}
|
||||||
strcpy((char*)OMSG.rip_tracefile, value);
|
strcpy((char*)OMSG.rip_tracefile, value);
|
||||||
omsg_len += strlen(value) - sizeof(OMSG.ripun);
|
omsg_len += strlen(value) - sizeof(OMSG.ripun);
|
||||||
|
@ -230,40 +232,34 @@ main(int argc,
|
||||||
not_trace = 1;
|
not_trace = 1;
|
||||||
p = strchr(optarg,'=');
|
p = strchr(optarg,'=');
|
||||||
if (!p)
|
if (!p)
|
||||||
goto usage;
|
usage();
|
||||||
*p++ = '\0';
|
*p++ = '\0';
|
||||||
if (!strcasecmp("passwd",optarg))
|
if (!strcasecmp("passwd",optarg))
|
||||||
auth_type = RIP_AUTH_PW;
|
auth_type = RIP_AUTH_PW;
|
||||||
else if (!strcasecmp("md5_passwd",optarg))
|
else if (!strcasecmp("md5_passwd",optarg))
|
||||||
auth_type = RIP_AUTH_MD5;
|
auth_type = RIP_AUTH_MD5;
|
||||||
else
|
else
|
||||||
goto usage;
|
usage();
|
||||||
if (0 > parse_quote(&p,"|",&delim,
|
if (0 > parse_quote(&p,"|",&delim,
|
||||||
passwd,sizeof(passwd)))
|
passwd,sizeof(passwd)))
|
||||||
goto usage;
|
usage();
|
||||||
if (auth_type == RIP_AUTH_MD5
|
if (auth_type == RIP_AUTH_MD5
|
||||||
&& delim == '|') {
|
&& delim == '|') {
|
||||||
keyid = strtoul(p+1,&p,0);
|
keyid = strtoul(p+1,&p,0);
|
||||||
if (keyid > 255 || *p != '\0')
|
if (keyid > 255 || *p != '\0')
|
||||||
goto usage;
|
usage();
|
||||||
} else if (delim != '\0') {
|
} else if (delim != '\0') {
|
||||||
goto usage;
|
usage();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
goto usage;
|
usage();
|
||||||
}
|
}
|
||||||
argv += optind;
|
argv += optind;
|
||||||
argc -= optind;
|
argc -= optind;
|
||||||
if (not_trace && trace) {
|
if (not_trace && trace)
|
||||||
usage: fprintf(stderr, "%s: [-np1] [-r tgt_rt] [-w wtime]"
|
usage();
|
||||||
" [-a type=passwd] host1 [host2 ...]\n"
|
|
||||||
"or\t-t {on=filename|more|off|dump}"
|
|
||||||
" host1 [host2 ...]\n",
|
|
||||||
pgmname);
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
if (argc == 0) {
|
if (argc == 0) {
|
||||||
argc = 1;
|
argc = 1;
|
||||||
argv = default_argv;
|
argv = default_argv;
|
||||||
|
@ -291,6 +287,19 @@ usage: fprintf(stderr, "%s: [-np1] [-r tgt_rt] [-w wtime]"
|
||||||
else
|
else
|
||||||
query_loop(argv, argc);
|
query_loop(argv, argc);
|
||||||
/* NOTREACHED */
|
/* NOTREACHED */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
static void
|
||||||
|
usage(void)
|
||||||
|
{
|
||||||
|
fprintf(stderr,
|
||||||
|
"usage: rtquery [-np1] [-r tgt_rt] [-w wtime]"
|
||||||
|
" [-a type=passwd] host1 [host2 ...]\n"
|
||||||
|
"\trtquery -t {on=filename|more|off|dump}"
|
||||||
|
" host1 [host2 ...]\n");
|
||||||
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -364,7 +373,7 @@ query_loop(char *argv[], int argc)
|
||||||
OMSG.rip_nets[1] = OMSG.rip_nets[0];
|
OMSG.rip_nets[1] = OMSG.rip_nets[0];
|
||||||
NA0.a_family = RIP_AF_AUTH;
|
NA0.a_family = RIP_AF_AUTH;
|
||||||
NA0.a_type = RIP_AUTH_PW;
|
NA0.a_type = RIP_AUTH_PW;
|
||||||
memmove(NA0.au.au_pw, passwd, RIP_AUTH_PW_LEN);
|
memcpy(NA0.au.au_pw, passwd, RIP_AUTH_PW_LEN);
|
||||||
omsg_len += sizeof(OMSG.rip_nets[0]);
|
omsg_len += sizeof(OMSG.rip_nets[0]);
|
||||||
|
|
||||||
} else if (auth_type == RIP_AUTH_MD5) {
|
} else if (auth_type == RIP_AUTH_MD5) {
|
||||||
|
@ -372,15 +381,17 @@ query_loop(char *argv[], int argc)
|
||||||
NA0.a_family = RIP_AF_AUTH;
|
NA0.a_family = RIP_AF_AUTH;
|
||||||
NA0.a_type = RIP_AUTH_MD5;
|
NA0.a_type = RIP_AUTH_MD5;
|
||||||
NA0.au.a_md5.md5_keyid = (int8_t)keyid;
|
NA0.au.a_md5.md5_keyid = (int8_t)keyid;
|
||||||
NA0.au.a_md5.md5_auth_len = RIP_AUTH_PW_LEN;
|
NA0.au.a_md5.md5_auth_len = RIP_AUTH_MD5_LEN;
|
||||||
NA0.au.a_md5.md5_seqno = 0;
|
NA0.au.a_md5.md5_seqno = 0;
|
||||||
NA0.au.a_md5.md5_pkt_len = sizeof(OMSG.rip_nets[1]);
|
cc = (char *)&NA2-(char *)&OMSG;
|
||||||
|
NA0.au.a_md5.md5_pkt_len = htons(cc);
|
||||||
NA2.a_family = RIP_AF_AUTH;
|
NA2.a_family = RIP_AF_AUTH;
|
||||||
NA2.a_type = 1;
|
NA2.a_type = htons(1);
|
||||||
memmove(NA2.au.au_pw, passwd, sizeof(NA2.au.au_pw));
|
|
||||||
MD5Init(&md5_ctx);
|
MD5Init(&md5_ctx);
|
||||||
MD5Update(&md5_ctx, (u_char *)&NA0,
|
MD5Update(&md5_ctx,
|
||||||
(char *)(&NA2+1) - (char *)&NA0);
|
(u_char *)&OMSG, cc);
|
||||||
|
MD5Update(&md5_ctx,
|
||||||
|
(u_char *)passwd, RIP_AUTH_MD5_LEN);
|
||||||
MD5Final(NA2.au.au_pw, &md5_ctx);
|
MD5Final(NA2.au.au_pw, &md5_ctx);
|
||||||
omsg_len += 2*sizeof(OMSG.rip_nets[0]);
|
omsg_len += 2*sizeof(OMSG.rip_nets[0]);
|
||||||
}
|
}
|
||||||
|
@ -425,6 +436,11 @@ query_loop(char *argv[], int argc)
|
||||||
}
|
}
|
||||||
if (sp == 0) {
|
if (sp == 0) {
|
||||||
sp = malloc(sizeof(*sp));
|
sp = malloc(sizeof(*sp));
|
||||||
|
if (sp == 0) {
|
||||||
|
fprintf(stderr,
|
||||||
|
"rtquery: malloc failed\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
sp->addr = from.sin_addr;
|
sp->addr = from.sin_addr;
|
||||||
sp->next = seen;
|
sp->next = seen;
|
||||||
seen = sp;
|
seen = sp;
|
||||||
|
@ -493,7 +509,7 @@ out(char *host)
|
||||||
herror(host);
|
herror(host);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
memmove(&router.sin_addr, hp->h_addr, sizeof(router.sin_addr));
|
memcpy(&router.sin_addr, hp->h_addr, sizeof(router.sin_addr));
|
||||||
}
|
}
|
||||||
router.sin_port = htons(RIP_PORT);
|
router.sin_port = htons(RIP_PORT);
|
||||||
|
|
||||||
|
@ -572,6 +588,9 @@ rip_input(struct sockaddr_in *from,
|
||||||
struct in_addr in;
|
struct in_addr in;
|
||||||
char *name;
|
char *name;
|
||||||
char net_buf[80];
|
char net_buf[80];
|
||||||
|
u_char hash[RIP_AUTH_MD5_LEN];
|
||||||
|
MD5_CTX md5_ctx;
|
||||||
|
u_char md5_authed = 0;
|
||||||
u_int mask, dmask;
|
u_int mask, dmask;
|
||||||
char *sp;
|
char *sp;
|
||||||
int i;
|
int i;
|
||||||
|
@ -686,15 +705,18 @@ rip_input(struct sockaddr_in *from,
|
||||||
|
|
||||||
if (na->a_type == RIP_AUTH_MD5
|
if (na->a_type == RIP_AUTH_MD5
|
||||||
&& n == IMSG.rip_nets) {
|
&& n == IMSG.rip_nets) {
|
||||||
(void)printf(" MD5 Authentication"
|
(void)printf(" MD5 Auth"
|
||||||
" len=%d KeyID=%d"
|
" len=%d KeyID=%d"
|
||||||
" seqno=%d"
|
" auth_len=%d"
|
||||||
|
" seqno=%#x"
|
||||||
" rsvd=%#x,%#x\n",
|
" rsvd=%#x,%#x\n",
|
||||||
na->au.a_md5.md5_pkt_len,
|
ntohs(na->au.a_md5.md5_pkt_len),
|
||||||
na->au.a_md5.md5_keyid,
|
na->au.a_md5.md5_keyid,
|
||||||
na->au.a_md5.md5_seqno,
|
na->au.a_md5.md5_auth_len,
|
||||||
|
ntohl(na->au.a_md5.md5_seqno),
|
||||||
na->au.a_md5.rsvd[0],
|
na->au.a_md5.rsvd[0],
|
||||||
na->au.a_md5.rsvd[1]);
|
na->au.a_md5.rsvd[1]);
|
||||||
|
md5_authed = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
(void)printf(" Authentication type %d: ",
|
(void)printf(" Authentication type %d: ",
|
||||||
|
@ -702,6 +724,19 @@ rip_input(struct sockaddr_in *from,
|
||||||
for (i = 0; i < sizeof(na->au.au_pw); i++)
|
for (i = 0; i < sizeof(na->au.au_pw); i++)
|
||||||
(void)printf("%02x ", na->au.au_pw[i]);
|
(void)printf("%02x ", na->au.au_pw[i]);
|
||||||
putc('\n', stdout);
|
putc('\n', stdout);
|
||||||
|
if (md5_authed && n+1 > lim
|
||||||
|
&& na->a_type == ntohs(1)) {
|
||||||
|
MD5Init(&md5_ctx);
|
||||||
|
MD5Update(&md5_ctx, (u_char *)&IMSG,
|
||||||
|
(char *)na-(char *)&IMSG);
|
||||||
|
MD5Update(&md5_ctx, (u_char *)passwd,
|
||||||
|
RIP_AUTH_MD5_LEN);
|
||||||
|
MD5Final(hash, &md5_ctx);
|
||||||
|
(void)printf(" %s hash\n",
|
||||||
|
memcmp(hash, na->au.au_pw,
|
||||||
|
sizeof(hash))
|
||||||
|
? "WRONG" : "correct");
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -829,7 +864,7 @@ parse_quote(char **linep,
|
||||||
if (c == '\0')
|
if (c == '\0')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (c == '\\' && pc != '\0') {
|
if (c == '\\' && *pc != '\0') {
|
||||||
if ((c = *pc++) == 'n') {
|
if ((c = *pc++) == 'n') {
|
||||||
c = '\n';
|
c = '\n';
|
||||||
} else if (c == 'r') {
|
} else if (c == 'r') {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: table.c,v 1.7 1998/06/02 18:02:56 thorpej Exp $ */
|
/* $NetBSD: table.c,v 1.8 1998/10/25 14:56:09 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1983, 1988, 1993
|
* Copyright (c) 1983, 1988, 1993
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
* must display the following acknowledgement:
|
* must display the following acknowledgment:
|
||||||
* This product includes software developed by the University of
|
* This product includes software developed by the University of
|
||||||
* California, Berkeley and its contributors.
|
* California, Berkeley and its contributors.
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
static char sccsid[] = "@(#)tables.c 8.1 (Berkeley) 6/5/93";
|
static char sccsid[] = "@(#)tables.c 8.1 (Berkeley) 6/5/93";
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__RCSID("$NetBSD: table.c,v 1.7 1998/06/02 18:02:56 thorpej Exp $");
|
__RCSID("$NetBSD: table.c,v 1.8 1998/10/25 14:56:09 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
|
@ -192,11 +192,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
|
* 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
|
* routes with coarser masks that match it, the one with the longest
|
||||||
* mask is appropriate. This is ensured by scanning the routes
|
* 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.
|
* among routes to the same destination.
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
|
@ -335,8 +335,8 @@ ag_check(naddr dst,
|
||||||
* A route to an address less than the current destination
|
* A route to an address less than the current destination
|
||||||
* will not be affected by the current route or any route
|
* will not be affected by the current route or any route
|
||||||
* seen hereafter. That means it is safe to suppress it.
|
* seen hereafter. That means it is safe to suppress it.
|
||||||
* This check keeps poor routes (eg. with large hop counts)
|
* This check keeps poor routes (e.g. with large hop counts)
|
||||||
* from preventing suppresion of finer routes.
|
* from preventing suppression of finer routes.
|
||||||
*/
|
*/
|
||||||
if (ag_cors != 0
|
if (ag_cors != 0
|
||||||
&& ag->ag_dst_h < dst
|
&& ag->ag_dst_h < dst
|
||||||
|
@ -833,7 +833,7 @@ kern_check_static(struct khash *k,
|
||||||
if (k->k_metric == 0)
|
if (k->k_metric == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
bzero(&new, sizeof(new));
|
memset(&new, 0, sizeof(new));
|
||||||
new.rts_ifp = ifp;
|
new.rts_ifp = ifp;
|
||||||
new.rts_gate = k->k_gate;
|
new.rts_gate = k->k_gate;
|
||||||
new.rts_router = (ifp != 0) ? ifp->int_addr : loopaddr;
|
new.rts_router = (ifp != 0) ? ifp->int_addr : loopaddr;
|
||||||
|
@ -1385,7 +1385,8 @@ kern_out(struct ag_info *ag)
|
||||||
|
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
static int
|
static int
|
||||||
walk_kern(struct radix_node *rn, struct walkarg *argp)
|
walk_kern(struct radix_node *rn,
|
||||||
|
struct walkarg *argp)
|
||||||
{
|
{
|
||||||
#define RT ((struct rt_entry *)rn)
|
#define RT ((struct rt_entry *)rn)
|
||||||
char metric, pref;
|
char metric, pref;
|
||||||
|
@ -1952,7 +1953,8 @@ rtbad_sub(struct rt_entry *rt)
|
||||||
*/
|
*/
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
int
|
int
|
||||||
walk_bad(struct radix_node *rn, struct walkarg *argp)
|
walk_bad(struct radix_node *rn,
|
||||||
|
struct walkarg *argp)
|
||||||
{
|
{
|
||||||
#define RT ((struct rt_entry *)rn)
|
#define RT ((struct rt_entry *)rn)
|
||||||
struct rt_spare *rts;
|
struct rt_spare *rts;
|
||||||
|
@ -1994,7 +1996,8 @@ walk_bad(struct radix_node *rn, struct walkarg *argp)
|
||||||
*/
|
*/
|
||||||
/* ARGSUSED */
|
/* ARGSUSED */
|
||||||
static int
|
static int
|
||||||
walk_age(struct radix_node *rn, struct walkarg *argp)
|
walk_age(struct radix_node *rn,
|
||||||
|
struct walkarg *argp)
|
||||||
{
|
{
|
||||||
#define RT ((struct rt_entry *)rn)
|
#define RT ((struct rt_entry *)rn)
|
||||||
struct interface *ifp;
|
struct interface *ifp;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $NetBSD: trace.c,v 1.21 1998/06/02 18:02:56 thorpej Exp $ */
|
/* $NetBSD: trace.c,v 1.22 1998/10/25 14:56:09 christos Exp $ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 1983, 1988, 1993
|
* Copyright (c) 1983, 1988, 1993
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
* notice, this list of conditions and the following disclaimer in the
|
* notice, this list of conditions and the following disclaimer in the
|
||||||
* documentation and/or other materials provided with the distribution.
|
* documentation and/or other materials provided with the distribution.
|
||||||
* 3. All advertising materials mentioning features or use of this software
|
* 3. All advertising materials mentioning features or use of this software
|
||||||
* must display the following acknowledgement:
|
* must display the following acknowledgment:
|
||||||
* This product includes software developed by the University of
|
* This product includes software developed by the University of
|
||||||
* California, Berkeley and its contributors.
|
* California, Berkeley and its contributors.
|
||||||
* 4. Neither the name of the University nor the names of its contributors
|
* 4. Neither the name of the University nor the names of its contributors
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
static char sccsid[] = "@(#)trace.c 8.1 (Berkeley) 6/5/93";
|
static char sccsid[] = "@(#)trace.c 8.1 (Berkeley) 6/5/93";
|
||||||
#elif defined(__NetBSD__)
|
#elif defined(__NetBSD__)
|
||||||
#include <sys/cdefs.h>
|
#include <sys/cdefs.h>
|
||||||
__RCSID("$NetBSD: trace.c,v 1.21 1998/06/02 18:02:56 thorpej Exp $");
|
__RCSID("$NetBSD: trace.c,v 1.22 1998/10/25 14:56:09 christos Exp $");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define RIPCMDS
|
#define RIPCMDS
|
||||||
|
@ -154,7 +154,7 @@ ts(time_t secs) {
|
||||||
#ifdef sgi
|
#ifdef sgi
|
||||||
(void)cftime(s, "%T", &secs);
|
(void)cftime(s, "%T", &secs);
|
||||||
#else
|
#else
|
||||||
memmove(s, ctime(&secs)+11, 8);
|
memcpy(s, ctime(&secs)+11, 8);
|
||||||
s[8] = '\0';
|
s[8] = '\0';
|
||||||
#endif
|
#endif
|
||||||
return s;
|
return s;
|
||||||
|
@ -874,7 +874,7 @@ trace_rip(char *dir1, char *dir2,
|
||||||
int size) /* total size of message */
|
int size) /* total size of message */
|
||||||
{
|
{
|
||||||
struct netinfo *n, *lim;
|
struct netinfo *n, *lim;
|
||||||
# define NA (msg->rip_auths)
|
# define NA ((struct netauth*)n)
|
||||||
int i, seen_route;
|
int i, seen_route;
|
||||||
|
|
||||||
if (!TRACEPACKETS || ftrace == 0)
|
if (!TRACEPACKETS || ftrace == 0)
|
||||||
|
@ -944,20 +944,21 @@ trace_rip(char *dir1, char *dir2,
|
||||||
if (NA->a_type == RIP_AUTH_MD5
|
if (NA->a_type == RIP_AUTH_MD5
|
||||||
&& n == msg->rip_nets) {
|
&& n == msg->rip_nets) {
|
||||||
(void)fprintf(ftrace,
|
(void)fprintf(ftrace,
|
||||||
"\tMD5 Authentication"
|
"\tMD5 Auth"
|
||||||
" len=%d KeyID=%u"
|
" pkt_len=%d KeyID=%u"
|
||||||
" seqno=%u"
|
" auth_len=%d"
|
||||||
|
" seqno=%#x"
|
||||||
" rsvd=%#x,%#x\n",
|
" rsvd=%#x,%#x\n",
|
||||||
NA->au.a_md5.md5_pkt_len,
|
ntohs(NA->au.a_md5.md5_pkt_len),
|
||||||
NA->au.a_md5.md5_keyid,
|
NA->au.a_md5.md5_keyid,
|
||||||
NA->au.a_md5.md5_seqno,
|
NA->au.a_md5.md5_auth_len,
|
||||||
NA->au.a_md5.rsvd[0],
|
ntohl(NA->au.a_md5.md5_seqno),
|
||||||
NA->au.a_md5.rsvd[1]);
|
ntohs(NA->au.a_md5.rsvd[0]),
|
||||||
|
ntohs(NA->au.a_md5.rsvd[1]));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
(void)fprintf(ftrace,
|
(void)fprintf(ftrace,
|
||||||
"\tAuthentication"
|
"\tAuthentication type %d: ",
|
||||||
" type %d: ",
|
|
||||||
ntohs(NA->a_type));
|
ntohs(NA->a_type));
|
||||||
for (i = 0;
|
for (i = 0;
|
||||||
i < sizeof(NA->au.au_pw);
|
i < sizeof(NA->au.au_pw);
|
||||||
|
|
Loading…
Reference in New Issue