Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-1-5]: src/usr.sbin/rtadvd pullup from main trunc (approved by rel...
details: https://anonhg.NetBSD.org/src/rev/5fac2a8f0180
branches: netbsd-1-5
changeset: 488598:5fac2a8f0180
user: itojun <itojun%NetBSD.org@localhost>
date: Thu Jul 20 00:30:15 2000 +0000
description:
pullup from main trunc (approved by releng-1-5)
sync with sys/netinet/icmp6.h change (no bitfield for router renumber).
more logging. improve error handling/garbage collection. sync with kame.
1.1 -> 1.2 basesrc/usr.sbin/rtadvd/dump.c
1.5 -> 1.6 basesrc/usr.sbin/rtadvd/if.c
1.3 -> 1.4 basesrc/usr.sbin/rtadvd/if.h \
basesrc/usr.sbin/rtadvd/rtadvd.conf.5 basesrc/usr.sbin/rtadvd/timer.c \
basesrc/usr.sbin/rtadvd/timer.h
1.4 -> 1.5 basesrc/usr.sbin/rtadvd/rrenum.c \
basesrc/usr.sbin/rtadvd/rtadvd.h
1.8 -> 1.9 basesrc/usr.sbin/rtadvd/rtadvd.8
1.9 -> 1.10 basesrc/usr.sbin/rtadvd/rtadvd.c
diffstat:
usr.sbin/rtadvd/dump.c | 11 ++-
usr.sbin/rtadvd/if.c | 12 +--
usr.sbin/rtadvd/if.h | 5 +-
usr.sbin/rtadvd/rrenum.c | 54 ++++++++------
usr.sbin/rtadvd/rtadvd.8 | 16 +++-
usr.sbin/rtadvd/rtadvd.c | 146 +++++++++++++++++++++++++++++++++--------
usr.sbin/rtadvd/rtadvd.conf.5 | 6 +-
usr.sbin/rtadvd/rtadvd.h | 12 ++-
usr.sbin/rtadvd/timer.c | 20 ++++-
usr.sbin/rtadvd/timer.h | 5 +-
10 files changed, 210 insertions(+), 77 deletions(-)
diffs (truncated from 695 to 300 lines):
diff -r bb1dc4b6ed19 -r 5fac2a8f0180 usr.sbin/rtadvd/dump.c
--- a/usr.sbin/rtadvd/dump.c Thu Jul 20 00:28:20 2000 +0000
+++ b/usr.sbin/rtadvd/dump.c Thu Jul 20 00:30:15 2000 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: dump.c,v 1.1 2000/05/23 11:37:58 itojun Exp $ */
-/* $KAME: dump.c,v 1.10 2000/05/23 11:31:25 itojun Exp $ */
+/* $NetBSD: dump.c,v 1.1.4.1 2000/07/20 00:30:15 itojun Exp $ */
+/* $KAME: dump.c,v 1.11 2000/05/27 11:30:43 jinmei Exp $ */
/*
* Copyright (C) 2000 WIDE Project.
@@ -55,6 +55,7 @@
#include "rtadvd.h"
#include "timer.h"
+#include "if.h"
#include "dump.h"
static FILE *fp;
@@ -100,6 +101,10 @@
for (rai = ralist; rai; rai = rai->next) {
fprintf(fp, "%s:\n", rai->ifname);
+ fprintf(fp, " Status: %s\n",
+ (iflist[rai->ifindex]->ifm_flags & IFF_UP) ? "UP" :
+ "DOWN");
+
/* control information */
if (rai->lastsent.tv_sec) {
/* note that ctime() appends CR by itself */
@@ -110,6 +115,8 @@
fprintf(fp, " Next RA will be sent: %s",
ctime((time_t *)&rai->timer->tm.tv_sec));
}
+ else
+ fprintf(fp, " RA timer is stopped");
fprintf(fp, " waits: %d, initcount: %d\n",
rai->waiting, rai->initcounter);
diff -r bb1dc4b6ed19 -r 5fac2a8f0180 usr.sbin/rtadvd/if.c
--- a/usr.sbin/rtadvd/if.c Thu Jul 20 00:28:20 2000 +0000
+++ b/usr.sbin/rtadvd/if.c Thu Jul 20 00:30:15 2000 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: if.c,v 1.5 2000/05/23 11:37:59 itojun Exp $ */
-/* $KAME: if.c,v 1.8 2000/05/22 22:04:37 itojun Exp $ */
+/* $NetBSD: if.c,v 1.5.4.1 2000/07/20 00:30:15 itojun Exp $ */
+/* $KAME: if.c,v 1.11 2000/07/06 08:20:04 jinmei Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -39,9 +39,7 @@
#ifdef __FreeBSD__
# include <net/ethernet.h>
#endif
-#ifdef __bsdi__
-# include <ifaddrs.h>
-#endif
+#include <ifaddrs.h>
#ifdef __NetBSD__
#include <net/if_ether.h>
#endif
@@ -149,7 +147,7 @@
int
if_getmtu(char *name)
{
-#ifndef __bsdi__
+#if 0
struct ifreq ifr;
int s;
@@ -207,6 +205,7 @@
close(s);
return (oifflags & ~IFF_UP);
}
+ close(s);
return (ifr.ifr_flags);
}
@@ -589,5 +588,4 @@
/* make list of pointers to each if_msghdr */
parse_iflist(&iflist, ifblock, ifblock_size);
-
}
diff -r bb1dc4b6ed19 -r 5fac2a8f0180 usr.sbin/rtadvd/if.h
--- a/usr.sbin/rtadvd/if.h Thu Jul 20 00:28:20 2000 +0000
+++ b/usr.sbin/rtadvd/if.h Thu Jul 20 00:30:15 2000 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: if.h,v 1.3 2000/05/23 11:37:59 itojun Exp $ */
-/* $KAME: if.h,v 1.2 2000/05/16 13:34:13 itojun Exp $ */
+/* $NetBSD: if.h,v 1.3.4.1 2000/07/20 00:30:15 itojun Exp $ */
+/* $KAME: if.h,v 1.3 2000/05/27 11:47:09 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
@@ -36,6 +36,7 @@
extern size_t ifblock_size;
extern char *ifblock;
+struct nd_opt_hdr;
struct sockaddr_dl *if_nametosdl __P((char *name));
int if_getmtu __P((char *name));
int if_getflags __P((int ifindex, int oifflags));
diff -r bb1dc4b6ed19 -r 5fac2a8f0180 usr.sbin/rtadvd/rrenum.c
--- a/usr.sbin/rtadvd/rrenum.c Thu Jul 20 00:28:20 2000 +0000
+++ b/usr.sbin/rtadvd/rrenum.c Thu Jul 20 00:30:15 2000 +0000
@@ -1,10 +1,10 @@
-/* $NetBSD: rrenum.c,v 1.4 2000/05/23 11:37:59 itojun Exp $ */
-/* $KAME: rrenum.c,v 1.3 2000/05/16 13:34:14 itojun Exp $ */
+/* $NetBSD: rrenum.c,v 1.4.4.1 2000/07/20 00:30:15 itojun Exp $ */
+/* $KAME: rrenum.c,v 1.4 2000/07/03 02:51:08 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
* All rights reserved.
- *
+ *
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
@@ -16,7 +16,7 @@
* 3. Neither the name of the project nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
- *
+ *
* THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
@@ -65,11 +65,12 @@
static struct rr_operation rro;
static int rr_rcvifindex;
-static int rrcmd2pco[RPM_PCO_MAX] = {0,
- SIOCAIFPREFIX_IN6,
- SIOCCIFPREFIX_IN6,
- SIOCSGIFPREFIX_IN6
- };
+static int rrcmd2pco[RPM_PCO_MAX] = {
+ 0,
+ SIOCAIFPREFIX_IN6,
+ SIOCCIFPREFIX_IN6,
+ SIOCSGIFPREFIX_IN6
+};
static int s = -1;
/*
@@ -81,7 +82,7 @@
{
struct rr_pco_use *rpu, *rpulim;
int checklen;
-
+
/* rpm->rpm_len must be (4N * 3) as router-renum-05.txt */
if ((rpm->rpm_len - 3) < 0 || /* must be at least 3 */
(rpm->rpm_len - 3) & 0x3) { /* must be multiple of 4 */
@@ -171,14 +172,20 @@
/* init in6_rrenumreq fields */
irr->irr_u_uselen = rpu->rpu_uselen;
irr->irr_u_keeplen = rpu->rpu_keeplen;
- irr->irr_raf_mask_onlink = rpu->rpu_mask_onlink;
- irr->irr_raf_mask_auto = rpu->rpu_mask_autonomous;
+ irr->irr_raf_mask_onlink =
+ (rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_ONLINK);
+ irr->irr_raf_mask_auto =
+ (rpu->rpu_ramask & ICMP6_RR_PCOUSE_RAFLAGS_AUTO);
irr->irr_vltime = rpu->rpu_vltime;
irr->irr_pltime = rpu->rpu_pltime;
- irr->irr_raf_onlink = rpu->rpu_onlink;
- irr->irr_raf_auto = rpu->rpu_autonomous;
- irr->irr_rrf_decrvalid = rpu->rpu_decr_vltime;
- irr->irr_rrf_decrprefd = rpu->rpu_decr_pltime;
+ irr->irr_raf_onlink =
+ (rpu->rpu_raflags & ICMP6_RR_PCOUSE_RAFLAGS_ONLINK);
+ irr->irr_raf_auto =
+ (rpu->rpu_raflags & ICMP6_RR_PCOUSE_RAFLAGS_AUTO);
+ irr->irr_rrf_decrvalid =
+ (rpu->rpu_flags & ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME);
+ irr->irr_rrf_decrprefd =
+ (rpu->rpu_flags & ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME);
irr->irr_useprefix.sin6_len = sizeof(irr->irr_useprefix);
irr->irr_useprefix.sin6_family = AF_INET6;
irr->irr_useprefix.sin6_addr = rpu->rpu_prefix;
@@ -220,10 +227,10 @@
while (if_indextoname(++ifindex, irr.irr_name)) {
/*
- * if rr_forceapply(A flag) is 0 and IFF_UP is off,
+ * if ICMP6_RR_FLAGS_FORCEAPPLY(A flag) is 0 and IFF_UP is off,
* the interface is not applied
*/
- if (!rr->rr_forceapply &&
+ if ((rr->rr_flags & ICMP6_RR_FLAGS_FORCEAPPLY) == 0 &&
(iflist[ifindex]->ifm_flags & IFF_UP) == 0)
continue;
/* TODO: interface scope check */
@@ -240,7 +247,7 @@
}
/*
- * call do_pco() for each Prefix Control Operations(PCOs) in a received
+ * call do_pco() for each Prefix Control Operations(PCOs) in a received
* Router Renumbering Command packet.
* return 0 on success, 1 on failure
*/
@@ -321,9 +328,9 @@
return 1;
}
if (rro.rro_seqnum == rr->rr_seqnum &&
- rr->rr_test == 0 &&
+ (rr->rr_flags & ICMP6_RR_FLAGS_TEST) == 0 &&
RR_ISSET_SEGNUM(rro.rro_segnum_bits, rr->rr_segnum)) {
- if (rr->rr_reqresult)
+ if ((rr->rr_flags & ICMP6_RR_FLAGS_REQRESULT) != 0)
syslog(LOG_WARNING,
"<%s> rcvd duped segnum %d from %s",
__FUNCTION__, rr->rr_segnum,
@@ -333,7 +340,7 @@
}
/* update seqnum */
- if (rro.rro_seqnum != rr->rr_seqnum) {
+ if (rro.rro_seqnum != rr->rr_seqnum) {
/* then must be "<" */
/* init rro_segnum_bits */
@@ -352,7 +359,8 @@
/* rr_command validity check */
if (rr_command_check(len, rr, from, dst))
goto failed;
- if (rr->rr_test && !rr->rr_reqresult)
+ if ((rr->rr_flags & (ICMP6_RR_FLAGS_TEST|ICMP6_RR_FLAGS_REQRESULT)) ==
+ ICMP6_RR_FLAGS_TEST)
return;
/* do router renumbering */
diff -r bb1dc4b6ed19 -r 5fac2a8f0180 usr.sbin/rtadvd/rtadvd.8
--- a/usr.sbin/rtadvd/rtadvd.8 Thu Jul 20 00:28:20 2000 +0000
+++ b/usr.sbin/rtadvd/rtadvd.8 Thu Jul 20 00:30:15 2000 +0000
@@ -1,5 +1,5 @@
-.\" $NetBSD: rtadvd.8,v 1.8 2000/05/23 11:37:59 itojun Exp $
-.\" $KAME: rtadvd.8,v 1.8 2000/05/22 22:12:11 itojun Exp $
+.\" $NetBSD: rtadvd.8,v 1.8.4.1 2000/07/20 00:30:15 itojun Exp $
+.\" $KAME: rtadvd.8,v 1.9 2000/05/27 13:37:01 jinmei Exp $
.\"
.\" Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
.\" All rights reserved.
@@ -64,13 +64,18 @@
.Nm
also watches the routing table.
By default, if an interface direct route is
-added/deleted on an advertising interface,
+added/deleted on an advertising interface and no static prefixes are
+specified by the configuration file,
.Nm
adds/deletes the corresponding prefix to/from its advertising list,
respectively.
The
.Ic Fl s
-command line option may be used to disable this behavior.
+may be used to disable this behavior.
+Moreover, if the status of an advertising interface changes,
+.Nm
+will start or stop sending router advertisements according
+to the latest status.
.Pp
The command line options are:
.Bl -tag -width indent
@@ -96,7 +101,8 @@
Accept router renumbering requests.
If you enable it, certain IPsec setup is suggested for security reasons.
.It Fl s
-Do not monitor routing table changes (static prefix).
+Do not add or delete prefixes dynamically.
+Only statically configured prefixes, if any, will be advertised.
.El
.Pp
Upon receipt of signal
diff -r bb1dc4b6ed19 -r 5fac2a8f0180 usr.sbin/rtadvd/rtadvd.c
--- a/usr.sbin/rtadvd/rtadvd.c Thu Jul 20 00:28:20 2000 +0000
+++ b/usr.sbin/rtadvd/rtadvd.c Thu Jul 20 00:30:15 2000 +0000
@@ -1,5 +1,5 @@
-/* $NetBSD: rtadvd.c,v 1.9 2000/05/23 11:37:59 itojun Exp $ */
-/* $KAME: rtadvd.c,v 1.26 2000/05/23 11:31:26 itojun Exp $ */
+/* $NetBSD: rtadvd.c,v 1.9.4.1 2000/07/20 00:30:15 itojun Exp $ */
+/* $KAME: rtadvd.c,v 1.31 2000/06/23 06:34:51 itojun Exp $ */
/*
* Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
@@ -243,12 +243,10 @@
FD_ZERO(&fdset);
FD_SET(sock, &fdset);
maxfd = sock;
- if (sflag == 0) {
- rtsock_open();
- FD_SET(rtsock, &fdset);
- if (rtsock > sock)
+ rtsock_open();
+ FD_SET(rtsock, &fdset);
+ if (rtsock > sock)
Home |
Main Index |
Thread Index |
Old Index