Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.sbin update IPv6 MLD API to new one. various correction...
details: https://anonhg.NetBSD.org/src/rev/64d3dac937b0
branches: trunk
changeset: 486340:64d3dac937b0
user: itojun <itojun%NetBSD.org@localhost>
date: Fri May 19 10:43:36 2000 +0000
description:
update IPv6 MLD API to new one. various corrections including
timeout processing, node-local/link-local handling (ignore them),
and more. (sync with kame)
nroff fixes to manpage.
diffstat:
usr.sbin/pim6dd/debug.c | 68 +++++++++++++++++++++++++++++++++++++-
usr.sbin/pim6dd/defs.h | 5 +-
usr.sbin/pim6dd/main.c | 6 +-
usr.sbin/pim6dd/mld6.c | 31 +++++++++--------
usr.sbin/pim6dd/mld6.h | 5 ++-
usr.sbin/pim6dd/mld6_proto.c | 23 ++++---------
usr.sbin/pim6dd/mrt.c | 8 ++--
usr.sbin/pim6dd/pim6.c | 9 ++--
usr.sbin/pim6dd/pim6_proto.c | 6 +--
usr.sbin/pim6dd/pim6dd.8 | 15 +++++--
usr.sbin/pim6dd/pim6dd.conf.5 | 19 +++++-----
usr.sbin/pim6dd/timer.c | 18 +++++++++-
usr.sbin/pim6dd/vif.c | 11 +++++-
usr.sbin/pim6sd/cfparse.y | 70 +++++++++++++++++++++++++++++++++------
usr.sbin/pim6sd/cftoken.l | 3 +-
usr.sbin/pim6sd/config.c | 4 +-
usr.sbin/pim6sd/debug.c | 73 ++++++++++++++++++++++++++++++++++++++++-
usr.sbin/pim6sd/debug.h | 3 +-
usr.sbin/pim6sd/inet6.c | 32 ++++++++++++------
usr.sbin/pim6sd/inet6.h | 3 +-
usr.sbin/pim6sd/main.c | 4 +-
usr.sbin/pim6sd/mld6.c | 29 ++++++++--------
usr.sbin/pim6sd/mld6.h | 5 ++-
usr.sbin/pim6sd/mld6_proto.c | 48 +++++++++-----------------
usr.sbin/pim6sd/mrt.c | 12 +++++-
usr.sbin/pim6sd/pim6_proto.c | 20 ++++++----
usr.sbin/pim6sd/pim6sd.8 | 18 ++++++---
usr.sbin/pim6sd/pim6sd.conf.5 | 20 ++++++----
usr.sbin/pim6sd/pim6stat.1 | 12 +++---
usr.sbin/pim6sd/rp.c | 14 +++----
usr.sbin/pim6sd/timer.c | 20 ++++++++++-
usr.sbin/pim6sd/vif.c | 75 +++++++++++++++++++++---------------------
usr.sbin/pim6sd/vif.h | 3 +-
33 files changed, 465 insertions(+), 227 deletions(-)
diffs (truncated from 1666 to 300 lines):
diff -r 9552cbbe1389 -r 64d3dac937b0 usr.sbin/pim6dd/debug.c
--- a/usr.sbin/pim6dd/debug.c Fri May 19 10:39:43 2000 +0000
+++ b/usr.sbin/pim6dd/debug.c Fri May 19 10:43:36 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: debug.c,v 1.6 2000/03/27 17:07:22 kleink Exp $ */
+/* $NetBSD: debug.c,v 1.7 2000/05/19 10:43:36 itojun Exp $ */
/*
* Copyright (c) 1998 by the University of Southern California.
@@ -36,7 +36,7 @@
* Questions concerning this software should be directed to
* Pavlin Ivanov Radoslavov (pavlin%catarina.usc.edu@localhost)
*
- * KAME Id: debug.c,v 1.4 1999/09/20 14:28:08 jinmei Exp
+ * KAME Id: debug.c,v 1.8 2000/05/18 12:47:59 itojun Exp
*/
/*
* Part of this program has been derived from mrouted.
@@ -68,6 +68,38 @@
static char dumpfilename[] = _PATH_PIM6D_DUMP;
static char cachefilename[] = _PATH_PIM6D_CACHE; /* TODO: notused */
+static char *sec2str __P((time_t));
+
+static char *
+sec2str(total)
+ time_t total;
+{
+ static char result[256];
+ int days, hours, mins, secs;
+ int first = 1;
+ char *p = result;
+
+ days = total / 3600 / 24;
+ hours = (total / 3600) % 24;
+ mins = (total / 60) % 60;
+ secs = total % 60;
+
+ if (days) {
+ first = 0;
+ p += sprintf(p, "%dd", days);
+ }
+ if (!first || hours) {
+ first = 0;
+ p += sprintf(p, "%dh", hours);
+ }
+ if (!first || mins) {
+ first = 0;
+ p += sprintf(p, "%dm", mins);
+ }
+ sprintf(p, "%ds", secs);
+
+ return(result);
+}
char *
packet_kind(proto, type, code)
@@ -198,6 +230,7 @@
fp = fopen(dumpfilename, "w");
if (fp != NULL) {
dump_vifs(fp);
+ dump_mldqueriers(fp);
dump_pim_mrt(fp);
dump_lcl_grp(fp);
(void) fclose(fp);
@@ -286,6 +319,8 @@
fprintf(fp, " %-12s", "NO-NBR");
width += 6;
}
+ if (v->uv_flags & VIFF_QUERIER)
+ fprintf(fp, " QRY");
if ((n = v->uv_pim_neighbors) != NULL) {
/* Print the first neighbor on the same line */
@@ -386,6 +421,35 @@
if (severity <= LOG_ERR) exit(-1);
}
+void
+dump_mldqueriers(fp)
+ FILE *fp;
+{
+ struct uvif *v;
+ vifi_t vifi;
+ time_t now;
+
+ fprintf(fp, "MLD Querier List\n");
+ fprintf(fp, " %-3s %6s %-40s %-5s %15s\n",
+ "Mif", "PhyIF", "Address", "Timer", "Last");
+ (void)time(&now);
+
+ for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) {
+ if (v->uv_querier) {
+ fprintf(fp, " %-3u %6s", vifi,
+ (v->uv_flags & MIFF_REGISTER) ? "regist":
+ v->uv_name);
+
+ fprintf(fp, " %-40s %5lu %15s\n",
+ inet6_fmt(&v->uv_querier->al_addr.sin6_addr),
+ (u_long)v->uv_querier->al_timer,
+ sec2str(now - v->uv_querier->al_ctime));
+ }
+ }
+
+ fprintf(fp, "\n");
+}
+
/* TODO: format the output for better readability */
void
dump_pim_mrt(fp)
diff -r 9552cbbe1389 -r 64d3dac937b0 usr.sbin/pim6dd/defs.h
--- a/usr.sbin/pim6dd/defs.h Fri May 19 10:39:43 2000 +0000
+++ b/usr.sbin/pim6dd/defs.h Fri May 19 10:43:36 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: defs.h,v 1.4 1999/12/10 06:13:31 itojun Exp $ */
+/* $NetBSD: defs.h,v 1.5 2000/05/19 10:43:37 itojun Exp $ */
/*
* Copyright (c) 1998 by the University of Oregon.
@@ -35,7 +35,7 @@
* Questions concerning this software should be directed to
* Kurt Windisch (kurtw%antc.uoregon.edu@localhost)
*
- * KAME Id: defs.h,v 1.5 1999/10/27 11:40:29 jinmei Exp
+ * KAME Id: defs.h,v 1.7 2000/04/30 13:01:36 itojun Exp
*/
/*
* Part of this program has been derived from PIM sparse-mode pimd.
@@ -324,6 +324,7 @@
extern char *packet_kind __P((u_int proto, u_int type, u_int code));
extern int debug_kind __P((u_int proto, u_int type, u_int code));
extern void log __P((int, int, char *, ...));
+extern void dump_mldqueriers __P((FILE *));
extern int log_level __P((u_int proto, u_int type, u_int code));
extern void dump __P((int i));
extern void fdump __P((int i));
diff -r 9552cbbe1389 -r 64d3dac937b0 usr.sbin/pim6dd/main.c
--- a/usr.sbin/pim6dd/main.c Fri May 19 10:39:43 2000 +0000
+++ b/usr.sbin/pim6dd/main.c Fri May 19 10:43:36 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: main.c,v 1.2 1999/08/19 17:31:06 itojun Exp $ */
+/* $NetBSD: main.c,v 1.3 2000/05/19 10:43:37 itojun Exp $ */
/*
* Copyright (c) 1998 by the University of Oregon.
@@ -35,7 +35,7 @@
* Questions concerning this software should be directed to
* Kurt Windisch (kurtw%antc.uoregon.edu@localhost)
*
- * KAME Id: main.c,v 1.2 1999/08/13 09:20:13 jinmei Exp
+ * KAME Id: main.c,v 1.3 2000/03/26 19:11:41 sumikawa Exp
*/
/*
* Part of this program has been derived from PIM sparse-mode pimd.
@@ -525,7 +525,7 @@
IF_DEBUG(DEBUG_TIMEOUT)
log(LOG_DEBUG, 0, "TIMEOUT: secs %d, diff secs %d, diff usecs %d", secs, difftime.tv_sec, difftime.tv_usec );
#endif
- while (difftime.tv_usec > 1000000) {
+ while (difftime.tv_usec >= 1000000) {
difftime.tv_sec++;
difftime.tv_usec -= 1000000;
}
diff -r 9552cbbe1389 -r 64d3dac937b0 usr.sbin/pim6dd/mld6.c
--- a/usr.sbin/pim6dd/mld6.c Fri May 19 10:39:43 2000 +0000
+++ b/usr.sbin/pim6dd/mld6.c Fri May 19 10:43:36 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mld6.c,v 1.5 2000/02/28 07:17:34 itojun Exp $ */
+/* $NetBSD: mld6.c,v 1.6 2000/05/19 10:43:38 itojun Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -65,7 +65,7 @@
* Questions concerning this software should be directed to
* Pavlin Ivanov Radoslavov (pavlin%catarina.usc.edu@localhost)
*
- * KAME Id: mld6.c,v 1.12 2000/02/28 05:39:35 jinmei Exp
+ * KAME Id: mld6.c,v 1.13 2000/04/12 07:34:38 jinmei Exp
*/
/*
* Part of this program has been derived from mrouted.
@@ -257,19 +257,6 @@
int ifindex = 0;
struct sockaddr_in6 *src = (struct sockaddr_in6 *) rcvmh.msg_name;
- /*
- * If control length is zero, it must be an upcall from the kernel
- * multicast forwarding engine.
- * XXX: can we trust it?
- */
- if (rcvmh.msg_controllen == 0) {
- /* XXX: msg_controllen must be reset in this case. */
- rcvmh.msg_controllen = rcvcmsglen;
-
- process_kernel_call();
- return;
- }
-
if (recvlen < sizeof(struct mld6_hdr))
{
log(LOG_WARNING, 0,
@@ -278,6 +265,20 @@
return;
}
mldh = (struct mld6_hdr *) rcvmh.msg_iov[0].iov_base;
+
+ /*
+ * Packets sent up from kernel to daemon have ICMPv6 type = 0.
+ * Note that we set filters on the mld6_socket, so we should never
+ * see a "normal" ICMPv6 packet with type 0 of ICMPv6 type.
+ */
+ if (mldh->mld6_type == 0) {
+ /* XXX: msg_controllen must be reset in this case. */
+ rcvmh.msg_controllen = rcvcmsglen;
+
+ process_kernel_call();
+ return;
+ }
+
group = &mldh->mld6_addr;
/* extract optional information via Advanced API */
diff -r 9552cbbe1389 -r 64d3dac937b0 usr.sbin/pim6dd/mld6.h
--- a/usr.sbin/pim6dd/mld6.h Fri May 19 10:39:43 2000 +0000
+++ b/usr.sbin/pim6dd/mld6.h Fri May 19 10:43:36 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mld6.h,v 1.1 1999/07/17 14:06:25 itojun Exp $ */
+/* $NetBSD: mld6.h,v 1.2 2000/05/19 10:43:42 itojun Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -43,3 +43,6 @@
MLD6_QUERY_RESPONSE_INTERVAL / MLD6_TIMER_SCALE)
#define MLD6_LAST_LISTENER_QUERY_INTERVAL 1000 /* in milliseconds */
#define MLD6_LAST_LISTENER_QUERY_COUNT MLD6_ROBUSTNESS_VARIABLE
+#define MLD6_OTHER_QUERIER_PRESENT_INTERVAL (MLD6_ROBUSTNESS_VARIABLE * \
+ MLD6_QUERY_INTERVAL + \
+ MLD6_QUERY_RESPONSE_INTERVAL / (2 * MLD6_TIMER_SCALE))
diff -r 9552cbbe1389 -r 64d3dac937b0 usr.sbin/pim6dd/mld6_proto.c
--- a/usr.sbin/pim6dd/mld6_proto.c Fri May 19 10:39:43 2000 +0000
+++ b/usr.sbin/pim6dd/mld6_proto.c Fri May 19 10:43:36 2000 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: mld6_proto.c,v 1.3 1999/12/10 06:13:31 itojun Exp $ */
+/* $NetBSD: mld6_proto.c,v 1.4 2000/05/19 10:43:42 itojun Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@@ -64,7 +64,7 @@
* Questions concerning this software should be directed to
* Kurt Windisch (kurtw%antc.uoregon.edu@localhost)
*
- * KAME Id: mld6_proto.c,v 1.2 1999/09/12 17:00:09 jinmei Exp
+ * KAME Id: mld6_proto.c,v 1.4 2000/05/05 12:38:30 jinmei Exp
*/
/*
* Part of this program has been derived from PIM sparse-mode pimd.
@@ -156,7 +156,7 @@
v = &uvifs[mifi];
- if (v->uv_querier == NULL || inet6_equal(&v->uv_querier->al_addr, src))
+ if (v->uv_querier == NULL || !inet6_equal(&v->uv_querier->al_addr, src))
{
/*
* This might be:
@@ -178,19 +178,10 @@
if (!v->uv_querier) {
v->uv_querier = (struct listaddr *)
malloc(sizeof(struct listaddr));
- v->uv_querier->al_next = (struct listaddr *)NULL;
- v->uv_querier->al_timer = 0;
- v->uv_querier->al_genid = 0;
- v->uv_querier->al_pv = 0;
- v->uv_querier->al_mv = 0;
- v->uv_querier->al_old = 0;
- v->uv_querier->al_index = 0;
- v->uv_querier->al_timerid = 0;
- v->uv_querier->al_query = 0;
- v->uv_querier->al_flags = 0;
-
- v->uv_flags &= ~VIFF_QUERIER;
+ memset(v->uv_querier, 0,
+ sizeof(struct listaddr));
}
+ v->uv_flags &= ~VIFF_QUERIER;
v->uv_querier->al_addr = *src;
time(&v->uv_querier->al_ctime);
}
@@ -200,7 +191,7 @@
* Reset the timer since we've received a query.
*/
if (v->uv_querier && inet6_equal(src, &v->uv_querier->al_addr))
- v->uv_querier->al_timer = 0;
+ v->uv_querier->al_timer = MLD6_OTHER_QUERIER_PRESENT_INTERVAL;
/*
* If this is a Group-Specific query which we did not source,
diff -r 9552cbbe1389 -r 64d3dac937b0 usr.sbin/pim6dd/mrt.c
--- a/usr.sbin/pim6dd/mrt.c Fri May 19 10:39:43 2000 +0000
+++ b/usr.sbin/pim6dd/mrt.c Fri May 19 10:43:36 2000 +0000
Home |
Main Index |
Thread Index |
Old Index