Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin/rtadvd avoid infinite loop when -s is specified (se...
details: https://anonhg.NetBSD.org/src/rev/8a592c060b8e
branches: trunk
changeset: 503256:8a592c060b8e
user: itojun <itojun%NetBSD.org@localhost>
date: Sun Feb 04 06:19:40 2001 +0000
description:
avoid infinite loop when -s is specified (select loop mistake).
make agetent() 32bit clean. KAME PR 127.
disable -R (router renumbering receiver). sync with kame.
diffstat:
usr.sbin/rtadvd/advcap.c | 10 +++---
usr.sbin/rtadvd/advcap.h | 6 +-
usr.sbin/rtadvd/config.c | 74 ++++++++++++++++++++++++-----------------------
usr.sbin/rtadvd/rtadvd.8 | 13 +++++--
usr.sbin/rtadvd/rtadvd.c | 25 ++++++++++-----
5 files changed, 71 insertions(+), 57 deletions(-)
diffs (truncated from 335 to 300 lines):
diff -r cedff2bbb3cb -r 8a592c060b8e usr.sbin/rtadvd/advcap.c
--- a/usr.sbin/rtadvd/advcap.c Sun Feb 04 05:19:14 2001 +0000
+++ b/usr.sbin/rtadvd/advcap.c Sun Feb 04 06:19:40 2001 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: advcap.c,v 1.5 2000/05/23 11:37:58 itojun Exp $ */
-/* $KAME: advcap.c,v 1.4 2000/05/23 11:17:40 itojun Exp $ */
+/* $NetBSD: advcap.c,v 1.6 2001/02/04 06:19:40 itojun Exp $ */
+/* $KAME: advcap.c,v 1.5 2001/02/01 09:12:08 jinmei Exp $ */
/*
* Copyright (c) 1983 The Regents of the University of California.
@@ -96,7 +96,7 @@
int tnchktc __P((void));
int tnamatch __P((char *));
static char *tskip __P((char *));
-int tgetnum __P((char *));
+long long tgetnum __P((char *));
int tgetflag __P((char *));
char *tgetstr __P((char *, char **));
static char *tdecode __P((char *, char **));
@@ -307,11 +307,11 @@
* a # character. If the option is not found we return -1.
* Note that we handle octal numbers beginning with 0.
*/
-int
+long long
tgetnum(id)
char *id;
{
- register long int i;
+ register long long i;
register int base;
register char *bp = tbuf;
diff -r cedff2bbb3cb -r 8a592c060b8e usr.sbin/rtadvd/advcap.h
--- a/usr.sbin/rtadvd/advcap.h Sun Feb 04 05:19:14 2001 +0000
+++ b/usr.sbin/rtadvd/advcap.h Sun Feb 04 06:19:40 2001 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: advcap.h,v 1.3 2000/05/23 11:37:58 itojun Exp $ */
-/* $KAME: advcap.h,v 1.2 2000/05/16 13:34:13 itojun Exp $ */
+/* $NetBSD: advcap.h,v 1.4 2001/02/04 06:19:40 itojun Exp $ */
+/* $KAME: advcap.h,v 1.3 2001/02/01 09:12:08 jinmei Exp $ */
/*
* Copyright (C) 1994,1995 by Andrey A. Chernov, Moscow, Russia.
@@ -38,7 +38,7 @@
extern int agetent __P((char *, const char *));
extern int agetflag __P((const char *));
-extern int agetnum __P((const char *));
+extern long long agetnum __P((const char *));
extern char *agetstr __P((const char *, char **));
__END_DECLS
diff -r cedff2bbb3cb -r 8a592c060b8e usr.sbin/rtadvd/config.c
--- a/usr.sbin/rtadvd/config.c Sun Feb 04 05:19:14 2001 +0000
+++ b/usr.sbin/rtadvd/config.c Sun Feb 04 06:19:40 2001 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: config.c,v 1.10 2001/01/23 15:35:54 itojun Exp $ */
-/* $KAME: config.c,v 1.29 2001/01/23 14:13:08 jinmei Exp $ */
+/* $NetBSD: config.c,v 1.11 2001/02/04 06:19:40 itojun Exp $ */
+/* $KAME: config.c,v 1.32 2001/02/01 09:12:08 jinmei Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -85,6 +85,7 @@
char tbuf[BUFSIZ];
struct rainfo *tmp;
long val;
+ long long val64;
char buf[BUFSIZ];
char *bp = buf;
char *addr;
@@ -216,20 +217,23 @@
}
tmp->reachabletime = (u_int32_t)val;
- MAYHAVE(val, "retrans", DEF_ADVRETRANSTIMER);
- if (val < 0 || val > 0xffffffff) {
+ MAYHAVE(val64, "retrans", DEF_ADVRETRANSTIMER);
+ if (val64 < 0 || val64 > 0xffffffff) {
syslog(LOG_ERR,
"<%s> retrans time out of range", __FUNCTION__);
exit(1);
}
- tmp->retranstimer = (u_int32_t)val;
+ tmp->retranstimer = (u_int32_t)val64;
-#ifdef MIP6
- if (!mobileip6)
+#ifndef MIP6
+ if (agetstr("hapref", &bp) || agetstr("hatime", &bp)) {
+ syslog(LOG_ERR,
+ "<%s> mobile-ip6 configuration not supported",
+ __FUNCTION__);
+ exit(1);
+ }
#else
- if (1)
-#endif
- {
+ if (!mobileip6) {
if (agetstr("hapref", &bp) || agetstr("hatime", &bp)) {
syslog(LOG_ERR,
"<%s> mobile-ip6 configuration without "
@@ -237,9 +241,7 @@
__FUNCTION__);
exit(1);
}
- }
-#ifdef MIP6
- else {
+ } else {
tmp->hapref = 0;
if ((val = agetnum("hapref")) >= 0)
tmp->hapref = (int16_t)val;
@@ -315,7 +317,7 @@
{
MAYHAVE(val, entbuf,
(ND_OPT_PI_FLAG_ONLINK|ND_OPT_PI_FLAG_AUTO|
- ND_OPT_PI_FLAG_RTADDR));
+ ND_OPT_PI_FLAG_ROUTER));
} else
#endif
{
@@ -325,18 +327,18 @@
pfx->onlinkflg = val & ND_OPT_PI_FLAG_ONLINK;
pfx->autoconfflg = val & ND_OPT_PI_FLAG_AUTO;
#ifdef MIP6
- pfx->routeraddr = val & ND_OPT_PI_FLAG_RTADDR;
+ pfx->routeraddr = val & ND_OPT_PI_FLAG_ROUTER;
#endif
makeentry(entbuf, i, "vltime", added);
- MAYHAVE(val, entbuf, DEF_ADVVALIDLIFETIME);
- if (val < 0 || val > 0xffffffff) {
+ MAYHAVE(val64, entbuf, DEF_ADVVALIDLIFETIME);
+ if (val64 < 0 || val64 > 0xffffffff) {
syslog(LOG_ERR,
"<%s> vltime out of range",
__FUNCTION__);
exit(1);
}
- pfx->validlifetime = (u_int32_t)val;
+ pfx->validlifetime = (u_int32_t)val64;
makeentry(entbuf, i, "vltimedecr", added);
if (agetflag(entbuf)) {
@@ -347,14 +349,14 @@
}
makeentry(entbuf, i, "pltime", added);
- MAYHAVE(val, entbuf, DEF_ADVPREFERREDLIFETIME);
- if (val < 0 || val > 0xffffffff) {
+ MAYHAVE(val64, entbuf, DEF_ADVPREFERREDLIFETIME);
+ if (val64 < 0 || val64 > 0xffffffff) {
syslog(LOG_ERR,
"<%s> pltime out of range",
__FUNCTION__);
exit(1);
}
- pfx->preflifetime = (u_int32_t)val;
+ pfx->preflifetime = (u_int32_t)val64;
makeentry(entbuf, i, "pltimedecr", added);
if (agetflag(entbuf)) {
@@ -669,8 +671,8 @@
struct nd_opt_prefix_info *ndopt_pi;
struct nd_opt_mtu *ndopt_mtu;
#ifdef MIP6
- struct nd_opt_advint *ndopt_advint;
- struct nd_opt_hai *ndopt_hai;
+ struct nd_opt_advinterval *ndopt_advint;
+ struct nd_opt_homeagent_info *ndopt_hai;
#endif
struct prefix *pfx;
@@ -693,9 +695,9 @@
packlen += sizeof(struct nd_opt_mtu);
#ifdef MIP6
if (mobileip6 && rainfo->maxinterval)
- packlen += sizeof(struct nd_opt_advint);
+ packlen += sizeof(struct nd_opt_advinterval);
if (mobileip6 && rainfo->hatime)
- packlen += sizeof(struct nd_opt_hai);
+ packlen += sizeof(struct nd_opt_homeagent_info);
#endif
/* allocate memory for the packet */
@@ -747,25 +749,25 @@
#ifdef MIP6
if (mobileip6 && rainfo->maxinterval) {
- ndopt_advint = (struct nd_opt_advint *)buf;
- ndopt_advint->nd_opt_int_type = ND_OPT_ADV_INTERVAL;
- ndopt_advint->nd_opt_int_len = 1;
- ndopt_advint->nd_opt_int_reserved = 0;
- ndopt_advint->nd_opt_int_interval = ntohl(rainfo->maxinterval *
+ ndopt_advint = (struct nd_opt_advinterval *)buf;
+ ndopt_advint->nd_opt_adv_type = ND_OPT_ADVINTERVAL;
+ ndopt_advint->nd_opt_adv_len = 1;
+ ndopt_advint->nd_opt_adv_reserved = 0;
+ ndopt_advint->nd_opt_adv_interval = ntohl(rainfo->maxinterval *
1000);
- buf += sizeof(struct nd_opt_advint);
+ buf += sizeof(struct nd_opt_advinterval);
}
#endif
#ifdef MIP6
if (rainfo->hatime) {
- ndopt_hai = (struct nd_opt_hai *)buf;
- ndopt_hai->nd_opt_hai_type = ND_OPT_HA_INFORMATION;
+ ndopt_hai = (struct nd_opt_homeagent_info *)buf;
+ ndopt_hai->nd_opt_hai_type = ND_OPT_HOMEAGENT_INFO;
ndopt_hai->nd_opt_hai_len = 1;
ndopt_hai->nd_opt_hai_reserved = 0;
- ndopt_hai->nd_opt_hai_pref = ntohs(rainfo->hapref);
+ ndopt_hai->nd_opt_hai_preference = ntohs(rainfo->hapref);
ndopt_hai->nd_opt_hai_lifetime = ntohs(rainfo->hatime);
- buf += sizeof(struct nd_opt_hai);
+ buf += sizeof(struct nd_opt_homeagent_info);
}
#endif
@@ -788,7 +790,7 @@
#ifdef MIP6
if (pfx->routeraddr)
ndopt_pi->nd_opt_pi_flags_reserved |=
- ND_OPT_PI_FLAG_RTADDR;
+ ND_OPT_PI_FLAG_ROUTER;
#endif
if (pfx->vltimeexpire || pfx->pltimeexpire)
gettimeofday(&now, NULL);
diff -r cedff2bbb3cb -r 8a592c060b8e usr.sbin/rtadvd/rtadvd.8
--- a/usr.sbin/rtadvd/rtadvd.8 Sun Feb 04 05:19:14 2001 +0000
+++ b/usr.sbin/rtadvd/rtadvd.8 Sun Feb 04 06:19:40 2001 +0000
@@ -1,5 +1,5 @@
-.\" $NetBSD: rtadvd.8,v 1.12 2001/01/15 06:14:05 itojun Exp $
-.\" $KAME: rtadvd.8,v 1.15 2000/12/22 08:54:29 jinmei Exp $
+.\" $NetBSD: rtadvd.8,v 1.13 2001/02/04 06:19:41 itojun Exp $
+.\" $KAME: rtadvd.8,v 1.17 2001/02/04 05:34:38 jinmei Exp $
.\"
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
.\" All rights reserved.
@@ -110,7 +110,7 @@
line.
This option has meaning only with the
.Fl R
-option, which enables auto routing renumbering.
+option, which enables routing renumbering protocol support.
.\".It Fl m
.\"Enables mobile IPv6 support.
.\"This changes the content of router advertisement option, as well as
@@ -118,6 +118,12 @@
.It Fl R
Accept router renumbering requests.
If you enable it, certain IPsec setup is suggested for security reasons.
+.\"On KAME-based systems,
+.\".Xr rrenumd 8
+.\"generates router renumbering request packets.
+This option is currently disabled, and is ignored by
+.Nm
+with a warning message.
.It Fl s
Do not add or delete prefixes dynamically.
Only statically configured prefixes, if any, will be advertised.
@@ -156,7 +162,6 @@
dumps its internal state.
.El
.Sh SEE ALSO
-.Xr daemon 3 ,
.Xr rtadvd.conf 5 ,
.Xr rtsol 8
.Sh HISTORY
diff -r cedff2bbb3cb -r 8a592c060b8e usr.sbin/rtadvd/rtadvd.c
--- a/usr.sbin/rtadvd/rtadvd.c Sun Feb 04 05:19:14 2001 +0000
+++ b/usr.sbin/rtadvd/rtadvd.c Sun Feb 04 06:19:40 2001 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: rtadvd.c,v 1.11 2001/01/15 06:14:05 itojun Exp $ */
-/* $KAME: rtadvd.c,v 1.47 2001/01/15 05:50:25 itojun Exp $ */
+/* $NetBSD: rtadvd.c,v 1.12 2001/02/04 06:19:41 itojun Exp $ */
+/* $KAME: rtadvd.c,v 1.50 2001/02/04 06:15:15 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -79,7 +79,8 @@
static char *dumpfilename = "/var/run/rtadvd.dump"; /* XXX: should be configurable */
static char *pidfilename = "/var/run/rtadvd.pid"; /* should be configurable */
static char *mcastif;
-int sock, rtsock;
+int sock;
+int rtsock = -1;
#ifdef MIP6
int mobileip6 = 0;
#endif
@@ -189,7 +190,10 @@
break;
#endif
case 'R':
Home |
Main Index |
Thread Index |
Old Index