sync with recent KAME.

- added more friendly debugging code
- fix to make assert looser correctly stop forwarding
- fixed SIGHUP support
This commit is contained in:
itojun 1999-09-03 04:49:23 +00:00
parent 7ddaec434e
commit 56448bbc4f
12 changed files with 89 additions and 36 deletions

View File

@ -34,7 +34,7 @@
* Questions concerning this software should be directed to
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
*
* KAME Id: LICENSE.pimd,v 1.1.1.1 1999/08/08 23:30:50 itojun Exp
* $Id: LICENSE.pimd,v 1.3 1999/09/03 04:49:23 itojun Exp $
*/
/*
* Part of this program has been derived from mrouted.

View File

@ -1,4 +1,4 @@
/* $NetBSD: debug.c,v 1.3 1999/08/19 17:31:06 itojun Exp $ */
/* $NetBSD: debug.c,v 1.4 1999/09/03 04:49:23 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)
*
* KAME Id: debug.c,v 1.1.1.1 1999/08/08 23:30:51 itojun Exp
* KAME Id: debug.c,v 1.3 1999/08/24 16:45:22 jinmei Exp
*/
/*
* Part of this program has been derived from mrouted.
@ -199,6 +199,7 @@ fdump(i)
if (fp != NULL) {
dump_vifs(fp);
dump_pim_mrt(fp);
dump_lcl_grp(fp);
(void) fclose(fp);
}
}
@ -395,6 +396,7 @@ dump_pim_mrt(fp)
u_int number_of_groups = 0;
char oifs[(sizeof(if_set)<<3)+1];
char pruned_oifs[(sizeof(if_set)<<3)+1];
char asserted_oifs[(sizeof(if_set)<<3)+1];
char leaves_oifs[(sizeof(if_set)<<3)+1];
char filter_oifs[(sizeof(if_set)<<3)+1];
char incoming_iif[(sizeof(if_set)<<3)+1];
@ -417,6 +419,8 @@ dump_pim_mrt(fp)
IF_ISSET(vifi, &r->oifs) ? 'o' : '.';
pruned_oifs[vifi] =
IF_ISSET(vifi, &r->pruned_oifs) ? 'p' : '.';
asserted_oifs[vifi] =
IF_ISSET(vifi, &r->pruned_oifs) ? 'a' : '.';
filter_oifs[vifi] =
IF_ISSET(vifi, &r->filter_oifs) ? 'f' : '.';
leaves_oifs[vifi] =
@ -445,6 +449,7 @@ dump_pim_mrt(fp)
fprintf(fp, "\n");
fprintf(fp, "Pruned oifs: %-20s\n", pruned_oifs);
fprintf(fp, "Asserted oifs: %-20s\n", pruned_oifs);
fprintf(fp, "Filtered oifs: %-20s\n", filter_oifs);
fprintf(fp, "Leaves oifs: %-20s\n", leaves_oifs);
fprintf(fp, "Outgoing oifs: %-20s\n", oifs);
@ -466,3 +471,31 @@ dump_pim_mrt(fp)
fprintf(fp, "Number of Groups: %u\n", number_of_groups);
}
void
dump_lcl_grp(fp)
FILE *fp;
{
vifi_t vifi;
struct uvif *v;
struct listaddr *g;
fprintf(fp, "\nList of local listner information per interface\n");
for (vifi = 0, v = uvifs; vifi < numvifs; vifi++, v++) {
int first = 1;
for (g = v->uv_groups; g != NULL; g = g->al_next) {
if (first) {
fprintf(fp, " Mif %d(%s)\n", vifi, v->uv_name);
first = 0;
}
fprintf(fp, " %s", inet6_fmt(&g->al_addr.sin6_addr));
if (g->al_timerid)
fprintf(fp, " timeout: %d",
timer_leftTimer(g->al_timerid));
if (g->al_query)
fprintf(fp, " querytimer: %d",
timer_leftTimer(g->al_timerid));
fputc('\n', fp);
}
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: defs.h,v 1.2 1999/08/19 17:31:06 itojun Exp $ */
/* $NetBSD: defs.h,v 1.3 1999/09/03 04:49:24 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)
*
* KAME Id: defs.h,v 1.1.1.1 1999/08/08 23:30:52 itojun Exp
* KAME Id: defs.h,v 1.3 1999/08/24 16:45:23 jinmei Exp
*/
/*
* Part of this program has been derived from PIM sparse-mode pimd.
@ -330,6 +330,7 @@ extern void fdump __P((int i));
extern void cdump __P((int i));
extern void dump_vifs __P((FILE *fp));
extern void dump_pim_mrt __P((FILE *fp));
extern void dump_lcl_grp __P((FILE *fp));
/* dvmrp_proto.c */
extern void dvmrp_accept_probe __P((u_int32 src, u_int32 dst,
@ -550,7 +551,8 @@ extern void set_leaves __P((mrtentry_t *mrtentry_ptr));
extern int change_interfaces __P((mrtentry_t *mrtentry_ptr,
vifi_t new_iif,
if_set *new_pruned_oifs,
if_set *new_leaves_));
if_set *new_leaves_,
if_set *new_asserted_oifs));
extern void calc_oifs __P((mrtentry_t *mrtentry_ptr,
if_set *oifs_ptr));
extern void process_kernel_call __P((void));

