summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--usr.sbin/rtadvd/Makefile4
-rw-r--r--usr.sbin/rtadvd/advcap.c9
-rw-r--r--usr.sbin/rtadvd/advcap.h3
-rw-r--r--usr.sbin/rtadvd/config.c11
-rw-r--r--usr.sbin/rtadvd/config.h3
-rw-r--r--usr.sbin/rtadvd/if.c10
-rw-r--r--usr.sbin/rtadvd/if.h3
-rw-r--r--usr.sbin/rtadvd/pathnames.h3
-rw-r--r--usr.sbin/rtadvd/rrenum.c3
-rw-r--r--usr.sbin/rtadvd/rrenum.h3
-rw-r--r--usr.sbin/rtadvd/rtadvd.820
-rw-r--r--usr.sbin/rtadvd/rtadvd.c103
-rw-r--r--usr.sbin/rtadvd/rtadvd.conf32
-rw-r--r--usr.sbin/rtadvd/rtadvd.conf.55
-rw-r--r--usr.sbin/rtadvd/rtadvd.h18
-rw-r--r--usr.sbin/rtadvd/timer.c5
-rw-r--r--usr.sbin/rtadvd/timer.h3
17 files changed, 173 insertions, 65 deletions
diff --git a/usr.sbin/rtadvd/Makefile b/usr.sbin/rtadvd/Makefile
index 7c658546b76..6f14591aff9 100644
--- a/usr.sbin/rtadvd/Makefile
+++ b/usr.sbin/rtadvd/Makefile
@@ -1,7 +1,7 @@
-# $OpenBSD: Makefile,v 1.1 1999/12/11 10:33:27 itojun Exp $
+# $OpenBSD: Makefile,v 1.2 2000/05/23 11:23:22 itojun Exp $
PROG= rtadvd
-SRCS= rtadvd.c rrenum.c advcap.c if.c config.c timer.c
+SRCS= rtadvd.c rrenum.c advcap.c if.c config.c timer.c dump.c
CPPFLAGS+=-DINET6
LDADD+= -lcompat
diff --git a/usr.sbin/rtadvd/advcap.c b/usr.sbin/rtadvd/advcap.c
index 468a3ccb1fa..0dd4a27b433 100644
--- a/usr.sbin/rtadvd/advcap.c
+++ b/usr.sbin/rtadvd/advcap.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: advcap.c,v 1.2 1999/12/11 10:33:28 itojun Exp $ */
+/* $OpenBSD: advcap.c,v 1.3 2000/05/23 11:23:22 itojun Exp $ */
+/* $KAME: advcap.c,v 1.4 2000/05/23 11:17:40 itojun Exp $ */
/*
* Copyright (c) 1983 The Regents of the University of California.
@@ -33,10 +34,6 @@
* SUCH DAMAGE.
*/
-#ifndef lint
-static char sccsid[] = "@(#)remcap.c 5.5 (Berkeley) 2/2/91";
-#endif /* not lint */
-
/*
* remcap - routines for dealing with the remote host data base
*
@@ -141,7 +138,7 @@ getent(bp, name, cp)
tf = open(RM = cp, O_RDONLY);
}
if (tf < 0) {
- syslog(LOG_WARNING,
+ syslog(LOG_INFO,
"<%s> open: %s", __FUNCTION__, strerror(errno));
return (-2);
}
diff --git a/usr.sbin/rtadvd/advcap.h b/usr.sbin/rtadvd/advcap.h
index c09356df819..e69cdd6d77e 100644
--- a/usr.sbin/rtadvd/advcap.h
+++ b/usr.sbin/rtadvd/advcap.h
@@ -1,4 +1,5 @@
-/* $OpenBSD: advcap.h,v 1.2 1999/12/11 10:33:28 itojun Exp $ */
+/* $OpenBSD: advcap.h,v 1.3 2000/05/23 11:23:22 itojun Exp $ */
+/* $KAME: advcap.h,v 1.2 2000/05/16 13:34:13 itojun Exp $ */
/*
* Copyright (C) 1994,1995 by Andrey A. Chernov, Moscow, Russia.
diff --git a/usr.sbin/rtadvd/config.c b/usr.sbin/rtadvd/config.c
index b3042761c4f..2c7e320b647 100644
--- a/usr.sbin/rtadvd/config.c
+++ b/usr.sbin/rtadvd/config.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: config.c,v 1.5 2000/03/13 06:16:11 itojun Exp $ */
+/* $OpenBSD: config.c,v 1.6 2000/05/23 11:23:22 itojun Exp $ */
+/* $KAME: config.c,v 1.11 2000/05/16 13:34:13 itojun Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -57,7 +58,7 @@
#include <errno.h>
#include <string.h>
#include <stdlib.h>
-#ifdef __NetBSD__
+#if defined(__NetBSD__) || defined(__OpenBSD__)
#include <search.h>
#endif
#include <unistd.h>
@@ -260,6 +261,8 @@ getconfig(intface)
/* link into chain */
insque(pfx, &tmp->prefix);
+ pfx->origin = PREFIX_FROM_CONFIG;
+
makeentry(entbuf, i, "prefixlen", added);
MAYHAVE(val, entbuf, 64);
if (val < 0 || val > 128) {
@@ -438,6 +441,7 @@ get_prefix(struct rainfo *rai)
pp->preflifetime = DEF_ADVPREFERREDLIFETIME;
pp->onlinkflg = 1;
pp->autoconfflg = 1;
+ pp->origin = PREFIX_FROM_KERNEL;
/* link into chain */
insque(pp, &rai->prefix);
@@ -493,6 +497,7 @@ add_prefix(struct rainfo *rai, struct in6_prefixreq *ipr)
prefix->preflifetime = ipr->ipr_pltime;
prefix->onlinkflg = ipr->ipr_raf_onlink;
prefix->autoconfflg = ipr->ipr_raf_auto;
+ prefix->origin = PREFIX_FROM_DYNAMIC;
insque(prefix, &rai->prefix);
@@ -520,7 +525,7 @@ add_prefix(struct rainfo *rai, struct in6_prefixreq *ipr)
/*
* Delete a prefix to the list of specified interface and reconstruct
* the outgoing packet.
- * The prefix must be in the list
+ * The prefix must be in the list.
*/
void
delete_prefix(struct rainfo *rai, struct prefix *prefix)
diff --git a/usr.sbin/rtadvd/config.h b/usr.sbin/rtadvd/config.h
index d52b3782a00..33ce8638fcf 100644
--- a/usr.sbin/rtadvd/config.h
+++ b/usr.sbin/rtadvd/config.h
@@ -1,4 +1,5 @@
-/* $OpenBSD: config.h,v 1.3 2000/02/02 04:10:37 itojun Exp $ */
+/* $OpenBSD: config.h,v 1.4 2000/05/23 11:23:23 itojun Exp $ */
+/* $KAME: config.h,v 1.3 2000/05/16 13:34:13 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
diff --git a/usr.sbin/rtadvd/if.c b/usr.sbin/rtadvd/if.c
index 6740ea68787..ac28bb90e07 100644
--- a/usr.sbin/rtadvd/if.c
+++ b/usr.sbin/rtadvd/if.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: if.c,v 1.3 2000/03/13 06:16:11 itojun Exp $ */
+/* $OpenBSD: if.c,v 1.4 2000/05/23 11:23:23 itojun Exp $ */
+/* $KAME: if.c,v 1.8 2000/05/22 22:04:37 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -148,7 +149,7 @@ if_nametosdl(char *name)
int
if_getmtu(char *name)
{
-#if defined(__FreeBSD__) || defined(__NetBSD__)
+#ifndef __bsdi__
struct ifreq ifr;
int s;
@@ -165,8 +166,7 @@ if_getmtu(char *name)
close(s);
return(ifr.ifr_mtu);
-#endif
-#ifdef __bsdi__
+#else
struct ifaddrs *ifap, *ifa;
struct if_data *ifd;
@@ -185,8 +185,6 @@ if_getmtu(char *name)
freeifaddrs(ifap);
return 0;
#endif
- /* last resort */
- return 0;
}
/* give interface index and its old flags, then new flags returned */
diff --git a/usr.sbin/rtadvd/if.h b/usr.sbin/rtadvd/if.h
index fd1cedd797d..b65ea191995 100644
--- a/usr.sbin/rtadvd/if.h
+++ b/usr.sbin/rtadvd/if.h
@@ -1,4 +1,5 @@
-/* $OpenBSD: if.h,v 1.2 1999/12/11 10:33:28 itojun Exp $ */
+/* $OpenBSD: if.h,v 1.3 2000/05/23 11:23:23 itojun Exp $ */
+/* $KAME: if.h,v 1.2 2000/05/16 13:34:13 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
diff --git a/usr.sbin/rtadvd/pathnames.h b/usr.sbin/rtadvd/pathnames.h
index 6d2e1273dd2..8f53945b733 100644
--- a/usr.sbin/rtadvd/pathnames.h
+++ b/usr.sbin/rtadvd/pathnames.h
@@ -1,3 +1,4 @@
-/* $OpenBSD: pathnames.h,v 1.3 2000/01/05 19:53:12 angelos Exp $ */
+/* $OpenBSD: pathnames.h,v 1.4 2000/05/23 11:23:23 itojun Exp $ */
+/* $KAME: pathnames.h,v 1.2 2000/05/16 13:34:13 itojun Exp $ */
#define _PATH_RTADVDCONF "/etc/rtadvd.conf"
diff --git a/usr.sbin/rtadvd/rrenum.c b/usr.sbin/rtadvd/rrenum.c
index 5c20c934f04..4054331edcb 100644
--- a/usr.sbin/rtadvd/rrenum.c
+++ b/usr.sbin/rtadvd/rrenum.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: rrenum.c,v 1.3 2000/03/13 06:16:11 itojun Exp $ */
+/* $OpenBSD: rrenum.c,v 1.4 2000/05/23 11:23:23 itojun Exp $ */
+/* $KAME: rrenum.c,v 1.3 2000/05/16 13:34:14 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
diff --git a/usr.sbin/rtadvd/rrenum.h b/usr.sbin/rtadvd/rrenum.h
index fd591a95451..a126f6de52f 100644
--- a/usr.sbin/rtadvd/rrenum.h
+++ b/usr.sbin/rtadvd/rrenum.h
@@ -1,4 +1,5 @@
-/* $OpenBSD: rrenum.h,v 1.2 1999/12/11 10:33:29 itojun Exp $ */
+/* $OpenBSD: rrenum.h,v 1.3 2000/05/23 11:23:23 itojun Exp $ */
+/* $KAME: rrenum.h,v 1.2 2000/05/16 13:34:14 itojun Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
diff --git a/usr.sbin/rtadvd/rtadvd.8 b/usr.sbin/rtadvd/rtadvd.8
index ea4599b5740..9f499a85d72 100644
--- a/usr.sbin/rtadvd/rtadvd.8
+++ b/usr.sbin/rtadvd/rtadvd.8
@@ -1,4 +1,5 @@
-.\" $OpenBSD: rtadvd.8,v 1.10 2000/04/12 21:47:56 aaron Exp $
+.\" $OpenBSD: rtadvd.8,v 1.11 2000/05/23 11:23:23 itojun Exp $
+.\" $KAME: rtadvd.8,v 1.8 2000/05/22 22:12:11 itojun Exp $
.\"
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
.\" All rights reserved.
@@ -27,8 +28,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" KAME Id: rtadvd.8,v 1.5 2000/02/08 05:19:36 itojun Exp
-.\"
.Dd May 17, 1998
.Dt RTADVD 8
.Os
@@ -36,7 +35,7 @@
.Nm rtadvd
.Nd router advertisement daemon
.Sh SYNOPSIS
-.Nm rtadvd
+.Nm
.Op Fl c Ar configfile
.Op Fl dDfRs
.Ar interface ...
@@ -100,6 +99,12 @@ If you enable it, certain IPsec setup is suggested for security reasons.
Do not monitor routing table changes (static prefix).
.El
.Pp
+Upon receipt of signal
+.Dv SIGUSR1 ,
+.Nm
+will dump the current internal state into
+.Pa /var/run/rtadvd.dump.
+.Pp
Use
.Dv SIGTERM
to kill
@@ -116,6 +121,13 @@ The program exits with 0 on success, and non-zero on failures.
.Bl -tag -width /etc/rtadvd.conf -compact
.It Pa /etc/rtadvd.conf
The default configuration file.
+.It Pa /var/run/rtadvd.pid
+contains pid of the currently running
+.Nm rtadvd .
+.It Pa /var/run/rtadvd.dump
+on which
+.Nm
+dumps its internal state.
.El
.Sh SEE ALSO
.Xr daemon 3 ,
diff --git a/usr.sbin/rtadvd/rtadvd.c b/usr.sbin/rtadvd/rtadvd.c
index 82384327e10..8bbfbe9c852 100644
--- a/usr.sbin/rtadvd/rtadvd.c
+++ b/usr.sbin/rtadvd/rtadvd.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: rtadvd.c,v 1.4 2000/03/13 06:16:11 itojun Exp $ */
+/* $OpenBSD: rtadvd.c,v 1.5 2000/05/23 11:23:23 itojun Exp $ */
+/* $KAME: rtadvd.c,v 1.24 2000/05/22 21:58:10 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -65,11 +66,14 @@ static u_char *rcvcmsgbuf;
static size_t rcvcmsgbuflen;
static u_char *sndcmsgbuf = NULL;
static size_t sndcmsgbuflen;
+static int do_dump;
struct msghdr sndmhdr;
struct iovec rcviov[2];
struct iovec sndiov[2];
struct sockaddr_in6 from;
struct sockaddr_in6 sin6_allnodes = {sizeof(sin6_allnodes), AF_INET6};
+static char *dumpfilename = "/var/run/rtadvd.dump"; /* XXX: should be configurable */
+static char *pidfilename = "/var/run/rtadvd.pid"; /* should be configurable */
int sock, rtsock;
#ifdef MIP6
int mobileip6 = 0;
@@ -123,16 +127,19 @@ static void rs_input __P((int, struct nd_router_solicit *,
struct in6_pktinfo *, struct sockaddr_in6 *));
static void ra_input __P((int, struct nd_router_advert *,
struct in6_pktinfo *, struct sockaddr_in6 *));
-static void prefix_check __P((struct nd_opt_prefix_info *, struct rainfo *,
- struct sockaddr_in6 *));
+static int prefix_check __P((struct nd_opt_prefix_info *, struct rainfo *,
+ struct sockaddr_in6 *));
static int nd6_options __P((struct nd_opt_hdr *, int,
union nd_opts *, u_int32_t));
static void free_ndopts __P((union nd_opts *));
static struct rainfo *if_indextorainfo __P((int));
static void ra_output __P((struct rainfo *));
static void rtmsg_input __P((void));
+static void rtadvd_set_dump_file __P((void));
+
struct prefix *find_prefix __P((struct rainfo *, struct in6_addr *, int));
+extern void rtadvd_dump_file __P((char *));
int
main(argc, argv)
@@ -144,8 +151,10 @@ main(argc, argv)
struct timeval *timeout;
int i, ch;
int fflag = 0;
+ FILE *pidfp;
+ pid_t pid;
- openlog(*argv, LOG_NDELAY|LOG_PID, LOG_DAEMON);
+ openlog("rtadvd", LOG_NDELAY|LOG_PID, LOG_DAEMON);
/* get command line options and arguments */
#ifdef MIP6
@@ -221,6 +230,17 @@ main(argc, argv)
if (!fflag)
daemon(1, 0);
+ /* record the current PID */
+ pid = getpid();
+ if ((pidfp = fopen(pidfilename, "w")) == NULL)
+ syslog(LOG_ERR,
+ "<%s> failed to open a log file(%s), run anyway.",
+ __FUNCTION__, pidfilename);
+ else {
+ fprintf(pidfp, "%d\n", pid);
+ fclose(pidfp);
+ }
+
FD_ZERO(&fdset);
FD_SET(sock, &fdset);
maxfd = sock;
@@ -231,11 +251,17 @@ main(argc, argv)
maxfd = rtsock;
}
- signal(SIGTERM, die);
+ signal(SIGTERM, (void *)die);
+ signal(SIGUSR1, (void *)rtadvd_set_dump_file);
while (1) {
struct fd_set select_fd = fdset; /* reinitialize */
+ if (do_dump) { /* SIGUSR1 */
+ do_dump = 0;
+ rtadvd_dump_file(dumpfilename);
+ }
+
/* timer expiration check and reset the timer */
timeout = rtadvd_check_timer();
@@ -243,12 +269,14 @@ main(argc, argv)
"<%s> set timer to %ld:%ld. waiting for inputs "
"or timeout",
__FUNCTION__,
- timeout->tv_sec, timeout->tv_usec);
+ (long int)timeout->tv_sec, (long int)timeout->tv_usec);
if ((i = select(maxfd + 1, &select_fd,
- NULL, NULL, timeout)) < 0){
- syslog(LOG_ERR, "<%s> select: %s",
- __FUNCTION__, strerror(errno));
+ NULL, NULL, timeout)) < 0) {
+ /* EINTR would occur upon SIGUSR1 for status dump */
+ if (errno != EINTR)
+ syslog(LOG_ERR, "<%s> select: %s",
+ __FUNCTION__, strerror(errno));
continue;
}
if (i == 0) /* timeout */
@@ -262,6 +290,12 @@ main(argc, argv)
}
static void
+rtadvd_set_dump_file()
+{
+ do_dump = 1;
+}
+
+static void
die(sig)
int sig;
{
@@ -290,7 +324,7 @@ die(sig)
static void
rtmsg_input()
{
- int n, type, ifindex, plen;
+ int n, type, ifindex = 0, plen;
size_t len;
char msg[2048], *next, *lim;
u_char ifname[16];
@@ -699,6 +733,8 @@ rs_input(int len, struct nd_router_solicit *rs,
goto done;
}
+ ra->rsinput++; /* increment statistics */
+
/*
* Decide whether to send RA according to the rate-limit
* consideration.
@@ -766,6 +802,7 @@ ra_input(int len, struct nd_router_advert *ra,
union nd_opts ndopts;
char *on_off[] = {"OFF", "ON"};
u_int32_t reachabletime, retranstimer, mtu;
+ int inconsistent = 0;
syslog(LOG_DEBUG,
"<%s> RA received from %s on %s",
@@ -802,6 +839,8 @@ ra_input(int len, struct nd_router_advert *ra,
if_indextoname(pi->ipi6_ifindex, ifnamebuf));
goto done;
}
+ rai->rainput++; /* increment statistics */
+
/* Cur Hop Limit value */
if (ra->nd_ra_curhoplimit && rai->hoplimit &&
ra->nd_ra_curhoplimit != rai->hoplimit) {
@@ -814,6 +853,7 @@ ra_input(int len, struct nd_router_advert *ra,
inet_ntop(AF_INET6, &from->sin6_addr,
ntopbuf, INET6_ADDRSTRLEN),
rai->hoplimit);
+ inconsistent++;
}
/* M flag */
if ((ra->nd_ra_flags_reserved & ND_RA_FLAG_MANAGED) !=
@@ -827,6 +867,7 @@ ra_input(int len, struct nd_router_advert *ra,
inet_ntop(AF_INET6, &from->sin6_addr,
ntopbuf, INET6_ADDRSTRLEN),
on_off[rai->managedflg]);
+ inconsistent++;
}
/* O flag */
if ((ra->nd_ra_flags_reserved & ND_RA_FLAG_OTHER) !=
@@ -840,6 +881,7 @@ ra_input(int len, struct nd_router_advert *ra,
inet_ntop(AF_INET6, &from->sin6_addr,
ntopbuf, INET6_ADDRSTRLEN),
on_off[rai->otherflg]);
+ inconsistent++;
}
/* Reachable Time */
reachabletime = ntohl(ra->nd_ra_reachable);
@@ -854,6 +896,7 @@ ra_input(int len, struct nd_router_advert *ra,
inet_ntop(AF_INET6, &from->sin6_addr,
ntopbuf, INET6_ADDRSTRLEN),
rai->reachabletime);
+ inconsistent++;
}
/* Retrans Timer */
retranstimer = ntohl(ra->nd_ra_retransmit);
@@ -868,6 +911,7 @@ ra_input(int len, struct nd_router_advert *ra,
inet_ntop(AF_INET6, &from->sin6_addr,
ntopbuf, INET6_ADDRSTRLEN),
rai->retranstimer);
+ inconsistent++;
}
/* Values in the MTU options */
if (ndopts.nd_opts_mtu) {
@@ -881,37 +925,48 @@ ra_input(int len, struct nd_router_advert *ra,
inet_ntop(AF_INET6, &from->sin6_addr,
ntopbuf, INET6_ADDRSTRLEN),
rai->linkmtu);
+ inconsistent++;
}
}
/* Preferred and Valid Lifetimes for prefixes */
{
struct nd_optlist *optp = ndopts.nd_opts_list;
- if (ndopts.nd_opts_pi)
- prefix_check(ndopts.nd_opts_pi, rai, from);
+ if (ndopts.nd_opts_pi) {
+ if (prefix_check(ndopts.nd_opts_pi, rai, from))
+ inconsistent++;
+ }
while (optp) {
- prefix_check((struct nd_opt_prefix_info *)optp->opt,
- rai, from);
+ if (prefix_check((struct nd_opt_prefix_info *)optp->opt,
+ rai, from))
+ inconsistent++;
optp = optp->next;
}
}
+
+ if (inconsistent) {
+ printf("RA input %d inconsistents\n", inconsistent);
+ rai->rainconsistent++;
+ }
done:
free_ndopts(&ndopts);
return;
}
-static void
+/* return a non-zero value if the received prefix is inconsitent with ours */
+static int
prefix_check(struct nd_opt_prefix_info *pinfo,
struct rainfo *rai, struct sockaddr_in6 *from)
{
u_int32_t preferred_time, valid_time;
struct prefix *pp;
+ int inconsistent = 0;
u_char ntopbuf[INET6_ADDRSTRLEN], prefixbuf[INET6_ADDRSTRLEN];
#if 0 /* impossible */
if (pinfo->nd_opt_pi_type != ND_OPT_PREFIX_INFORMATION)
- return;
+ return(0);
#endif
/*
@@ -941,11 +996,11 @@ prefix_check(struct nd_opt_prefix_info *pinfo,
inet_ntop(AF_INET6, &from->sin6_addr,
ntopbuf, INET6_ADDRSTRLEN),
rai->ifname);
- return;
+ return(0);
}
preferred_time = ntohl(pinfo->nd_opt_pi_preferred_time);
- if (preferred_time != pp->preflifetime)
+ if (preferred_time != pp->preflifetime) {
syslog(LOG_WARNING,
"<%s> prefeerred lifetime for %s/%d"
" inconsistent on %s:"
@@ -958,9 +1013,11 @@ prefix_check(struct nd_opt_prefix_info *pinfo,
inet_ntop(AF_INET6, &from->sin6_addr,
ntopbuf, INET6_ADDRSTRLEN),
pp->preflifetime);
+ inconsistent++;
+ }
valid_time = ntohl(pinfo->nd_opt_pi_valid_time);
- if (valid_time != pp->validlifetime)
+ if (valid_time != pp->validlifetime) {
syslog(LOG_WARNING,
"<%s> valid lifetime for %s/%d"
" inconsistent on %s:"
@@ -973,6 +1030,10 @@ prefix_check(struct nd_opt_prefix_info *pinfo,
inet_ntop(AF_INET6, &from->sin6_addr,
ntopbuf, INET6_ADDRSTRLEN),
pp->validlifetime);
+ inconsistent++;
+ }
+
+ return(inconsistent);
}
struct prefix *
@@ -1283,6 +1344,7 @@ struct rainfo *rainfo;
/* update counter */
if (rainfo->initcounter < MAX_INITIAL_RTR_ADVERTISEMENTS)
rainfo->initcounter++;
+ rainfo->raoutput++;
/* update timestamp */
gettimeofday(&rainfo->lastsent, NULL);
@@ -1344,7 +1406,8 @@ ra_timer_update(void *data, struct timeval *tm)
syslog(LOG_DEBUG,
"<%s> RA timer on %s is set to %ld:%ld",
- __FUNCTION__, rai->ifname, tm->tv_sec, tm->tv_usec);
+ __FUNCTION__, rai->ifname,
+ (long int)tm->tv_sec, (long int)tm->tv_usec);
return;
}
diff --git a/usr.sbin/rtadvd/rtadvd.conf b/usr.sbin/rtadvd/rtadvd.conf
index 6f563564a61..418b665871f 100644
--- a/usr.sbin/rtadvd/rtadvd.conf
+++ b/usr.sbin/rtadvd/rtadvd.conf
@@ -1,13 +1,27 @@
#
# common definitions.
#
-default:\
- :chlim#64:raflags#0:rltime#1800:rtime#30000:retrans#1000:\
- :pinfoflags#192:vltime#3600000:pltime#3600000:mtu#1500:
-ether:\
- :mtu#1500:tc=default:
+# Note: All of the following parameters have default values defined
+# in specifications, and hence you usually do not have to set them
+# by hand unless you need special non-default values.
#
-# interfaces.
-#
-ef0:\
- :addrs#1:addr="3ffe:501:4819:1000::":prefixlen#64:tc=ether:
+# You even do not need to create the configuration file. rtadvd
+# would usually work well without a configuration file.
+# See also: rtadvd(8)
+
+#default:\
+# :chlim#64:raflags#0:rltime#1800:rtime#30000:retrans#1000:\
+# :pinfoflags#192:vltime#3600000:pltime#3600000:mtu#1500:
+#ether:\
+# :mtu#1500:tc=default:
+
+# per-interface definitions.
+# Mainly IPv6 prefixes are configured in this part. However, rtadvd
+# automatically learns appropriate prefixes from the kernel's routing
+# table and advertises the prefixes, so you don't have to configure
+# this part, either.
+# If you don't want the automatic advertisement, invoke rtadvd with
+# the -s option and configure this part by hand.
+
+#ef0:\
+# :addrs#1:addr="3ffe:501:4819:1000::":prefixlen#64:tc=ether:
diff --git a/usr.sbin/rtadvd/rtadvd.conf.5 b/usr.sbin/rtadvd/rtadvd.conf.5
index 3a4833777c9..889dbdcacfc 100644
--- a/usr.sbin/rtadvd/rtadvd.conf.5
+++ b/usr.sbin/rtadvd/rtadvd.conf.5
@@ -1,4 +1,5 @@
-.\" $OpenBSD: rtadvd.conf.5,v 1.7 2000/04/15 02:15:20 aaron Exp $
+.\" $OpenBSD: rtadvd.conf.5,v 1.8 2000/05/23 11:23:23 itojun Exp $
+.\" $KAME: rtadvd.conf.5,v 1.4 2000/05/22 22:10:53 itojun Exp $
.\"
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
.\" All rights reserved.
@@ -27,8 +28,6 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
-.\" KAME Id: rtadvd.conf.5,v 1.2 2000/02/08 05:19:36 itojun Exp
-.\"
.Dd May 17, 1998
.Dt RTADVD.CONF 5
.Os
diff --git a/usr.sbin/rtadvd/rtadvd.h b/usr.sbin/rtadvd/rtadvd.h
index ae427599129..df24207ee4f 100644
--- a/usr.sbin/rtadvd/rtadvd.h
+++ b/usr.sbin/rtadvd/rtadvd.h
@@ -1,4 +1,5 @@
-/* $OpenBSD: rtadvd.h,v 1.3 2000/03/13 06:16:11 itojun Exp $ */
+/* $OpenBSD: rtadvd.h,v 1.4 2000/05/23 11:23:23 itojun Exp $ */
+/* $KAME: rtadvd.h,v 1.8 2000/05/16 13:34:14 itojun Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -64,6 +65,10 @@
#define MIN_DELAY_BETWEEN_RAS 3
#define MAX_RA_DELAY_TIME 500000 /* usec */
+#define PREFIX_FROM_KERNEL 1
+#define PREFIX_FROM_CONFIG 2
+#define PREFIX_FROM_DYNAMIC 3
+
struct prefix {
struct prefix *next; /* forward link */
struct prefix *prev; /* previous link */
@@ -75,7 +80,8 @@ struct prefix {
#ifdef MIP6
u_int routeraddr; /* bool: RouterAddress */
#endif
- int prefixlen;
+ int prefixlen;
+ int origin; /* from kernel or cofig */
struct in6_addr prefix;
};
@@ -86,7 +92,7 @@ struct rainfo {
/* timer related parameters */
struct rtadvd_timer *timer;
int initcounter; /* counter for the first few advertisements */
- struct timeval lastsent; /* timestamp when the lates RA was sent */
+ struct timeval lastsent; /* timestamp when the latest RA was sent */
int waiting; /* number of RS waiting for RA */
/* interface information */
@@ -120,6 +126,12 @@ struct rainfo {
/* actual RA packet data and its length */
size_t ra_datalen;
u_char *ra_data;
+
+ /* statistics */
+ u_quad_t raoutput; /* number of RAs sent */
+ u_quad_t rainput; /* number of RAs received */
+ u_quad_t rainconsistent; /* number of RAs inconsistent with ours */
+ u_quad_t rsinput; /* number of RSs received */
};
void ra_timeout __P((void *));
diff --git a/usr.sbin/rtadvd/timer.c b/usr.sbin/rtadvd/timer.c
index 884335bdbd8..72938ccfb16 100644
--- a/usr.sbin/rtadvd/timer.c
+++ b/usr.sbin/rtadvd/timer.c
@@ -1,4 +1,5 @@
-/* $OpenBSD: timer.c,v 1.2 1999/12/11 10:33:30 itojun Exp $ */
+/* $OpenBSD: timer.c,v 1.3 2000/05/23 11:23:24 itojun Exp $ */
+/* $KAME: timer.c,v 1.2 2000/05/16 13:34:14 itojun Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -35,7 +36,7 @@
#include <syslog.h>
#include <stdlib.h>
#include <string.h>
-#ifdef __NetBSD__
+#if defined(__NetBSD__) || defined(__OpenBSD__)
#include <search.h>
#endif
#include "timer.h"
diff --git a/usr.sbin/rtadvd/timer.h b/usr.sbin/rtadvd/timer.h
index ab781e24191..a7ee10f0d5e 100644
--- a/usr.sbin/rtadvd/timer.h
+++ b/usr.sbin/rtadvd/timer.h
@@ -1,4 +1,5 @@
-/* $OpenBSD: timer.h,v 1.2 1999/12/11 10:33:30 itojun Exp $ */
+/* $OpenBSD: timer.h,v 1.3 2000/05/23 11:23:24 itojun Exp $ */
+/* $KAME: timer.h,v 1.2 2000/05/16 13:34:14 itojun Exp $ */
/*
* Copyright (C) 1998 WIDE Project.