diff --git a/usr.sbin/pim6sd/BUGS.TODO b/usr.sbin/pim6sd/BUGS.TODO index 34d5e536b67d..5b8fccbb8ce2 100644 --- a/usr.sbin/pim6sd/BUGS.TODO +++ b/usr.sbin/pim6sd/BUGS.TODO @@ -1,4 +1,4 @@ -KAME Id: BUGS.TODO,v 1.1.1.1 1999/08/08 23:30:57 itojun Exp +$KAME: BUGS.TODO,v 1.2 2000/07/24 01:00:28 itojun Exp $ THIS LIST IS FAR AWAY FROM BEING COMPLETE, so these are the few things that came up at the right moment to be written down. diff --git a/usr.sbin/pim6sd/LICENSE.pimd b/usr.sbin/pim6sd/LICENSE.pimd index 419b880c054f..b965503b13ad 100644 --- a/usr.sbin/pim6sd/LICENSE.pimd +++ b/usr.sbin/pim6sd/LICENSE.pimd @@ -1,4 +1,7 @@ /* +/* $NetBSD: LICENSE.pimd,v 1.2 2000/12/04 07:09:35 itojun Exp $ */ +/* $KAME: LICENSE.pimd,v 1.2 2000/07/24 01:00:28 itojun Exp $ */ + * Copyright (c) 1998 by the University of Southern California. * All rights reserved. * @@ -33,8 +36,6 @@ /* * 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:57 itojun Exp */ /* * Part of this program has been derived from mrouted. diff --git a/usr.sbin/pim6sd/README b/usr.sbin/pim6sd/README index 0b8d6be6c5ca..3d1949bf629d 100644 --- a/usr.sbin/pim6sd/README +++ b/usr.sbin/pim6sd/README @@ -1,4 +1,4 @@ -KAME Id: README,v 1.1.1.1 1999/08/08 23:30:57 itojun Exp +$KAME: README,v 1.2 2000/07/24 01:00:28 itojun Exp $ WARNING! WARNING! WARNING! THIS RELEASE IS VERY ALPHA, SO PLEASE DO NOT REDISTRIBUTE AND diff --git a/usr.sbin/pim6sd/callout.c b/usr.sbin/pim6sd/callout.c index 87be03769b9a..444a6a7fdbb1 100644 --- a/usr.sbin/pim6sd/callout.c +++ b/usr.sbin/pim6sd/callout.c @@ -1,4 +1,5 @@ -/* $NetBSD: callout.c,v 1.1 2000/01/28 19:32:46 itojun Exp $ */ +/* $NetBSD: callout.c,v 1.2 2000/12/04 07:09:35 itojun Exp $ */ +/* $KAME: callout.c,v 1.6 2000/12/04 06:45:28 itojun Exp $ */ /* * The mrouted program is covered by the license in the accompanying file @@ -32,8 +33,9 @@ #include #include #include -#include "debug.h" +#include #include "defs.h" +#include "debug.h" #include "callout.h" /* the code below implements a callout queue */ diff --git a/usr.sbin/pim6sd/callout.h b/usr.sbin/pim6sd/callout.h index bf7d3ba128ac..038ea66edd78 100644 --- a/usr.sbin/pim6sd/callout.h +++ b/usr.sbin/pim6sd/callout.h @@ -1,4 +1,5 @@ -/* $NetBSD: callout.h,v 1.1 2000/01/28 19:32:46 itojun Exp $ */ +/* $NetBSD: callout.h,v 1.2 2000/12/04 07:09:35 itojun Exp $ */ +/* $KAME: callout.h,v 1.4 2000/12/04 06:45:28 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. @@ -50,8 +51,6 @@ #ifndef CALLOUT_H #define CALLOUT_H -#include "defs.h" - extern void callout_init __P((void)); extern void free_all_callouts __P((void)); extern void age_callout_queue __P((int)); diff --git a/usr.sbin/pim6sd/cfparse.h b/usr.sbin/pim6sd/cfparse.h index 1504e8622163..564a9c5493c0 100644 --- a/usr.sbin/pim6sd/cfparse.h +++ b/usr.sbin/pim6sd/cfparse.h @@ -1,4 +1,5 @@ -/* $NetBSD: cfparse.h,v 1.1 2000/01/28 19:32:46 itojun Exp $ */ +/* $NetBSD: cfparse.h,v 1.2 2000/12/04 07:09:35 itojun Exp $ */ +/* $KAME: cfparse.h,v 1.2 2000/12/04 06:45:28 itojun Exp $ */ /* * Copyright (C) 1999 WIDE Project. diff --git a/usr.sbin/pim6sd/cfparse.y b/usr.sbin/pim6sd/cfparse.y index cf2342500658..42c4fcbaaaa3 100644 --- a/usr.sbin/pim6sd/cfparse.y +++ b/usr.sbin/pim6sd/cfparse.y @@ -1,4 +1,5 @@ -/* $NetBSD: cfparse.y,v 1.2 2000/05/19 10:43:46 itojun Exp $ */ +/* $NetBSD: cfparse.y,v 1.3 2000/12/04 07:09:35 itojun Exp $ */ +/* $KAME: cfparse.y,v 1.13 2000/12/04 06:45:28 itojun Exp $ */ /* * Copyright (C) 1999 WIDE Project. @@ -30,17 +31,21 @@ */ %{ #include - +#include +#include +#include #include - +#include +#include #include - #include #include +#include #include "defs.h" -#include "rp.h" #include "vif.h" +#include "mrt.h" +#include "rp.h" #include "var.h" #include "vmbuf.h" @@ -641,6 +646,10 @@ phyint_config() } } + /* IPv6 PIM needs one global unicast address (at least for now) */ + if (max_global_address() == NULL) + log(LOG_ERR, 0, "There's no global address available"); + return(0); } @@ -689,7 +698,7 @@ rp_config() } if (!sa6_rp) - sa6_rp = max_global_address(); /* this MUST suceed */ + sa6_rp = max_global_address(); /* this MUST succeed */ my_cand_rp_address = *sa6_rp; /* @@ -790,7 +799,7 @@ bsr_config() } if (!sa6_bsr) - sa6_bsr = max_global_address(); /* this MUST suceed */ + sa6_bsr = max_global_address(); /* this MUST succeed */ my_bsr_address = *sa6_bsr; MASKLEN_TO_MASK6(my_bsr_hash_masklen, my_bsr_hash_mask); diff --git a/usr.sbin/pim6sd/cftoken.l b/usr.sbin/pim6sd/cftoken.l index 30103d4340e0..6baa6d8017dc 100644 --- a/usr.sbin/pim6sd/cftoken.l +++ b/usr.sbin/pim6sd/cftoken.l @@ -1,4 +1,5 @@ -/* $NetBSD: cftoken.l,v 1.3 2000/10/06 00:13:02 itojun Exp $ */ +/* $NetBSD: cftoken.l,v 1.4 2000/12/04 07:09:35 itojun Exp $ */ +/* $KAME: cftoken.l,v 1.8 2000/12/04 06:45:29 itojun Exp $ */ %{ /* diff --git a/usr.sbin/pim6sd/config.c b/usr.sbin/pim6sd/config.c index bb5f6f25b89b..44d3a9f850d4 100644 --- a/usr.sbin/pim6sd/config.c +++ b/usr.sbin/pim6sd/config.c @@ -1,4 +1,5 @@ -/* $NetBSD: config.c,v 1.3 2000/05/19 10:43:47 itojun Exp $ */ +/* $NetBSD: config.c,v 1.4 2000/12/04 07:09:35 itojun Exp $ */ +/* $KAME: config.c,v 1.22 2000/12/04 06:45:29 itojun Exp $ */ /* * Copyright (c) 1998 by the University of Southern California. @@ -59,29 +60,39 @@ */ +#include #include -#include -#include -#include "vif.h" -#include "pim6.h" -#include "inet6.h" -#include "rp.h" -#include "pimd.h" -#include "timer.h" -#include "route.h" +#include +#include +#include #if defined(__FreeBSD__) && __FreeBSD__ >= 3 #include #endif +#include +#include +#include +#include #include +#include +#include +#include #ifdef HAVE_GETIFADDRS #include #endif #include #include #include -#include "config.h" -#include #include +#include "defs.h" +#include "config.h" +#include "vif.h" +#include "pim6.h" +#include "inet6.h" +#include "mrt.h" +#include "rp.h" +#include "pimd.h" +#include "timer.h" +#include "route.h" #include "debug.h" void add_phaddr(struct uvif *v, struct sockaddr_in6 *addr, diff --git a/usr.sbin/pim6sd/config.h b/usr.sbin/pim6sd/config.h index 79f8a464639d..9d367f6b2c41 100644 --- a/usr.sbin/pim6sd/config.h +++ b/usr.sbin/pim6sd/config.h @@ -1,4 +1,5 @@ -/* $NetBSD: config.h,v 1.1 2000/01/28 19:32:47 itojun Exp $ */ +/* $NetBSD: config.h,v 1.2 2000/12/04 07:09:35 itojun Exp $ */ +/* $KAME: config.h,v 1.4 2000/12/04 06:45:29 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. diff --git a/usr.sbin/pim6sd/crc.c b/usr.sbin/pim6sd/crc.c index bfee70c9c42d..eae346fad3bf 100644 --- a/usr.sbin/pim6sd/crc.c +++ b/usr.sbin/pim6sd/crc.c @@ -1,4 +1,5 @@ -/* $NetBSD: crc.c,v 1.1 2000/01/28 19:32:47 itojun Exp $ */ +/* $NetBSD: crc.c,v 1.2 2000/12/04 07:09:35 itojun Exp $ */ +/* $KAME: crc.c,v 1.4 2000/12/04 06:45:29 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. diff --git a/usr.sbin/pim6sd/crc.h b/usr.sbin/pim6sd/crc.h index c3e6a0282be2..3f3f9a6b9b85 100644 --- a/usr.sbin/pim6sd/crc.h +++ b/usr.sbin/pim6sd/crc.h @@ -1,4 +1,5 @@ -/* $NetBSD: crc.h,v 1.1 2000/01/28 19:32:47 itojun Exp $ */ +/* $NetBSD: crc.h,v 1.2 2000/12/04 07:09:35 itojun Exp $ */ +/* $KAME: crc.h,v 1.4 2000/12/04 06:45:29 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. diff --git a/usr.sbin/pim6sd/debug.c b/usr.sbin/pim6sd/debug.c index ea2697658c25..bea4d8682179 100644 --- a/usr.sbin/pim6sd/debug.c +++ b/usr.sbin/pim6sd/debug.c @@ -1,4 +1,5 @@ -/* $NetBSD: debug.c,v 1.6 2000/10/12 06:33:23 augustss Exp $ */ +/* $NetBSD: debug.c,v 1.7 2000/12/04 07:09:35 itojun Exp $ */ +/* $KAME: debug.c,v 1.44 2000/12/04 06:45:29 itojun Exp $ */ /* * Copyright (c) 1998 by the University of Southern California. @@ -58,21 +59,22 @@ * */ -#include -#include -#include #include #include #include #include -#include +#include #include #include #include #include +#include #include -#include "pathnames.h" +#include +#include +#include #include "defs.h" +#include "pathnames.h" #include "pimd.h" #include "debug.h" #include "mrt.h" @@ -512,6 +514,7 @@ dump_nbrs(fp) struct uvif *v; vifi_t vifi; pim_nbr_entry_t *n; + struct phaddr *pa; fprintf(fp, "PIM Neighbor List\n"); fprintf(fp, " %-3s %6s %-40s %-5s\n", @@ -530,8 +533,12 @@ dump_nbrs(fp) else fprintf(fp, " %3s %6s", "", ""); fprintf(fp, " %-40s %-5u\n", - inet6_fmt(&n->address.sin6_addr), - n->timer); + sa6_fmt(&n->address), n->timer); + + for (pa = n->aux_addrs; pa; pa = pa->pa_next) { + fprintf(fp, "%16s%s\n", "", + sa6_fmt(&pa->pa_addr)); + } } } } @@ -960,16 +967,20 @@ dump_rp_set(fp) cand_rp_t *rp; rp_grp_entry_t *rp_grp_entry; grp_mask_t *grp_mask; + int print_upstream; fprintf(fp, "---------------------------RP-Set----------------------------\n"); fprintf(fp, "Current BSR address: %s Prio: %d Timeout: %d\n", inet6_fmt(&curr_bsr_address.sin6_addr), curr_bsr_priority, pim_bootstrap_timer); fprintf(fp, "%-40s %-3s Group prefix Prio Hold Age\n", - "RP-address", "IN"); + "RP-address/Upstream", "IN"); for (rp = cand_rp_list; rp != (cand_rp_t *) NULL; rp = rp->next) { + char *upstream_str; + + print_upstream = 0; fprintf(fp, "%-40s %-3d ", inet6_fmt(&rp->rpentry->address.sin6_addr), @@ -983,17 +994,31 @@ dump_rp_set(fp) rp_grp_entry->priority, rp_grp_entry->advholdtime, rp_grp_entry->holdtime); + if (rp->rpentry->upstream != NULL) + upstream_str = sa6_fmt(&rp->rpentry->upstream->address); + else + upstream_str = "(none)"; + for (rp_grp_entry = rp_grp_entry->rp_grp_next; rp_grp_entry != (rp_grp_entry_t *) NULL; rp_grp_entry = rp_grp_entry->rp_grp_next) { grp_mask = rp_grp_entry->group; - fprintf(fp, "%59.16s %-4u %-4u %-3u\n", /* XXX: hardcoding */ + /* XXX: hardcoding */ + if (print_upstream == 0) { + fprintf(fp, " %-38s", upstream_str); + print_upstream = 1; + } + else + fprintf(fp, " %38s", ""); + fprintf(fp, "%4s %-16.16s %-4u %-4u %-3u\n", "", net6name(&grp_mask->group_addr.sin6_addr, &grp_mask->group_mask), rp_grp_entry->priority, rp_grp_entry->advholdtime, rp_grp_entry->holdtime); } + if (print_upstream == 0) + fprintf(fp, " %-38s\n", upstream_str); } } return (TRUE); diff --git a/usr.sbin/pim6sd/debug.h b/usr.sbin/pim6sd/debug.h index 6db92274487e..c1cb43427f9b 100644 --- a/usr.sbin/pim6sd/debug.h +++ b/usr.sbin/pim6sd/debug.h @@ -1,4 +1,5 @@ -/* $NetBSD: debug.h,v 1.3 2000/10/11 20:23:54 is Exp $ */ +/* $NetBSD: debug.h,v 1.4 2000/12/04 07:09:35 itojun Exp $ */ +/* $KAME: debug.h,v 1.11 2000/12/04 06:45:29 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. @@ -49,9 +50,6 @@ #ifndef DEBUG_H #define DEBUG_H -#include -#include - extern unsigned long debug; extern int log_nmsgs; extern FILE *log_fp; diff --git a/usr.sbin/pim6sd/defs.h b/usr.sbin/pim6sd/defs.h index f1b9f2c9fd88..05f113a1aa85 100644 --- a/usr.sbin/pim6sd/defs.h +++ b/usr.sbin/pim6sd/defs.h @@ -1,4 +1,5 @@ -/* $NetBSD: defs.h,v 1.1 2000/01/28 19:32:47 itojun Exp $ */ +/* $NetBSD: defs.h,v 1.2 2000/12/04 07:09:35 itojun Exp $ */ +/* $KAME: defs.h,v 1.4 2000/12/04 06:45:29 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. @@ -49,8 +50,6 @@ #ifndef DEFS_H #define DEFS_H -#include - #define TRUE 1 #define FALSE 0 #define ELSE else /* To make emacs cc-mode happy */ diff --git a/usr.sbin/pim6sd/inet6.c b/usr.sbin/pim6sd/inet6.c index 019ac7b6700c..796023f87555 100644 --- a/usr.sbin/pim6sd/inet6.c +++ b/usr.sbin/pim6sd/inet6.c @@ -1,4 +1,5 @@ -/* $NetBSD: inet6.c,v 1.2 2000/05/19 10:43:47 itojun Exp $ */ +/* $NetBSD: inet6.c,v 1.3 2000/12/04 07:09:35 itojun Exp $ */ +/* $KAME: inet6.c,v 1.9 2000/12/04 06:45:29 itojun Exp $ */ /* * Copyright (C) 1998 WIDE Project. @@ -47,6 +48,12 @@ #include #include +#include +#include +#include +#include +#include +#include #include #include #include diff --git a/usr.sbin/pim6sd/inet6.h b/usr.sbin/pim6sd/inet6.h index 97ed9adcf937..774905a68b47 100644 --- a/usr.sbin/pim6sd/inet6.h +++ b/usr.sbin/pim6sd/inet6.h @@ -1,4 +1,5 @@ -/* $NetBSD: inet6.h,v 1.2 2000/05/19 10:43:48 itojun Exp $ */ +/* $NetBSD: inet6.h,v 1.3 2000/12/04 07:09:35 itojun Exp $ */ +/* $KAME: inet6.h,v 1.6 2000/12/04 06:45:29 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. @@ -48,7 +49,6 @@ #ifndef INET6_H #define INET6_H -#include "vif.h" extern int numerichost; diff --git a/usr.sbin/pim6sd/kern.c b/usr.sbin/pim6sd/kern.c index eb9e14d0b7b3..7a3185bfcee5 100644 --- a/usr.sbin/pim6sd/kern.c +++ b/usr.sbin/pim6sd/kern.c @@ -1,4 +1,5 @@ -/* $NetBSD: kern.c,v 1.1 2000/01/28 19:32:48 itojun Exp $ */ +/* $NetBSD: kern.c,v 1.2 2000/12/04 07:09:35 itojun Exp $ */ +/* $KAME: kern.c,v 1.7 2000/12/04 06:45:30 itojun Exp $ */ /* * Copyright (c) 1998 by the University of Southern California. @@ -49,22 +50,28 @@ * */ +#include #include #include -#include #include #include -#include +#include #include -#include -#include -#include #if defined(__FreeBSD__) && __FreeBSD__ >= 3 #include #endif +#include +#include +#include +#include #include #include +#include +#include +#include +#include "defs.h" #include "pimd.h" +#include "vif.h" #include "inet6.h" #include "vif.h" #include "mrt.h" diff --git a/usr.sbin/pim6sd/kern.h b/usr.sbin/pim6sd/kern.h index fab877c664ab..46906b8ad7cd 100644 --- a/usr.sbin/pim6sd/kern.h +++ b/usr.sbin/pim6sd/kern.h @@ -1,4 +1,5 @@ -/* $NetBSD: kern.h,v 1.1 2000/01/28 19:32:48 itojun Exp $ */ +/* $NetBSD: kern.h,v 1.2 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: kern.h,v 1.5 2000/12/04 06:45:30 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. @@ -48,8 +49,6 @@ #ifndef KERN_H #define KERN_H -#include "vif.h" -#include "mrt.h" extern void k_set_rcvbuf __P((int socket, int bufsize, int minsize)); extern void k_set_hlim __P((int socket, int t)); diff --git a/usr.sbin/pim6sd/main.c b/usr.sbin/pim6sd/main.c index 882e8936d4a6..def6ffe8aa1f 100644 --- a/usr.sbin/pim6sd/main.c +++ b/usr.sbin/pim6sd/main.c @@ -1,4 +1,5 @@ -/* $NetBSD: main.c,v 1.4 2000/10/12 06:33:24 augustss Exp $ */ +/* $NetBSD: main.c,v 1.5 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: main.c,v 1.14 2000/12/04 07:01:08 itojun Exp $ */ /* * Copyright (c) 1998 by the University of Southern California. @@ -58,8 +59,15 @@ * */ +#include #include #include +#include +#include +#include +#include +#include +#include #include #include #include @@ -67,6 +75,7 @@ #include #include #include +#include #include "pathnames.h" #include "defs.h" #include "debug.h" @@ -80,6 +89,7 @@ #include "rp.h" #include "kern.h" #include "cfparse.h" +#include "pim6_proto.h" char configfilename[256] = _PATH_PIM6D_CONF; char versionstring[100]; @@ -674,17 +684,25 @@ timer(i) static void cleanup() { + vifi_t vifi; + struct uvif *v; + + /* inform all neighbors that I'm going to die */ + for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) { + if ((v->uv_flags & (VIFF_DOWN|VIFF_DISABLED|MIFF_REGISTER)) == 0) + send_pim6_hello(v, 0); + } /* * TODO: XXX (not in the spec): if I am the BSR, somehow inform the other * routers I am going down and need to elect another BSR? (probably by * sending a the Cand-RP-set with my_priority=LOWEST?) * - */ - - k_stop_pim(mld6_socket); -} + */ + ; + k_stop_pim(mld6_socket); +} /* * Signal handler. Take note of the fact that the signal arrived so that the diff --git a/usr.sbin/pim6sd/mld6.c b/usr.sbin/pim6sd/mld6.c index b7c614e4a132..4d4d0e2529dc 100644 --- a/usr.sbin/pim6sd/mld6.c +++ b/usr.sbin/pim6sd/mld6.c @@ -1,4 +1,5 @@ -/* $NetBSD: mld6.c,v 1.6 2000/10/12 06:33:24 augustss Exp $ */ +/* $NetBSD: mld6.c,v 1.7 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: mld6.c,v 1.29 2000/12/04 06:45:30 itojun Exp $ */ /* * Copyright (C) 1998 WIDE Project. @@ -78,19 +79,27 @@ */ #include +#include #include #include -#include +#include +#include #include #include +#include #include +#include #include #include #include #include +#include +#include +#include "defs.h" +#include "vif.h" +#include "mrt.h" #include "mld6.h" #include "kern.h" -#include "defs.h" #include "inet6.h" #include "debug.h" #include "mld6_proto.h" @@ -168,7 +177,13 @@ init_mld6() k_set_rcvbuf(mld6_socket, SO_RECV_BUF_SIZE_MAX, SO_RECV_BUF_SIZE_MIN); /* lots of input buffering */ k_set_hlim(mld6_socket, MINHLIM); /* restrict multicasts to one hop */ +#if 0 + /* + * Since we don't have to handle DMVRP messages via the MLD6 socket, + * we can just let outgoing multicast packets be loop-backed. + */ k_set_loop(mld6_socket, FALSE); /* disable multicast loopback */ +#endif /* address initialization */ allnodes_group.sin6_addr = in6addr_linklocal_allnodes; @@ -473,7 +488,7 @@ make_mld6_msg(type, code, src, dst, group, ifindex, delay, datalen, alert) if (ifindex != -1 || src) { struct in6_pktinfo *pktinfo; - cmsgp->cmsg_len = CMSG_SPACE(sizeof(struct in6_pktinfo)); + cmsgp->cmsg_len = CMSG_LEN(sizeof(struct in6_pktinfo)); cmsgp->cmsg_level = IPPROTO_IPV6; cmsgp->cmsg_type = IPV6_PKTINFO; pktinfo = (struct in6_pktinfo *)CMSG_DATA(cmsgp); @@ -489,7 +504,7 @@ make_mld6_msg(type, code, src, dst, group, ifindex, delay, datalen, alert) int currentlen; void *hbhbuf, *optp = NULL; - cmsgp->cmsg_len = CMSG_SPACE(hbhlen); + cmsgp->cmsg_len = CMSG_LEN(hbhlen); cmsgp->cmsg_level = IPPROTO_IPV6; cmsgp->cmsg_type = IPV6_HOPOPTS; hbhbuf = CMSG_DATA(cmsgp); @@ -533,15 +548,11 @@ send_mld6(type, code, src, dst, group, index, delay, datalen, alert) int index, delay, alert; int datalen; /* for trace packets only */ { - int setloop = 0; struct sockaddr_in6 *dstp; make_mld6_msg(type, code, src, dst, group, index, delay, datalen, alert); dstp = (struct sockaddr_in6 *)sndmh.msg_name; - if (IN6_ARE_ADDR_EQUAL(&dstp->sin6_addr, &allnodes_group.sin6_addr)) { - setloop = 1; - k_set_loop(mld6_socket, TRUE); - } + if (sendmsg(mld6_socket, &sndmh, 0) < 0) { if (errno == ENETDOWN) check_vif_state(); @@ -552,8 +563,6 @@ send_mld6(type, code, src, dst, group, index, delay, datalen, alert) src ? inet6_fmt(&src->sin6_addr) : "(unspec)", ifindex2str(index)); - if (setloop) - k_set_loop(mld6_socket, FALSE); return; } diff --git a/usr.sbin/pim6sd/mld6.h b/usr.sbin/pim6sd/mld6.h index eb89ef5f22e5..31cbc4381959 100644 --- a/usr.sbin/pim6sd/mld6.h +++ b/usr.sbin/pim6sd/mld6.h @@ -1,4 +1,5 @@ -/* $NetBSD: mld6.h,v 1.2 2000/05/19 10:43:48 itojun Exp $ */ +/* $NetBSD: mld6.h,v 1.3 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: mld6.h,v 1.8 2000/12/04 06:45:30 itojun Exp $ */ /* * Copyright (C) 1998 WIDE Project. @@ -49,11 +50,6 @@ #ifndef MLD6_H #define MLD6_H -#include -#include -#include -#include - #define RECV_BUF_SIZE 64*1024 #define SO_RECV_BUF_SIZE_MAX 256*1024 #define SO_RECV_BUF_SIZE_MIN 48*1024 diff --git a/usr.sbin/pim6sd/mld6_proto.c b/usr.sbin/pim6sd/mld6_proto.c index 533ce4075526..ac051978b36e 100644 --- a/usr.sbin/pim6sd/mld6_proto.c +++ b/usr.sbin/pim6sd/mld6_proto.c @@ -1,4 +1,5 @@ -/* $NetBSD: mld6_proto.c,v 1.3 2000/10/12 06:33:24 augustss Exp $ */ +/* $NetBSD: mld6_proto.c,v 1.4 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: mld6_proto.c,v 1.13 2000/12/04 06:45:30 itojun Exp $ */ /* * Copyright (C) 1998 WIDE Project. @@ -95,20 +96,26 @@ * */ -#include #include +#include #include #include +#include #include #include +#include #include #include #include #include +#include +#include +#include "defs.h" #include "mld6.h" #include "vif.h" #include "debug.h" #include "inet6.h" +#include "mrt.h" #include "route.h" #include "callout.h" #include "timer.h" diff --git a/usr.sbin/pim6sd/mld6_proto.h b/usr.sbin/pim6sd/mld6_proto.h index 62cd1cbddc61..adcfbc71987a 100644 --- a/usr.sbin/pim6sd/mld6_proto.h +++ b/usr.sbin/pim6sd/mld6_proto.h @@ -1,4 +1,5 @@ -/* $NetBSD: mld6_proto.h,v 1.1 2000/01/28 19:32:49 itojun Exp $ */ +/* $NetBSD: mld6_proto.h,v 1.2 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: mld6_proto.h,v 1.4 2000/12/04 06:45:30 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. @@ -49,8 +50,6 @@ #ifndef MLD6_PROTO_H #define MLD6_PROTO_H -#include "vif.h" - extern void query_groups __P((struct uvif *v)); extern int check_grp_membership __P((struct uvif *v, struct sockaddr_in6 *group)); diff --git a/usr.sbin/pim6sd/mrt.c b/usr.sbin/pim6sd/mrt.c index 99e857bc8d98..0fb4adcbacad 100644 --- a/usr.sbin/pim6sd/mrt.c +++ b/usr.sbin/pim6sd/mrt.c @@ -1,4 +1,5 @@ -/* $NetBSD: mrt.c,v 1.3 2000/05/19 10:43:49 itojun Exp $ */ +/* $NetBSD: mrt.c,v 1.4 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: mrt.c,v 1.6 2000/12/04 06:45:30 itojun Exp $ */ /* * Copyright (c) 1998 by the University of Southern California. @@ -49,9 +50,18 @@ * */ +#include +#include +#include +#include +#include +#include +#include #include #include #include +#include +#include "defs.h" #include "mrt.h" #include "vif.h" #include "rp.h" @@ -815,7 +825,7 @@ create_grpentry(group) /* * Return TRUE if the entry is found and then *mrtPtr is set to point to that - * entry. Otherwise return FALSE and *mrtPtr points the the previous entry + * entry. Otherwise return FALSE and *mrtPtr points the previous entry * (or NULL if first in the chain. */ static int @@ -852,7 +862,7 @@ search_srcmrtlink(srcentry_ptr, group, mrtPtr) /* * Return TRUE if the entry is found and then *mrtPtr is set to point to that - * entry. Otherwise return FALSE and *mrtPtr points the the previous entry + * entry. Otherwise return FALSE and *mrtPtr points the previous entry * (or NULL if first in the chain. */ static int diff --git a/usr.sbin/pim6sd/mrt.h b/usr.sbin/pim6sd/mrt.h index 2b9141a01e52..14aedfe59919 100644 --- a/usr.sbin/pim6sd/mrt.h +++ b/usr.sbin/pim6sd/mrt.h @@ -1,4 +1,5 @@ -/* $NetBSD: mrt.h,v 1.1 2000/01/28 19:32:49 itojun Exp $ */ +/* $NetBSD: mrt.h,v 1.2 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: mrt.h,v 1.8 2000/12/04 06:45:30 itojun Exp $ */ /* * Copyright (c) 1998 by the University of Southern California. @@ -53,18 +54,6 @@ #ifndef MRT_H #define MRT_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "defs.h" - - /* flags for the mrt entries */ #define MRTF_SPT 0x0001 /* iif toward source */ @@ -153,16 +142,16 @@ typedef struct build_jp_message { typedef struct pim_nbr_entry { - struct pim_nbr_entry *next; /* link to next neighbor */ - struct pim_nbr_entry *prev; /* link to prev neighbor */ - struct sockaddr_in6 address; /* neighbor address */ - vifi_t vifi; /* which interface */ - u_int16 timer; /* for timing out neighbor */ - build_jp_message_t *build_jp_message; /* A structure for fairly - * complicated Join/Prune - * message construction. - */ - + struct pim_nbr_entry *next; /* link to next neighbor */ + struct pim_nbr_entry *prev; /* link to prev neighbor */ + struct sockaddr_in6 address; /* (primary) neighbor address */ + struct phaddr *aux_addrs; /* additional addresses */ + vifi_t vifi; /* which interface */ + u_int16 timer; /* for timing out neighbor */ + build_jp_message_t *build_jp_message; /* A structure for fairly + * complicated Join/Prune + * message construction. + */ } pim_nbr_entry_t; typedef struct srcentry { diff --git a/usr.sbin/pim6sd/pathnames.h b/usr.sbin/pim6sd/pathnames.h index f540602e86ac..b5767bdd4aad 100644 --- a/usr.sbin/pim6sd/pathnames.h +++ b/usr.sbin/pim6sd/pathnames.h @@ -1,4 +1,5 @@ -/* $NetBSD: pathnames.h,v 1.1 2000/01/28 19:32:49 itojun Exp $ */ +/* $NetBSD: pathnames.h,v 1.2 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: pathnames.h,v 1.8 2000/12/04 06:45:30 itojun Exp $ */ /* * Copyright (c) 1998 by the University of Southern California. @@ -61,7 +62,7 @@ #ifndef PATHNAMES_H #define PATHNAMES_H -#define _PATH_PIM6D_CONF "/etc/pim6sd.conf" +#define _PATH_PIM6D_CONF "/usr/local/v6/etc/pim6sd.conf" #define _PATH_PIM6D_LOGFILE "/var/log/pim6sd.log" #if (defined(BSD) && (BSD >= 199103)) diff --git a/usr.sbin/pim6sd/pim6.c b/usr.sbin/pim6sd/pim6.c index 71197dce79ed..8860e28e35b4 100644 --- a/usr.sbin/pim6sd/pim6.c +++ b/usr.sbin/pim6sd/pim6.c @@ -1,4 +1,5 @@ -/* $NetBSD: pim6.c,v 1.2 2000/02/28 07:14:05 itojun Exp $ */ +/* $NetBSD: pim6.c,v 1.3 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: pim6.c,v 1.14 2000/12/04 06:45:30 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. @@ -77,18 +78,24 @@ #include #include #include -#include +#include +#include #include -#include +#include #include #include #include #include +#include +#include #include #include #include -#include "mld6.h" +#include #include "defs.h" +#include "vif.h" +#include "mrt.h" +#include "mld6.h" #include "kern.h" #include "pim6.h" #include "pimd.h" diff --git a/usr.sbin/pim6sd/pim6.h b/usr.sbin/pim6sd/pim6.h index 881ea9f5b933..bd43d70d23a5 100644 --- a/usr.sbin/pim6sd/pim6.h +++ b/usr.sbin/pim6sd/pim6.h @@ -1,4 +1,5 @@ -/* $NetBSD: pim6.h,v 1.1 2000/01/28 19:32:49 itojun Exp $ */ +/* $NetBSD: pim6.h,v 1.2 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: pim6.h,v 1.5 2000/12/04 06:45:31 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. @@ -49,14 +50,6 @@ #ifndef PIM6_H #define PIM6_H -#include -#include -#include -#include -#include -#include -#include - extern struct sockaddr_in6 allpim6routers_group; extern char *pim6_send_buf; extern int pim6_socket; diff --git a/usr.sbin/pim6sd/pim6_proto.c b/usr.sbin/pim6sd/pim6_proto.c index a2bc19ace307..267ea6b69c5f 100644 --- a/usr.sbin/pim6sd/pim6_proto.c +++ b/usr.sbin/pim6sd/pim6_proto.c @@ -1,4 +1,5 @@ -/* $NetBSD: pim6_proto.c,v 1.2 2000/05/19 10:43:49 itojun Exp $ */ +/* $NetBSD: pim6_proto.c,v 1.3 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: pim6_proto.c,v 1.37 2000/12/04 06:45:31 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. @@ -107,13 +108,20 @@ #include #include +#include +#include #include +#include #include +#include #include #include #include -#include "mrt.h" +#include +#include +#include #include "defs.h" +#include "mrt.h" #include "vif.h" #include "debug.h" #include "pim6.h" @@ -127,13 +135,19 @@ #include "kern.h" #include "routesock.h" +struct pim_hello_options { + int holdtime; /* mandatory */ + struct phaddr *addrs; /* additional addresses (experimental) */ +}; + /* * Local functions definitions. */ - -static int parse_pim6_hello __P((char *pktPtr , int datalen , struct sockaddr_in6 *src, - u_int16 *holdtime)); - +static int parse_pim6_hello __P((char *pktPtr, int datalen, + struct sockaddr_in6 *src, + struct pim_hello_options *)); +static void set_pim6_nbr_param __P((pim_nbr_entry_t *, + struct pim_hello_options *)); static int send_pim6_register_stop __P((struct sockaddr_in6 *reg_src , struct sockaddr_in6 *reg_dst , struct sockaddr_in6 *inner_source, struct sockaddr_in6 *inner_grp)); @@ -175,7 +189,9 @@ receive_pim6_hello(src, pim_message, datalen) u_int8 *data_ptr; srcentry_t *srcentry_ptr; mrtentry_t *mrtentry_ptr; - + struct pim_hello_options hopts; + struct phaddr *addr, *naddr; + int result = TRUE; if ((mifi = find_vif_direct(src)) == NO_VIF) { @@ -197,10 +213,13 @@ receive_pim6_hello(src, pim_message, datalen) data_ptr = (u_int8 *) (pim_message + sizeof(struct pim)); - /* Get the Holdtime (in seconds) from the message. Return if error. */ - - if (parse_pim6_hello(pim_message, datalen, src, &holdtime) == FALSE) - return (FALSE); + /* Get Hello options (including Holdtime in seconds) from the message. */ + memset(&hopts, 0, sizeof(hopts)); + if (parse_pim6_hello(pim_message, datalen, src, &hopts) == FALSE) { + result = FALSE; + goto end; + } + holdtime = hopts.holdtime; IF_DEBUG(DEBUG_PIM_HELLO | DEBUG_PIM_TIMER) log(LOG_DEBUG, 0, "PIM HELLO holdtime from %s is %u", inet6_fmt(&src->sin6_addr), holdtime); @@ -228,14 +247,13 @@ receive_pim6_hello(src, pim_message, datalen) * wants to inform us by sending "holdtime=0". Thanks buddy * and see you again! */ - log(LOG_INFO, 0, "PIM HELLO received: neighbor %s going down", inet6_fmt(&src->sin6_addr)); delete_pim6_nbr(nbr); - return (TRUE); + goto end; } - SET_TIMER(nbr->timer, holdtime); - return (TRUE); + set_pim6_nbr_param(nbr, &hopts); + goto end; } else /* @@ -253,7 +271,7 @@ receive_pim6_hello(src, pim_message, datalen) new_nbr = (pim_nbr_entry_t *) malloc(sizeof(pim_nbr_entry_t)); new_nbr->address = *src; new_nbr->vifi = mifi; - SET_TIMER(new_nbr->timer, holdtime); + set_pim6_nbr_param(new_nbr, &hopts); new_nbr->build_jp_message = (build_jp_message_t *) NULL; new_nbr->next = nbr; new_nbr->prev = prev_nbr; @@ -284,12 +302,12 @@ receive_pim6_hello(src, pim_message, datalen) */ if ((bsr_length = create_pim6_bootstrap_message(pim6_send_buf))) - send_pim6(pim6_send_buf, &v->uv_linklocal->pa_addr , src , PIM_BOOTSTRAP, - bsr_length); - + send_pim6(pim6_send_buf, &v->uv_linklocal->pa_addr, src, + PIM_BOOTSTRAP, bsr_length); /* The router with highest network address is the elected DR */ - if (inet6_lessthan(&v->uv_linklocal->pa_addr,&v->uv_pim_neighbors->address)) + if (inet6_lessthan(&v->uv_linklocal->pa_addr, + &v->uv_pim_neighbors->address)) { /* * I was the DR, but not anymore. Remove all register_vif from @@ -329,12 +347,44 @@ receive_pim6_hello(src, pim_message, datalen) * TODO: XXX: does a new neighbor change any routing entries info? Need * to trigger joins? */ - IF_DEBUG(DEBUG_PIM_HELLO) - log(LOG_DEBUG,0,"I'have got a new neighbor %s on vif %s",inet6_fmt(&src->sin6_addr),v->uv_name); - return (TRUE); + log(LOG_DEBUG, 0, "I've got a new neighbor %s on vif %s", + inet6_fmt(&src->sin6_addr), v->uv_name); + + end: + /* free all temporary option data and return */ + for (addr = hopts.addrs; addr; addr = naddr) { + naddr = addr->pa_next; + free(addr); + } + return(result); } +static void +set_pim6_nbr_param(nbr, opts) + pim_nbr_entry_t *nbr; + struct pim_hello_options *opts; +{ + struct phaddr *pa, *next_pa; + + if (opts == NULL) + return; + + /* set holdtime */ + SET_TIMER(nbr->timer, opts->holdtime); + + /* + * Replace addtional addresses. + * XXX: we just replace them, but should we do something special if + * there's change in the list? + */ + for (pa = nbr->aux_addrs; pa; pa = next_pa) { + next_pa = pa->pa_next; + free(pa); + } + nbr->aux_addrs = opts->addrs; + opts->addrs = NULL; /* copied */ +} void delete_pim6_nbr(nbr_delete) @@ -350,6 +400,7 @@ delete_pim6_nbr(nbr_delete) rp_grp_entry_t *rp_grp_entry_ptr; rpentry_t *rpentry_ptr; struct uvif *v; + struct phaddr *pa, *next_pa; v = &uvifs[nbr_delete->vifi]; @@ -506,24 +557,30 @@ delete_pim6_nbr(nbr_delete) } } + /* free additional addresses */ + for (pa = nbr_delete->aux_addrs; pa; pa = next_pa) { + next_pa = pa->pa_next; + free(pa); + } free((char *) nbr_delete); } /* TODO: simplify it! */ static int -parse_pim6_hello(pim_message, datalen, src, holdtime) +parse_pim6_hello(pim_message, datalen, src, opts) char *pim_message; int datalen; struct sockaddr_in6 *src; - u_int16 *holdtime; + struct pim_hello_options *opts; { u_int8 *pim_hello_message; - u_int8 *data_ptr; + u_int8 *data_ptr, *lim; u_int16 option_type; u_int16 option_length; int holdtime_received_ok = FALSE; int option_total_length; + pim6_encod_uni_addr_t encod_uniaddr; pim_hello_message = (u_int8 *) (pim_message + sizeof(struct pim)); datalen -= sizeof(struct pim); @@ -539,14 +596,57 @@ parse_pim6_hello(pim_message, datalen, src, holdtime) if (PIM_MESSAGE_HELLO_HOLDTIME_LENGTH != option_length) { IF_DEBUG(DEBUG_PIM_HELLO) - log(LOG_DEBUG, 0, + log(LOG_INFO, 0, "PIM HELLO Holdtime from %s: invalid OptionLength = %u", - inet6_fmt(&src->sin6_addr), option_length); + sa6_fmt(src), option_length); return (FALSE); } - GET_HOSTSHORT(*holdtime, data_ptr); + GET_HOSTSHORT(opts->holdtime, data_ptr); holdtime_received_ok = TRUE; break; + case PIM_MESSAGE_HELLO_ADDRESSES: + for (lim = data_ptr + option_length; data_ptr < lim; ) { + struct phaddr *addr; + + if (*data_ptr != ADDRF_IPv6) { + log(LOG_INFO, 0, + "PIM HELLO additional address from %s:" + "unsupported address type (%d)", + sa6_fmt(src), *data_ptr); + return(FALSE); /* XXX: should skip */ + } + if (data_ptr + 18 > lim) { /* 18 = sizeof(encoded ipv6 addr) */ + IF_DEBUG(DEBUG_PIM_HELLO) + log(LOG_INFO, 0, + "PIM HELLO additional address from %s: " + "length inconsistent", sa6_fmt(src)); + return(FALSE); + } + + GET_EUADDR6(&encod_uniaddr, data_ptr); + IF_DEBUG(DEBUG_PIM_HELLO) + log(LOG_DEBUG, 0, "PIM HELLO additional address %s", + inet6_fmt(&encod_uniaddr.unicast_addr)); + if (IN6_ARE_ADDR_EQUAL(&encod_uniaddr.unicast_addr, + &src->sin6_addr)) { + IF_DEBUG(DEBUG_PIM_HELLO) + log(LOG_DEBUG, 0, + " same as the neighbor's own address (ignored)"); + continue; + } + + if ((addr = (struct phaddr *)malloc(sizeof(*addr))) == NULL) + log(LOG_ERR, errno, "malloc failed in pim6 hello parsing"); + + /* XXX: we only use part of the structure */ + memset(addr, 0, sizeof(*addr)); + addr->pa_addr.sin6_family = AF_INET6; + addr->pa_addr.sin6_len = sizeof(struct sockaddr_in6); + addr->pa_addr.sin6_addr = encod_uniaddr.unicast_addr; + addr->pa_next = opts->addrs; + opts->addrs = addr; + } + break; default: /* Ignore any unknown options */ break; @@ -568,26 +668,50 @@ parse_pim6_hello(pim_message, datalen, src, holdtime) datalen -= option_total_length; pim_hello_message += option_total_length; } + + if (datalen != 0) /* malformed packet */ + return(FALSE); + + /* holdtime is actually mandatory, so we return FALSE if not included. */ return (holdtime_received_ok); } - int send_pim6_hello(v, holdtime) struct uvif *v; u_int16 holdtime; { char *buf; - u_int8 *data_ptr; + u_int8 *data_ptr, *data_ptr0; + struct phaddr *pa; int datalen; buf = pim6_send_buf + sizeof(struct pim); data_ptr = (u_int8 *) buf; + + /* encode the holdtime option */ PUT_HOSTSHORT(PIM_MESSAGE_HELLO_HOLDTIME, data_ptr); PUT_HOSTSHORT(PIM_MESSAGE_HELLO_HOLDTIME_LENGTH, data_ptr); PUT_HOSTSHORT(holdtime, data_ptr); + /* encode the additional addresses option (experimental) */ + data_ptr0 = data_ptr; + data_ptr += 4; /* sizeof(type + length) */ + for (pa = v->uv_addrs; pa; pa = pa->pa_next) { + if (inet6_equal(&v->uv_linklocal->pa_addr, &pa->pa_addr)) + continue; + + PUT_EUADDR6(pa->pa_addr.sin6_addr, data_ptr); + } + if ((datalen = data_ptr - data_ptr0 - 4) > 0) { + /* at least one address is encoded. */ + PUT_HOSTSHORT(PIM_MESSAGE_HELLO_ADDRESSES, data_ptr0); + PUT_HOSTSHORT(datalen, data_ptr0); + } + else + data_ptr = data_ptr0; /* rewind the pointer */ + datalen = data_ptr - (u_int8 *) buf; send_pim6(pim6_send_buf, &v->uv_linklocal->pa_addr, @@ -626,6 +750,21 @@ receive_pim6_register(reg_src, reg_dst, pim_message, datalen) pim6dstat.in_pim6_register++; + /* + * Message length validation. + * This is almost done in the kernel, but the kernel does not pefrome + * the check for NULL register messages. Thus, we always check this for + * safety. + */ + if (sizeof(struct pim) + sizeof(pim_register_t) + + sizeof(struct ip6_hdr) > datalen) { + IF_DEBUG(DEBUG_PIM_REGISTER) + log(LOG_INFO, 0, + "PIM register: short packet (len = %d) from %s", + datalen, sa6_fmt(reg_src)); + return(FALSE); + } + register_p = (pim_register_t *) (pim_message + sizeof(struct pim)); borderBit = ntohl(register_p->reg_flags) & PIM_MESSAGE_REGISTER_BORDER_BIT; @@ -633,7 +772,18 @@ receive_pim6_register(reg_src, reg_dst, pim_message, datalen) ntohl(register_p->reg_flags) & PIM_MESSAGE_REGISTER_NULL_REGISTER_BIT; /* initialize the pointer to the encapsulated packet */ - ip = (struct ip6_hdr *) (register_p + 1); + ip = (struct ip6_hdr *)(register_p + 1); + + /* check the IP version (especially for the null register...see above) */ + if ((ip->ip6_vfc & IPV6_VERSION_MASK) != IPV6_VERSION) { + IF_DEBUG(DEBUG_PIM_REGISTER) + log(LOG_INFO, 0, + "PIM register: incorrect IP version (%d) of the inner" + " packet from %s", + ip->ip6_vfc & IPV6_VERSION_MASK, + sa6_fmt(reg_src)); + return(FALSE); + } /* * We are keeping all addresses in network order, @@ -1557,7 +1707,7 @@ receive_pim6_join_prune(src, dst, pim_message, datalen) if (my_action == PIM_ACTION_JOIN) { /* Override the Prune by scheduling a Join */ - jp_value = (RANDOM() % 11) / (10 * PIM_RANDOM_DELAY_JOIN_TIMEOUT); + jp_value = (RANDOM() % (int)(10 * PIM_RANDOM_DELAY_JOIN_TIMEOUT)) / 10; /* TODO: XXX: TIMER implem. dependency! */ if (mrtentry_rp->jp_timer > jp_value) SET_TIMER(mrtentry_rp->jp_timer, jp_value); @@ -1577,7 +1727,13 @@ receive_pim6_join_prune(src, dst, pim_message, datalen) if (my_action == PIM_ACTION_JOIN) { - jp_value = (RANDOM() % 11) / (10 * PIM_RANDOM_DELAY_JOIN_TIMEOUT); + /* + * make a random delay between 0 to + * PIM_RANDOM_DELAY_JOIN_TIMEOUT. + * Note that the default value of the random + * delay is 4.5, thus we need to multiply 10. + */ + jp_value = (RANDOM() % (int)(10 * PIM_RANDOM_DELAY_JOIN_TIMEOUT)) / 10; /* TODO: XXX: TIMER implem. dependency! */ if (grpentry_ptr->grp_route->jp_timer > jp_value) @@ -1592,7 +1748,7 @@ receive_pim6_join_prune(src, dst, pim_message, datalen) if (my_action == PIM_ACTION_JOIN) { - jp_value = (RANDOM() % 11) / (10 * PIM_RANDOM_DELAY_JOIN_TIMEOUT); + jp_value = (RANDOM() % (int)(10 * PIM_RANDOM_DELAY_JOIN_TIMEOUT)) / 10; /* TODO: XXX: TIMER implem. dependency! */ if (mrtentry_srcs->jp_timer > jp_value) SET_TIMER(mrtentry_srcs->jp_timer, jp_value); @@ -1721,7 +1877,7 @@ receive_pim6_join_prune(src, dst, pim_message, datalen) if (my_action == PIM_ACTION_JOIN) { /* Override the Prune by scheduling a Join */ - jp_value = (RANDOM() % 11) / (10 * PIM_RANDOM_DELAY_JOIN_TIMEOUT); + jp_value = (RANDOM() % (int)(10 * PIM_RANDOM_DELAY_JOIN_TIMEOUT)) / 10; /* TODO: XXX: TIMER implem. dependency! */ if (mrtentry_ptr->jp_timer > jp_value) SET_TIMER(mrtentry_ptr->jp_timer, jp_value); @@ -1740,7 +1896,7 @@ receive_pim6_join_prune(src, dst, pim_message, datalen) upstream_router); if (my_action == PIM_ACTION_JOIN) { - jp_value = (RANDOM() % 11) / (10 * PIM_RANDOM_DELAY_JOIN_TIMEOUT); + jp_value = (RANDOM() % (int)(10 * PIM_RANDOM_DELAY_JOIN_TIMEOUT)) / 10; /* TODO: XXX: TIMER implem. dependency! */ if (mrtentry_ptr->jp_timer > jp_value) SET_TIMER(mrtentry_ptr->jp_timer, jp_value); @@ -1771,7 +1927,7 @@ receive_pim6_join_prune(src, dst, pim_message, datalen) if (my_action == PIM_ACTION_JOIN) { /* Override the Prune by scheduling a Join */ - jp_value = (RANDOM() % 11) / (10 * PIM_RANDOM_DELAY_JOIN_TIMEOUT); + jp_value = (RANDOM() % (int)(10 * PIM_RANDOM_DELAY_JOIN_TIMEOUT)) / 10; /* TODO: XXX: TIMER implem. dependency! */ if (mrtentry_ptr->jp_timer > jp_value) SET_TIMER(mrtentry_ptr->jp_timer, jp_value); @@ -3582,7 +3738,7 @@ receive_pim6_bootstrap(src, dst, pim_message, datalen) } else { - if (local_address(dst) == NO_VIF) + if (local_address(dst) == NO_VIF) { /* * TODO: XXX: this situation should be handled earlier: The * destination is neither ALL_PIM_ROUTERS nor me @@ -3591,6 +3747,7 @@ receive_pim6_bootstrap(src, dst, pim_message, datalen) "receive_pim6_bootstrap: Bootstrap with an invalid dst(%s)", inet6_fmt(&dst->sin6_addr)); return (FALSE); + } /* Probably unicasted from the current DR */ if (cand_rp_list != (cand_rp_t *) NULL) @@ -3633,13 +3790,12 @@ receive_pim6_bootstrap(src, dst, pim_message, datalen) if (cand_rp_flag == TRUE) { - /* If change in the BSR address, send immediately Cand-RP-Adv */ + /* If change in the BSR address, schedule immediate Cand-RP-Adv */ /* TODO: use some random delay? */ if (!inet6_equal(&new_bsr_address , &curr_bsr_address)) { - send_pim6_cand_rp_adv(); - SET_TIMER(pim_cand_rp_adv_timer, my_cand_rp_adv_period); + SET_TIMER(pim_cand_rp_adv_timer, 0); } } diff --git a/usr.sbin/pim6sd/pim6_proto.h b/usr.sbin/pim6sd/pim6_proto.h index 1de4e2af8329..597479b661de 100644 --- a/usr.sbin/pim6sd/pim6_proto.h +++ b/usr.sbin/pim6sd/pim6_proto.h @@ -1,4 +1,5 @@ -/* $NetBSD: pim6_proto.h,v 1.1 2000/01/28 19:32:50 itojun Exp $ */ +/* $NetBSD: pim6_proto.h,v 1.2 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: pim6_proto.h,v 1.5 2000/12/04 06:45:31 itojun Exp $ */ /* * Copyright (c) 1998 by the University of Southern California. @@ -51,9 +52,6 @@ #ifndef PIM6_PROTO_H #define PIM6_PROTO_H -#include "defs.h" -#include "vif.h" -#include "mrt.h" extern build_jp_message_t *build_jp_message_pool; extern int build_jp_message_pool_counter; diff --git a/usr.sbin/pim6sd/pim6sd.8 b/usr.sbin/pim6sd/pim6sd.8 index ea629c273f7d..5748fb8386e2 100644 --- a/usr.sbin/pim6sd/pim6sd.8 +++ b/usr.sbin/pim6sd/pim6sd.8 @@ -1,5 +1,6 @@ -.\" $NetBSD: pim6sd.8,v 1.3 2000/11/07 06:43:37 lukem Exp $ -.\" +.\" $NetBSD: pim6sd.8,v 1.4 2000/12/04 07:09:36 itojun Exp $ +.\" $KAME: pim6sd.8,v 1.10 2000/12/04 06:39:29 itojun Exp $ +.\" .\" Copyright (C) 1999 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: pim6sd.8,v 1.5 2000/05/05 14:57:14 sumikawa Exp -.\" .Dd June 10, 1999 .Dt PIM6SD 8 .Os @@ -153,4 +152,11 @@ daemon needs to run on the system. The kernel unicast routing table is periodically polled by .Nm in order to follow changes of existing unicast routes. +.Pp +.Nm +must be used on an IPv6 router. +Be sure to set +.Li net.inet6.ip6.forwarding +variable to 1 with +.Xr sysctl 8 . .\" diff --git a/usr.sbin/pim6sd/pim6sd.conf.5 b/usr.sbin/pim6sd/pim6sd.conf.5 index 6719b9f18095..2db67a4e5d13 100644 --- a/usr.sbin/pim6sd/pim6sd.conf.5 +++ b/usr.sbin/pim6sd/pim6sd.conf.5 @@ -1,5 +1,5 @@ -.\" $NetBSD: pim6sd.conf.5,v 1.3 2000/07/10 08:58:31 itojun Exp $ -.\" $KAME: pim6sd.conf.5,v 1.13 2000/07/10 08:53:00 itojun Exp $ +.\" $NetBSD: pim6sd.conf.5,v 1.4 2000/12/04 07:09:36 itojun Exp $ +.\" $KAME: pim6sd.conf.5,v 1.14 2000/08/14 04:53:23 jinmei Exp $ .\" .\" Copyright (C) 1999 WIDE Project. .\" All rights reserved. @@ -135,8 +135,6 @@ listner on the interface. .Xc Specifies a default preference value when sending a PIM assert message. Preferences are used by assert elections to determine upstream routers. -Specifies a default preference value when sending a PIM assert message. -Preferences are used by assert elections to determine upstream routers. Currently .Xr pim6sd 8 does not have an effective method to obtain preferences and metrics from the diff --git a/usr.sbin/pim6sd/pim6stat.1 b/usr.sbin/pim6sd/pim6stat.1 index 64d6631f152f..878f3d71fd4d 100644 --- a/usr.sbin/pim6sd/pim6stat.1 +++ b/usr.sbin/pim6sd/pim6stat.1 @@ -1,4 +1,5 @@ -.\" $NetBSD: pim6stat.1,v 1.4 2000/11/07 06:43:37 lukem Exp $ +.\" $NetBSD: pim6stat.1,v 1.5 2000/12/04 07:09:36 itojun Exp $ +.\" $KAME: pim6stat.1,v 1.8 2000/12/04 06:28:26 itojun Exp $ .\" .\" Copyright (C) 1999 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: pim6stat.1,v 1.5 2000/05/05 14:57:14 sumikawa Exp -.\" .Dd July 28, 1999 .Dt PIM6STAT 1 .Os @@ -64,7 +63,7 @@ specifies the PID file of the currently running daemon. specifies to dump statistics instead of status (for sparse mode only). .It Fl w specifies the wait period in seconds between sending a signal to the -daemon and outputs the dumpfile. +daemon and dumping the status or statistics to the dumpfile. .El .Sh FILES .Bl -tag -width /var/run/pim6sd.pidX -compact diff --git a/usr.sbin/pim6sd/pimd.h b/usr.sbin/pim6sd/pimd.h index af42f026af5d..cce68b37dd48 100644 --- a/usr.sbin/pim6sd/pimd.h +++ b/usr.sbin/pim6sd/pimd.h @@ -1,4 +1,5 @@ -/* $NetBSD: pimd.h,v 1.1 2000/01/28 19:32:50 itojun Exp $ */ +/* $NetBSD: pimd.h,v 1.2 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: pimd.h,v 1.10 2000/12/04 06:45:31 itojun Exp $ */ /* * Copyright (c) 1998 by the University of Southern California. @@ -52,11 +53,6 @@ #ifndef PIMD_H #define PIMD_H -#include -#include -#include -#include "defs.h" - #define PIM_PROTOCOL_VERSION 2 /* PIM protocol timers (in seconds) */ @@ -275,6 +271,9 @@ typedef struct pim_jp_encod_grp_ { #define PIM_MESSAGE_HELLO_HOLDTIME_LENGTH 2 #define PIM_MESSAGE_HELLO_HOLDTIME_FOREVER 0xffff +/* PIM HELLO additional addresses option (experimental) */ +#define PIM_MESSAGE_HELLO_ADDRESSES 65001 + /* PIM_REGISTER definitions */ #define PIM_MESSAGE_REGISTER_BORDER_BIT 0x80000000 #define PIM_MESSAGE_REGISTER_NULL_REGISTER_BIT 0x40000000 diff --git a/usr.sbin/pim6sd/route.c b/usr.sbin/pim6sd/route.c index 5427d7786082..8a1cfae4deb8 100644 --- a/usr.sbin/pim6sd/route.c +++ b/usr.sbin/pim6sd/route.c @@ -1,4 +1,5 @@ -/* $NetBSD: route.c,v 1.2 2000/07/23 23:05:38 mycroft Exp $ */ +/* $NetBSD: route.c,v 1.3 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: route.c,v 1.14 2000/12/04 06:45:31 itojun Exp $ */ /* * Copyright (c) 1998 by the University of Southern California. @@ -50,7 +51,17 @@ */ #include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include +#include "defs.h" #include "pimd.h" #include "vif.h" #include "mrt.h" @@ -62,8 +73,6 @@ #include "kern.h" #include "timer.h" #include "inet6.h" -#include -#include #include "routesock.h" static void process_cache_miss __P((struct mrt6msg * im)); @@ -208,45 +217,54 @@ set_incoming(srcentry_ptr, srctype) /* * The upstream router must be a (PIM router) neighbor, otherwise we are * in big trouble ;-). - * Yes but the neighbors are link-local and the rp is global ipv6.. */ -/* WARNING WARNING WARNING WARNING */ -/* If the router is directly connected to the RP and the RP is the BSR , the next hop is - * the globally reachable addresse of the RP : NOT link local neighbor but - * a ipv6 global neighbor... - * the upstream router is the globally reachable router... - * - */ -/* WARNING WARNING WARNING WARNING */ - v = &uvifs[srcentry_ptr->incoming]; - if (inet6_equal(&source,&neighbor_addr)) - { - srcentry_ptr->upstream=v->uv_pim_neighbors; - return (TRUE); - } for (n = v->uv_pim_neighbors; n != NULL; n = n->next) { - if (inet6_lessthan(&neighbor_addr,&n->address)) + struct phaddr *pa; + +#if 0 + /* we must go through all entries for aux_addr match */ + if (inet6_lessthan(&neighbor_addr, &n->address)) continue; - if (inet6_equal(&neighbor_addr,&n->address)) +#endif + if (inet6_equal(&neighbor_addr, &n->address)) { /* * The upstream router is found in the list of neighbors. We are * safe! */ - srcentry_ptr->upstream = n; IF_DEBUG(DEBUG_RPF) log(LOG_DEBUG, 0, "For src %s, iif is %d, next hop router is %s", - inet6_fmt(&source.sin6_addr), srcentry_ptr->incoming, - inet6_fmt(&neighbor_addr.sin6_addr)); + sa6_fmt(&source), srcentry_ptr->incoming, + sa6_fmt(&neighbor_addr)); return (TRUE); } - else - break; + + /* + * If the router is directly connected to the RP, the next hop is the + * globally reachable address of the RP: NOT link-local neighbor but an + * IPv6 global neighbor. + * Thus, we search through the list of additional addresses of the + * neighbor to see if an additional address matches the RP address. + * XXX: is there a scope issue here? maybe yes for a site-local RP. + */ + for (pa = n->aux_addrs; pa; pa = pa->pa_next) { + if (inet6_equal(&neighbor_addr, &pa->pa_addr)) { + IF_DEBUG(DEBUG_RPF) + log(LOG_DEBUG, 0, + "For src %s, iif is %d, next hop router is %s" + " (aux_addr match)", + sa6_fmt(&source), srcentry_ptr->incoming, + sa6_fmt(&neighbor_addr)); + + srcentry_ptr->upstream = n; + return (TRUE); + } + } } /* TODO: control the number of messages! */ @@ -277,25 +295,21 @@ add_leaf(vifi, source, group) if_set new_oifs; if_set new_leaves; + if ((uvifs[vifi].uv_flags & VIFF_DR) != 0) { + /* + * I am not the DR on the subnet on which the report is received. + * Ignore the report. + */ + log(LOG_DEBUG, 0, "I'm not the DR on mif %d. Ignore a report.\n", + vifi); + return; + } mrtentry_ptr = find_route(&sockaddr6_any, group, MRTF_WC, CREATE); if (mrtentry_ptr == (mrtentry_t *) NULL) return; - if ((mrtentry_ptr->incoming == vifi) - && (!(uvifs[vifi].uv_flags & VIFF_DR))) - { - /* - * The report is received on the iif for this routing entry and I am - * not the DR for that subnet. Ignore it. - */ - - if (mrtentry_ptr->flags & MRTF_NEW) - delete_mrtentry(mrtentry_ptr); - return; - } - IF_DEBUG(DEBUG_MRT) log(LOG_DEBUG, 0, "Adding vif %d for group %s", vifi, inet6_fmt(&group->sin6_addr)); diff --git a/usr.sbin/pim6sd/route.h b/usr.sbin/pim6sd/route.h index a74149351175..ac08c7549ce5 100644 --- a/usr.sbin/pim6sd/route.h +++ b/usr.sbin/pim6sd/route.h @@ -1,4 +1,5 @@ -/* $NetBSD: route.h,v 1.1 2000/01/28 19:32:51 itojun Exp $ */ +/* $NetBSD: route.h,v 1.2 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: route.h,v 1.5 2000/12/04 06:45:31 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. @@ -49,8 +50,6 @@ #ifndef ROUTE_H #define ROUTE_H -#include "mrt.h" - extern u_int32 default_source_preference; extern u_int32 default_source_metric; diff --git a/usr.sbin/pim6sd/routesock.c b/usr.sbin/pim6sd/routesock.c index f3307e1d86da..890a01cb76b0 100644 --- a/usr.sbin/pim6sd/routesock.c +++ b/usr.sbin/pim6sd/routesock.c @@ -1,4 +1,5 @@ -/* $NetBSD: routesock.c,v 1.2 2000/07/23 23:05:38 mycroft Exp $ */ +/* $NetBSD: routesock.c,v 1.3 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: routesock.c,v 1.10 2000/12/04 06:45:31 itojun Exp $ */ /* * Copyright (c) 1998 by the University of Southern California. @@ -63,10 +64,13 @@ #include #include #include +#include #include #include "defs.h" #include #include +#include +#include #ifdef HAVE_ROUTING_SOCKETS #include #endif @@ -76,6 +80,7 @@ #include #include #include +#include #include "vif.h" #include "debug.h" #include "routesock.h" diff --git a/usr.sbin/pim6sd/routesock.h b/usr.sbin/pim6sd/routesock.h index f2d8aa3342c1..66c5b810d508 100644 --- a/usr.sbin/pim6sd/routesock.h +++ b/usr.sbin/pim6sd/routesock.h @@ -1,4 +1,5 @@ -/* $NetBSD: routesock.h,v 1.1 2000/01/28 19:32:51 itojun Exp $ */ +/* $NetBSD: routesock.h,v 1.2 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: routesock.h,v 1.4 2000/12/04 06:45:31 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. diff --git a/usr.sbin/pim6sd/rp.c b/usr.sbin/pim6sd/rp.c index 5c444858a187..5cd8d93d37d1 100644 --- a/usr.sbin/pim6sd/rp.c +++ b/usr.sbin/pim6sd/rp.c @@ -1,4 +1,5 @@ -/* $NetBSD: rp.c,v 1.3 2000/07/23 23:05:38 mycroft Exp $ */ +/* $NetBSD: rp.c,v 1.4 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: rp.c,v 1.15 2000/12/04 06:45:32 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. @@ -77,12 +78,24 @@ * */ +#include +#include +#include +#include +#include +#include +#include +#include #include #include +#include +#include +#include "defs.h" +#include "vif.h" +#include "mrt.h" #include "rp.h" #include "pim6_proto.h" #include "pimd.h" -#include #include "timer.h" #include "inet6.h" #include "route.h" @@ -323,10 +336,10 @@ add_cand_rp(used_cand_rp_list, address) */ if (local_address(&rpentry_ptr->address) == NO_VIF) - { - /* TODO: check for error and delete */ - set_incoming(rpentry_ptr, PIM_IIF_RP); - } + { + /* TODO: check for error and delete */ + set_incoming(rpentry_ptr, PIM_IIF_RP); + } else { /* TODO: XXX: CHECK!!! */ @@ -435,7 +448,7 @@ add_rp_grp_entry(used_cand_rp_list, used_grp_mask_list, if (!IN6_IS_ADDR_MULTICAST(&group_addr->sin6_addr)) { - return (rp_grp_entry_t *) NULL; + return (rp_grp_entry_t *) NULL; } grp_mask_ptr = add_grp_mask(used_grp_mask_list, group_addr, group_mask, bsr_hash_mask); diff --git a/usr.sbin/pim6sd/rp.h b/usr.sbin/pim6sd/rp.h index a0d77aeef981..ace96a029448 100644 --- a/usr.sbin/pim6sd/rp.h +++ b/usr.sbin/pim6sd/rp.h @@ -1,4 +1,5 @@ -/* $NetBSD: rp.h,v 1.1 2000/01/28 19:32:52 itojun Exp $ */ +/* $NetBSD: rp.h,v 1.2 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: rp.h,v 1.5 2000/12/04 06:45:32 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. @@ -49,9 +50,6 @@ #ifndef RP_H #define RP_H -#include "defs.h" -#include "mrt.h" - extern cand_rp_t *cand_rp_list; extern grp_mask_t *grp_mask_list; extern cand_rp_t *segmented_cand_rp_list; diff --git a/usr.sbin/pim6sd/timer.c b/usr.sbin/pim6sd/timer.c index fad54f49e0d5..73e3444fb001 100644 --- a/usr.sbin/pim6sd/timer.c +++ b/usr.sbin/pim6sd/timer.c @@ -1,4 +1,5 @@ -/* $NetBSD: timer.c,v 1.2 2000/05/19 10:43:51 itojun Exp $ */ +/* $NetBSD: timer.c,v 1.3 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: timer.c,v 1.13 2000/12/04 06:45:32 itojun Exp $ */ /* * Copyright (c) 1998 by the University of Southern California. @@ -49,12 +50,22 @@ * */ +#include +#include +#include +#include +#include +#include +#include +#include #include #include +#include +#include +#include "defs.h" #include "pimd.h" #include "mrt.h" #include "vif.h" -#include #include "timer.h" #include "debug.h" #include "rp.h" @@ -556,7 +567,7 @@ age_routes() < kernel_cache_ptr->sg_count.bytecnt)) { if (mrtentry_rp->incoming == reg_vif_num) - + { #ifdef KERNEL_MFC_WC_G // TODO (one day :)) if (kernel_cache_ptr->source == IN6ADDR_ANY_N) @@ -567,9 +578,10 @@ age_routes() continue; } #endif /* KERNEL_MFC_WC_G */ - pim6dstat.pim6_trans_spt_rp++; - switch_shortest_path(&kernel_cache_ptr->source, - &kernel_cache_ptr->group); + pim6dstat.pim6_trans_spt_rp++; + switch_shortest_path(&kernel_cache_ptr->source, + &kernel_cache_ptr->group); + } } } } @@ -746,6 +758,7 @@ age_routes() < kernel_cache_ptr->sg_count.bytecnt)) { if (mrtentry_grp->incoming == reg_vif_num) + { #ifdef KERNEL_MFC_WC_G // TODO if (kernel_cache_ptr->source @@ -757,9 +770,10 @@ age_routes() continue; } #endif /* KERNEL_MFC_WC_G */ - pim6dstat.pim6_trans_spt_rp++; - switch_shortest_path(&kernel_cache_ptr->source, - &kernel_cache_ptr->group); + pim6dstat.pim6_trans_spt_rp++; + switch_shortest_path(&kernel_cache_ptr->source, + &kernel_cache_ptr->group); + } } } } diff --git a/usr.sbin/pim6sd/timer.h b/usr.sbin/pim6sd/timer.h index 5ed0b02f3a9d..e63af7221ada 100644 --- a/usr.sbin/pim6sd/timer.h +++ b/usr.sbin/pim6sd/timer.h @@ -1,4 +1,5 @@ -/* $NetBSD: timer.h,v 1.1 2000/01/28 19:32:52 itojun Exp $ */ +/* $NetBSD: timer.h,v 1.2 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: timer.h,v 1.4 2000/12/04 06:45:32 itojun Exp $ */ /* * Copyright (C) 1999 LSIIT Laboratory. diff --git a/usr.sbin/pim6sd/trace.c b/usr.sbin/pim6sd/trace.c index 18005c53c8da..ae71bbe9afd5 100644 --- a/usr.sbin/pim6sd/trace.c +++ b/usr.sbin/pim6sd/trace.c @@ -1,4 +1,5 @@ -/* $NetBSD: trace.c,v 1.1 2000/01/28 19:32:52 itojun Exp $ */ +/* $NetBSD: trace.c,v 1.2 2000/12/04 07:09:36 itojun Exp $ */ +/* $KAME: trace.c,v 1.12 2000/12/04 06:45:32 itojun Exp $ */ /* * Copyright (C) 1999 WIDE Project. @@ -63,8 +64,6 @@ /* * Questions concerning this software should be directed to * Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu) - * - * KAME Id: trace.c,v 1.7 1999/09/16 08:45:45 jinmei Exp */ /* * Part of this program has been derived from mrouted. @@ -78,25 +77,30 @@ #include #include -#include "vif.h" -#include "inet6.h" #include #include -#include +#include #include #if defined(__FreeBSD__) && __FreeBSD__ >= 3 #include #endif +#include #include #include #include +#include #include #include #include +#include #include #include #include +#include #include "defs.h" +#include "vif.h" +#include "mrt.h" +#include "inet6.h" #include "mld6.h" #include "kern.h" #include "debug.h" @@ -310,11 +314,9 @@ accept_mtrace(src, dst, group, ifindex, data, no, datalen) /* copy the packet to the sending buffer */ p = mld6_send_buf + sizeof(struct mld6_hdr); - bcopy(data, p, datalen); - p += datalen; - + /* * If there is no room to insert our reply, coopt the previous hop * error indication to relay this fact. diff --git a/usr.sbin/pim6sd/trace.h b/usr.sbin/pim6sd/trace.h index aeda6eda7980..25f1a207b7dc 100644 --- a/usr.sbin/pim6sd/trace.h +++ b/usr.sbin/pim6sd/trace.h @@ -1,4 +1,5 @@ -/* $NetBSD: trace.h,v 1.1 2000/01/28 19:32:52 itojun Exp $ */ +/* $NetBSD: trace.h,v 1.2 2000/12/04 07:09:37 itojun Exp $ */ +/* $KAME: trace.h,v 1.4 2000/12/04 06:45:32 itojun Exp $ */ /* * Copyright (C) 1999 WIDE Project. @@ -63,8 +64,6 @@ /* * Questions concerning this software should be directed to * Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu) - * - * KAME Id: trace.h,v 1.2 1999/09/09 15:47:11 jinmei Exp */ /* * Part of this program has been derived from mrouted. diff --git a/usr.sbin/pim6sd/var.h b/usr.sbin/pim6sd/var.h index 897221d29aed..977926eb99fe 100644 --- a/usr.sbin/pim6sd/var.h +++ b/usr.sbin/pim6sd/var.h @@ -1,4 +1,5 @@ -/* $NetBSD: var.h,v 1.1 2000/01/28 19:32:53 itojun Exp $ */ +/* $NetBSD: var.h,v 1.2 2000/12/04 07:09:37 itojun Exp $ */ +/* $KAME: var.h,v 1.3 2000/07/24 01:00:29 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -28,13 +29,10 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* YIPS Id: var.h,v 1.1 1999/10/29 09:04:54 jinmei Exp */ #if !defined(_VAR_H_) #define _VAR_H_ -#include - #define MAX3(a,b,c) (a > b ? (a > c ? a : c) : (b > c ? b : c)) #define CALLOC(size, cast) (cast)calloc(1, (size)) diff --git a/usr.sbin/pim6sd/vers.c b/usr.sbin/pim6sd/vers.c index 95d57e2b133e..9cb2d1501d61 100644 --- a/usr.sbin/pim6sd/vers.c +++ b/usr.sbin/pim6sd/vers.c @@ -1,3 +1,4 @@ -/* $NetBSD: vers.c,v 1.1 2000/01/28 19:32:53 itojun Exp $ */ +/* $NetBSD: vers.c,v 1.2 2000/12/04 07:09:37 itojun Exp $ */ +/* $KAME: vers.c,v 1.2 2000/12/04 06:45:32 itojun Exp $ */ char todaysversion[]="2.1.0-alpha23"; diff --git a/usr.sbin/pim6sd/vif.c b/usr.sbin/pim6sd/vif.c index d8dada1916a9..3c054f66f127 100644 --- a/usr.sbin/pim6sd/vif.c +++ b/usr.sbin/pim6sd/vif.c @@ -1,4 +1,5 @@ -/* $NetBSD: vif.c,v 1.2 2000/05/19 10:43:51 itojun Exp $ */ +/* $NetBSD: vif.c,v 1.3 2000/12/04 07:09:37 itojun Exp $ */ +/* $KAME: vif.c,v 1.15 2000/12/04 06:45:32 itojun Exp $ */ /* * Copyright (c) 1998 by the University of Southern California. @@ -58,13 +59,23 @@ * */ +#include #include +#include +#include +#include +#include +#include +#include #include #include #include #include +#include +#include "defs.h" #include "vif.h" #include "mld6.h" +#include "mrt.h" #include "pim6.h" #include "pimd.h" #include "route.h" @@ -133,8 +144,6 @@ void init_vifs() IF_DEBUG(DEBUG_IF) log(LOG_DEBUG,0,"Getting vifs from kernel"); config_vifs_from_kernel(); - if (max_global_address() == NULL) - log(LOG_ERR, 0, "There's no global address"); IF_DEBUG(DEBUG_IF) log(LOG_DEBUG,0,"Getting vifs from %s",configfilename); diff --git a/usr.sbin/pim6sd/vif.h b/usr.sbin/pim6sd/vif.h index 986c81e7a8be..3dc96fa6c6d8 100644 --- a/usr.sbin/pim6sd/vif.h +++ b/usr.sbin/pim6sd/vif.h @@ -1,4 +1,5 @@ -/* $NetBSD: vif.h,v 1.2 2000/05/19 10:43:51 itojun Exp $ */ +/* $NetBSD: vif.h,v 1.3 2000/12/04 07:09:37 itojun Exp $ */ +/* $KAME: vif.h,v 1.13 2000/12/04 06:45:32 itojun Exp $ */ /* * Copyright (c) 1998 by the University of Southern California. @@ -61,17 +62,6 @@ #ifndef VIF_H #define VIF_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "defs.h" - extern int total_interfaces; extern int udp_socket; extern struct uvif uvifs[]; diff --git a/usr.sbin/pim6sd/vmbuf.h b/usr.sbin/pim6sd/vmbuf.h index 50b21a64cd29..3c98af7743a3 100644 --- a/usr.sbin/pim6sd/vmbuf.h +++ b/usr.sbin/pim6sd/vmbuf.h @@ -1,4 +1,5 @@ -/* $NetBSD: vmbuf.h,v 1.1 2000/01/28 19:32:53 itojun Exp $ */ +/* $NetBSD: vmbuf.h,v 1.2 2000/12/04 07:09:37 itojun Exp $ */ +/* $KAME: vmbuf.h,v 1.2 2000/07/24 01:00:29 itojun Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -28,7 +29,6 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ -/* YIPS Id: vmbuf.h,v 1.1 1999/10/29 09:04:55 jinmei Exp */ typedef struct _vchar_ { u_int32_t t; /* type of the value */ @@ -46,3 +46,4 @@ extern vchar_t *vdup(vchar_t *); extern int pvdump(vchar_t *); #define VREALLOC(ptr, size) ((ptr) = vrealloc((ptr), (size))) +