View File

@ -1,4 +1,4 @@
/* $NetBSD: mrt.c,v 1.2 1999/08/19 17:31:07 itojun Exp $ */
/* $NetBSD: mrt.c,v 1.3 1999/09/03 04:49:24 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)
*
* KAME Id: mrt.c,v 1.1.1.1 1999/08/08 23:30:52 itojun Exp
* KAME Id: mrt.c,v 1.2 1999/08/24 10:04:56 jinmei Exp
*/
/*
* Part of this program has been derived from PIM sparse-mode pimd.
@ -614,6 +614,7 @@ alloc_mrtentry(srcentry_ptr, grpentry_ptr)
IF_ZERO(&mrtentry_ptr->pruned_oifs);
IF_ZERO(&mrtentry_ptr->oifs);
IF_ZERO(&mrtentry_ptr->filter_oifs);
IF_ZERO(&mrtentry_ptr->asserted_oifs);
mrtentry_ptr->upstream = (pim_nbr_entry_t *)NULL;
mrtentry_ptr->metric = 0;
mrtentry_ptr->preference = 0;

View File

@ -1,4 +1,4 @@
/* $NetBSD: mrt.h,v 1.2 1999/08/19 17:31:07 itojun Exp $ */
/* $NetBSD: mrt.h,v 1.3 1999/09/03 04:49:24 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)
*
* KAME Id: mrt.h,v 1.1.1.1 1999/08/08 23:30:52 itojun Exp
* KAME Id: mrt.h,v 1.2 1999/08/24 10:04:56 jinmei Exp
*/
/*
* Part of this program has been derived from PIM sparse-mode pimd.
@ -171,6 +171,7 @@ struct mrtentry {
if_set oifs; /* The current result oifs */
if_set pruned_oifs; /* The pruned oifs (Prune received) */
if_set asserted_oifs; /* The asserted oifs (Lost Assert) */
if_set filter_oifs; /* The filtered oifs */
if_set leaves; /* Has directly connected members */
struct pim_nbr_entry *upstream; /* upstream router, needed because

View File

@ -1,4 +1,4 @@
/* $NetBSD: pim6_proto.c,v 1.2 1999/08/19 17:31:07 itojun Exp $ */
/* $NetBSD: pim6_proto.c,v 1.3 1999/09/03 04:49:24 itojun Exp $ */
/*
* Copyright (C) 1998 WIDE Project.
@ -63,7 +63,7 @@
* Questions concerning this software should be directed to
* Kurt Windisch (kurtw@antc.uoregon.edu)
*
* KAME Id: pim6_proto.c,v 1.2 1999/08/13 06:24:06 jinmei Exp
* KAME Id: pim6_proto.c,v 1.3 1999/08/24 10:04:56 jinmei Exp
*/
/*
* Part of this program has been derived from PIM sparse-mode pimd.
@ -241,7 +241,8 @@ receive_pim6_hello(src, pim_message, datalen)
change_interfaces(mrtentry_ptr,
srcentry_ptr->incoming,
&mrtentry_ptr->pruned_oifs,
&mrtentry_ptr->leaves);
&mrtentry_ptr->leaves,
&mrtentry_ptr->asserted_oifs);
if(state_change == 1)
trigger_join_alert(mrtentry_ptr);
}
@ -333,7 +334,8 @@ delete_pim6_nbr(nbr_delete)
change_interfaces(mrtentry_ptr,
srcentry_ptr->incoming,
&mrtentry_ptr->pruned_oifs,
&mrtentry_ptr->leaves);
&mrtentry_ptr->leaves,
&mrtentry_ptr->asserted_oifs);
if(state_change == -1) {
trigger_prune_alert(mrtentry_ptr);
} else if(state_change == 1) {
@ -546,7 +548,8 @@ delayed_prune_job(arg)
change_interfaces(mrtentry_ptr,
mrtentry_ptr->incoming,
&new_pruned_oifs,
&mrtentry_ptr->leaves);
&mrtentry_ptr->leaves,
&mrtentry_ptr->asserted_oifs);
/* Handle transition to negative cache */
if(state_change == -1)
@ -857,7 +860,8 @@ receive_pim6_join_prune(src, pim_message, datalen)
change_interfaces(mrtentry_ptr,
mrtentry_ptr->incoming,
&new_pruned_oifs,
&mrtentry_ptr->leaves);
&mrtentry_ptr->leaves,
&mrtentry_ptr->asserted_oifs);
/* Handle transition to negative cache */
if(state_change == -1)
@ -1148,6 +1152,7 @@ receive_pim6_assert(src, pim_message, datalen)
IF_COPY(&mrtentry_ptr->pruned_oifs, &new_pruned_oifs);
IF_SET(mifi, &new_pruned_oifs);
IF_SET(mifi, &mrtentry_ptr->asserted_oifs);
SET_TIMER(mrtentry_ptr->prune_timers[mifi],
PIM_JOIN_PRUNE_HOLDTIME);
@ -1155,7 +1160,8 @@ receive_pim6_assert(src, pim_message, datalen)
change_interfaces(mrtentry_ptr,
mrtentry_ptr->incoming,
&new_pruned_oifs,
&mrtentry_ptr->leaves);
&mrtentry_ptr->leaves,
&mrtentry_ptr->asserted_oifs);
/* Handle transition to negative cache */
if(state_change == -1)
@ -1494,12 +1500,14 @@ receive_pim6_graft(src, pim_message, datalen, pimtype)
/* Add to oiflist (unprune) */
if (IF_ISSET(mifi, &mrtentry_ptr->pruned_oifs)) {
IF_CLR(mifi, &mrtentry_ptr->pruned_oifs);
IF_CLR(mifi, &mrtentry_ptr->asserted_oifs);
SET_TIMER(mrtentry_ptr->prune_timers[mifi], 0);
state_change =
change_interfaces(mrtentry_ptr,
mrtentry_ptr->incoming,
&mrtentry_ptr->pruned_oifs,
&mrtentry_ptr->leaves);
&mrtentry_ptr->leaves,
&mrtentry_ptr->asserted_oifs);
if(state_change == 1)
trigger_join_alert(mrtentry_ptr);
}

View File

@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $NetBSD: pim6dd.8,v 1.3 1999/08/19 17:31:07 itojun Exp $
.\" $NetBSD: pim6dd.8,v 1.4 1999/09/03 04:49:24 itojun Exp $
.\" KAME Id: pim6dd.8,v 1.3 1999/08/13 09:20:43 jinmei Exp
.\"
.Dd Nov 17, 1998

View File

@ -25,7 +25,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $NetBSD: pim6dd.conf.5,v 1.2 1999/08/19 17:31:07 itojun Exp $
.\" $NetBSD: pim6dd.conf.5,v 1.3 1999/09/03 04:49:24 itojun Exp $
.\" KAME Id: pim6dd.conf.5,v 1.1.1.1 1999/08/08 23:30:53 itojun Exp
.\"
.Dd Nov 17, 1998

View File

@ -1,4 +1,4 @@
/* $NetBSD: route.c,v 1.2 1999/08/19 17:31:08 itojun Exp $ */
/* $NetBSD: route.c,v 1.3 1999/09/03 04:49:24 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)
*
* KAME Id: route.c,v 1.1.1.1 1999/08/08 23:30:53 itojun Exp
* KAME Id: route.c,v 1.2 1999/08/24 10:04:56 jinmei Exp
*/
/*
* Part of this program has been derived from PIM sparse-mode pimd.
@ -264,7 +264,8 @@ add_leaf(vifi, source, group)
change_interfaces(mrtentry_srcs,
mrtentry_srcs->incoming,
&mrtentry_srcs->pruned_oifs,
&new_leaves);
&new_leaves,
&mrtentry_srcs->asserted_oifs);
/* Handle transition from negative cache */
if(state_change == 1)
@ -324,7 +325,8 @@ delete_leaf(vifi, source, group)
change_interfaces(mrtentry_srcs,
mrtentry_srcs->incoming,
&mrtentry_srcs->pruned_oifs,
&new_leaves);
&new_leaves,
&mrtentry_srcs->asserted_oifs);
/* Handle transition to negative cache */
if(state_change == -1)
@ -356,6 +358,7 @@ calc_oifs(mrtentry_ptr, oifs_ptr)
IF_COPY(&nbr_mifs, &oifs);
IF_CLR_MASK(&oifs, &mrtentry_ptr->pruned_oifs);
IF_MERGE(&oifs, &mrtentry_ptr->leaves, &oifs);
IF_CLR_MASK(&oifs, &mrtentry_ptr->asserted_oifs);
IF_CLR_MASK(&oifs, &mrtentry_ptr->filter_oifs);
IF_CLR(mrtentry_ptr->incoming, &oifs);
IF_COPY(&oifs, oifs_ptr);
@ -374,17 +377,19 @@ calc_oifs(mrtentry_ptr, oifs_ptr)
*/
int
change_interfaces(mrtentry_ptr, new_iif, new_pruned_oifs,
new_leaves_)
new_leaves_, new_asserted_oifs)
mrtentry_t *mrtentry_ptr;
vifi_t new_iif;
if_set *new_pruned_oifs;
if_set *new_leaves_;
if_set *new_asserted_oifs;
{
if_set old_pruned_oifs;
if_set old_leaves;
if_set old_pruned_oifs; /* unnecessary? */
if_set old_leaves; /* unnecessary? */
if_set new_leaves;
if_set new_real_oifs; /* The result oifs */
if_set old_real_oifs;
if_set old_asserted_oifs; /* unnecessary? */
vifi_t old_iif;
int return_value;
@ -396,12 +401,14 @@ change_interfaces(mrtentry_ptr, new_iif, new_pruned_oifs,
old_iif = mrtentry_ptr->incoming;
IF_COPY(&mrtentry_ptr->leaves, &old_leaves);
IF_COPY(&mrtentry_ptr->pruned_oifs, &old_pruned_oifs);
IF_COPY(&mrtentry_ptr->asserted_oifs, &old_asserted_oifs);
IF_COPY(&mrtentry_ptr->oifs, &old_real_oifs);
mrtentry_ptr->incoming = new_iif;
IF_COPY(new_pruned_oifs, &mrtentry_ptr->pruned_oifs);
IF_COPY(&new_leaves, &mrtentry_ptr->leaves);
IF_COPY(new_asserted_oifs, &mrtentry_ptr->asserted_oifs);
calc_oifs(mrtentry_ptr, &new_real_oifs);
if (IF_ISEMPTY(&old_real_oifs)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: timer.c,v 1.2 1999/08/19 17:31:08 itojun Exp $ */
/* $NetBSD: timer.c,v 1.3 1999/09/03 04:49:24 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)
*
* KAME Id: timer.c,v 1.1.1.1 1999/08/08 23:30:54 itojun Exp
* KAME Id: timer.c,v 1.2 1999/08/24 10:04:57 jinmei Exp
*/
/*
* Part of this program has been derived from PIM sparse-mode pimd.
@ -307,7 +307,8 @@ age_routes()
change_interfaces(mrtentry_ptr,
mrtentry_ptr->incoming,
&mrtentry_ptr->pruned_oifs,
&mrtentry_ptr->leaves);
&mrtentry_ptr->leaves,
&mrtentry_ptr->asserted_oifs);
if(state_change == -1)
trigger_prune_alert(mrtentry_ptr);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: trace.c,v 1.2 1999/08/19 17:31:08 itojun Exp $ */
/* $NetBSD: trace.c,v 1.3 1999/09/03 04:49:24 itojun Exp $ */
/*
* Copyright (C) 1999 WIDE Project.
@ -64,7 +64,7 @@
* Questions concerning this software should be directed to
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
*
* KAME Id: trace.c,v 1.2 1999/08/17 10:47:27 itojun Exp
* KAME Id: trace.c,v 1.3 1999/08/31 12:30:53 jinmei Exp
*/
/*
* Part of this program has been derived from mrouted.
@ -156,7 +156,7 @@ accept_mtrace(src, dst, group, ifindex, data, no, datalen)
(IN6_IS_ADDR_LINKLOCAL(&qry->tr_src)
|| IN6_IS_ADDR_MC_LINKLOCAL(&qry->tr_src)) ? ifindex : 0;
dst_sa6.sin6_addr = qry->tr_dst;
src_sa6.sin6_scope_id =
dst_sa6.sin6_scope_id =
(IN6_IS_ADDR_LINKLOCAL(&qry->tr_dst)
|| IN6_IS_ADDR_MC_LINKLOCAL(&qry->tr_dst)) ? ifindex : 0;
grp_sa6.sin6_addr = *group;

View File

@ -1,4 +1,4 @@
/* $NetBSD: vif.h,v 1.2 1999/08/19 17:31:08 itojun Exp $ */
/* $NetBSD: vif.h,v 1.3 1999/09/03 04:49:24 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)
*
* KAME Id: vif.h,v 1.1.1.1 1999/08/08 23:30:56 itojun Exp
* KAME Id: vif.h,v 1.2 1999/08/24 16:45:23 jinmei Exp
*/
/*
* Part of this program has been derived from mrouted.
@ -256,7 +256,7 @@ struct listaddr {
} al_alu;
u_char al_pv; /* router protocol version */
u_char al_mv; /* router mrouted version */
u_char al_old; /* time since heard old report */
u_char al_old; /* time since heard old report: unnecessary for mld */
u_char al_index; /* neighbor index */
u_long al_timerid; /* timer for group membership */
u_long al_query; /* timer for repeated leave query */