Sync with latest KAME
Obtained from: KAME
This commit is contained in:
parent
037bed528d
commit
014fbe9293
@ -19,7 +19,7 @@
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL USC, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -31,7 +31,7 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
|
||||
*
|
||||
* $Id: LICENSE.pimd,v 1.1.1.1 1999/08/08 23:30:50 itojun Exp $
|
||||
|
@ -1,14 +1,90 @@
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/5/93
|
||||
# $FreeBSD$
|
||||
# Copyright (c) 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:
|
||||
# 1. Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# 2. Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# 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
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
|
||||
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
PROG= pim6dd
|
||||
MAN5= pim6dd.conf.5
|
||||
MAN8= pim6dd.8
|
||||
# Copyright (c) 1998 by the University of Oregon.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Permission to use, copy, modify, and distribute this software and
|
||||
# its documentation in source and binary forms for lawful
|
||||
# purposes and without fee is hereby granted, provided
|
||||
# that the above copyright notice appear in all copies and that both
|
||||
# the copyright notice and this permission notice appear in supporting
|
||||
# documentation, and that any documentation, advertising materials,
|
||||
# and other materials related to such distribution and use acknowledge
|
||||
# that the software was developed by the University of Oregon.
|
||||
# The name of the University of Oregon may not be used to endorse or
|
||||
# promote products derived from this software without specific prior
|
||||
# written permission.
|
||||
#
|
||||
# THE UNIVERSITY OF OREGON DOES NOT MAKE ANY REPRESENTATIONS
|
||||
# ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
# PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
# INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
# NON-INFRINGEMENT.
|
||||
#
|
||||
# IN NO EVENT SHALL UO, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
# SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES, WHETHER IN CONTRACT,
|
||||
# TORT, OR OTHER FORM OF ACTION, ARISING OUT OF OR IN CONNECTION WITH,
|
||||
# THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
#
|
||||
# Other copyrights might apply to parts of this software and are so
|
||||
# noted when applicable.
|
||||
#
|
||||
#
|
||||
# Questions concerning this software should be directed to
|
||||
# Kurt Windisch (kurtw@antc.uoregon.edu)
|
||||
#
|
||||
# $Id: Makefile,v 1.2 2000/02/25 06:32:22 itojun Exp $
|
||||
#
|
||||
#
|
||||
#Part of this program has been derived from PIM sparse-mode pimd.
|
||||
#The pimd program is covered by the license in the accompanying file
|
||||
#named "LICENSE.pimd".
|
||||
#
|
||||
#The pimd program is COPYRIGHT 1998 by University of Southern California.
|
||||
#
|
||||
#Part of this program has been derived from mrouted.
|
||||
#The mrouted program is covered by the license in the accompanying file
|
||||
#named "LICENSE.mrouted".
|
||||
#
|
||||
#The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
|
||||
#Leland Stanford Junior University.
|
||||
#
|
||||
# $FreeBSD$
|
||||
|
||||
PROG= pim6dd
|
||||
SRCS= mld6.c mld6_proto.c\
|
||||
inet6.c kern.c main.c config.c debug.c routesock.c vers.c callout.c\
|
||||
route.c vif.c timer.c mrt.c pim6.c pim6_proto.c trace.c
|
||||
|
||||
CFLAGS+= -DINET6 -DPIM -DIOCTL_OK_ON_RAW_SOCKET
|
||||
CFLAGS+=-Wall
|
||||
CFLAGS+=-DINET6 -DPIM -DIOCTL_OK_ON_RAW_SOCKET -DHAVE_GETIFADDRS
|
||||
|
||||
MAN5= pim6dd.conf.5
|
||||
MAN8= pim6dd.8
|
||||
|
||||
.include <bsd.prog.mk>
|
||||
|
@ -20,7 +20,7 @@ static struct timeout_q *Q = 0; /* pointer to the beginning of timeout queue */
|
||||
|
||||
struct timeout_q {
|
||||
struct timeout_q *next; /* next event */
|
||||
int id;
|
||||
int id;
|
||||
cfunc_t func; /* function to call */
|
||||
void *data; /* func's data */
|
||||
int time; /* time offset to next event*/
|
||||
@ -29,7 +29,7 @@ struct timeout_q {
|
||||
#ifdef CALLOUT_DEBUG
|
||||
static void print_Q __P((void));
|
||||
#else
|
||||
#define print_Q()
|
||||
#define print_Q()
|
||||
#endif
|
||||
|
||||
void
|
||||
@ -46,7 +46,7 @@ void
|
||||
free_all_callouts()
|
||||
{
|
||||
struct timeout_q *p;
|
||||
|
||||
|
||||
while (Q) {
|
||||
p = Q;
|
||||
Q = Q->next;
|
||||
@ -64,7 +64,7 @@ age_callout_queue(elapsed_time)
|
||||
int elapsed_time;
|
||||
{
|
||||
struct timeout_q *ptr, *expQ;
|
||||
|
||||
|
||||
#ifdef CALLOUT_DEBUG
|
||||
IF_DEBUG(DEBUG_TIMEOUT)
|
||||
log(LOG_DEBUG, 0, "aging queue (elapsed time %d):", elapsed_time);
|
||||
@ -73,7 +73,7 @@ age_callout_queue(elapsed_time)
|
||||
|
||||
expQ = Q;
|
||||
ptr = NULL;
|
||||
|
||||
|
||||
while (Q) {
|
||||
if (Q->time > elapsed_time) {
|
||||
Q->time -= elapsed_time;
|
||||
@ -88,7 +88,7 @@ age_callout_queue(elapsed_time)
|
||||
Q = Q->next;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* handle queue of expired timers */
|
||||
while (expQ) {
|
||||
ptr = expQ;
|
||||
@ -108,7 +108,7 @@ timer_nextTimer()
|
||||
{
|
||||
if (Q) {
|
||||
if (Q->time < 0) {
|
||||
log(LOG_WARNING, 0, "timer_nextTimer top of queue says %d",
|
||||
log(LOG_WARNING, 0, "timer_nextTimer top of queue says %d",
|
||||
Q->time);
|
||||
return 0;
|
||||
}
|
||||
@ -117,7 +117,7 @@ timer_nextTimer()
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* sets the timer
|
||||
*/
|
||||
int
|
||||
@ -127,39 +127,39 @@ timer_setTimer(delay, action, data)
|
||||
void *data; /* what to call the timeout function with */
|
||||
{
|
||||
struct timeout_q *ptr, *node, *prev;
|
||||
|
||||
|
||||
#ifdef CALLOUT_DEBUG
|
||||
IF_DEBUG(DEBUG_TIMEOUT)
|
||||
log(LOG_DEBUG, 0, "setting timer:");
|
||||
print_Q();
|
||||
#endif
|
||||
|
||||
/* create a node */
|
||||
/* create a node */
|
||||
node = (struct timeout_q *)malloc(sizeof(struct timeout_q));
|
||||
if (node == 0) {
|
||||
log(LOG_WARNING, 0, "Malloc Failed in timer_settimer\n");
|
||||
return -1;
|
||||
}
|
||||
node->func = action;
|
||||
node->func = action;
|
||||
node->data = data;
|
||||
node->time = delay;
|
||||
node->next = 0;
|
||||
node->time = delay;
|
||||
node->next = 0;
|
||||
node->id = ++id;
|
||||
|
||||
|
||||
prev = ptr = Q;
|
||||
|
||||
|
||||
/* insert node in the queue */
|
||||
|
||||
|
||||
/* if the queue is empty, insert the node and return */
|
||||
if (!Q)
|
||||
Q = node;
|
||||
else {
|
||||
/* chase the pointer looking for the right place */
|
||||
while (ptr) {
|
||||
|
||||
|
||||
if (delay < ptr->time) {
|
||||
/* right place */
|
||||
|
||||
|
||||
node->next = ptr;
|
||||
if (ptr == Q)
|
||||
Q = node;
|
||||
@ -169,7 +169,7 @@ timer_setTimer(delay, action, data)
|
||||
return node->id;
|
||||
} else {
|
||||
/* keep moving */
|
||||
|
||||
|
||||
delay -= ptr->time; node->time = delay;
|
||||
prev = ptr;
|
||||
ptr = ptr->next;
|
||||
@ -187,10 +187,10 @@ timer_leftTimer(timer_id)
|
||||
{
|
||||
struct timeout_q *ptr;
|
||||
int left = 0;
|
||||
|
||||
|
||||
if (!timer_id)
|
||||
return -1;
|
||||
|
||||
|
||||
for (ptr = Q; ptr; ptr = ptr->next) {
|
||||
left += ptr->time;
|
||||
if (ptr->id == timer_id)
|
||||
@ -205,31 +205,31 @@ timer_clearTimer(timer_id)
|
||||
int timer_id;
|
||||
{
|
||||
struct timeout_q *ptr, *prev;
|
||||
|
||||
|
||||
if (!timer_id)
|
||||
return;
|
||||
|
||||
|
||||
prev = ptr = Q;
|
||||
|
||||
|
||||
/*
|
||||
* find the right node, delete it. the subsequent node's time
|
||||
* gets bumped up
|
||||
*/
|
||||
|
||||
|
||||
while (ptr) {
|
||||
if (ptr->id == timer_id) {
|
||||
/* got the right node */
|
||||
|
||||
|
||||
/* unlink it from the queue */
|
||||
if (ptr == Q)
|
||||
Q = Q->next;
|
||||
else
|
||||
prev->next = ptr->next;
|
||||
|
||||
|
||||
/* increment next node if any */
|
||||
if (ptr->next != 0)
|
||||
(ptr->next)->time += ptr->time;
|
||||
|
||||
|
||||
if (ptr->data)
|
||||
free(ptr->data);
|
||||
free(ptr);
|
||||
@ -248,7 +248,7 @@ static void
|
||||
print_Q()
|
||||
{
|
||||
struct timeout_q *ptr;
|
||||
|
||||
|
||||
IF_DEBUG(DEBUG_TIMEOUT)
|
||||
for (ptr = Q; ptr; ptr = ptr->next)
|
||||
log(LOG_DEBUG, 0, "(%d,%d) ", ptr->id, ptr->time);
|
||||
|
@ -19,7 +19,7 @@
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL USC, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -31,10 +31,10 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
|
||||
*
|
||||
* $Id: config.c,v 1.3 1999/12/30 09:23:08 itojun Exp $
|
||||
* $Id: config.c,v 1.6 2000/02/23 16:10:26 itojun Exp $
|
||||
*/
|
||||
/*
|
||||
* Part of this program has been derived from mrouted.
|
||||
@ -48,6 +48,9 @@
|
||||
*/
|
||||
|
||||
#include "defs.h"
|
||||
#ifdef HAVE_GETIFADDRS
|
||||
#include <ifaddrs.h>
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
@ -69,21 +72,141 @@ static int parse_default_source_preference __P((char *));
|
||||
* Query the kernel to find network interfaces that are multicast-capable
|
||||
* and install them in the uvifs array.
|
||||
*/
|
||||
void
|
||||
void
|
||||
config_vifs_from_kernel()
|
||||
{
|
||||
struct ifreq *ifrp, *ifend;
|
||||
register struct uvif *v;
|
||||
register vifi_t vifi;
|
||||
int n;
|
||||
struct sockaddr_in6 addr;
|
||||
struct in6_addr mask, prefix;
|
||||
short flags;
|
||||
#ifdef HAVE_GETIFADDRS
|
||||
struct ifaddrs *ifap, *ifa;
|
||||
#else
|
||||
int n;
|
||||
int num_ifreq = 64;
|
||||
struct ifconf ifc;
|
||||
struct ifreq *ifrp, *ifend;
|
||||
#endif
|
||||
|
||||
total_interfaces = 0; /* The total number of physical interfaces */
|
||||
|
||||
#ifdef HAVE_GETIFADDRS
|
||||
if (getifaddrs(&ifap))
|
||||
log(LOG_ERR, errno, "getiaddrs");
|
||||
|
||||
/*
|
||||
* Loop through all of the interfaces.
|
||||
*/
|
||||
for (ifa = ifap; ifa; ifa = ifa->ifa_next) {
|
||||
/*
|
||||
* Ignore any interface for an address family other than IPv6.
|
||||
*/
|
||||
if (ifa->ifa_addr->sa_family != AF_INET6) {
|
||||
total_interfaces++; /* Eventually may have IPv6 address later */
|
||||
continue;
|
||||
}
|
||||
|
||||
memcpy(&addr, ifa->ifa_addr, sizeof(struct sockaddr_in6));
|
||||
|
||||
flags = ifa->ifa_flags;
|
||||
if ((flags & (IFF_LOOPBACK | IFF_MULTICAST)) != IFF_MULTICAST)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Get netmask of the address.
|
||||
*/
|
||||
memcpy(&mask, &((struct sockaddr_in6 *)ifa->ifa_netmask)->sin6_addr,
|
||||
sizeof(mask));
|
||||
|
||||
if (IN6_IS_ADDR_LINKLOCAL(&addr.sin6_addr)) {
|
||||
addr.sin6_scope_id = if_nametoindex(ifa->ifa_name);
|
||||
#ifdef __KAME__
|
||||
/*
|
||||
* Hack for KAME kernel. Set sin6_scope_id field of a
|
||||
* link local address and clear the index embedded in
|
||||
* the address.
|
||||
*/
|
||||
/* clear interface index */
|
||||
addr.sin6_addr.s6_addr[2] = 0;
|
||||
addr.sin6_addr.s6_addr[3] = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
* If the address is connected to the same subnet as one already
|
||||
* installed in the uvifs array, just add the address to the list
|
||||
* of addresses of the uvif.
|
||||
*/
|
||||
for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) {
|
||||
if (strcmp(v->uv_name, ifa->ifa_name) == 0) {
|
||||
add_phaddr(v, &addr, &mask);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (vifi != numvifs)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* If there is room in the uvifs array, install this interface.
|
||||
*/
|
||||
if (numvifs == MAXMIFS) {
|
||||
log(LOG_WARNING, 0, "too many ifs, ignoring %s", ifa->ifa_name);
|
||||
continue;
|
||||
}
|
||||
|
||||
/*
|
||||
* Everyone below is a potential vif interface.
|
||||
* We don't care if it has wrong configuration or not configured
|
||||
* at all.
|
||||
*/
|
||||
total_interfaces++;
|
||||
|
||||
v = &uvifs[numvifs];
|
||||
v->uv_flags = 0;
|
||||
v->uv_metric = DEFAULT_METRIC;
|
||||
v->uv_admetric = 0;
|
||||
v->uv_rate_limit = DEFAULT_PHY_RATE_LIMIT;
|
||||
v->uv_dst_addr = allpim6routers_group;
|
||||
v->uv_prefix.sin6_addr = prefix;
|
||||
v->uv_subnetmask = mask;
|
||||
strncpy(v->uv_name, ifa->ifa_name, IFNAMSIZ);
|
||||
v->uv_ifindex = if_nametoindex(v->uv_name);
|
||||
v->uv_groups = (struct listaddr *)NULL;
|
||||
v->uv_dvmrp_neighbors = (struct listaddr *)NULL;
|
||||
NBRM_CLRALL(v->uv_nbrmap);
|
||||
v->uv_querier = (struct listaddr *)NULL;
|
||||
v->uv_prune_lifetime = 0;
|
||||
v->uv_acl = (struct vif_acl *)NULL;
|
||||
v->uv_leaf_timer = 0;
|
||||
v->uv_addrs = (struct phaddr *)NULL;
|
||||
v->uv_filter = (struct vif_filter *)NULL;
|
||||
v->uv_pim_hello_timer = 0;
|
||||
v->uv_gq_timer = 0;
|
||||
v->uv_pim_neighbors = (struct pim_nbr_entry *)NULL;
|
||||
v->uv_local_pref = default_source_preference;
|
||||
v->uv_local_metric = default_source_metric;
|
||||
add_phaddr(v, &addr, &mask);
|
||||
|
||||
if (flags & IFF_POINTOPOINT)
|
||||
v->uv_flags |= (VIFF_REXMIT_PRUNES | VIFF_POINT_TO_POINT);
|
||||
log(LOG_INFO, 0,
|
||||
"installing %s as if #%u - rate=%d",
|
||||
v->uv_name, numvifs, v->uv_rate_limit);
|
||||
++numvifs;
|
||||
|
||||
/*
|
||||
* If the interface is not yet up, set the vifs_down flag to
|
||||
* remind us to check again later.
|
||||
*/
|
||||
if (!(flags & IFF_UP)) {
|
||||
v->uv_flags |= VIFF_DOWN;
|
||||
vifs_down = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
freeifaddrs(ifap);
|
||||
#else /* !HAVE_GETIFADDRS */
|
||||
ifc.ifc_len = num_ifreq * sizeof(struct ifreq);
|
||||
ifc.ifc_buf = calloc(ifc.ifc_len, sizeof(char));
|
||||
while (ifc.ifc_buf) {
|
||||
@ -91,7 +214,7 @@ config_vifs_from_kernel()
|
||||
|
||||
if (ioctl(udp_socket, SIOCGIFCONF, (char *)&ifc) < 0)
|
||||
log(LOG_ERR, errno, "ioctl SIOCGIFCONF");
|
||||
|
||||
|
||||
/*
|
||||
* If the buffer was large enough to hold all the addresses
|
||||
* then break out, otherwise increase the buffer size and
|
||||
@ -104,7 +227,7 @@ config_vifs_from_kernel()
|
||||
if ((num_ifreq * sizeof(struct ifreq)) >=
|
||||
ifc.ifc_len + sizeof(struct ifreq))
|
||||
break;
|
||||
|
||||
|
||||
num_ifreq *= 2;
|
||||
ifc.ifc_len = num_ifreq * sizeof(struct ifreq);
|
||||
newbuf = realloc(ifc.ifc_buf, ifc.ifc_len);
|
||||
@ -114,7 +237,7 @@ config_vifs_from_kernel()
|
||||
}
|
||||
if (ifc.ifc_buf == NULL)
|
||||
log(LOG_ERR, 0, "config_vifs_from_kernel: ran out of memory");
|
||||
|
||||
|
||||
ifrp = (struct ifreq *)ifc.ifc_buf;
|
||||
ifend = (struct ifreq *)(ifc.ifc_buf + ifc.ifc_len);
|
||||
/*
|
||||
@ -130,7 +253,7 @@ config_vifs_from_kernel()
|
||||
#else
|
||||
n = sizeof(*ifrp);
|
||||
#endif /* HAVE_SA_LEN */
|
||||
|
||||
|
||||
/*
|
||||
* Ignore any interface for an address family other than IPv6.
|
||||
*/
|
||||
@ -140,7 +263,7 @@ config_vifs_from_kernel()
|
||||
}
|
||||
|
||||
memcpy(&addr, &ifrp->ifr_addr, sizeof(struct sockaddr_in6));
|
||||
|
||||
|
||||
/*
|
||||
* Need a template to preserve address info that is
|
||||
* used below to locate the next entry. (Otherwise,
|
||||
@ -211,18 +334,12 @@ config_vifs_from_kernel()
|
||||
* at all.
|
||||
*/
|
||||
total_interfaces++;
|
||||
|
||||
|
||||
v = &uvifs[numvifs];
|
||||
v->uv_flags = 0;
|
||||
v->uv_metric = DEFAULT_METRIC;
|
||||
v->uv_admetric = 0;
|
||||
#if 0
|
||||
v->uv_threshold = DEFAULT_THRESHOLD;
|
||||
#endif
|
||||
v->uv_rate_limit = DEFAULT_PHY_RATE_LIMIT;
|
||||
#if 0
|
||||
v->uv_rmt_addr = INADDR_ANY_N;
|
||||
#endif
|
||||
v->uv_dst_addr = allpim6routers_group;
|
||||
v->uv_prefix.sin6_addr = prefix;
|
||||
v->uv_subnetmask = mask;
|
||||
@ -243,14 +360,14 @@ config_vifs_from_kernel()
|
||||
v->uv_local_pref = default_source_preference;
|
||||
v->uv_local_metric = default_source_metric;
|
||||
add_phaddr(v, &addr, &mask);
|
||||
|
||||
|
||||
if (flags & IFF_POINTOPOINT)
|
||||
v->uv_flags |= (VIFF_REXMIT_PRUNES | VIFF_POINT_TO_POINT);
|
||||
log(LOG_INFO, 0,
|
||||
"installing %s as if #%u - rate=%d",
|
||||
v->uv_name, numvifs, v->uv_rate_limit);
|
||||
++numvifs;
|
||||
|
||||
|
||||
/*
|
||||
* If the interface is not yet up, set the vifs_down flag to
|
||||
* remind us to check again later.
|
||||
@ -260,6 +377,7 @@ config_vifs_from_kernel()
|
||||
vifs_down = TRUE;
|
||||
}
|
||||
}
|
||||
#endif /* HAVE_GETIFADDRS */
|
||||
}
|
||||
|
||||
static void
|
||||
@ -316,12 +434,12 @@ ifname2mifi(ifname)
|
||||
return(mifi);
|
||||
}
|
||||
|
||||
#define UNKNOWN -1
|
||||
#define EMPTY 1
|
||||
#define PHYINT 2
|
||||
#define DEFAULT_SOURCE_METRIC 3
|
||||
#define DEFAULT_SOURCE_PREFERENCE 4
|
||||
#define FILTER 5
|
||||
#define UNKNOWN -1
|
||||
#define EMPTY 1
|
||||
#define PHYINT 2
|
||||
#define DEFAULT_SOURCE_METRIC 3
|
||||
#define DEFAULT_SOURCE_PREFERENCE 4
|
||||
#define FILTER 5
|
||||
|
||||
/*
|
||||
* function name: wordToOption
|
||||
@ -330,7 +448,7 @@ ifname2mifi(ifname)
|
||||
* operation: converts the result of the string comparisons into numerics.
|
||||
* comments: called by config_vifs_from_file()
|
||||
*/
|
||||
static int
|
||||
static int
|
||||
wordToOption(word)
|
||||
char *word;
|
||||
{
|
||||
@ -363,13 +481,13 @@ parse_phyint(s)
|
||||
vifi_t vifi;
|
||||
struct uvif *v;
|
||||
u_int n;
|
||||
|
||||
|
||||
if (EQUAL((w = next_word(&s)), "")) {
|
||||
log(LOG_WARNING, 0, "Missing phyint in %s", configfilename);
|
||||
return(FALSE);
|
||||
} /* if empty */
|
||||
ifname = w;
|
||||
|
||||
|
||||
for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) {
|
||||
if (vifi == numvifs) {
|
||||
log(LOG_WARNING, 0,
|
||||
@ -380,14 +498,14 @@ parse_phyint(s)
|
||||
|
||||
if (strcmp(v->uv_name, ifname))
|
||||
continue;
|
||||
|
||||
|
||||
while (!EQUAL((w = next_word(&s)), "")) {
|
||||
if (EQUAL(w, "disable"))
|
||||
v->uv_flags |= VIFF_DISABLED;
|
||||
else if (EQUAL(w, "nolistener"))
|
||||
v->uv_flags |= VIFF_NOLISTENER;
|
||||
else if(EQUAL(w, "preference")) {
|
||||
if(EQUAL((w = next_word(&s)), ""))
|
||||
if(EQUAL((w = next_word(&s)), ""))
|
||||
log(LOG_WARNING, 0,
|
||||
"Missing preference for phyint %s in %s",
|
||||
ifname, configfilename);
|
||||
@ -400,13 +518,13 @@ parse_phyint(s)
|
||||
else {
|
||||
IF_DEBUG(DEBUG_ASSERT)
|
||||
log(LOG_DEBUG, 0,
|
||||
"Config setting default local preference on %s to %d.",
|
||||
"Config setting default local preference on %s to %d.",
|
||||
ifname, n);
|
||||
v->uv_local_pref = n;
|
||||
}
|
||||
|
||||
|
||||
} else if(EQUAL(w, "metric")) {
|
||||
if(EQUAL((w = next_word(&s)), ""))
|
||||
if(EQUAL((w = next_word(&s)), ""))
|
||||
log(LOG_WARNING, 0,
|
||||
"Missing metric for phyint %s in %s",
|
||||
ifname, configfilename);
|
||||
@ -419,7 +537,7 @@ parse_phyint(s)
|
||||
else {
|
||||
IF_DEBUG(DEBUG_ASSERT)
|
||||
log(LOG_DEBUG, 0,
|
||||
"Config setting default local metric on %s to %d.",
|
||||
"Config setting default local metric on %s to %d.",
|
||||
ifname, n);
|
||||
v->uv_local_metric = n;
|
||||
}
|
||||
@ -526,7 +644,7 @@ parse_filter(s)
|
||||
* output: int
|
||||
* operation: reads and assigns the default source metric, if no reliable
|
||||
* unicast routing information available.
|
||||
* General form:
|
||||
* General form:
|
||||
* 'default_source_metric <number>'.
|
||||
* default pref and metric statements should precede all phyint
|
||||
* statements in the config file.
|
||||
@ -557,7 +675,7 @@ parse_default_source_metric(s)
|
||||
for (vifi = 0, v = uvifs; vifi < MAXMIFS; ++vifi, ++v) {
|
||||
v->uv_local_metric = default_source_metric;
|
||||
}
|
||||
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
@ -568,7 +686,7 @@ parse_default_source_metric(s)
|
||||
* output: int
|
||||
* operation: reads and assigns the default source preference, if no reliable
|
||||
* unicast routing information available.
|
||||
* General form:
|
||||
* General form:
|
||||
* 'default_source_preference <number>'.
|
||||
* default pref and metric statements should precede all phyint
|
||||
* statements in the config file.
|
||||
@ -604,27 +722,20 @@ parse_default_source_preference(s)
|
||||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
void
|
||||
config_vifs_from_file()
|
||||
{
|
||||
FILE *f;
|
||||
char linebuf[100];
|
||||
char *w, *s;
|
||||
struct ifconf ifc;
|
||||
int option;
|
||||
char ifbuf[BUFSIZ];
|
||||
|
||||
if ((f = fopen(configfilename, "r")) == NULL) {
|
||||
if (errno != ENOENT) log(LOG_WARNING, errno, "can't open %s",
|
||||
if (errno != ENOENT) log(LOG_WARNING, errno, "can't open %s",
|
||||
configfilename);
|
||||
return;
|
||||
}
|
||||
|
||||
ifc.ifc_buf = ifbuf;
|
||||
ifc.ifc_len = sizeof(ifbuf);
|
||||
if (ioctl(udp_socket, SIOCGIFCONF, (char *)&ifc) < 0)
|
||||
log(LOG_ERR, errno, "ioctl SIOCGIFCONF");
|
||||
|
||||
while (fgets(linebuf, sizeof(linebuf), f) != NULL) {
|
||||
s = linebuf;
|
||||
w = next_word(&s);
|
||||
@ -652,11 +763,11 @@ next_word(s)
|
||||
char **s;
|
||||
{
|
||||
char *w;
|
||||
|
||||
|
||||
w = *s;
|
||||
while (*w == ' ' || *w == '\t')
|
||||
w++;
|
||||
|
||||
|
||||
*s = w;
|
||||
for(;;) {
|
||||
switch (**s) {
|
||||
|
@ -19,7 +19,7 @@
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL USC, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -31,10 +31,10 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
|
||||
*
|
||||
* $Id: debug.c,v 1.4 1999/09/20 14:28:08 jinmei Exp $
|
||||
* $Id: debug.c,v 1.8 2000/05/18 12:47:59 itojun Exp $
|
||||
*/
|
||||
/*
|
||||
* Part of this program has been derived from mrouted.
|
||||
@ -67,6 +67,38 @@ unsigned long debug = 0x00000000; /* If (long) is smaller than
|
||||
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)
|
||||
@ -160,7 +192,7 @@ log_level(proto, type, code)
|
||||
default:
|
||||
return LOG_WARNING;
|
||||
}
|
||||
|
||||
|
||||
case IPPROTO_PIM:
|
||||
/* PIM v2 */
|
||||
switch (type) {
|
||||
@ -178,18 +210,18 @@ log_level(proto, type, code)
|
||||
* Dump internal data structures to stderr.
|
||||
*/
|
||||
/* TODO: currently not used
|
||||
void
|
||||
void
|
||||
dump(int i)
|
||||
{
|
||||
dump_vifs(stderr);
|
||||
dump_pim_mrt(stderr);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
* Dump internal data structures to a file.
|
||||
*/
|
||||
void
|
||||
void
|
||||
fdump(i)
|
||||
int i;
|
||||
{
|
||||
@ -197,6 +229,7 @@ fdump(i)
|
||||
fp = fopen(dumpfilename, "w");
|
||||
if (fp != NULL) {
|
||||
dump_vifs(fp);
|
||||
dump_mldqueriers(fp);
|
||||
dump_pim_mrt(fp);
|
||||
dump_lcl_grp(fp);
|
||||
(void) fclose(fp);
|
||||
@ -212,11 +245,11 @@ cdump(i)
|
||||
int i;
|
||||
{
|
||||
FILE *fp;
|
||||
|
||||
|
||||
fp = fopen(cachefilename, "w");
|
||||
if (fp != NULL) {
|
||||
/* TODO: implement it:
|
||||
dump_cache(fp);
|
||||
dump_cache(fp);
|
||||
*/
|
||||
(void) fclose(fp);
|
||||
}
|
||||
@ -225,7 +258,7 @@ cdump(i)
|
||||
void
|
||||
dump_vifs(fp)
|
||||
FILE *fp;
|
||||
{
|
||||
{
|
||||
vifi_t vifi;
|
||||
register struct uvif *v;
|
||||
pim_nbr_entry_t *n;
|
||||
@ -236,7 +269,7 @@ dump_vifs(fp)
|
||||
fprintf(fp, "\nMulticast Interface Table\n %-4s %-6s %-50s %-14s %s",
|
||||
"Mif", " PhyIF", "Local-Address/Prefixlen", "Flags",
|
||||
"Neighbors\n");
|
||||
|
||||
|
||||
for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) {
|
||||
int firstaddr = 1;
|
||||
for (pa = v->uv_addrs; pa; pa = pa->pa_next) {
|
||||
@ -280,11 +313,13 @@ dump_vifs(fp)
|
||||
fprintf(fp, " DVMRP");
|
||||
width += 6;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
if (v->uv_flags & VIFF_NONBRS) {
|
||||
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 */
|
||||
@ -295,7 +330,7 @@ dump_vifs(fp)
|
||||
for (n = n->next; n != NULL; n = n->next)
|
||||
fprintf(fp, "%64s %-15s\n", "",
|
||||
inet6_fmt(&n->address.sin6_addr));
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
fprintf(fp, "\n");
|
||||
@ -319,7 +354,7 @@ log(int severity, int syserr, char *format, ...)
|
||||
char *msg;
|
||||
struct timeval now;
|
||||
struct tm *thyme;
|
||||
|
||||
|
||||
va_start(ap, format);
|
||||
#else
|
||||
/*VARARGS3*/
|
||||
@ -335,13 +370,13 @@ log(severity, syserr, format, va_alist)
|
||||
char tbuf[20];
|
||||
struct timeval now;
|
||||
struct tm *thyme;
|
||||
|
||||
|
||||
va_start(ap);
|
||||
#endif
|
||||
vsprintf(&fmt[10], format, ap);
|
||||
va_end(ap);
|
||||
msg = (severity == LOG_WARNING) ? fmt : &fmt[10];
|
||||
|
||||
|
||||
/*
|
||||
* Log to stderr if we haven't forked yet and it's a warning or worse,
|
||||
* or if we're debugging.
|
||||
@ -354,7 +389,8 @@ log(severity, syserr, format, va_alist)
|
||||
if (!debug)
|
||||
fprintf(stderr, "%s: ", progname);
|
||||
fprintf(stderr, "%02d:%02d:%02d.%03ld %s", thyme->tm_hour,
|
||||
thyme->tm_min, thyme->tm_sec, now.tv_usec / 1000, msg);
|
||||
thyme->tm_min, thyme->tm_sec, (long int)now.tv_usec / 1000,
|
||||
msg);
|
||||
if (syserr == 0)
|
||||
fprintf(stderr, "\n");
|
||||
else if (syserr < sys_nerr)
|
||||
@ -362,7 +398,7 @@ log(severity, syserr, format, va_alist)
|
||||
else
|
||||
fprintf(stderr, ": errno %d\n", syserr);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Always log things that are worse than warnings, no matter what
|
||||
* the log_nmsgs rate limiter says.
|
||||
@ -380,12 +416,41 @@ log(severity, syserr, format, va_alist)
|
||||
} else
|
||||
syslog(severity, "%s", msg);
|
||||
}
|
||||
|
||||
|
||||
if (severity <= LOG_ERR) exit(-1);
|
||||
}
|
||||
|
||||
/* TODO: format the output for better readability */
|
||||
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)
|
||||
FILE *fp;
|
||||
{
|
||||
@ -399,8 +464,8 @@ dump_pim_mrt(fp)
|
||||
char leaves_oifs[(sizeof(if_set)<<3)+1];
|
||||
char filter_oifs[(sizeof(if_set)<<3)+1];
|
||||
char incoming_iif[(sizeof(if_set)<<3)+1];
|
||||
|
||||
fprintf(fp, "Multicast Routing Table\n%s",
|
||||
|
||||
fprintf(fp, "Multicast Routing Table\n%s",
|
||||
" Source Group Flags\n");
|
||||
|
||||
/* TODO: remove the dummy 0:: group (first in the chain) */
|
||||
@ -446,7 +511,7 @@ dump_pim_mrt(fp)
|
||||
if (r->flags & MRTF_SG) fprintf(fp, " SG");
|
||||
if (r->flags & MRTF_PMBR) fprintf(fp, " PMBR");
|
||||
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);
|
||||
@ -454,7 +519,7 @@ dump_pim_mrt(fp)
|
||||
fprintf(fp, "Outgoing oifs: %-20s\n", oifs);
|
||||
fprintf(fp, "Incoming : %-20s\n", incoming_iif);
|
||||
|
||||
fprintf(fp, "Upstream nbr: %s\n",
|
||||
fprintf(fp, "Upstream nbr: %s\n",
|
||||
r->upstream ? inet6_fmt(&r->upstream->address.sin6_addr) : "NONE");
|
||||
fprintf(fp, "\nTIMERS: Entry Prune VIFS:");
|
||||
for (vifi = 0; vifi < numvifs; vifi++)
|
||||
|
@ -19,7 +19,7 @@
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL USC, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -31,7 +31,7 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
|
||||
*
|
||||
* $Id: debug.h,v 1.1.1.1 1999/08/08 23:30:52 itojun Exp $
|
||||
@ -49,70 +49,70 @@
|
||||
|
||||
extern unsigned long debug;
|
||||
extern int log_nmsgs;
|
||||
#define IF_DEBUG(l) if (debug && debug & (l))
|
||||
#define IF_DEBUG(l) if (debug && debug & (l))
|
||||
|
||||
#define LOG_MAX_MSGS 20 /* if > 20/minute then shut up for a while */
|
||||
#define LOG_SHUT_UP 600 /* shut up for 10 minutes */
|
||||
#define LOG_MAX_MSGS 20 /* if > 20/minute then shut up for a while */
|
||||
#define LOG_SHUT_UP 600 /* shut up for 10 minutes */
|
||||
|
||||
|
||||
/* Debug values definition */
|
||||
/* DVMRP reserved for future use */
|
||||
#define DEBUG_DVMRP_PRUNE 0x00000001
|
||||
#define DEBUG_DVMRP_ROUTE 0x00000002
|
||||
#define DEBUG_DVMRP_PEER 0x00000004
|
||||
#define DEBUG_DVMRP_TIMER 0x00000008
|
||||
#define DEBUG_DVMRP_DETAIL 0x01000000
|
||||
#define DEBUG_DVMRP ( DEBUG_DVMRP_PRUNE | DEBUG_DVMRP_ROUTE | \
|
||||
#define DEBUG_DVMRP_PRUNE 0x00000001
|
||||
#define DEBUG_DVMRP_ROUTE 0x00000002
|
||||
#define DEBUG_DVMRP_PEER 0x00000004
|
||||
#define DEBUG_DVMRP_TIMER 0x00000008
|
||||
#define DEBUG_DVMRP_DETAIL 0x01000000
|
||||
#define DEBUG_DVMRP ( DEBUG_DVMRP_PRUNE | DEBUG_DVMRP_ROUTE | \
|
||||
DEBUG_DVMRP_PEER )
|
||||
|
||||
/* MLD related */
|
||||
#define DEBUG_MLD_PROTO 0x00000010
|
||||
#define DEBUG_MLD_TIMER 0x00000020
|
||||
#define DEBUG_MLD_MEMBER 0x00000040
|
||||
#define DEBUG_MEMBER DEBUG_MLD_MEMBER
|
||||
#define DEBUG_MLD ( DEBUG_MLD_PROTO | DEBUG_MLD_TIMER | \
|
||||
#define DEBUG_MLD_PROTO 0x00000010
|
||||
#define DEBUG_MLD_TIMER 0x00000020
|
||||
#define DEBUG_MLD_MEMBER 0x00000040
|
||||
#define DEBUG_MEMBER DEBUG_MLD_MEMBER
|
||||
#define DEBUG_MLD ( DEBUG_MLD_PROTO | DEBUG_MLD_TIMER | \
|
||||
DEBUG_MLD_MEMBER )
|
||||
|
||||
/* Misc */
|
||||
#define DEBUG_TRACE 0x00000080
|
||||
#define DEBUG_TIMEOUT 0x00000100
|
||||
#define DEBUG_PKT 0x00000200
|
||||
#define DEBUG_TRACE 0x00000080
|
||||
#define DEBUG_TIMEOUT 0x00000100
|
||||
#define DEBUG_PKT 0x00000200
|
||||
|
||||
|
||||
/* Kernel related */
|
||||
#define DEBUG_IF 0x00000400
|
||||
#define DEBUG_KERN 0x00000800
|
||||
#define DEBUG_MFC 0x00001000
|
||||
#define DEBUG_RSRR 0x00002000
|
||||
#define DEBUG_IF 0x00000400
|
||||
#define DEBUG_KERN 0x00000800
|
||||
#define DEBUG_MFC 0x00001000
|
||||
#define DEBUG_RSRR 0x00002000
|
||||
|
||||
/* PIM related */
|
||||
#define DEBUG_PIM_GRAFT 0x02000000
|
||||
#define DEBUG_PIM_HELLO 0x00004000
|
||||
#define DEBUG_PIM_REGISTER 0x00008000
|
||||
#define DEBUG_PIM_JOIN_PRUNE 0x00010000
|
||||
#define DEBUG_PIM_BOOTSTRAP 0x00020000
|
||||
#define DEBUG_PIM_ASSERT 0x00040000
|
||||
#define DEBUG_PIM_CAND_RP 0x00080000
|
||||
#define DEBUG_PIM_MRT 0x00100000
|
||||
#define DEBUG_PIM_TIMER 0x00200000
|
||||
#define DEBUG_PIM_RPF 0x00400000
|
||||
#define DEBUG_RPF DEBUG_PIM_RPF
|
||||
#define DEBUG_PIM_DETAIL 0x00800000
|
||||
#define DEBUG_PIM ( DEBUG_PIM_HELLO | DEBUG_PIM_REGISTER | \
|
||||
#define DEBUG_PIM_GRAFT 0x02000000
|
||||
#define DEBUG_PIM_HELLO 0x00004000
|
||||
#define DEBUG_PIM_REGISTER 0x00008000
|
||||
#define DEBUG_PIM_JOIN_PRUNE 0x00010000
|
||||
#define DEBUG_PIM_BOOTSTRAP 0x00020000
|
||||
#define DEBUG_PIM_ASSERT 0x00040000
|
||||
#define DEBUG_PIM_CAND_RP 0x00080000
|
||||
#define DEBUG_PIM_MRT 0x00100000
|
||||
#define DEBUG_PIM_TIMER 0x00200000
|
||||
#define DEBUG_PIM_RPF 0x00400000
|
||||
#define DEBUG_RPF DEBUG_PIM_RPF
|
||||
#define DEBUG_PIM_DETAIL 0x00800000
|
||||
#define DEBUG_PIM ( DEBUG_PIM_HELLO | DEBUG_PIM_REGISTER | \
|
||||
DEBUG_PIM_JOIN_PRUNE | DEBUG_PIM_BOOTSTRAP | \
|
||||
DEBUG_PIM_ASSERT | DEBUG_PIM_CAND_RP | \
|
||||
DEBUG_PIM_MRT | DEBUG_PIM_TIMER | \
|
||||
DEBUG_PIM_RPF | DEBUG_PIM_GRAFT )
|
||||
DEBUG_PIM_RPF | DEBUG_PIM_GRAFT )
|
||||
|
||||
#define DEBUG_MRT ( DEBUG_DVMRP_ROUTE | DEBUG_PIM_MRT )
|
||||
#define DEBUG_NEIGHBORS ( DEBUG_DVMRP_PEER | DEBUG_PIM_HELLO )
|
||||
#define DEBUG_TIMER ( DEBUG_MLD_TIMER | DEBUG_DVMRP_TIMER | \
|
||||
#define DEBUG_MRT ( DEBUG_DVMRP_ROUTE | DEBUG_PIM_MRT )
|
||||
#define DEBUG_NEIGHBORS ( DEBUG_DVMRP_PEER | DEBUG_PIM_HELLO )
|
||||
#define DEBUG_TIMER ( DEBUG_MLD_TIMER | DEBUG_DVMRP_TIMER | \
|
||||
DEBUG_PIM_TIMER )
|
||||
#define DEBUG_ASSERT ( DEBUG_PIM_ASSERT )
|
||||
#define DEBUG_ALL 0xffffffff
|
||||
#define DEBUG_ASSERT ( DEBUG_PIM_ASSERT )
|
||||
#define DEBUG_ALL 0xffffffff
|
||||
|
||||
|
||||
#define DEBUG_DEFAULT 0xffffffff/* default if "-d" given without value */
|
||||
#define DEBUG_DEFAULT 0xffffffff/* default if "-d" given without value */
|
||||
|
||||
|
||||
|
||||
|
@ -10,15 +10,15 @@
|
||||
* documentation, and that any documentation, advertising materials,
|
||||
* and other materials related to such distribution and use acknowledge
|
||||
* that the software was developed by the University of Oregon.
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THE UNIVERSITY OF OREGON DOES NOT MAKE ANY REPRESENTATIONS
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL UO, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -30,22 +30,22 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Kurt Windisch (kurtw@antc.uoregon.edu)
|
||||
*
|
||||
* $Id: defs.h,v 1.6 1999/12/10 06:09:13 itojun Exp $
|
||||
* $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.
|
||||
* The pimd program is covered by the license in the accompanying file
|
||||
* named "LICENSE.pimd".
|
||||
*
|
||||
*
|
||||
* The pimd program is COPYRIGHT 1998 by University of Southern California.
|
||||
*
|
||||
* Part of this program has been derived from mrouted.
|
||||
* The mrouted program is covered by the license in the accompanying file
|
||||
* named "LICENSE.mrouted".
|
||||
*
|
||||
*
|
||||
* The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
|
||||
* Leland Stanford Junior University.
|
||||
*
|
||||
@ -54,12 +54,12 @@
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <unistd.h>
|
||||
#include <ctype.h>
|
||||
#include <errno.h>
|
||||
#include <syslog.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <string.h>
|
||||
#include <sys/param.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
@ -70,7 +70,9 @@
|
||||
#endif /* SYSV || __bsdi__ || SunOS 4.x */
|
||||
#include <sys/time.h>
|
||||
#include <net/if.h>
|
||||
#if defined(__FreeBSD__) && __FreeBSD__ >= 3
|
||||
#include <net/if_var.h>
|
||||
#endif /* __FreeBSD__ >= 3 */
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/in_systm.h>
|
||||
#include <netinet/ip.h>
|
||||
@ -80,10 +82,14 @@
|
||||
#include <netinet/ip6.h>
|
||||
|
||||
#include <arpa/inet.h>
|
||||
#ifdef __FreeBSD__ /* sigh */
|
||||
#include <osreldate.h>
|
||||
#define rtentry kernel_rtentry
|
||||
#endif /* __FreeBSD__ */
|
||||
#if (defined(__bsdi__)) || (defined(__FreeBSD__) && (__FreeBSD_version >= 220000))
|
||||
#define rtentry kernel_rtentry
|
||||
#include <net/route.h>
|
||||
#undef rtentry
|
||||
#endif /* __bsdi__ or __FreeBSD_version >= 220000 */
|
||||
#include <netinet/ip_mroute.h>
|
||||
#include <netinet6/ip6_mroute.h>
|
||||
#include <strings.h>
|
||||
@ -97,9 +103,9 @@ typedef u_char u_int8;
|
||||
|
||||
#ifndef __P
|
||||
#ifdef __STDC__
|
||||
#define __P(x) x
|
||||
#define __P(x) x
|
||||
#else
|
||||
#define __P(x) ()
|
||||
#define __P(x) ()
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@ -122,46 +128,46 @@ typedef void (*ihfunc_t) __P((int, fd_set *));
|
||||
*/
|
||||
/* #if (!(defined(__bsdi__)) && !(defined(KERNEL))) */
|
||||
#ifndef KERNEL
|
||||
#define max(a, b) ((a) < (b) ? (b) : (a))
|
||||
#define min(a, b) ((a) > (b) ? (b) : (a))
|
||||
#define max(a, b) ((a) < (b) ? (b) : (a))
|
||||
#define min(a, b) ((a) > (b) ? (b) : (a))
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Various definitions to make it working for different platforms
|
||||
*/
|
||||
/* The old style sockaddr definition doesn't have sa_len */
|
||||
#if (defined(BSD) && (BSD >= 199006)) /* sa_len was added with 4.3-Reno */
|
||||
#define HAVE_SA_LEN
|
||||
#if (defined(BSD) && (BSD >= 199006)) /* sa_len was added with 4.3-Reno */
|
||||
#define HAVE_SA_LEN
|
||||
#endif
|
||||
|
||||
/* Versions of Solaris older than 2.6 don't have routing sockets. */
|
||||
/* XXX TODO: check FreeBSD version and add all other platforms */
|
||||
#if ((defined(SunOS) && SunOS >=56) || (defined __FreeBSD__) || (defined IRIX) || (defined __bsdi__) || defined(__NetBSD__))
|
||||
#define HAVE_ROUTING_SOCKETS
|
||||
#define HAVE_ROUTING_SOCKETS
|
||||
#endif
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#define CREATE TRUE
|
||||
#define DONT_CREATE FALSE
|
||||
#define CREATE TRUE
|
||||
#define DONT_CREATE FALSE
|
||||
|
||||
#define EQUAL(s1, s2) (strcmp((s1), (s2)) == 0)
|
||||
#define EQUAL(s1, s2) (strcmp((s1), (s2)) == 0)
|
||||
|
||||
/* obnoxious gcc gives an extraneous warning about this constant... */
|
||||
#if defined(__STDC__) || defined(__GNUC__)
|
||||
#define JAN_1970 2208988800UL /* 1970 - 1900 in seconds */
|
||||
#define JAN_1970 2208988800UL /* 1970 - 1900 in seconds */
|
||||
#else
|
||||
#define JAN_1970 2208988800L /* 1970 - 1900 in seconds */
|
||||
#define const /**/
|
||||
#define JAN_1970 2208988800L /* 1970 - 1900 in seconds */
|
||||
#define const /**/
|
||||
#endif
|
||||
|
||||
|
||||
#define MINHLIM 1 /* min hoplim in the packets send locally */
|
||||
#define MINHLIM 1 /* min hoplim in the packets send locally */
|
||||
|
||||
#define MAX_IP_PACKET_LEN 576
|
||||
#define MIN_IP_HEADER_LEN 20
|
||||
#define MAX_IP_HEADER_LEN 60
|
||||
#define MAX_IP_PACKET_LEN 576
|
||||
#define MIN_IP_HEADER_LEN 20
|
||||
#define MAX_IP_HEADER_LEN 60
|
||||
|
||||
|
||||
/*
|
||||
@ -170,48 +176,48 @@ typedef void (*ihfunc_t) __P((int, fd_set *));
|
||||
*/
|
||||
#ifndef INADDR_ALLRTRS_GROUP
|
||||
/* address for multicast mtrace msg */
|
||||
#define INADDR_ALLRTRS_GROUP (u_int32)0xe0000002 /* 224.0.0.2 */
|
||||
#define INADDR_ALLRTRS_GROUP (u_int32)0xe0000002 /* 224.0.0.2 */
|
||||
#endif
|
||||
|
||||
#ifndef INADDR_MAX_LOCAL_GROUP
|
||||
define INADDR_MAX_LOCAL_GROUP (u_int32)0xe00000ff /* 224.0.0.255 */
|
||||
#endif
|
||||
|
||||
#define INADDR_ANY_N (u_int32)0x00000000 /* INADDR_ANY in
|
||||
#define INADDR_ANY_N (u_int32)0x00000000 /* INADDR_ANY in
|
||||
* network order */
|
||||
#define CLASSD_PREFIX (u_int32)0xe0000000 /* 224.0.0.0 */
|
||||
#define ALL_MCAST_GROUPS_ADDR (u_int32)0xe0000000 /* 224.0.0.0 */
|
||||
#define ALL_MCAST_GROUPS_LENGTH 4
|
||||
#define CLASSD_PREFIX (u_int32)0xe0000000 /* 224.0.0.0 */
|
||||
#define ALL_MCAST_GROUPS_ADDR (u_int32)0xe0000000 /* 224.0.0.0 */
|
||||
#define ALL_MCAST_GROUPS_LENGTH 4
|
||||
|
||||
/* Used by DVMRP */
|
||||
#define DEFAULT_METRIC 1 /* default subnet/tunnel metric */
|
||||
#define DEFAULT_THRESHOLD 1 /* default subnet/tunnel threshold */
|
||||
#define DEFAULT_METRIC 1 /* default subnet/tunnel metric */
|
||||
#define DEFAULT_THRESHOLD 1 /* default subnet/tunnel threshold */
|
||||
|
||||
#define TIMER_INTERVAL 5 /* 5 sec virtual timer granularity */
|
||||
#define TIMER_INTERVAL 5 /* 5 sec virtual timer granularity */
|
||||
|
||||
#ifdef RSRR
|
||||
#define BIT_ZERO(X) ((X) = 0)
|
||||
#define BIT_SET(X,n) ((X) |= 1 << (n))
|
||||
#define BIT_CLR(X,n) ((X) &= ~(1 << (n)))
|
||||
#define BIT_TST(X,n) ((X) & 1 << (n))
|
||||
#define BIT_ZERO(X) ((X) = 0)
|
||||
#define BIT_SET(X,n) ((X) |= 1 << (n))
|
||||
#define BIT_CLR(X,n) ((X) &= ~(1 << (n)))
|
||||
#define BIT_TST(X,n) ((X) & 1 << (n))
|
||||
#endif /* RSRR */
|
||||
|
||||
#ifdef SYSV
|
||||
#define bcopy(a, b, c) memcpy((b), (a), (c))
|
||||
#define bzero(s, n) memset((s), 0, (n))
|
||||
#define setlinebuf(s) setvbuf((s), (NULL), (_IOLBF), 0)
|
||||
#define RANDOM() lrand48()
|
||||
#define bcopy(a, b, c) memcpy((b), (a), (c))
|
||||
#define bzero(s, n) memset((s), 0, (n))
|
||||
#define setlinebuf(s) setvbuf((s), (NULL), (_IOLBF), 0)
|
||||
#define RANDOM() lrand48()
|
||||
#else
|
||||
#define RANDOM() random()
|
||||
#define RANDOM() random()
|
||||
#endif /* SYSV */
|
||||
|
||||
/*
|
||||
* External declarations for global variables and functions.
|
||||
*/
|
||||
#define RECV_BUF_SIZE 64*1024 /* Maximum buff size to send
|
||||
#define RECV_BUF_SIZE 64*1024 /* Maximum buff size to send
|
||||
* or receive packet */
|
||||
#define SO_RECV_BUF_SIZE_MAX 256*1024
|
||||
#define SO_RECV_BUF_SIZE_MIN 48*1024
|
||||
#define SO_RECV_BUF_SIZE_MAX 256*1024
|
||||
#define SO_RECV_BUF_SIZE_MIN 48*1024
|
||||
|
||||
/* TODO: describe the variables and clean up */
|
||||
extern char *mld6_recv_buf;
|
||||
@ -259,41 +265,41 @@ extern char * sys_errlist[];
|
||||
|
||||
|
||||
#ifndef IGMP_MEMBERSHIP_QUERY
|
||||
#define IGMP_MEMBERSHIP_QUERY IGMP_HOST_MEMBERSHIP_QUERY
|
||||
#define IGMP_MEMBERSHIP_QUERY IGMP_HOST_MEMBERSHIP_QUERY
|
||||
#if !(defined(__NetBSD__))
|
||||
#define IGMP_V1_MEMBERSHIP_REPORT IGMP_HOST_MEMBERSHIP_REPORT
|
||||
#define IGMP_V2_MEMBERSHIP_REPORT IGMP_HOST_NEW_MEMBERSHIP_REPORT
|
||||
#define IGMP_V1_MEMBERSHIP_REPORT IGMP_HOST_MEMBERSHIP_REPORT
|
||||
#define IGMP_V2_MEMBERSHIP_REPORT IGMP_HOST_NEW_MEMBERSHIP_REPORT
|
||||
#else
|
||||
#define IGMP_V1_MEMBERSHIP_REPORT IGMP_v1_HOST_MEMBERSHIP_REPORT
|
||||
#define IGMP_V2_MEMBERSHIP_REPORT IGMP_v2_HOST_MEMBERSHIP_REPORT
|
||||
#define IGMP_V1_MEMBERSHIP_REPORT IGMP_v1_HOST_MEMBERSHIP_REPORT
|
||||
#define IGMP_V2_MEMBERSHIP_REPORT IGMP_v2_HOST_MEMBERSHIP_REPORT
|
||||
#endif
|
||||
#define IGMP_V2_LEAVE_GROUP IGMP_HOST_LEAVE_MESSAGE
|
||||
#define IGMP_V2_LEAVE_GROUP IGMP_HOST_LEAVE_MESSAGE
|
||||
#endif
|
||||
|
||||
#if defined(__NetBSD__)
|
||||
#define IGMP_MTRACE_RESP IGMP_MTRACE_REPLY
|
||||
#define IGMP_MTRACE IGMP_MTRACE_QUERY
|
||||
#define IGMP_MTRACE_RESP IGMP_MTRACE_REPLY
|
||||
#define IGMP_MTRACE IGMP_MTRACE_QUERY
|
||||
#endif
|
||||
|
||||
/* For timeout. The timers count down */
|
||||
#define SET_TIMER(timer, value) (timer) = (value)
|
||||
#define IF_TIMER_SET(timer) if ((timer) > 0)
|
||||
#define IF_TIMER_NOT_SET(timer) if ((timer) <= 0)
|
||||
#define FIRE_TIMER(timer) (timer) = 0
|
||||
#define SET_TIMER(timer, value) (timer) = (value)
|
||||
#define IF_TIMER_SET(timer) if ((timer) > 0)
|
||||
#define IF_TIMER_NOT_SET(timer) if ((timer) <= 0)
|
||||
#define FIRE_TIMER(timer) (timer) = 0
|
||||
|
||||
#define IF_TIMEOUT(value) \
|
||||
#define IF_TIMEOUT(value) \
|
||||
if (!(((value) >= TIMER_INTERVAL) && ((value) -= TIMER_INTERVAL)))
|
||||
|
||||
#define IF_NOT_TIMEOUT(value) \
|
||||
#define IF_NOT_TIMEOUT(value) \
|
||||
if (((value) >= TIMER_INTERVAL) && ((value) -= TIMER_INTERVAL))
|
||||
|
||||
#define TIMEOUT(value) \
|
||||
#define TIMEOUT(value) \
|
||||
(!(((value) >= TIMER_INTERVAL) && ((value) -= TIMER_INTERVAL)))
|
||||
|
||||
#define NOT_TIMEOUT(value) \
|
||||
#define NOT_TIMEOUT(value) \
|
||||
(((value) >= TIMER_INTERVAL) && ((value) -= TIMER_INTERVAL))
|
||||
|
||||
#define ELSE else /* To make emacs cc-mode happy */
|
||||
#define ELSE else /* To make emacs cc-mode happy */
|
||||
|
||||
|
||||
/*
|
||||
@ -317,6 +323,7 @@ extern void config_vifs_from_file __P((void));
|
||||
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));
|
||||
@ -386,7 +393,7 @@ extern void accept_group_report __P((u_int32 src, u_int32 dst,
|
||||
u_int32 group, int r_type));
|
||||
extern void accept_leave_message __P((u_int32 src, u_int32 dst,
|
||||
u_int32 group));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/* inet.c */
|
||||
@ -482,7 +489,7 @@ extern int receive_pim6_join_prune __P((struct sockaddr_in6 *src,
|
||||
char *pim_message, int datalen));
|
||||
extern int send_pim6_jp __P((mrtentry_t *mrtentry_ptr, int action,
|
||||
mifi_t mifi,
|
||||
struct sockaddr_in6 *target_addr,
|
||||
struct sockaddr_in6 *target_addr,
|
||||
u_int16 holdtime, int echo));
|
||||
|
||||
extern int receive_pim6_assert __P((struct sockaddr_in6 *src,
|
||||
@ -512,7 +519,7 @@ extern void delete_pim_nbr __P((pim_nbr_entry_t *nbr_delete));
|
||||
extern int receive_pim_join_prune __P((u_int32 src, u_int32 dst,
|
||||
char *pim_message, int datalen));
|
||||
extern int send_pim_jp __P((mrtentry_t *mrtentry_ptr, int action,
|
||||
vifi_t vifi, u_int32 target_addr,
|
||||
vifi_t vifi, u_int32 target_addr,
|
||||
u_int16 holdtime));
|
||||
extern int receive_pim_assert __P((u_int32 src, u_int32 dst,
|
||||
char *pim_message, int datalen));
|
||||
@ -520,7 +527,7 @@ extern int send_pim_assert __P((u_int32 source, u_int32 group,
|
||||
vifi_t vifi,
|
||||
mrtentry_t *mrtentry_ptr));
|
||||
extern void delete_pim_graft_entry __P((mrtentry_t *mrtentry_ptr));
|
||||
extern int receive_pim_graft __P((u_int32 src, u_int32 dst,
|
||||
extern int receive_pim_graft __P((u_int32 src, u_int32 dst,
|
||||
char *pim_message, int datalen,
|
||||
int pimtype));
|
||||
#endif
|
||||
@ -562,9 +569,9 @@ extern int init_routesock __P((void));
|
||||
#endif /* HAVE_ROUTING_SOCKETS */
|
||||
|
||||
#ifdef RSRR
|
||||
#define gtable mrtentry
|
||||
#define RSRR_NOTIFICATION_OK TRUE
|
||||
#define RSRR_NOTIFICATION_FALSE FALSE
|
||||
#define gtable mrtentry
|
||||
#define RSRR_NOTIFICATION_OK TRUE
|
||||
#define RSRR_NOTIFICATION_FALSE FALSE
|
||||
|
||||
/* rsrr.c */
|
||||
extern void rsrr_init __P((void));
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 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:
|
||||
@ -13,7 +13,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
|
||||
@ -211,7 +211,7 @@ inet6_fmt(struct in6_addr *addr)
|
||||
static char ip6buf[8][INET6_ADDRSTRLEN];
|
||||
static int ip6round = 0;
|
||||
char *cp;
|
||||
|
||||
|
||||
ip6round = (ip6round + 1) & 7;
|
||||
cp = ip6buf[ip6round];
|
||||
|
||||
@ -274,7 +274,7 @@ net6name(struct in6_addr *prefix, struct in6_addr *mask)
|
||||
static char ip6buf[8][INET6_ADDRSTRLEN + 4]; /* length of addr/plen */
|
||||
static int ip6round = 0;
|
||||
char *cp;
|
||||
|
||||
|
||||
ip6round = (ip6round + 1) & 7;
|
||||
cp = ip6buf[ip6round];
|
||||
|
||||
|
@ -19,7 +19,7 @@
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL USC, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -31,7 +31,7 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
|
||||
*
|
||||
* $Id: kern.c,v 1.1.1.1 1999/08/08 23:30:52 itojun Exp $
|
||||
@ -57,18 +57,18 @@ int curttl = 0;
|
||||
/*
|
||||
* Open/init the multicast routing in the kernel and sets the MRT_ASSERT
|
||||
* flag in the kernel.
|
||||
*
|
||||
*
|
||||
*/
|
||||
void
|
||||
k_init_pim(socket)
|
||||
int socket;
|
||||
{
|
||||
int v = 1;
|
||||
|
||||
|
||||
if (setsockopt(socket, IPPROTO_IPV6,
|
||||
MRT6_INIT, (char *)&v, sizeof(int)) < 0)
|
||||
log(LOG_ERR, errno, "cannot enable multicast routing in kernel");
|
||||
|
||||
|
||||
if(setsockopt(socket, IPPROTO_IPV6,
|
||||
MRT6_PIM, (char *)&v, sizeof(int)) < 0)
|
||||
log(LOG_ERR, errno, "cannot set ASSERT flag in kernel");
|
||||
@ -91,7 +91,7 @@ k_stop_pim(socket)
|
||||
|
||||
if (setsockopt(socket, IPPROTO_IPV6, MRT6_DONE, (char *)NULL, 0) < 0)
|
||||
log(LOG_ERR, errno, "cannot disable multicast routing in kernel");
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -106,7 +106,7 @@ void k_set_rcvbuf(socket, bufsize, minsize)
|
||||
{
|
||||
int delta = bufsize / 2;
|
||||
int iter = 0;
|
||||
|
||||
|
||||
/*
|
||||
* Set the socket buffer. If we can't set it as large as we
|
||||
* want, search around to try to find the highest acceptable
|
||||
@ -120,7 +120,7 @@ void k_set_rcvbuf(socket, bufsize, minsize)
|
||||
iter++;
|
||||
if (delta > 1)
|
||||
delta /= 2;
|
||||
|
||||
|
||||
if (setsockopt(socket, SOL_SOCKET, SO_RCVBUF,
|
||||
(char *)&bufsize, sizeof(bufsize)) < 0) {
|
||||
bufsize -= delta;
|
||||
@ -174,7 +174,7 @@ void k_set_hlim(socket, h)
|
||||
curttl = h;
|
||||
#else
|
||||
int hlim = h;
|
||||
|
||||
|
||||
if (setsockopt(socket, IPPROTO_IPV6, IPV6_MULTICAST_HOPS,
|
||||
(char *)&hlim, sizeof(hlim)) < 0)
|
||||
log(LOG_ERR, errno, "setsockopt IPV6_MULTICAST_HOPS %u", hlim);
|
||||
@ -222,7 +222,7 @@ void k_join(socket, grp, ifindex)
|
||||
u_int ifindex;
|
||||
{
|
||||
struct ipv6_mreq mreq;
|
||||
|
||||
|
||||
mreq.ipv6mr_multiaddr = *grp;
|
||||
mreq.ipv6mr_interface = ifindex;
|
||||
|
||||
@ -245,7 +245,7 @@ void k_leave(socket, grp, ifindex)
|
||||
|
||||
mreq.ipv6mr_multiaddr = *grp;
|
||||
mreq.ipv6mr_interface = ifindex;
|
||||
|
||||
|
||||
if (setsockopt(socket, IPPROTO_IPV6, IPV6_LEAVE_GROUP,
|
||||
(char *)&mreq, sizeof(mreq)) < 0)
|
||||
log(LOG_WARNING, errno, "cannot leave group %s on interface %s",
|
||||
@ -304,13 +304,13 @@ k_del_mfc(socket, source, group)
|
||||
|
||||
mc.mf6cc_origin = *source;
|
||||
mc.mf6cc_mcastgrp = *group;
|
||||
|
||||
|
||||
if (setsockopt(socket, IPPROTO_IPV6, MRT6_DEL_MFC, (char *)&mc,
|
||||
sizeof(mc)) < 0) {
|
||||
log(LOG_WARNING, errno, "setsockopt MRT6_DEL_MFC");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
IF_DEBUG(DEBUG_MFC)
|
||||
log(LOG_DEBUG, 0, "Deleted MFC entry: src %s, grp %s",
|
||||
inet6_fmt(&source->sin6_addr),
|
||||
@ -345,7 +345,7 @@ k_chg_mfc(socket, source, group, iif, oifs)
|
||||
else
|
||||
IF_CLR(vifi, &mc.mf6cc_ifset);
|
||||
}
|
||||
|
||||
|
||||
if (setsockopt(socket, IPPROTO_IPV6, MRT6_ADD_MFC, (char *)&mc,
|
||||
sizeof(mc)) < 0) {
|
||||
log(LOG_WARNING, errno,
|
||||
@ -368,7 +368,7 @@ int k_get_vif_count(vifi, retval)
|
||||
struct vif_count *retval;
|
||||
{
|
||||
struct sioc_mif_req6 mreq;
|
||||
|
||||
|
||||
mreq.mifi = vifi;
|
||||
if (ioctl(udp_socket, SIOCGETMIFCNT_IN6, (char *)&mreq) < 0) {
|
||||
log(LOG_WARNING, errno, "SIOCGETMIFCNT_IN6 on vif %d", vifi);
|
||||
@ -396,7 +396,7 @@ k_get_sg_cnt(socket, source, group, retval)
|
||||
struct sg_count *retval;
|
||||
{
|
||||
struct sioc_sg_req6 sgreq;
|
||||
|
||||
|
||||
sgreq.src = *source;
|
||||
sgreq.grp = *group;
|
||||
if (ioctl(socket, SIOCGETSGCNT_IN6, (char *)&sgreq) < 0) {
|
||||
|
@ -10,15 +10,15 @@
|
||||
* documentation, and that any documentation, advertising materials,
|
||||
* and other materials related to such distribution and use acknowledge
|
||||
* that the software was developed by the University of Oregon.
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THE UNIVERSITY OF OREGON DOES NOT MAKE ANY REPRESENTATIONS
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL UO, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -30,22 +30,22 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Kurt Windisch (kurtw@antc.uoregon.edu)
|
||||
*
|
||||
* $Id: main.c,v 1.2 1999/08/13 09:20:13 jinmei Exp $
|
||||
* $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.
|
||||
* The pimd program is covered by the license in the accompanying file
|
||||
* named "LICENSE.pimd".
|
||||
*
|
||||
*
|
||||
* The pimd program is COPYRIGHT 1998 by University of Southern California.
|
||||
*
|
||||
* Part of this program has been derived from mrouted.
|
||||
* The mrouted program is covered by the license in the accompanying file
|
||||
* named "LICENSE.mrouted".
|
||||
*
|
||||
*
|
||||
* The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
|
||||
* Leland Stanford Junior University.
|
||||
*
|
||||
@ -70,17 +70,17 @@ int haveterminal = 1;
|
||||
char *progname;
|
||||
|
||||
static int sighandled = 0;
|
||||
#define GOT_SIGINT 0x01
|
||||
#define GOT_SIGHUP 0x02
|
||||
#define GOT_SIGUSR1 0x04
|
||||
#define GOT_SIGUSR2 0x08
|
||||
#define GOT_SIGALRM 0x10
|
||||
#define GOT_SIGINT 0x01
|
||||
#define GOT_SIGHUP 0x02
|
||||
#define GOT_SIGUSR1 0x04
|
||||
#define GOT_SIGUSR2 0x08
|
||||
#define GOT_SIGALRM 0x10
|
||||
|
||||
|
||||
#ifdef SNMP
|
||||
#define NHANDLERS 34
|
||||
#define NHANDLERS 34
|
||||
#else
|
||||
#define NHANDLERS 3
|
||||
#define NHANDLERS 3
|
||||
#endif
|
||||
|
||||
static struct ihandler {
|
||||
@ -186,10 +186,10 @@ register_input_handler(fd, func)
|
||||
{
|
||||
if (nhandlers >= NHANDLERS)
|
||||
return -1;
|
||||
|
||||
|
||||
ihandlers[nhandlers].fd = fd;
|
||||
ihandlers[nhandlers++].func = func;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -197,7 +197,7 @@ int
|
||||
main(argc, argv)
|
||||
int argc;
|
||||
char *argv[];
|
||||
{
|
||||
{
|
||||
int dummy, dummysigalrm;
|
||||
FILE *fp;
|
||||
struct timeval tv, difftime, curtime, lasttime, *timeout;
|
||||
@ -209,29 +209,29 @@ main(argc, argv)
|
||||
char c;
|
||||
int tmpd;
|
||||
|
||||
|
||||
|
||||
setlinebuf(stderr);
|
||||
|
||||
|
||||
if (geteuid() != 0) {
|
||||
fprintf(stderr, "pim6dd: must be root\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
progname = strrchr(argv[0], '/');
|
||||
if (progname)
|
||||
progname++;
|
||||
else
|
||||
progname = argv[0];
|
||||
|
||||
|
||||
argv++;
|
||||
argc--;
|
||||
while (argc > 0 && *argv[0] == '-') {
|
||||
if (strcmp(*argv, "-d") == 0) {
|
||||
if (argc > 1 && *(argv + 1)[0] != '-') {
|
||||
if (argc > 1 && *(argv + 1)[0] != '-') {
|
||||
char *p,*q;
|
||||
int i, len;
|
||||
struct debugname *d;
|
||||
|
||||
|
||||
argv++;
|
||||
argc--;
|
||||
debug = 0;
|
||||
@ -298,7 +298,7 @@ main(argc, argv)
|
||||
usage:
|
||||
tmpd = 0xffffffff;
|
||||
fprintf(stderr, "usage: pim6dd [-c configfile] [-d [debug_level][,debug_level]]\n");
|
||||
|
||||
|
||||
fprintf(stderr, "debug levels: ");
|
||||
c = '(';
|
||||
for (d = debugnames; d < debugnames +
|
||||
@ -311,8 +311,8 @@ main(argc, argv)
|
||||
}
|
||||
fprintf(stderr, ")\n");
|
||||
exit(1);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (debug != 0) {
|
||||
tmpd = debug;
|
||||
fprintf(stderr, "debug level 0x%lx ", debug);
|
||||
@ -327,7 +327,7 @@ main(argc, argv)
|
||||
}
|
||||
fprintf(stderr, ")\n");
|
||||
}
|
||||
|
||||
|
||||
#ifdef LOG_DAEMON
|
||||
(void)openlog("pim6dd", LOG_PID, LOG_DAEMON);
|
||||
(void)setlogmask(LOG_UPTO(LOG_NOTICE));
|
||||
@ -335,9 +335,9 @@ main(argc, argv)
|
||||
(void)openlog("pim6dd", LOG_PID);
|
||||
#endif /* LOG_DAEMON */
|
||||
sprintf(versionstring, "pim6dd version %s", todaysversion);
|
||||
|
||||
|
||||
log(LOG_DEBUG, 0, "%s starting", versionstring);
|
||||
|
||||
|
||||
/* TODO: XXX: use a combination of time and hostid to initialize the random
|
||||
* generator.
|
||||
*/
|
||||
@ -350,14 +350,14 @@ main(argc, argv)
|
||||
srandom(tm.tv_usec + gethostid());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
callout_init();
|
||||
|
||||
/* Start up the log rate-limiter */
|
||||
resetlogging(NULL);
|
||||
|
||||
init_mld6();
|
||||
#if 0
|
||||
#if 0
|
||||
k_stop_pim(mld6_socket);
|
||||
exit(0); /* XXX */
|
||||
#endif
|
||||
@ -365,15 +365,15 @@ main(argc, argv)
|
||||
|
||||
init_pim6_mrt();
|
||||
init_timers();
|
||||
|
||||
|
||||
/* TODO: check the kernel DVMRP/MROUTED/PIM support version */
|
||||
|
||||
|
||||
#ifdef SNMP
|
||||
if (i = snmp_init())
|
||||
return i;
|
||||
#endif /* SNMP */
|
||||
init_vifs();
|
||||
|
||||
|
||||
#ifdef RSRR
|
||||
rsrr_init();
|
||||
#endif /* RSRR */
|
||||
@ -387,7 +387,7 @@ main(argc, argv)
|
||||
sigaction(SIGINT, &sa, NULL);
|
||||
sigaction(SIGUSR1, &sa, NULL);
|
||||
sigaction(SIGUSR2, &sa, NULL);
|
||||
|
||||
|
||||
FD_ZERO(&readers);
|
||||
FD_SET(mld6_socket, &readers);
|
||||
nfds = mld6_socket + 1;
|
||||
@ -396,21 +396,21 @@ main(argc, argv)
|
||||
if (ihandlers[i].fd >= nfds)
|
||||
nfds = ihandlers[i].fd + 1;
|
||||
}
|
||||
|
||||
|
||||
IF_DEBUG(DEBUG_IF)
|
||||
dump_vifs(stderr);
|
||||
IF_DEBUG(DEBUG_PIM_MRT)
|
||||
dump_pim_mrt(stderr);
|
||||
|
||||
|
||||
/* schedule first timer interrupt */
|
||||
timer_setTimer(TIMER_INTERVAL, timer, NULL);
|
||||
|
||||
|
||||
if (debug == 0) {
|
||||
/* Detach from the terminal */
|
||||
#ifdef TIOCNOTTY
|
||||
int t;
|
||||
#endif /* TIOCNOTTY */
|
||||
|
||||
|
||||
haveterminal = 0;
|
||||
if (fork())
|
||||
exit(0);
|
||||
@ -422,7 +422,7 @@ main(argc, argv)
|
||||
(void)dup2(0, 2);
|
||||
#if defined(SYSV) || defined(linux)
|
||||
(void)setpgrp();
|
||||
#else
|
||||
#else
|
||||
#ifdef TIOCNOTTY
|
||||
t = open("/dev/tty", 2);
|
||||
if (t >= 0) {
|
||||
@ -439,13 +439,13 @@ main(argc, argv)
|
||||
#ifdef HAVE_ROUTING_SOCKETS
|
||||
init_routesock();
|
||||
#endif /* HAVE_ROUTING_SOCKETS */
|
||||
|
||||
|
||||
fp = fopen(pidfilename, "w");
|
||||
if (fp != NULL) {
|
||||
fprintf(fp, "%d\n", (int)getpid());
|
||||
(void) fclose(fp);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Main receive loop.
|
||||
*/
|
||||
@ -464,7 +464,7 @@ main(argc, argv)
|
||||
timeout->tv_sec = secs;
|
||||
timeout->tv_usec = 0;
|
||||
}
|
||||
|
||||
|
||||
if (sighandled) {
|
||||
if (sighandled & GOT_SIGINT) {
|
||||
sighandled &= ~GOT_SIGINT;
|
||||
@ -552,7 +552,7 @@ main(argc, argv)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
} /* Main loop */
|
||||
|
||||
log(LOG_NOTICE, 0, "%s exiting", versionstring);
|
||||
@ -584,16 +584,16 @@ u_long virtual_time = 0;
|
||||
* aging interfaces, quering neighbors and members, etc... The granularity
|
||||
* is equal to TIMER_INTERVAL.
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
timer(i)
|
||||
void *i;
|
||||
{
|
||||
age_vifs(); /* Timeout neighbors and groups */
|
||||
age_routes(); /* Timeout routing entries */
|
||||
|
||||
|
||||
virtual_time += TIMER_INTERVAL;
|
||||
timer_setTimer(TIMER_INTERVAL, timer, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Performs all necessary functions to quit gracefully
|
||||
@ -629,15 +629,15 @@ handler(sig)
|
||||
case SIGTERM:
|
||||
sighandled |= GOT_SIGINT;
|
||||
break;
|
||||
|
||||
|
||||
case SIGHUP:
|
||||
sighandled |= GOT_SIGHUP;
|
||||
break;
|
||||
|
||||
|
||||
case SIGUSR1:
|
||||
sighandled |= GOT_SIGUSR1;
|
||||
break;
|
||||
|
||||
|
||||
case SIGUSR2:
|
||||
sighandled |= GOT_SIGUSR2;
|
||||
break;
|
||||
@ -657,9 +657,9 @@ restart(i)
|
||||
#ifdef SNMP
|
||||
int s;
|
||||
#endif /* SNMP */
|
||||
|
||||
|
||||
log(LOG_NOTICE, 0, "% restart", versionstring);
|
||||
|
||||
|
||||
/*
|
||||
* reset all the entries
|
||||
*/
|
||||
@ -674,7 +674,7 @@ restart(i)
|
||||
close(mld6_socket);
|
||||
close(pim6_socket);
|
||||
close(udp_socket);
|
||||
|
||||
|
||||
/*
|
||||
* start processing again
|
||||
*/
|
||||
@ -705,7 +705,7 @@ resetlogging(arg)
|
||||
{
|
||||
int nxttime = 60;
|
||||
void *narg = NULL;
|
||||
|
||||
|
||||
if (arg == NULL && log_nmsgs > LOG_MAX_MSGS) {
|
||||
nxttime = LOG_SHUT_UP;
|
||||
narg = (void *)&log_nmsgs; /* just need some valid void * */
|
||||
@ -714,6 +714,6 @@ resetlogging(arg)
|
||||
} else {
|
||||
log_nmsgs = 0;
|
||||
}
|
||||
|
||||
|
||||
timer_setTimer(nxttime, resetlogging, narg);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 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:
|
||||
@ -13,7 +13,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
|
||||
@ -48,7 +48,7 @@
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL USC, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -60,10 +60,10 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
|
||||
*
|
||||
* $Id: mld6.c,v 1.7 2000/01/04 17:17:21 jinmei Exp $
|
||||
* $Id: mld6.c,v 1.13 2000/04/12 07:34:38 jinmei Exp $
|
||||
*/
|
||||
/*
|
||||
* Part of this program has been derived from mrouted.
|
||||
@ -100,11 +100,12 @@ static struct msghdr sndmh,
|
||||
static struct iovec sndiov[2];
|
||||
static struct iovec rcviov[2];
|
||||
static struct sockaddr_in6 from;
|
||||
static u_char rcvcmsgbuf[CMSG_SPACE(sizeof(struct in6_pktinfo)) +
|
||||
CMSG_SPACE(sizeof(int))];
|
||||
static u_char *rcvcmsgbuf = NULL;
|
||||
static int rcvcmsglen;
|
||||
|
||||
#ifndef USE_RFC2292BIS
|
||||
u_int8_t raopt[IP6OPT_RTALERT_LEN];
|
||||
#endif
|
||||
#endif
|
||||
static char *sndcmsgbuf;
|
||||
static int ctlbuflen = 0;
|
||||
static u_short rtalert_code;
|
||||
@ -116,8 +117,8 @@ static void accept_mld6 __P((int len));
|
||||
static void make_mld6_msg __P((int, int, struct sockaddr_in6 *,
|
||||
struct sockaddr_in6 *, struct in6_addr *, int, int, int, int));
|
||||
|
||||
#ifndef IP6OPT_ROUTER_ALERT
|
||||
#define IP6OPT_ROUTER_ALERT IP6OPT_RTALERT
|
||||
#ifndef IP6OPT_ROUTER_ALERT /* XXX to be compatible older systems */
|
||||
#define IP6OPT_ROUTER_ALERT IP6OPT_RTALERT
|
||||
#endif
|
||||
|
||||
/*
|
||||
@ -131,10 +132,15 @@ init_mld6()
|
||||
|
||||
rtalert_code = htons(IP6OPT_RTALERT_MLD);
|
||||
if (!mld6_recv_buf && (mld6_recv_buf = malloc(RECV_BUF_SIZE)) == NULL)
|
||||
log(LOG_ERR, 0, "malloca failed");
|
||||
log(LOG_ERR, 0, "malloc failed");
|
||||
if (!mld6_send_buf && (mld6_send_buf = malloc(RECV_BUF_SIZE)) == NULL)
|
||||
log(LOG_ERR, 0, "malloca failed");
|
||||
log(LOG_ERR, 0, "malloc failed");
|
||||
|
||||
rcvcmsglen = CMSG_SPACE(sizeof(struct in6_pktinfo)) +
|
||||
CMSG_SPACE(sizeof(int));
|
||||
if (rcvcmsgbuf == NULL && (rcvcmsgbuf = malloc(rcvcmsglen)) == NULL)
|
||||
log(LOG_ERR, 0,"malloc failed");
|
||||
|
||||
IF_DEBUG(DEBUG_KERN)
|
||||
log(LOG_DEBUG,0,"%d octets allocated for the emit/recept buffer mld6",RECV_BUF_SIZE);
|
||||
|
||||
@ -173,7 +179,7 @@ init_mld6()
|
||||
if (setsockopt(mld6_socket, IPPROTO_IPV6, IPV6_PKTINFO, &on,
|
||||
sizeof(on)) < 0)
|
||||
log(LOG_ERR, errno, "setsockopt(IPV6_PKTINFO)");
|
||||
#endif
|
||||
#endif
|
||||
on = 1;
|
||||
/* specify to tell value of hoplimit field of received IP6 hdr */
|
||||
#ifdef IPV6_RECVHOPLIMIT
|
||||
@ -184,7 +190,7 @@ init_mld6()
|
||||
if (setsockopt(mld6_socket, IPPROTO_IPV6, IPV6_HOPLIMIT, &on,
|
||||
sizeof(on)) < 0)
|
||||
log(LOG_ERR, errno, "setsockopt(IPV6_HOPLIMIT)");
|
||||
#endif
|
||||
#endif
|
||||
/* initialize msghdr for receiving packets */
|
||||
rcviov[0].iov_base = (caddr_t) mld6_recv_buf;
|
||||
rcviov[0].iov_len = RECV_BUF_SIZE;
|
||||
@ -193,7 +199,7 @@ init_mld6()
|
||||
rcvmh.msg_iov = rcviov;
|
||||
rcvmh.msg_iovlen = 1;
|
||||
rcvmh.msg_control = (caddr_t) rcvcmsgbuf;
|
||||
rcvmh.msg_controllen = sizeof(rcvcmsgbuf);
|
||||
rcvmh.msg_controllen = rcvcmsglen;
|
||||
|
||||
/* initialize msghdr for sending packets */
|
||||
sndiov[0].iov_base = (caddr_t)mld6_send_buf;
|
||||
@ -205,7 +211,7 @@ init_mld6()
|
||||
raopt[0] = IP6OPT_ROUTER_ALERT;
|
||||
raopt[1] = IP6OPT_RTALERT_LEN - 2;
|
||||
memcpy(&raopt[2], (caddr_t) & rtalert_code, sizeof(u_short));
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* register MLD message handler */
|
||||
if (register_input_handler(mld6_socket, mld6_read) < 0)
|
||||
@ -250,19 +256,6 @@ int recvlen;
|
||||
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 = sizeof(rcvcmsgbuf);
|
||||
|
||||
process_kernel_call();
|
||||
return;
|
||||
}
|
||||
|
||||
if (recvlen < sizeof(struct mld6_hdr))
|
||||
{
|
||||
log(LOG_WARNING, 0,
|
||||
@ -271,6 +264,20 @@ int recvlen;
|
||||
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 */
|
||||
@ -400,7 +407,7 @@ make_mld6_msg(type, code, src, dst, group, ifindex, delay, datalen, alert)
|
||||
datalen = sizeof(struct mld6_hdr);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
bzero(mhp, sizeof(*mhp));
|
||||
mhp->mld6_type = type;
|
||||
mhp->mld6_code = code;
|
||||
@ -427,6 +434,7 @@ make_mld6_msg(type, code, src, dst, group, ifindex, delay, datalen, alert)
|
||||
hbhlen = inet6_option_space(sizeof(raopt));
|
||||
ctllen += hbhlen;
|
||||
#endif
|
||||
|
||||
}
|
||||
/* extend ancillary data space (if necessary) */
|
||||
if (ctlbuflen < ctllen) {
|
||||
@ -488,7 +496,7 @@ make_mld6_msg(type, code, src, dst, group, ifindex, delay, datalen, alert)
|
||||
if (inet6_option_append(cmsgp, raopt, 4, 0))
|
||||
log(LOG_ERR, 0, /* assert */
|
||||
"make_mld6_msg: inet6_option_append failed");
|
||||
#endif
|
||||
#endif
|
||||
cmsgp = CMSG_NXTHDR(&sndmh, cmsgp);
|
||||
}
|
||||
}
|
||||
@ -508,7 +516,7 @@ send_mld6(type, code, src, dst, group, index, delay, datalen, alert)
|
||||
{
|
||||
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)) {
|
||||
@ -529,7 +537,7 @@ send_mld6(type, code, src, dst, group, index, delay, datalen, alert)
|
||||
k_set_loop(mld6_socket, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
IF_DEBUG(DEBUG_PKT|debug_kind(IPPROTO_IGMP, type, 0))
|
||||
log(LOG_DEBUG, 0, "SENT %s from %-15s to %s",
|
||||
packet_kind(IPPROTO_ICMPV6, type, 0),
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 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:
|
||||
@ -13,7 +13,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
|
||||
@ -32,14 +32,17 @@
|
||||
/*
|
||||
* Constans for Multicast Listener Discovery protocol for IPv6.
|
||||
*/
|
||||
#define MLD6_ROBUSTNESS_VARIABLE 2
|
||||
#define MLD6_QUERY_INTERVAL 125 /* in seconds */
|
||||
#define MLD6_QUERY_RESPONSE_INTERVAL 10000 /* in milliseconds */
|
||||
#define MLD6_ROBUSTNESS_VARIABLE 2
|
||||
#define MLD6_QUERY_INTERVAL 125 /* in seconds */
|
||||
#define MLD6_QUERY_RESPONSE_INTERVAL 10000 /* in milliseconds */
|
||||
#ifndef MLD6_TIMER_SCALE
|
||||
#define MLD6_TIMER_SCALE 1000
|
||||
#endif
|
||||
#define MLD6_LISTENER_INTERVAL (MLD6_ROBUSTNESS_VARIABLE * \
|
||||
#define MLD6_TIMER_SCALE 1000
|
||||
#endif
|
||||
#define MLD6_LISTENER_INTERVAL (MLD6_ROBUSTNESS_VARIABLE * \
|
||||
MLD6_QUERY_INTERVAL + \
|
||||
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))
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 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:
|
||||
@ -13,7 +13,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
|
||||
@ -39,15 +39,15 @@
|
||||
* documentation, and that any documentation, advertising materials,
|
||||
* and other materials related to such distribution and use acknowledge
|
||||
* that the software was developed by the University of Oregon.
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THE UNIVERSITY OF OREGON DOES NOT MAKE ANY REPRESENTATIONS
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL UO, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -59,22 +59,22 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Kurt Windisch (kurtw@antc.uoregon.edu)
|
||||
*
|
||||
* $Id: mld6_proto.c,v 1.2 1999/09/12 17:00:09 jinmei Exp $
|
||||
* $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.
|
||||
* The pimd program is covered by the license in the accompanying file
|
||||
* named "LICENSE.pimd".
|
||||
*
|
||||
*
|
||||
* The pimd program is COPYRIGHT 1998 by University of Southern California.
|
||||
*
|
||||
* Part of this program has been derived from mrouted.
|
||||
* The mrouted program is covered by the license in the accompanying file
|
||||
* named "LICENSE.mrouted".
|
||||
*
|
||||
*
|
||||
* The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
|
||||
* Leland Stanford Junior University.
|
||||
*
|
||||
@ -110,7 +110,7 @@ query_groups(v)
|
||||
register struct uvif *v;
|
||||
{
|
||||
register struct listaddr *g;
|
||||
|
||||
|
||||
v->uv_gq_timer = MLD6_QUERY_INTERVAL;
|
||||
if (v->uv_flags & VIFF_QUERIER && (v->uv_flags & VIFF_NOLISTENER) == 0)
|
||||
send_mld6(MLD6_LISTENER_QUERY, 0, &v->uv_linklocal->pa_addr,
|
||||
@ -155,7 +155,7 @@ accept_listener_query(src, dst, group, tmo)
|
||||
|
||||
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:
|
||||
@ -177,29 +177,20 @@ accept_listener_query(src, dst, group, tmo)
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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,
|
||||
@ -273,7 +264,7 @@ accept_listener_report(src, dst, group)
|
||||
"accept_listener_report: can't find a mif");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
IF_DEBUG(DEBUG_MLD)
|
||||
log(LOG_INFO, 0,
|
||||
"accepting multicast listener report: "
|
||||
@ -282,7 +273,7 @@ accept_listener_report(src, dst, group)
|
||||
inet6_fmt(group));
|
||||
|
||||
v = &uvifs[mifi];
|
||||
|
||||
|
||||
/*
|
||||
* Look for the group in our group list; if found, reset its timer.
|
||||
*/
|
||||
@ -354,7 +345,7 @@ accept_listener_done(src, dst, group)
|
||||
inet6_fmt(dst), inet6_fmt(group));
|
||||
|
||||
v = &uvifs[mifi];
|
||||
|
||||
|
||||
if (!(v->uv_flags & (VIFF_QUERIER | VIFF_DR)))
|
||||
return;
|
||||
|
||||
@ -377,14 +368,14 @@ accept_listener_done(src, dst, group)
|
||||
*/
|
||||
if (g->al_old)
|
||||
return;
|
||||
|
||||
|
||||
/*
|
||||
* still waiting for a reply to a query,
|
||||
* ignore the done
|
||||
*/
|
||||
if (g->al_query)
|
||||
return;
|
||||
|
||||
|
||||
/** delete old timer set a timer for expiration **/
|
||||
if (g->al_timerid)
|
||||
g->al_timerid = DeleteTimer(g->al_timerid);
|
||||
@ -453,7 +444,7 @@ SetTimer(mifi, g)
|
||||
struct listaddr *g;
|
||||
{
|
||||
cbk_t *cbk;
|
||||
|
||||
|
||||
cbk = (cbk_t *) malloc(sizeof(cbk_t));
|
||||
cbk->mifi = mifi;
|
||||
cbk->g = g;
|
||||
@ -525,7 +516,7 @@ check_multicast_listener(v, group)
|
||||
* Look for the group in our listener list;
|
||||
*/
|
||||
for (g = v->uv_groups; g != NULL; g = g->al_next) {
|
||||
if (inet6_equal(group, &g->al_addr))
|
||||
if (inet6_equal(group, &g->al_addr))
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
@ -10,15 +10,15 @@
|
||||
* documentation, and that any documentation, advertising materials,
|
||||
* and other materials related to such distribution and use acknowledge
|
||||
* that the software was developed by the University of Oregon.
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THE UNIVERSITY OF OREGON DOES NOT MAKE ANY REPRESENTATIONS
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL UO, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -30,22 +30,22 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Kurt Windisch (kurtw@antc.uoregon.edu)
|
||||
*
|
||||
* $Id: mrt.c,v 1.2 1999/08/24 10:04:56 jinmei Exp $
|
||||
* $Id: mrt.c,v 1.3 2000/05/18 16:09:39 itojun Exp $
|
||||
*/
|
||||
/*
|
||||
* Part of this program has been derived from PIM sparse-mode pimd.
|
||||
* The pimd program is covered by the license in the accompanying file
|
||||
* named "LICENSE.pimd".
|
||||
*
|
||||
*
|
||||
* The pimd program is COPYRIGHT 1998 by University of Southern California.
|
||||
*
|
||||
* Part of this program has been derived from mrouted.
|
||||
* The mrouted program is covered by the license in the accompanying file
|
||||
* named "LICENSE.mrouted".
|
||||
*
|
||||
*
|
||||
* The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
|
||||
* Leland Stanford Junior University.
|
||||
*
|
||||
@ -85,7 +85,7 @@ static mrtentry_t *create_mrtentry __P((srcentry_t *srcentry_ptr,
|
||||
u_int16 flags));
|
||||
|
||||
|
||||
void
|
||||
void
|
||||
init_pim6_mrt()
|
||||
{
|
||||
|
||||
@ -106,7 +106,7 @@ init_pim6_mrt()
|
||||
srclist->metric = 0;
|
||||
srclist->preference = 0;
|
||||
srclist->timer = 0;
|
||||
|
||||
|
||||
/* Initialize the group list */
|
||||
/* The first entry has the unspecified address and is not used */
|
||||
/* The order is the smallest address first. */
|
||||
@ -128,7 +128,7 @@ find_group(group)
|
||||
|
||||
if (!IN6_IS_ADDR_MULTICAST(&group->sin6_addr))
|
||||
return (grpentry_t *)NULL;
|
||||
|
||||
|
||||
if (search_grplist(group, &grpentry_ptr) == TRUE) {
|
||||
/* Group found! */
|
||||
return (grpentry_ptr);
|
||||
@ -145,7 +145,7 @@ find_source(source)
|
||||
|
||||
if (!inet6_valid_host(source))
|
||||
return (srcentry_t *)NULL;
|
||||
|
||||
|
||||
if (search_srclist(source, &srcentry_ptr) == TRUE) {
|
||||
/* Source found! */
|
||||
return (srcentry_ptr);
|
||||
@ -166,12 +166,12 @@ find_route(source, group, flags, create)
|
||||
|
||||
if (!IN6_IS_ADDR_MULTICAST(&group->sin6_addr))
|
||||
return (mrtentry_t *)NULL;
|
||||
|
||||
|
||||
if (!inet6_valid_host(source))
|
||||
return (mrtentry_t *)NULL;
|
||||
|
||||
|
||||
if (create == DONT_CREATE) {
|
||||
if (search_grplist(group, &grpentry_ptr) == FALSE)
|
||||
if (search_grplist(group, &grpentry_ptr) == FALSE)
|
||||
return (mrtentry_t *)NULL;
|
||||
/* Search for the source */
|
||||
if (search_grpmrtlink(grpentry_ptr, source,
|
||||
@ -212,11 +212,11 @@ find_route(source, group, flags, create)
|
||||
}
|
||||
return (mrtentry_t *)NULL;
|
||||
}
|
||||
|
||||
|
||||
if (mrtentry_ptr->flags & MRTF_NEW) {
|
||||
struct mrtfilter *f;
|
||||
/* The mrtentry pref/metric should be the pref/metric of the
|
||||
* _upstream_ assert winner. Since this isn't known now,
|
||||
/* The mrtentry pref/metric should be the pref/metric of the
|
||||
* _upstream_ assert winner. Since this isn't known now,
|
||||
* set it to the config'ed default
|
||||
*/
|
||||
mrtentry_ptr->incoming = srcentry_ptr->incoming;
|
||||
@ -227,7 +227,7 @@ find_route(source, group, flags, create)
|
||||
if ((f = search_filter(&group->sin6_addr)))
|
||||
IF_COPY(&f->ifset, &mrtentry_ptr->filter_oifs);
|
||||
}
|
||||
|
||||
|
||||
return (mrtentry_ptr);
|
||||
}
|
||||
|
||||
@ -245,7 +245,7 @@ delete_srcentry(srcentry_ptr)
|
||||
srcentry_ptr->prev->next = srcentry_ptr->next;
|
||||
if (srcentry_ptr->next != (srcentry_t *)NULL)
|
||||
srcentry_ptr->next->prev = srcentry_ptr->prev;
|
||||
|
||||
|
||||
for (mrtentry_ptr = srcentry_ptr->mrtlink;
|
||||
mrtentry_ptr != (mrtentry_t *)NULL;
|
||||
mrtentry_ptr = mrtentry_next) {
|
||||
@ -273,14 +273,14 @@ delete_grpentry(grpentry_ptr)
|
||||
{
|
||||
mrtentry_t *mrtentry_ptr;
|
||||
mrtentry_t *mrtentry_next;
|
||||
|
||||
|
||||
if (grpentry_ptr == (grpentry_t *)NULL)
|
||||
return;
|
||||
/* TODO: XXX: the first entry is unused and always there */
|
||||
grpentry_ptr->prev->next = grpentry_ptr->next;
|
||||
if (grpentry_ptr->next != (grpentry_t *)NULL)
|
||||
grpentry_ptr->next->prev = grpentry_ptr->prev;
|
||||
|
||||
|
||||
for (mrtentry_ptr = grpentry_ptr->mrtlink;
|
||||
mrtentry_ptr != (mrtentry_t *)NULL;
|
||||
mrtentry_ptr = mrtentry_next) {
|
||||
@ -329,10 +329,10 @@ delete_mrtentry(mrtentry_ptr)
|
||||
delete_grpentry(mrtentry_ptr->group);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (mrtentry_ptr->grpnext != (mrtentry_t *)NULL)
|
||||
mrtentry_ptr->grpnext->grpprev = mrtentry_ptr->grpprev;
|
||||
|
||||
|
||||
/* Delete from the srcentry MRT chain */
|
||||
if (mrtentry_ptr->srcprev != (mrtentry_t *)NULL)
|
||||
mrtentry_ptr->srcprev->srcnext = mrtentry_ptr->srcnext;
|
||||
@ -356,7 +356,7 @@ search_srclist(source, sourceEntry)
|
||||
register srcentry_t **sourceEntry;
|
||||
{
|
||||
register srcentry_t *s_prev,*s;
|
||||
|
||||
|
||||
for (s_prev = srclist, s = s_prev->next; s != (srcentry_t *)NULL;
|
||||
s_prev = s, s = s->next) {
|
||||
/* The srclist is ordered with the smallest addresses first.
|
||||
@ -368,7 +368,7 @@ search_srclist(source, sourceEntry)
|
||||
*sourceEntry = s;
|
||||
return(TRUE);
|
||||
}
|
||||
break;
|
||||
break;
|
||||
}
|
||||
*sourceEntry = s_prev; /* The insertion point is between s_prev and s */
|
||||
return(FALSE);
|
||||
@ -381,7 +381,7 @@ search_grplist(group, groupEntry)
|
||||
register grpentry_t **groupEntry;
|
||||
{
|
||||
register grpentry_t *g_prev, *g;
|
||||
|
||||
|
||||
for (g_prev = grplist, g = g_prev->next; g != (grpentry_t *)NULL;
|
||||
g_prev = g, g = g->next) {
|
||||
/* The grplist is ordered with the smallest address first.
|
||||
@ -408,7 +408,7 @@ create_srcentry(source)
|
||||
|
||||
if (search_srclist(source, &srcentry_prev) == TRUE)
|
||||
return (srcentry_prev);
|
||||
|
||||
|
||||
srcentry_ptr = (srcentry_t *)malloc(sizeof(srcentry_t));
|
||||
if (srcentry_ptr == (srcentry_t *)NULL) {
|
||||
log(LOG_WARNING, 0, "Memory allocation error for srcentry %s",
|
||||
@ -420,7 +420,7 @@ create_srcentry(source)
|
||||
/*
|
||||
* Free the memory if there is error getting the iif and
|
||||
* the next hop (upstream) router.
|
||||
*/
|
||||
*/
|
||||
if (set_incoming(srcentry_ptr, PIM_IIF_SOURCE) == FALSE) {
|
||||
free((char *)srcentry_ptr);
|
||||
return (srcentry_t *)NULL;
|
||||
@ -432,7 +432,7 @@ create_srcentry(source)
|
||||
srcentry_ptr->prev = srcentry_prev;
|
||||
if (srcentry_ptr->next != (srcentry_t *)NULL)
|
||||
srcentry_ptr->next->prev = srcentry_ptr;
|
||||
|
||||
|
||||
IF_DEBUG(DEBUG_MFC)
|
||||
log(LOG_DEBUG, 0, "create source entry, source %s",
|
||||
inet6_fmt(&source->sin6_addr));
|
||||
@ -449,7 +449,7 @@ create_grpentry(group)
|
||||
|
||||
if (search_grplist(group, &grpentry_prev) == TRUE)
|
||||
return (grpentry_prev);
|
||||
|
||||
|
||||
grpentry_ptr = (grpentry_t *)malloc(sizeof(grpentry_t));
|
||||
if (grpentry_ptr == (grpentry_t *)NULL) {
|
||||
log(LOG_WARNING, 0, "Memory allocation error for grpentry %s",
|
||||
@ -466,7 +466,7 @@ create_grpentry(group)
|
||||
grpentry_ptr->prev = grpentry_prev;
|
||||
if (grpentry_ptr->next != (grpentry_t *)NULL)
|
||||
grpentry_ptr->next->prev = grpentry_ptr;
|
||||
|
||||
|
||||
IF_DEBUG(DEBUG_MFC)
|
||||
log(LOG_DEBUG, 0, "create group entry, group %s",
|
||||
inet6_fmt(&group->sin6_addr));
|
||||
@ -476,18 +476,18 @@ 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
|
||||
search_srcmrtlink(srcentry_ptr, group, mrtPtr)
|
||||
srcentry_t *srcentry_ptr;
|
||||
srcentry_t *srcentry_ptr;
|
||||
struct sockaddr_in6 *group;
|
||||
mrtentry_t **mrtPtr;
|
||||
{
|
||||
register mrtentry_t *mrtentry_ptr;
|
||||
register mrtentry_t *m_prev = (mrtentry_t *)NULL;
|
||||
|
||||
|
||||
for(mrtentry_ptr = srcentry_ptr->mrtlink;
|
||||
mrtentry_ptr != (mrtentry_t *)NULL;
|
||||
m_prev = mrtentry_ptr, mrtentry_ptr = mrtentry_ptr->srcnext) {
|
||||
@ -509,7 +509,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
|
||||
@ -520,7 +520,7 @@ search_grpmrtlink(grpentry_ptr, source, mrtPtr)
|
||||
{
|
||||
register mrtentry_t *mrtentry_ptr;
|
||||
register mrtentry_t *m_prev = (mrtentry_t *)NULL;
|
||||
|
||||
|
||||
for (mrtentry_ptr = grpentry_ptr->mrtlink;
|
||||
mrtentry_ptr != (mrtentry_t *)NULL;
|
||||
m_prev = mrtentry_ptr, mrtentry_ptr = mrtentry_ptr->grpnext) {
|
||||
@ -595,13 +595,13 @@ alloc_mrtentry(srcentry_ptr, grpentry_ptr)
|
||||
u_int16 i, *i_ptr;
|
||||
u_long *il_ptr;
|
||||
u_int8 vif_numbers;
|
||||
|
||||
|
||||
mrtentry_ptr = (mrtentry_t *)malloc(sizeof(mrtentry_t));
|
||||
if (mrtentry_ptr == (mrtentry_t *)NULL) {
|
||||
log(LOG_WARNING, 0, "alloc_mrtentry(): out of memory");
|
||||
return (mrtentry_t *)NULL;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* grpnext, grpprev, srcnext, srcprev will be setup when we link the
|
||||
* mrtentry to the source and group chains
|
||||
@ -631,7 +631,7 @@ alloc_mrtentry(srcentry_ptr, grpentry_ptr)
|
||||
*/
|
||||
#ifdef SAVE_MEMORY
|
||||
mrtentry_ptr->prune_timers = (u_int16 *)malloc(sizeof(u_int16) * numvifs);
|
||||
mrtentry_ptr->prune_delay_timerids =
|
||||
mrtentry_ptr->prune_delay_timerids =
|
||||
(u_long *)malloc(sizeof(u_long) * numvifs);
|
||||
mrtentry_ptr->last_assert = (u_long *)malloc(sizeof(u_long) * numvifs);
|
||||
mrtentry_ptr->last_prune = (u_long *)malloc(sizeof(u_long) * numvifs);
|
||||
@ -693,7 +693,7 @@ create_mrtentry(srcentry_ptr, grpentry_ptr, flags)
|
||||
/* (S,G) entry */
|
||||
source = &srcentry_ptr->address;
|
||||
group = &grpentry_ptr->group;
|
||||
|
||||
|
||||
if (search_grpmrtlink(grpentry_ptr, source, &r_grp_insert) == TRUE) {
|
||||
return(r_grp_insert);
|
||||
}
|
||||
@ -715,7 +715,7 @@ create_mrtentry(srcentry_ptr, grpentry_ptr, flags)
|
||||
return (mrtentry_t *)NULL;
|
||||
/*
|
||||
* r_new has to be insert right after r_grp_insert in the
|
||||
* grp mrtlink chain and right after r_src_insert in the
|
||||
* grp mrtlink chain and right after r_src_insert in the
|
||||
* src mrtlink chain
|
||||
*/
|
||||
insert_grpmrtlink(r_new, r_grp_insert, grpentry_ptr);
|
||||
@ -761,7 +761,7 @@ search_filter(maddr)
|
||||
|
||||
/*
|
||||
* Make a new filter entry.
|
||||
* This function assumes
|
||||
* This function assumes
|
||||
*/
|
||||
struct mrtfilter *
|
||||
add_filter(type, maddr1, maddr2, plen)
|
||||
|
@ -10,15 +10,15 @@
|
||||
* documentation, and that any documentation, advertising materials,
|
||||
* and other materials related to such distribution and use acknowledge
|
||||
* that the software was developed by the University of Oregon.
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THE UNIVERSITY OF OREGON DOES NOT MAKE ANY REPRESENTATIONS
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL UO, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -30,7 +30,7 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Kurt Windisch (kurtw@antc.uoregon.edu)
|
||||
*
|
||||
* $Id: mrt.h,v 1.2 1999/08/24 10:04:56 jinmei Exp $
|
||||
@ -39,34 +39,34 @@
|
||||
* Part of this program has been derived from PIM sparse-mode pimd.
|
||||
* The pimd program is covered by the license in the accompanying file
|
||||
* named "LICENSE.pimd".
|
||||
*
|
||||
*
|
||||
* The pimd program is COPYRIGHT 1998 by University of Southern California.
|
||||
*
|
||||
* Part of this program has been derived from mrouted.
|
||||
* The mrouted program is covered by the license in the accompanying file
|
||||
* named "LICENSE.mrouted".
|
||||
*
|
||||
*
|
||||
* The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
|
||||
* Leland Stanford Junior University.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#define MRTF_SPT 0x0001 /* iif toward source */
|
||||
#define MRTF_WC 0x0002 /* (*,G) entry */
|
||||
#define MRTF_RP 0x0004 /* iif toward RP */
|
||||
#define MRTF_NEW 0x0008 /* new created routing entry */
|
||||
#define MRTF_IIF_REGISTER 0x0020 /* ??? */
|
||||
#define MRTF_REGISTER 0x0080 /* ??? */
|
||||
#define MRTF_KERNEL_CACHE 0x0200 /* a mirror for the kernel cache */
|
||||
#define MRTF_NULL_OIF 0x0400 /* null oif cache.. ??? */
|
||||
#define MRTF_REG_SUPP 0x0800 /* register suppress ??? */
|
||||
#define MRTF_ASSERTED 0x1000 /* upstream is not that of src ??? */
|
||||
#define MRTF_SG 0x2000 /* (S,G) pure, not hanging off of (*,G)*/
|
||||
#define MRTF_PMBR 0x4000 /* (*,*,RP) entry (for interop) */
|
||||
#define MRTF_SPT 0x0001 /* iif toward source */
|
||||
#define MRTF_WC 0x0002 /* (*,G) entry */
|
||||
#define MRTF_RP 0x0004 /* iif toward RP */
|
||||
#define MRTF_NEW 0x0008 /* new created routing entry */
|
||||
#define MRTF_IIF_REGISTER 0x0020 /* ??? */
|
||||
#define MRTF_REGISTER 0x0080 /* ??? */
|
||||
#define MRTF_KERNEL_CACHE 0x0200 /* a mirror for the kernel cache */
|
||||
#define MRTF_NULL_OIF 0x0400 /* null oif cache.. ??? */
|
||||
#define MRTF_REG_SUPP 0x0800 /* register suppress ??? */
|
||||
#define MRTF_ASSERTED 0x1000 /* upstream is not that of src ??? */
|
||||
#define MRTF_SG 0x2000 /* (S,G) pure, not hanging off of (*,G)*/
|
||||
#define MRTF_PMBR 0x4000 /* (*,*,RP) entry (for interop) */
|
||||
|
||||
/* Macro to duplicate oif info (oif bits, timers): XXX: unused */
|
||||
#define VOIF_COPY(from, to) \
|
||||
#define VOIF_COPY(from, to) \
|
||||
do { \
|
||||
VIFM_COPY((from)->joined_oifs, (to)->joined_oifs); \
|
||||
VIFM_COPY((from)->oifs, (to)->oifs); \
|
||||
@ -81,7 +81,7 @@
|
||||
} while (0)
|
||||
|
||||
#ifdef SAVE_MEMORY
|
||||
#define FREE_MRTENTRY(mrtentry_ptr) \
|
||||
#define FREE_MRTENTRY(mrtentry_ptr) \
|
||||
do { \
|
||||
u_int16 i; \
|
||||
u_long *il_ptr; \
|
||||
@ -95,7 +95,7 @@
|
||||
free((char *)(mrtentry_ptr)); \
|
||||
} while (0)
|
||||
#else
|
||||
#define FREE_MRTENTRY(mrtentry_ptr) \
|
||||
#define FREE_MRTENTRY(mrtentry_ptr) \
|
||||
do { \
|
||||
u_int16 i; \
|
||||
u_long *il_ptr; \
|
||||
@ -201,12 +201,12 @@ struct mrtentry {
|
||||
struct vif_count {
|
||||
u_long icount; /* Input packet count on vif */
|
||||
u_long ocount; /* Output packet count on vif */
|
||||
u_long ibytes; /* Input byte count on vif */
|
||||
u_long obytes; /* Output byte count on vif */
|
||||
u_long ibytes; /* Input byte count on vif */
|
||||
u_long obytes; /* Output byte count on vif */
|
||||
};
|
||||
|
||||
#define FILTER_RANGE 0
|
||||
#define FILTER_PREFIX 1
|
||||
#define FILTER_RANGE 0
|
||||
#define FILTER_PREFIX 1
|
||||
struct mrtfilter {
|
||||
struct mrtfilter *next; /* link to the next entry */
|
||||
int type; /* filter type: RANGE or PREFIX */
|
||||
@ -222,7 +222,7 @@ struct mrtfilter {
|
||||
} mrtu;
|
||||
if_set ifset; /* interface list */
|
||||
};
|
||||
#define mrtf_from mrtu.mrtfu_range.from
|
||||
#define mrtf_to mrtu.mrtfu_range.to
|
||||
#define mrtf_prefix mrtu.mrtfu_prefix.prefix
|
||||
#define mrtf_mask mrtu.mrtfu_prefix.mask
|
||||
#define mrtf_from mrtu.mrtfu_range.from
|
||||
#define mrtf_to mrtu.mrtfu_range.to
|
||||
#define mrtf_prefix mrtu.mrtfu_prefix.prefix
|
||||
#define mrtf_mask mrtu.mrtfu_prefix.mask
|
||||
|
@ -19,7 +19,7 @@
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL USC, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -31,7 +31,7 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
|
||||
*
|
||||
* $Id: pathnames.h,v 1.2 1999/12/16 05:36:37 jinmei Exp $
|
||||
@ -48,16 +48,16 @@
|
||||
*/
|
||||
|
||||
|
||||
#define _PATH_PIM6D_CONF "/etc/pim6dd.conf"
|
||||
#define _PATH_PIM6D_CONF "/etc/pim6dd.conf"
|
||||
|
||||
#if (defined(BSD) && (BSD >= 199103))
|
||||
#define _PATH_PIM6D_PID "/var/run/pim6dd.pid"
|
||||
#define _PATH_PIM6D_GENID "/var/run/pim6dd.genid"
|
||||
#define _PATH_PIM6D_DUMP "/var/run/pim6dd.dump"
|
||||
#define _PATH_PIM6D_CACHE "/var/run/pim6dd.cache"
|
||||
#define _PATH_PIM6D_PID "/var/run/pim6dd.pid"
|
||||
#define _PATH_PIM6D_GENID "/var/run/pim6dd.genid"
|
||||
#define _PATH_PIM6D_DUMP "/var/run/pim6dd.dump"
|
||||
#define _PATH_PIM6D_CACHE "/var/run/pim6dd.cache"
|
||||
#else
|
||||
#define _PATH_PIM6D_PID "/etc/pim6dd.pid"
|
||||
#define _PATH_PIM6D_GENID "/etc/pim6dd.genid"
|
||||
#define _PATH_PIM6D_DUMP "/etc/pim6dd.dump"
|
||||
#define _PATH_PIM6D_CACHE "/etc/pim6dd.cache"
|
||||
#define _PATH_PIM6D_PID "/etc/pim6dd.pid"
|
||||
#define _PATH_PIM6D_GENID "/etc/pim6dd.genid"
|
||||
#define _PATH_PIM6D_DUMP "/etc/pim6dd.dump"
|
||||
#define _PATH_PIM6D_CACHE "/etc/pim6dd.cache"
|
||||
#endif
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 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:
|
||||
@ -13,7 +13,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
|
||||
@ -47,7 +47,7 @@
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL USC, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -59,10 +59,10 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
|
||||
*
|
||||
* $Id: pim6.c,v 1.3 1999/10/26 08:39:19 itojun Exp $
|
||||
* $Id: pim6.c,v 1.6 2000/03/07 02:23:50 jinmei Exp $
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
@ -79,12 +79,13 @@ struct sockaddr_in6 allpim6routers_group; /* ALL_PIM_ROUTERS group */
|
||||
int pim6_socket; /* socket for PIM control msgs */
|
||||
|
||||
/*
|
||||
* Local variables.
|
||||
* Local variables.
|
||||
*/
|
||||
static struct sockaddr_in6 from;
|
||||
static struct msghdr sndmh;
|
||||
static struct iovec sndiov[2];
|
||||
static struct in6_pktinfo *sndpktinfo;
|
||||
static u_char *sndcmsgbuf = NULL;
|
||||
|
||||
/*
|
||||
* Local function definitions.
|
||||
@ -92,15 +93,16 @@ static struct in6_pktinfo *sndpktinfo;
|
||||
static void pim6_read __P((int f, fd_set *rfd));
|
||||
static void accept_pim6 __P((int recvlen));
|
||||
static int pim6_cksum __P((u_short *, struct in6_addr *,
|
||||
struct in6_addr *, int));
|
||||
struct in6_addr *, int));
|
||||
|
||||
void
|
||||
init_pim6()
|
||||
{
|
||||
static u_char sndcmsgbuf[CMSG_SPACE(sizeof(struct in6_pktinfo))];
|
||||
static int sndcmsglen;
|
||||
struct cmsghdr *cmsgp = (struct cmsghdr *)sndcmsgbuf;
|
||||
|
||||
if ((pim6_socket = socket(AF_INET6, SOCK_RAW, IPPROTO_PIM)) < 0)
|
||||
sndcmsglen = CMSG_SPACE(sizeof(struct in6_pktinfo));
|
||||
if ((pim6_socket = socket(AF_INET6, SOCK_RAW, IPPROTO_PIM)) < 0)
|
||||
log(LOG_ERR, errno, "PIM6 socket");
|
||||
|
||||
k_set_rcvbuf(pim6_socket, SO_RECV_BUF_SIZE_MAX,
|
||||
@ -113,7 +115,7 @@ init_pim6()
|
||||
if (inet_pton(AF_INET6, "ff02::d",
|
||||
(void *)&allpim6routers_group.sin6_addr) != 1)
|
||||
log(LOG_ERR, 0, "inet_pton failed for ff02::d");
|
||||
|
||||
|
||||
if ((pim6_recv_buf = malloc(RECV_BUF_SIZE)) == NULL ||
|
||||
(pim6_send_buf = malloc(RECV_BUF_SIZE)) == NULL) {
|
||||
log(LOG_ERR, 0, "init_pim6: malloc failed\n");
|
||||
@ -123,13 +125,16 @@ init_pim6()
|
||||
sndmh.msg_namelen = sizeof(struct sockaddr_in6);
|
||||
sndmh.msg_iov = sndiov;
|
||||
sndmh.msg_iovlen = 1;
|
||||
if (sndcmsgbuf == NULL && (sndcmsgbuf = malloc(sndcmsglen)) == NULL)
|
||||
log(LOG_ERR, 0, "malloc failed");
|
||||
sndmh.msg_control = (caddr_t)sndcmsgbuf;
|
||||
sndmh.msg_controllen = sizeof(sndcmsgbuf);
|
||||
sndmh.msg_controllen = sndcmsglen;
|
||||
/* initilization cmsg for specifing outgoing interfaces and source */
|
||||
sndpktinfo = (struct in6_pktinfo *)CMSG_DATA(cmsgp);
|
||||
cmsgp=(struct cmsghdr *)sndcmsgbuf;
|
||||
cmsgp->cmsg_len = CMSG_SPACE(sizeof(struct in6_pktinfo));
|
||||
cmsgp->cmsg_level = IPPROTO_IPV6;
|
||||
cmsgp->cmsg_type = IPV6_PKTINFO;
|
||||
sndpktinfo = (struct in6_pktinfo *)CMSG_DATA(cmsgp);
|
||||
|
||||
if (register_input_handler(pim6_socket, pim6_read) < 0)
|
||||
log(LOG_ERR, 0,
|
||||
@ -170,9 +175,9 @@ pim6_read(f, rfd)
|
||||
/* Use of omask taken from main() */
|
||||
omask = sigblock(sigmask(SIGALRM));
|
||||
#endif /* SYSV */
|
||||
|
||||
|
||||
accept_pim6(pim6_recvlen);
|
||||
|
||||
|
||||
#ifdef SYSV
|
||||
(void)sigprocmask(SIG_SETMASK, &oblock, (sigset_t *)NULL);
|
||||
#else
|
||||
@ -191,7 +196,7 @@ accept_pim6(pimlen)
|
||||
/* sanity check */
|
||||
if (pimlen < sizeof(pim)) {
|
||||
log(LOG_WARNING, 0,
|
||||
"data field too short (%u bytes) for PIM header, from %s",
|
||||
"data field too short (%u bytes) for PIM header, from %s",
|
||||
pimlen, inet6_fmt(&src->sin6_addr));
|
||||
return;
|
||||
}
|
||||
@ -201,7 +206,7 @@ accept_pim6(pimlen)
|
||||
IF_DEBUG(DEBUG_PIM_DETAIL) {
|
||||
IF_DEBUG(DEBUG_PIM) {
|
||||
log(LOG_DEBUG, 0, "Receiving %s from %s",
|
||||
packet_kind(IPPROTO_PIM, pim->pim_type, 0),
|
||||
packet_kind(IPPROTO_PIM, pim->pim_type, 0),
|
||||
inet6_fmt(&src->sin6_addr));
|
||||
log(LOG_DEBUG, 0, "PIM type is %u", pim->pim_type);
|
||||
}
|
||||
@ -218,7 +223,7 @@ accept_pim6(pimlen)
|
||||
|
||||
switch (pim->pim_type) {
|
||||
case PIM_HELLO:
|
||||
receive_pim6_hello(src, (char *)(pim), pimlen);
|
||||
receive_pim6_hello(src, (char *)(pim), pimlen);
|
||||
break;
|
||||
case PIM_REGISTER:
|
||||
log(LOG_INFO, 0, "ignore %s from %s",
|
||||
@ -231,7 +236,7 @@ accept_pim6(pimlen)
|
||||
inet6_fmt(&src->sin6_addr));
|
||||
break;
|
||||
case PIM_JOIN_PRUNE:
|
||||
receive_pim6_join_prune(src, (char *)(pim), pimlen);
|
||||
receive_pim6_join_prune(src, (char *)(pim), pimlen);
|
||||
break;
|
||||
case PIM_BOOTSTRAP:
|
||||
log(LOG_INFO, 0, "ignore %s from %s",
|
||||
@ -239,7 +244,7 @@ accept_pim6(pimlen)
|
||||
inet6_fmt(&src->sin6_addr));
|
||||
break;
|
||||
case PIM_ASSERT:
|
||||
receive_pim6_assert(src, (char *)(pim), pimlen);
|
||||
receive_pim6_assert(src, (char *)(pim), pimlen);
|
||||
break;
|
||||
case PIM_GRAFT:
|
||||
case PIM_GRAFT_ACK:
|
||||
@ -264,7 +269,7 @@ accept_pim6(pimlen)
|
||||
* Send a multicast PIM packet from src to dst, PIM message type = "type"
|
||||
* and data length (after the PIM header) = "datalen"
|
||||
*/
|
||||
void
|
||||
void
|
||||
send_pim6(buf, src, dst, type, datalen)
|
||||
char *buf;
|
||||
struct sockaddr_in6 *src, *dst;
|
||||
@ -312,7 +317,7 @@ send_pim6(buf, src, dst, type, datalen)
|
||||
IN6_ARE_ADDR_EQUAL(&dst->sin6_addr,
|
||||
&allpim6routers_group.sin6_addr)) {
|
||||
setloop = 1;
|
||||
k_set_loop(pim6_socket, TRUE);
|
||||
k_set_loop(pim6_socket, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
@ -327,12 +332,12 @@ send_pim6(buf, src, dst, type, datalen)
|
||||
inet6_fmt(&src->sin6_addr),
|
||||
inet6_fmt(&dst->sin6_addr));
|
||||
if (setloop)
|
||||
k_set_loop(pim6_socket, FALSE);
|
||||
k_set_loop(pim6_socket, FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
if (setloop)
|
||||
k_set_loop(pim6_socket, FALSE);
|
||||
k_set_loop(pim6_socket, FALSE);
|
||||
|
||||
IF_DEBUG(DEBUG_PIM_DETAIL) {
|
||||
IF_DEBUG(DEBUG_PIM) {
|
||||
@ -348,7 +353,7 @@ send_pim6(buf, src, dst, type, datalen)
|
||||
}
|
||||
|
||||
u_int pim_send_cnt = 0;
|
||||
#define SEND_DEBUG_NUMBER 50
|
||||
#define SEND_DEBUG_NUMBER 50
|
||||
|
||||
/* ============================== */
|
||||
|
||||
@ -359,8 +364,8 @@ u_int pim_send_cnt = 0;
|
||||
* code and should be modified for each CPU to be as fast as possible.
|
||||
*/
|
||||
|
||||
#define ADDCARRY(x) (x > 65535 ? x -= 65535 : x)
|
||||
#define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; ADDCARRY(sum);}
|
||||
#define ADDCARRY(x) (x > 65535 ? x -= 65535 : x)
|
||||
#define REDUCE {l_util.l = sum; sum = l_util.s[0] + l_util.s[1]; ADDCARRY(sum);}
|
||||
|
||||
static union {
|
||||
u_short phs[4];
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 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:
|
||||
@ -13,7 +13,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
|
||||
@ -38,15 +38,15 @@
|
||||
* documentation, and that any documentation, advertising materials,
|
||||
* and other materials related to such distribution and use acknowledge
|
||||
* that the software was developed by the University of Oregon.
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THE UNIVERSITY OF OREGON DOES NOT MAKE ANY REPRESENTATIONS
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL UO, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -58,22 +58,22 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Kurt Windisch (kurtw@antc.uoregon.edu)
|
||||
*
|
||||
* $Id: pim6_proto.c,v 1.4 1999/10/27 11:40:30 jinmei Exp $
|
||||
* $Id: pim6_proto.c,v 1.5 2000/04/30 10:50:31 jinmei Exp $
|
||||
*/
|
||||
/*
|
||||
* Part of this program has been derived from PIM sparse-mode pimd.
|
||||
* The pimd program is covered by the license in the accompanying file
|
||||
* named "LICENSE.pimd".
|
||||
*
|
||||
*
|
||||
* The pimd program is COPYRIGHT 1998 by University of Southern California.
|
||||
*
|
||||
* Part of this program has been derived from mrouted.
|
||||
* The mrouted program is covered by the license in the accompanying file
|
||||
* named "LICENSE.mrouted".
|
||||
*
|
||||
*
|
||||
* The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
|
||||
* Leland Stanford Junior University.
|
||||
*
|
||||
@ -145,7 +145,7 @@ receive_pim6_hello(src, pim_message, datalen)
|
||||
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);
|
||||
|
||||
|
||||
for (prev_nbr = (pim_nbr_entry_t *)NULL, nbr = v->uv_pim_neighbors;
|
||||
nbr != (pim_nbr_entry_t *)NULL;
|
||||
prev_nbr = nbr, nbr = nbr->next) {
|
||||
@ -210,7 +210,6 @@ receive_pim6_hello(src, pim_message, datalen)
|
||||
* DR address and it wins (is >) over the local address.
|
||||
*/
|
||||
v->uv_flags &= ~VIFF_DR;
|
||||
v->uv_flags &= ~VIFF_QUERIER;
|
||||
}
|
||||
|
||||
/*
|
||||
@ -236,7 +235,7 @@ receive_pim6_hello(src, pim_message, datalen)
|
||||
mrtentry_ptr = mrtentry_ptr->srcnext) {
|
||||
|
||||
if(!(IF_ISSET(mifi, &mrtentry_ptr->oifs))) {
|
||||
state_change =
|
||||
state_change =
|
||||
change_interfaces(mrtentry_ptr,
|
||||
srcentry_ptr->incoming,
|
||||
&mrtentry_ptr->pruned_oifs,
|
||||
@ -247,7 +246,7 @@ receive_pim6_hello(src, pim_message, datalen)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IF_DEBUG(DEBUG_PIM_HELLO)
|
||||
dump_vifs(stderr); /* Show we got a new neighbor */
|
||||
return(TRUE);
|
||||
@ -264,7 +263,7 @@ delete_pim6_nbr(nbr_delete)
|
||||
int state_change;
|
||||
|
||||
v = &uvifs[nbr_delete->vifi];
|
||||
|
||||
|
||||
/* Delete the entry from the pim_nbrs chain */
|
||||
if (nbr_delete->prev != (pim_nbr_entry_t *)NULL)
|
||||
nbr_delete->prev->next = nbr_delete->next;
|
||||
@ -272,7 +271,7 @@ delete_pim6_nbr(nbr_delete)
|
||||
v->uv_pim_neighbors = nbr_delete->next;
|
||||
if (nbr_delete->next != (pim_nbr_entry_t *)NULL)
|
||||
nbr_delete->next->prev = nbr_delete->prev;
|
||||
|
||||
|
||||
if (v->uv_pim_neighbors == (pim_nbr_entry_t *)NULL) {
|
||||
/* This was our last neighbor. */
|
||||
v->uv_flags &= ~VIFF_PIM_NBR;
|
||||
@ -286,7 +285,6 @@ delete_pim6_nbr(nbr_delete)
|
||||
* DR address, but the local address is the winner.
|
||||
*/
|
||||
v->uv_flags |= VIFF_DR;
|
||||
v->uv_flags |= VIFF_QUERIER;
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,16 +297,16 @@ delete_pim6_nbr(nbr_delete)
|
||||
for (srcentry_ptr = srclist; srcentry_ptr != (srcentry_t *)NULL;
|
||||
srcentry_ptr = srcentry_ptr_next) {
|
||||
srcentry_ptr_next = srcentry_ptr->next;
|
||||
|
||||
|
||||
/* The only time we don't need to scan all mrtentries is
|
||||
* when the nbr was on the iif, but not the upstream nbr!
|
||||
* when the nbr was on the iif, but not the upstream nbr!
|
||||
*/
|
||||
if (nbr_delete->vifi == srcentry_ptr->incoming &&
|
||||
srcentry_ptr->upstream != nbr_delete)
|
||||
continue;
|
||||
|
||||
/* Reset the next hop (PIM) router */
|
||||
if(srcentry_ptr->upstream == nbr_delete)
|
||||
if(srcentry_ptr->upstream == nbr_delete)
|
||||
if (set_incoming(srcentry_ptr, PIM_IIF_SOURCE) == FALSE) {
|
||||
/*
|
||||
* Couldn't reset it. Sorry, the next hop router
|
||||
@ -329,7 +327,7 @@ delete_pim6_nbr(nbr_delete)
|
||||
mrtentry_ptr->upstream = srcentry_ptr->upstream;
|
||||
mrtentry_ptr->metric = srcentry_ptr->metric;
|
||||
mrtentry_ptr->preference = srcentry_ptr->preference;
|
||||
state_change =
|
||||
state_change =
|
||||
change_interfaces(mrtentry_ptr,
|
||||
srcentry_ptr->incoming,
|
||||
&mrtentry_ptr->pruned_oifs,
|
||||
@ -342,7 +340,7 @@ delete_pim6_nbr(nbr_delete)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
free((char *)nbr_delete);
|
||||
}
|
||||
|
||||
@ -447,8 +445,8 @@ typedef struct {
|
||||
struct sockaddr_in6 group;
|
||||
u_int16 holdtime;
|
||||
} prune_delay_cbk_t;
|
||||
|
||||
static void
|
||||
|
||||
static void
|
||||
delayed_join_job(arg)
|
||||
void *arg;
|
||||
{
|
||||
@ -458,7 +456,7 @@ delayed_join_job(arg)
|
||||
|
||||
mrtentry_ptr = find_route(&cbk->source, &cbk->group,
|
||||
MRTF_SG, DONT_CREATE);
|
||||
if(mrtentry_ptr == (mrtentry_t *)NULL)
|
||||
if(mrtentry_ptr == (mrtentry_t *)NULL)
|
||||
return;
|
||||
|
||||
if(mrtentry_ptr->join_delay_timerid)
|
||||
@ -472,16 +470,16 @@ delayed_join_job(arg)
|
||||
free(cbk);
|
||||
}
|
||||
|
||||
static void
|
||||
schedule_delayed_join(mrtentry_ptr, target)
|
||||
static void
|
||||
schedule_delayed_join(mrtentry_ptr, target)
|
||||
mrtentry_t *mrtentry_ptr;
|
||||
struct sockaddr_in6 *target;
|
||||
{
|
||||
u_long random_delay;
|
||||
join_delay_cbk_t *cbk;
|
||||
|
||||
|
||||
/* Delete existing timer */
|
||||
if(mrtentry_ptr->join_delay_timerid)
|
||||
if(mrtentry_ptr->join_delay_timerid)
|
||||
timer_clearTimer(mrtentry_ptr->join_delay_timerid);
|
||||
|
||||
#ifdef SYSV
|
||||
@ -489,7 +487,7 @@ schedule_delayed_join(mrtentry_ptr, target)
|
||||
#else
|
||||
random_delay = random() % (long)PIM_RANDOM_DELAY_JOIN_TIMEOUT;
|
||||
#endif
|
||||
|
||||
|
||||
IF_DEBUG(DEBUG_PIM_JOIN_PRUNE)
|
||||
log(LOG_DEBUG, 0, "Scheduling join for src %s, grp %s, delay %d",
|
||||
inet6_fmt(&mrtentry_ptr->source->address.sin6_addr),
|
||||
@ -508,12 +506,12 @@ schedule_delayed_join(mrtentry_ptr, target)
|
||||
cbk->group = mrtentry_ptr->group->group;
|
||||
cbk->target = *target;
|
||||
|
||||
mrtentry_ptr->join_delay_timerid =
|
||||
mrtentry_ptr->join_delay_timerid =
|
||||
timer_setTimer(random_delay, delayed_join_job, cbk);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
static void
|
||||
delayed_prune_job(arg)
|
||||
void *arg;
|
||||
{
|
||||
@ -525,9 +523,9 @@ delayed_prune_job(arg)
|
||||
|
||||
mrtentry_ptr = find_route(&cbk->source, &cbk->group,
|
||||
MRTF_SG, DONT_CREATE);
|
||||
if(mrtentry_ptr == (mrtentry_t *)NULL)
|
||||
if(mrtentry_ptr == (mrtentry_t *)NULL)
|
||||
return;
|
||||
|
||||
|
||||
if(mrtentry_ptr->prune_delay_timerids[cbk->mifi])
|
||||
timer_clearTimer(mrtentry_ptr->prune_delay_timerids[cbk->mifi]);
|
||||
|
||||
@ -535,7 +533,7 @@ delayed_prune_job(arg)
|
||||
IF_DEBUG(DEBUG_PIM_JOIN_PRUNE)
|
||||
log(LOG_DEBUG, 0,
|
||||
"Deleting pruned mif %d for src %s, grp %s",
|
||||
cbk->mifi,
|
||||
cbk->mifi,
|
||||
inet6_fmt(&cbk->source.sin6_addr),
|
||||
inet6_fmt(&cbk->group.sin6_addr));
|
||||
|
||||
@ -543,7 +541,7 @@ delayed_prune_job(arg)
|
||||
IF_SET(cbk->mifi, &new_pruned_oifs);
|
||||
SET_TIMER(mrtentry_ptr->prune_timers[cbk->mifi], cbk->holdtime);
|
||||
|
||||
state_change =
|
||||
state_change =
|
||||
change_interfaces(mrtentry_ptr,
|
||||
mrtentry_ptr->incoming,
|
||||
&new_pruned_oifs,
|
||||
@ -558,16 +556,16 @@ delayed_prune_job(arg)
|
||||
free(cbk);
|
||||
}
|
||||
|
||||
static void
|
||||
schedule_delayed_prune(mrtentry_ptr, mifi, holdtime)
|
||||
static void
|
||||
schedule_delayed_prune(mrtentry_ptr, mifi, holdtime)
|
||||
mrtentry_t *mrtentry_ptr;
|
||||
mifi_t mifi;
|
||||
u_int16 holdtime;
|
||||
{
|
||||
prune_delay_cbk_t *cbk;
|
||||
|
||||
|
||||
/* Delete existing timer */
|
||||
if(mrtentry_ptr->prune_delay_timerids[mifi])
|
||||
if(mrtentry_ptr->prune_delay_timerids[mifi])
|
||||
timer_clearTimer(mrtentry_ptr->prune_delay_timerids[mifi]);
|
||||
|
||||
cbk = (prune_delay_cbk_t *)malloc(sizeof(prune_delay_cbk_t));
|
||||
@ -576,8 +574,8 @@ schedule_delayed_prune(mrtentry_ptr, mifi, holdtime)
|
||||
cbk->group = mrtentry_ptr->group->group;
|
||||
cbk->holdtime = holdtime;
|
||||
|
||||
mrtentry_ptr->prune_delay_timerids[mifi] =
|
||||
timer_setTimer((u_int16)PIM_RANDOM_DELAY_JOIN_TIMEOUT,
|
||||
mrtentry_ptr->prune_delay_timerids[mifi] =
|
||||
timer_setTimer((u_int16)PIM_RANDOM_DELAY_JOIN_TIMEOUT,
|
||||
delayed_prune_job, cbk);
|
||||
}
|
||||
|
||||
@ -618,7 +616,7 @@ receive_pim6_join_prune(src, pim_message, datalen)
|
||||
inet6_fmt(&src->sin6_addr));
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
v = &uvifs[mifi];
|
||||
if (uvifs[mifi].uv_flags & (VIFF_DOWN | VIFF_DISABLED | VIFF_NONBRS))
|
||||
return(FALSE); /* Shoudn't come on this interface */
|
||||
@ -642,13 +640,13 @@ receive_pim6_join_prune(src, pim_message, datalen)
|
||||
inet6_fmt(&src->sin6_addr),
|
||||
inet6_fmt(&target.sin6_addr),
|
||||
holdtime);
|
||||
|
||||
|
||||
if (!inet6_localif_address(&target, v) &&
|
||||
!IN6_IS_ADDR_UNSPECIFIED(&uni_target_addr.unicast_addr)) {
|
||||
/* if I am not the target of the join or prune message */
|
||||
/*
|
||||
* Join Suppression: when receiving a join not addressed to me,
|
||||
* if I am delaying a join for this (S,G) then cancel the delayed
|
||||
* if I am delaying a join for this (S,G) then cancel the delayed
|
||||
* join.
|
||||
* Prune Soliticiting Joins: when receiving a prune not
|
||||
* addressed to me on a LAN, schedule delayed join if I have
|
||||
@ -726,9 +724,9 @@ receive_pim6_join_prune(src, pim_message, datalen)
|
||||
|
||||
s_flags = encod_src.flags;
|
||||
|
||||
/* if P2P link (not addressed to me) ignore
|
||||
/* if P2P link (not addressed to me) ignore
|
||||
*/
|
||||
if(uvifs[mifi].uv_flags & VIFF_POINT_TO_POINT)
|
||||
if(uvifs[mifi].uv_flags & VIFF_POINT_TO_POINT)
|
||||
continue;
|
||||
|
||||
/*
|
||||
@ -736,7 +734,7 @@ receive_pim6_join_prune(src, pim_message, datalen)
|
||||
*/
|
||||
mrtentry_ptr = find_route(&source, &group,
|
||||
MRTF_SG, DONT_CREATE);
|
||||
if(mrtentry_ptr == (mrtentry_t *)NULL)
|
||||
if(mrtentry_ptr == (mrtentry_t *)NULL)
|
||||
continue;
|
||||
|
||||
if(!(IF_ISEMPTY(&mrtentry_ptr->oifs))) {
|
||||
@ -746,7 +744,7 @@ receive_pim6_join_prune(src, pim_message, datalen)
|
||||
"- scheduling delayed join",
|
||||
inet6_fmt(&source.sin6_addr),
|
||||
inet6_fmt(&group.sin6_addr));
|
||||
|
||||
|
||||
schedule_delayed_join(mrtentry_ptr,
|
||||
&target);
|
||||
}
|
||||
@ -759,7 +757,7 @@ receive_pim6_join_prune(src, pim_message, datalen)
|
||||
|
||||
/* I am the target of this join/prune:
|
||||
* For joins, cancel delayed prunes that I have scheduled.
|
||||
* For prunes, echo the prune and schedule delayed prunes on LAN or
|
||||
* For prunes, echo the prune and schedule delayed prunes on LAN or
|
||||
* prune immediately on point-to-point links.
|
||||
*/
|
||||
else {
|
||||
@ -797,10 +795,10 @@ receive_pim6_join_prune(src, pim_message, datalen)
|
||||
|
||||
s_flags = encod_src.flags;
|
||||
MASKLEN_TO_MASK6(encod_src.masklen, s_mask);
|
||||
|
||||
|
||||
mrtentry_ptr = find_route(&source, &group,
|
||||
MRTF_SG, DONT_CREATE);
|
||||
if(mrtentry_ptr == (mrtentry_t *)NULL)
|
||||
if(mrtentry_ptr == (mrtentry_t *)NULL)
|
||||
continue;
|
||||
|
||||
IF_DEBUG(DEBUG_PIM_JOIN_PRUNE)
|
||||
@ -814,7 +812,7 @@ receive_pim6_join_prune(src, pim_message, datalen)
|
||||
if(mrtentry_ptr->prune_delay_timerids[mifi]) {
|
||||
timer_clearTimer(mrtentry_ptr->prune_delay_timerids[mifi]);
|
||||
mrtentry_ptr->prune_delay_timerids[mifi] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
while (num_p_srcs--) {
|
||||
@ -829,7 +827,7 @@ receive_pim6_join_prune(src, pim_message, datalen)
|
||||
|
||||
mrtentry_ptr = find_route(&source, &group,
|
||||
MRTF_SG, DONT_CREATE);
|
||||
if(mrtentry_ptr == (mrtentry_t *)NULL)
|
||||
if(mrtentry_ptr == (mrtentry_t *)NULL)
|
||||
continue;
|
||||
|
||||
/* if P2P link (addressed to me) prune immediately
|
||||
@ -844,10 +842,10 @@ receive_pim6_join_prune(src, pim_message, datalen)
|
||||
"mif",
|
||||
inet6_fmt(&source.sin6_addr),
|
||||
inet6_fmt(&group.sin6_addr));
|
||||
|
||||
|
||||
IF_DEBUG(DEBUG_MRT)
|
||||
log(LOG_DEBUG, 0, "Deleting pruned mif %d for src %s, grp %s",
|
||||
mifi,
|
||||
mifi,
|
||||
inet6_fmt(&source.sin6_addr),
|
||||
inet6_fmt(&group.sin6_addr));
|
||||
|
||||
@ -855,13 +853,13 @@ receive_pim6_join_prune(src, pim_message, datalen)
|
||||
IF_SET(mifi, &new_pruned_oifs);
|
||||
SET_TIMER(mrtentry_ptr->prune_timers[mifi], holdtime);
|
||||
|
||||
state_change =
|
||||
state_change =
|
||||
change_interfaces(mrtentry_ptr,
|
||||
mrtentry_ptr->incoming,
|
||||
&new_pruned_oifs,
|
||||
&mrtentry_ptr->leaves,
|
||||
&mrtentry_ptr->asserted_oifs);
|
||||
|
||||
|
||||
/* Handle transition to negative cache */
|
||||
if(state_change == -1)
|
||||
trigger_prune_alert(mrtentry_ptr);
|
||||
@ -903,7 +901,7 @@ send_pim6_jp(mrtentry_ptr, action, mifi, target_addr, holdtime, echo)
|
||||
int echo;
|
||||
{
|
||||
u_int8 *data_ptr, *data_start_ptr;
|
||||
|
||||
|
||||
data_ptr = (u_int8 *)(pim6_send_buf + sizeof(struct pim));
|
||||
data_start_ptr = data_ptr;
|
||||
|
||||
@ -911,7 +909,7 @@ send_pim6_jp(mrtentry_ptr, action, mifi, target_addr, holdtime, echo)
|
||||
/* No upstream neighbor - don't send */
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
IF_DEBUG(DEBUG_PIM_JOIN_PRUNE)
|
||||
log(LOG_DEBUG, 0,
|
||||
"Sending %s: vif %s, src %s, group %s, "
|
||||
@ -938,19 +936,19 @@ send_pim6_jp(mrtentry_ptr, action, mifi, target_addr, holdtime, echo)
|
||||
} else if(action == PIM_ACTION_PRUNE) {
|
||||
PUT_HOSTSHORT(0, data_ptr);
|
||||
PUT_HOSTSHORT(1, data_ptr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
PUT_ESADDR6(mrtentry_ptr->source->address.sin6_addr, SINGLE_SRC_MSK6LEN,
|
||||
0, data_ptr);
|
||||
|
||||
/* Cancel active graft */
|
||||
if (echo == 0)
|
||||
delete_pim6_graft_entry(mrtentry_ptr);
|
||||
|
||||
|
||||
send_pim6(pim6_send_buf, &uvifs[mifi].uv_linklocal->pa_addr,
|
||||
&allpim6routers_group, PIM_JOIN_PRUNE,
|
||||
data_ptr - data_start_ptr);
|
||||
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
@ -988,7 +986,7 @@ receive_pim6_assert(src, pim_message, datalen)
|
||||
u_int8 local_wins;
|
||||
if_set new_pruned_oifs, new_leaves;
|
||||
int state_change;
|
||||
|
||||
|
||||
if ((mifi = find_vif_direct(src)) == NO_VIF) {
|
||||
/* Either a local vif or somehow received PIM_ASSERT from
|
||||
* non-directly connected router. Ignore it.
|
||||
@ -999,7 +997,7 @@ receive_pim6_assert(src, pim_message, datalen)
|
||||
inet6_fmt(&src->sin6_addr));
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
v = &uvifs[mifi];
|
||||
if (uvifs[mifi].uv_flags & (VIFF_DOWN | VIFF_DISABLED | VIFF_NONBRS))
|
||||
return(FALSE); /* Shoudn't come on this interface */
|
||||
@ -1008,7 +1006,7 @@ receive_pim6_assert(src, pim_message, datalen)
|
||||
/* Get the group and source addresses */
|
||||
GET_EGADDR6(&egaddr, data_ptr);
|
||||
GET_EUADDR6(&eusaddr, data_ptr);
|
||||
|
||||
|
||||
/* Get the metric related info */
|
||||
GET_HOSTLONG(assert_preference, data_ptr);
|
||||
GET_HOSTLONG(assert_metric, data_ptr);
|
||||
@ -1017,7 +1015,7 @@ receive_pim6_assert(src, pim_message, datalen)
|
||||
source.sin6_scope_id = inet6_uvif2scopeid(&source, v);
|
||||
group.sin6_addr = egaddr.mcast_addr;
|
||||
group.sin6_scope_id = inet6_uvif2scopeid(&group, v);
|
||||
|
||||
|
||||
IF_DEBUG(DEBUG_PIM_ASSERT)
|
||||
log(LOG_DEBUG, 0,
|
||||
"PIM Assert received from %s: src %s, grp %s, "
|
||||
@ -1026,7 +1024,7 @@ receive_pim6_assert(src, pim_message, datalen)
|
||||
inet6_fmt(&source.sin6_addr),
|
||||
inet6_fmt(&group.sin6_addr),
|
||||
assert_preference, assert_metric);
|
||||
|
||||
|
||||
if ((mrtentry_ptr = find_route(&source, &group, MRTF_SG, CREATE))
|
||||
== NULL) {
|
||||
IF_DEBUG(DEBUG_PIM_ASSERT)
|
||||
@ -1040,17 +1038,17 @@ receive_pim6_assert(src, pim_message, datalen)
|
||||
/* For some reason, it's possible for asserts to be processed
|
||||
* before the data alerts a cache miss. Therefore, when an
|
||||
* assert is received, create (S,G) state and continue, since
|
||||
* we know by the assert that there are upstream forwarders.
|
||||
* we know by the assert that there are upstream forwarders.
|
||||
*/
|
||||
IF_DEBUG(DEBUG_PIM_ASSERT)
|
||||
log(LOG_DEBUG, 0, "\tNo MRT entry - creating...");
|
||||
|
||||
mrtentry_ptr->flags &= ~MRTF_NEW;
|
||||
|
||||
/* Set oifs */
|
||||
/* Set oifs */
|
||||
set_leaves(mrtentry_ptr);
|
||||
calc_oifs(mrtentry_ptr, &(mrtentry_ptr->oifs));
|
||||
|
||||
|
||||
/* Add it to the kernel */
|
||||
k_chg_mfc(mld6_socket, &source, &group, mrtentry_ptr->incoming,
|
||||
&mrtentry_ptr->oifs);
|
||||
@ -1061,7 +1059,7 @@ receive_pim6_assert(src, pim_message, datalen)
|
||||
|
||||
/* No need to call change_interfaces, but check for NULL oiflist */
|
||||
if(IF_ISEMPTY(&mrtentry_ptr->oifs))
|
||||
trigger_prune_alert(mrtentry_ptr);
|
||||
trigger_prune_alert(mrtentry_ptr);
|
||||
}
|
||||
|
||||
/* If arrived on iif, I'm downstream of the asserted LAN.
|
||||
@ -1073,13 +1071,13 @@ receive_pim6_assert(src, pim_message, datalen)
|
||||
/* Determine local (really that of upstream nbr!) pref/metric */
|
||||
local_metric = mrtentry_ptr->metric;
|
||||
local_preference = mrtentry_ptr->preference;
|
||||
|
||||
|
||||
if(mrtentry_ptr->upstream &&
|
||||
inet6_equal(&mrtentry_ptr->upstream->address, src) &&
|
||||
assert_preference == local_preference &&
|
||||
assert_metric == local_metric)
|
||||
|
||||
/* if assert from previous winner w/ same pref/metric,
|
||||
/* if assert from previous winner w/ same pref/metric,
|
||||
* then assert sender wins again */
|
||||
local_wins = FALSE;
|
||||
|
||||
@ -1092,7 +1090,7 @@ receive_pim6_assert(src, pim_message, datalen)
|
||||
assert_metric, src);
|
||||
|
||||
/*
|
||||
* This is between the assert sender and previous winner or rpf
|
||||
* This is between the assert sender and previous winner or rpf
|
||||
* (who is the "local" in this case).
|
||||
*/
|
||||
if(local_wins == TRUE) {
|
||||
@ -1121,7 +1119,7 @@ receive_pim6_assert(src, pim_message, datalen)
|
||||
mrtentry_ptr->flags |= MRTF_ASSERTED;
|
||||
|
||||
/* Send a join for the S,G if oiflist is non-empty */
|
||||
if(!(IF_ISEMPTY(&mrtentry_ptr->oifs)))
|
||||
if(!(IF_ISEMPTY(&mrtentry_ptr->oifs)))
|
||||
send_pim6_jp(mrtentry_ptr, PIM_ACTION_JOIN,
|
||||
mrtentry_ptr->incoming, src, 0, 0);
|
||||
|
||||
@ -1129,7 +1127,7 @@ receive_pim6_assert(src, pim_message, datalen)
|
||||
|
||||
/* If the assert arrived on an oif: */
|
||||
else {
|
||||
if(!(IF_ISSET(mifi, &mrtentry_ptr->oifs)))
|
||||
if(!(IF_ISSET(mifi, &mrtentry_ptr->oifs)))
|
||||
return(FALSE);
|
||||
/* assert arrived on oif ==> I'm a upstream router */
|
||||
|
||||
@ -1154,7 +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],
|
||||
SET_TIMER(mrtentry_ptr->prune_timers[mifi],
|
||||
PIM_JOIN_PRUNE_HOLDTIME);
|
||||
|
||||
if (IF_ISSET(mifi, &mrtentry_ptr->leaves)) {
|
||||
@ -1191,7 +1189,7 @@ receive_pim6_assert(src, pim_message, datalen)
|
||||
IF_DEBUG(DEBUG_PIM_ASSERT)
|
||||
log(LOG_DEBUG, 0,
|
||||
"\tAssert sender %s loses - "
|
||||
"sending assert and scheuling prune",
|
||||
"sending assert and scheuling prune",
|
||||
inet6_fmt(&src->sin6_addr));
|
||||
|
||||
if(!(IF_ISSET(mifi, &mrtentry_ptr->leaves))) {
|
||||
@ -1201,19 +1199,19 @@ receive_pim6_assert(src, pim_message, datalen)
|
||||
send_pim6_jp(mrtentry_ptr, PIM_ACTION_PRUNE,
|
||||
mifi, &v->uv_linklocal->pa_addr,
|
||||
PIM_JOIN_PRUNE_HOLDTIME, 0);
|
||||
schedule_delayed_prune(mrtentry_ptr, mifi,
|
||||
schedule_delayed_prune(mrtentry_ptr, mifi,
|
||||
PIM_JOIN_PRUNE_HOLDTIME);
|
||||
}
|
||||
send_pim6_assert(&source, &group, mifi, mrtentry_ptr);
|
||||
}
|
||||
|
||||
} /* if assert on oif */
|
||||
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
|
||||
int
|
||||
int
|
||||
send_pim6_assert(source, group, mifi, mrtentry_ptr)
|
||||
struct sockaddr_in6 *source;
|
||||
struct sockaddr_in6 *group;
|
||||
@ -1305,10 +1303,10 @@ delete_pim6_graft_entry(mrtentry_ptr)
|
||||
if(mrtentry_ptr->graft == (pim_graft_entry_t *)NULL)
|
||||
return;
|
||||
graft_entry = mrtentry_ptr->graft;
|
||||
|
||||
|
||||
if(graft_entry->prev)
|
||||
graft_entry->prev->next = graft_entry->next;
|
||||
else
|
||||
else
|
||||
graft_list = graft_entry->next;
|
||||
if(graft_entry->next)
|
||||
graft_entry->next->prev = graft_entry->prev;
|
||||
@ -1328,7 +1326,7 @@ retransmit_pim6_graft(mrtentry_ptr)
|
||||
mrtentry_t *mrtentry_ptr;
|
||||
{
|
||||
u_int8 *data_ptr, *data_start_ptr;
|
||||
|
||||
|
||||
data_ptr = (u_int8 *)(pim6_send_buf + sizeof(struct pim));
|
||||
data_start_ptr = data_ptr;
|
||||
|
||||
@ -1380,10 +1378,10 @@ retransmit_all_pim6_grafts(arg)
|
||||
|
||||
IF_DEBUG(DEBUG_PIM_GRAFT)
|
||||
log(LOG_DEBUG, 0, "Retransmitting all pending PIM-Grafts");
|
||||
|
||||
|
||||
|
||||
for(graft_ptr = graft_list;
|
||||
graft_ptr != NULL;
|
||||
for(graft_ptr = graft_list;
|
||||
graft_ptr != NULL;
|
||||
graft_ptr = graft_ptr->next) {
|
||||
|
||||
IF_DEBUG(DEBUG_PIM_GRAFT)
|
||||
@ -1453,7 +1451,7 @@ receive_pim6_graft(src, pim_message, datalen, pimtype)
|
||||
"PIM %s received from %s on mif %d, grps: %d",
|
||||
pimtype == PIM_GRAFT ? "GRAFT" : "GRAFT-ACK",
|
||||
inet6_fmt(&src->sin6_addr), mifi, num_groups);
|
||||
|
||||
|
||||
group.sin6_len = sizeof(group);
|
||||
group.sin6_family = AF_INET6;
|
||||
source.sin6_len = sizeof(source);
|
||||
@ -1477,7 +1475,7 @@ receive_pim6_graft(src, pim_message, datalen, pimtype)
|
||||
(num_j_srcs + num_p_srcs) * sizeof(pim6_encod_src_addr_t);
|
||||
continue; /* Ignore this group and jump to the next */
|
||||
}
|
||||
|
||||
|
||||
while (num_j_srcs--) {
|
||||
GET_ESADDR6(&encod_src, data_ptr);
|
||||
if (encod_src.masklen > (sizeof(struct in6_addr) << 3))
|
||||
@ -1491,7 +1489,7 @@ receive_pim6_graft(src, pim_message, datalen, pimtype)
|
||||
|
||||
mrtentry_ptr = find_route(&source, &group, MRTF_SG,
|
||||
DONT_CREATE);
|
||||
if(mrtentry_ptr == (mrtentry_t *)NULL)
|
||||
if(mrtentry_ptr == (mrtentry_t *)NULL)
|
||||
continue;
|
||||
|
||||
if(pimtype == PIM_GRAFT) {
|
||||
@ -1508,14 +1506,14 @@ receive_pim6_graft(src, pim_message, datalen, pimtype)
|
||||
if(mrtentry_ptr->prune_delay_timerids[mifi]) {
|
||||
timer_clearTimer(mrtentry_ptr->prune_delay_timerids[mifi]);
|
||||
mrtentry_ptr->prune_delay_timerids[mifi] = 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* 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 =
|
||||
state_change =
|
||||
change_interfaces(mrtentry_ptr,
|
||||
mrtentry_ptr->incoming,
|
||||
&mrtentry_ptr->pruned_oifs,
|
||||
@ -1555,7 +1553,7 @@ receive_pim6_graft(src, pim_message, datalen, pimtype)
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
int
|
||||
int
|
||||
send_pim6_graft(mrtentry_ptr)
|
||||
mrtentry_t *mrtentry_ptr;
|
||||
{
|
||||
@ -1574,7 +1572,7 @@ send_pim6_graft(mrtentry_ptr)
|
||||
/* Set up retransmission */
|
||||
new_graft = (pim_graft_entry_t *)malloc(sizeof(pim_graft_entry_t));
|
||||
if (new_graft == (pim_graft_entry_t *)NULL) {
|
||||
log(LOG_WARNING, 0,
|
||||
log(LOG_WARNING, 0,
|
||||
"Memory allocation error for graft entry src %s, grp %s",
|
||||
inet6_fmt(&mrtentry_ptr->source->address.sin6_addr),
|
||||
inet6_fmt(&mrtentry_ptr->group->group.sin6_addr));
|
||||
@ -1589,9 +1587,9 @@ send_pim6_graft(mrtentry_ptr)
|
||||
mrtentry_ptr->graft = new_graft;
|
||||
|
||||
/* Set up timer if not running */
|
||||
if(!graft_retrans_timer)
|
||||
if(!graft_retrans_timer)
|
||||
graft_retrans_timer = timer_setTimer(PIM_GRAFT_RETRANS_PERIOD,
|
||||
retransmit_all_pim6_grafts,
|
||||
retransmit_all_pim6_grafts,
|
||||
(void *)NULL);
|
||||
|
||||
return(TRUE);
|
||||
|
@ -1,6 +1,6 @@
|
||||
.\" Copyright (C) 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:
|
||||
@ -12,7 +12,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
|
||||
@ -25,7 +25,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $Id: pim6dd.8,v 1.3 1999/08/13 09:20:43 jinmei Exp $
|
||||
.\" $Id: pim6dd.8,v 1.5 2000/05/18 16:11:46 itojun Exp $
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd Nov 17, 1998
|
||||
@ -55,8 +55,7 @@ By default,
|
||||
.Pa /etc/pim6dd.conf
|
||||
is used.
|
||||
.It Fl d
|
||||
Specify debug levels.
|
||||
If this option is specified without any arguments,
|
||||
Specify debug levels. If this option is specified without any arguments,
|
||||
all debug messages will be printed out.
|
||||
A subset of the messages to be printed out can be specified
|
||||
as arguments of the option.
|
||||
@ -68,7 +67,7 @@ and
|
||||
.Ic asserts.
|
||||
.El
|
||||
.Pp
|
||||
.Nm Pim6dd
|
||||
.Nm Pim6dd
|
||||
automatically configures itself to forward on all multicast-capable
|
||||
interfaces, i.e., interfaces that have the IFF_MULTICAST flag set (excluding
|
||||
the "loopback interface").
|
||||
@ -93,7 +92,7 @@ The default configuration file.
|
||||
The
|
||||
.Nm
|
||||
command is based on
|
||||
.Nm pimdd,
|
||||
.Nm pimdd ,
|
||||
which is an IPv4 multicast routing daemon
|
||||
developed at the University of Oregon.
|
||||
.Nm Pimdd
|
||||
@ -101,19 +100,15 @@ has been derived from PIM sparse-mode
|
||||
.Nm pimd
|
||||
developed at University of Southern California.
|
||||
Part of these two programs above has also been derived from
|
||||
.Nm mrouted.
|
||||
.Nm mrouted .
|
||||
.Nm Mrouted
|
||||
is COPYRIGHT 1989 by The Board of Trustees of
|
||||
Leland Stanford Junior University.
|
||||
.Pp
|
||||
IPv6 and IPsec support based on the KAME Project (http://www.kame.net/) stack
|
||||
was initially integrated into
|
||||
.Fx 4.0
|
||||
.\"
|
||||
.Sh BUGS
|
||||
.Nm Pim6dd
|
||||
does not contain any unicast routing engine, so a unicast routing
|
||||
daemon needs to run on the system.
|
||||
daemon needs to run on the system.
|
||||
.Pp
|
||||
The kernel unicast routing table is periodically polled by
|
||||
.Nm
|
||||
|
@ -1,6 +1,6 @@
|
||||
.\" Copyright (C) 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:
|
||||
@ -12,7 +12,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
|
||||
@ -25,7 +25,7 @@
|
||||
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
.\" SUCH DAMAGE.
|
||||
.\"
|
||||
.\" $Id: pim6dd.conf.5,v 1.2 1999/12/10 06:08:49 itojun Exp $
|
||||
.\" $Id: pim6dd.conf.5,v 1.3 2000/05/05 14:43:18 sumikawa Exp $
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd Nov 17, 1998
|
||||
@ -33,7 +33,8 @@
|
||||
.Os
|
||||
.Sh NAME
|
||||
.Nm pim6dd.conf
|
||||
.Nd "config file for pim6dd, PIM for IPv6 dense mode daemon"
|
||||
.Nd config file for pim6dd, PIM for IPv6 dense mode daemon
|
||||
.\"
|
||||
.Sh DESCRIPTION
|
||||
The file describes how the
|
||||
.Nm pim6dd
|
||||
@ -60,8 +61,7 @@ unicast routing protocols, so a default value may be configured.
|
||||
.It Ic default_source_metric Ar metric
|
||||
Specifies a default metric value when sending a PIM assert message.
|
||||
It is recommended that preferences be set such that metrics are never
|
||||
consulted.
|
||||
However, default metrics may also be set and will default to
|
||||
consulted. However, default metrics may also be set and will default to
|
||||
1024.
|
||||
.\"
|
||||
.It Xo
|
||||
@ -87,8 +87,7 @@ assert message on the interface.
|
||||
.It Xo
|
||||
.Ic filter Ar groupaddrs Ar interfaces...
|
||||
.Xc
|
||||
Specifies an output filter.
|
||||
If an incoming multicast packet's destination
|
||||
Specifies an output filter. If an incoming multicast packet's destination
|
||||
matches the specified
|
||||
.Ar groupaddrs ,
|
||||
the packet is not sent on the
|
||||
@ -122,8 +121,7 @@ is omitted, it means the exact match for
|
||||
.Ar multicastaddr.
|
||||
.El
|
||||
.Ar interfaces
|
||||
are specified as a blank separated list of interfaces.
|
||||
Each interface is
|
||||
are specified as a blank separated list of interfaces. Each interface is
|
||||
specified in the form of "name unit".
|
||||
.El
|
||||
.\"
|
||||
|
@ -10,15 +10,15 @@
|
||||
* documentation, and that any documentation, advertising materials,
|
||||
* and other materials related to such distribution and use acknowledge
|
||||
* that the software was developed by the University of Oregon.
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THE UNIVERSITY OF OREGON DOES NOT MAKE ANY REPRESENTATIONS
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL UO, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -30,7 +30,7 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Kurt Windisch (kurtw@antc.uoregon.edu)
|
||||
*
|
||||
* $Id: pimdd.h,v 1.1.1.1 1999/08/08 23:30:53 itojun Exp $
|
||||
@ -39,13 +39,13 @@
|
||||
* Part of this program has been derived from PIM sparse-mode pimd.
|
||||
* The pimd program is covered by the license in the accompanying file
|
||||
* named "LICENSE.pimd".
|
||||
*
|
||||
*
|
||||
* The pimd program is COPYRIGHT 1998 by University of Southern California.
|
||||
*
|
||||
* Part of this program has been derived from mrouted.
|
||||
* The mrouted program is covered by the license in the accompanying file
|
||||
* named "LICENSE.mrouted".
|
||||
*
|
||||
*
|
||||
* The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
|
||||
* Leland Stanford Junior University.
|
||||
*
|
||||
@ -54,45 +54,45 @@
|
||||
|
||||
#include <netinet6/pim6.h>
|
||||
|
||||
#define PIM_PROTOCOL_VERSION 2
|
||||
#define PIMD_VERSION PIM_PROTOCOL_VERSION
|
||||
#define PIMD_SUBVERSION 1
|
||||
#define PIM_PROTOCOL_VERSION 2
|
||||
#define PIMD_VERSION PIM_PROTOCOL_VERSION
|
||||
#define PIMD_SUBVERSION 1
|
||||
#if 0
|
||||
#define PIM_CONSTANT 0x000eff00 /* constant portion of 'group' field */
|
||||
#define PIM_CONSTANT 0x000eff00 /* constant portion of 'group' field */
|
||||
#endif
|
||||
#define PIM_CONSTANT 0
|
||||
#define PIMD_LEVEL (PIM_CONSTANT | PIMD_VERSION | (PIMD_SUBVERSION << 8))
|
||||
#define PIM_CONSTANT 0
|
||||
#define PIMD_LEVEL (PIM_CONSTANT | PIMD_VERSION | (PIMD_SUBVERSION << 8))
|
||||
|
||||
#define INADDR_ALL_PIM_ROUTERS (u_int32)0xe000000D /* 224.0.0.13 */
|
||||
#define INADDR_ALL_PIM_ROUTERS (u_int32)0xe000000D /* 224.0.0.13 */
|
||||
|
||||
|
||||
/* PIM protocol timers (in seconds) */
|
||||
#ifndef TIMER_INTERVAL
|
||||
#define TIMER_INTERVAL 5 /* virtual timer granularity */
|
||||
#define TIMER_INTERVAL 5 /* virtual timer granularity */
|
||||
#endif /* TIMER_INTERVAL */
|
||||
|
||||
#define PIM_DATA_TIMEOUT 210
|
||||
#define PIM_TIMER_HELLO_PERIOD 30
|
||||
#define PIM_JOIN_PRUNE_HOLDTIME 210
|
||||
#define PIM_RANDOM_DELAY_JOIN_TIMEOUT 3
|
||||
#define PIM_GRAFT_RETRANS_PERIOD 3
|
||||
#define PIM_TIMER_HELLO_HOLDTIME (3.5 * PIM_TIMER_HELLO_PERIOD)
|
||||
#define PIM_ASSERT_TIMEOUT 210
|
||||
#define PIM_DATA_TIMEOUT 210
|
||||
#define PIM_TIMER_HELLO_PERIOD 30
|
||||
#define PIM_JOIN_PRUNE_HOLDTIME 210
|
||||
#define PIM_RANDOM_DELAY_JOIN_TIMEOUT 3
|
||||
#define PIM_GRAFT_RETRANS_PERIOD 3
|
||||
#define PIM_TIMER_HELLO_HOLDTIME (3.5 * PIM_TIMER_HELLO_PERIOD)
|
||||
#define PIM_ASSERT_TIMEOUT 210
|
||||
|
||||
|
||||
/* Misc definitions */
|
||||
#define SINGLE_SRC_MSKLEN 32 /* the single source mask length */
|
||||
#define SINGLE_GRP_MSKLEN 32 /* the single group mask length */
|
||||
#define SINGLE_SRC_MSKLEN 32 /* the single source mask length */
|
||||
#define SINGLE_GRP_MSKLEN 32 /* the single group mask length */
|
||||
|
||||
#define SINGLE_SRC_MSK6LEN 128 /* the single source mask length for IPv6*/
|
||||
#define SINGLE_GRP_MSK6LEN 128 /* the single group mask length for IPv6*/
|
||||
#define SINGLE_SRC_MSK6LEN 128 /* the single source mask length for IPv6*/
|
||||
#define SINGLE_GRP_MSK6LEN 128 /* the single group mask length for IPv6*/
|
||||
|
||||
/* TODO: change? */
|
||||
#define PIM_GROUP_PREFIX_DEFAULT_MASKLEN 16 /* The default group masklen if
|
||||
#define PIM_GROUP_PREFIX_DEFAULT_MASKLEN 16 /* The default group masklen if
|
||||
* omitted in the config file.
|
||||
*/
|
||||
|
||||
#define UCAST_ROUTING_CHECK_INTERVAL 20 /* Unfortunately, if the unicast
|
||||
#define UCAST_ROUTING_CHECK_INTERVAL 20 /* Unfortunately, if the unicast
|
||||
* routing changes, the kernel
|
||||
* or any of the existing
|
||||
* unicast routing daemons
|
||||
@ -104,40 +104,40 @@
|
||||
*/
|
||||
|
||||
|
||||
#define DEFAULT_PHY_RATE_LIMIT 0 /* default phyint rate limit */
|
||||
#define DEFAULT_PHY_RATE_LIMIT 0 /* default phyint rate limit */
|
||||
|
||||
#define DEFAULT_LOCAL_PREF 101 /* Default assert preference */
|
||||
#define DEFAULT_LOCAL_METRIC 1024 /* Default assert metric */
|
||||
#define DEFAULT_LOCAL_PREF 101 /* Default assert preference */
|
||||
#define DEFAULT_LOCAL_METRIC 1024 /* Default assert metric */
|
||||
|
||||
/**************************************************************************
|
||||
* PIM Encoded-Unicast, Encoded-Group and Encoded-Source Address formats *
|
||||
*************************************************************************/
|
||||
/* Address families definition */
|
||||
#define ADDRF_RESERVED 0
|
||||
#define ADDRF_IPv4 1
|
||||
#define ADDRF_IPv6 2
|
||||
#define ADDRF_NSAP 3
|
||||
#define ADDRF_HDLC 4
|
||||
#define ADDRF_BBN1822 5
|
||||
#define ADDRF_802 6
|
||||
#define ADDRF_ETHERNET ADDRF_802
|
||||
#define ADDRF_E163 7
|
||||
#define ADDRF_E164 8
|
||||
#define ADDRF_SMDS ADDRF_E164
|
||||
#define ADDRF_ATM ADDRF_E164
|
||||
#define ADDRF_F69 9
|
||||
#define ADDRF_TELEX ADDRF_F69
|
||||
#define ADDRF_X121 10
|
||||
#define ADDRF_X25 ADDRF_X121
|
||||
#define ADDRF_IPX 11
|
||||
#define ADDRF_APPLETALK 12
|
||||
#define ADDRF_DECNET_IV 13
|
||||
#define ADDRF_BANYAN 14
|
||||
#define ADDRF_E164_NSAP 15
|
||||
#define ADDRF_RESERVED 0
|
||||
#define ADDRF_IPv4 1
|
||||
#define ADDRF_IPv6 2
|
||||
#define ADDRF_NSAP 3
|
||||
#define ADDRF_HDLC 4
|
||||
#define ADDRF_BBN1822 5
|
||||
#define ADDRF_802 6
|
||||
#define ADDRF_ETHERNET ADDRF_802
|
||||
#define ADDRF_E163 7
|
||||
#define ADDRF_E164 8
|
||||
#define ADDRF_SMDS ADDRF_E164
|
||||
#define ADDRF_ATM ADDRF_E164
|
||||
#define ADDRF_F69 9
|
||||
#define ADDRF_TELEX ADDRF_F69
|
||||
#define ADDRF_X121 10
|
||||
#define ADDRF_X25 ADDRF_X121
|
||||
#define ADDRF_IPX 11
|
||||
#define ADDRF_APPLETALK 12
|
||||
#define ADDRF_DECNET_IV 13
|
||||
#define ADDRF_BANYAN 14
|
||||
#define ADDRF_E164_NSAP 15
|
||||
|
||||
/* Addresses Encoding Type (specific for each Address Family */
|
||||
#define ADDRT_IPv4 0
|
||||
#define ADDRT_IPv6 0
|
||||
#define ADDRT_IPv4 0
|
||||
#define ADDRT_IPv6 0
|
||||
|
||||
|
||||
#if 0 /* XXX: the definition is for IPv4 only */
|
||||
@ -200,9 +200,9 @@ typedef struct pim6_encod_src_addr_ {
|
||||
u_int8 masklen;
|
||||
struct in6_addr src_addr;
|
||||
} pim6_encod_src_addr_t;
|
||||
#define USADDR_RP_BIT 0x1
|
||||
#define USADDR_WC_BIT 0x2
|
||||
#define USADDR_S_BIT 0x4
|
||||
#define USADDR_RP_BIT 0x1
|
||||
#define USADDR_WC_BIT 0x2
|
||||
#define USADDR_S_BIT 0x4
|
||||
|
||||
/**************************************************************************
|
||||
* PIM Messages formats *
|
||||
@ -233,56 +233,56 @@ typedef struct pim_jp_encod_grp_ {
|
||||
} pim_jp_encod_grp_t;
|
||||
#endif
|
||||
|
||||
#define PIM_ACTION_NOTHING 0
|
||||
#define PIM_ACTION_JOIN 1
|
||||
#define PIM_ACTION_PRUNE 2
|
||||
#define PIM_ACTION_NOTHING 0
|
||||
#define PIM_ACTION_JOIN 1
|
||||
#define PIM_ACTION_PRUNE 2
|
||||
|
||||
#define PIM_IIF_SOURCE 1
|
||||
#define PIM_IIF_RP 2
|
||||
#define PIM_IIF_SOURCE 1
|
||||
#define PIM_IIF_RP 2
|
||||
|
||||
#define PIM_ASSERT_RPT_BIT 0x80000000
|
||||
#define PIM_ASSERT_RPT_BIT 0x80000000
|
||||
|
||||
|
||||
/* PIM messages type */
|
||||
#define PIM_HELLO 0
|
||||
#define PIM_HELLO 0
|
||||
#ifndef PIM_REGISTER
|
||||
#define PIM_REGISTER 1
|
||||
#define PIM_REGISTER 1
|
||||
#endif
|
||||
#define PIM_REGISTER_STOP 2
|
||||
#define PIM_JOIN_PRUNE 3
|
||||
#define PIM_BOOTSTRAP 4
|
||||
#define PIM_ASSERT 5
|
||||
#define PIM_GRAFT 6
|
||||
#define PIM_GRAFT_ACK 7
|
||||
#define PIM_CAND_RP_ADV 8
|
||||
#define PIM_REGISTER_STOP 2
|
||||
#define PIM_JOIN_PRUNE 3
|
||||
#define PIM_BOOTSTRAP 4
|
||||
#define PIM_ASSERT 5
|
||||
#define PIM_GRAFT 6
|
||||
#define PIM_GRAFT_ACK 7
|
||||
#define PIM_CAND_RP_ADV 8
|
||||
|
||||
#define PIM_V2_HELLO PIM_HELLO
|
||||
#define PIM_V2_REGISTER PIM_REGISTER
|
||||
#define PIM_V2_REGISTER_STOP PIM_REGISTER_STOP
|
||||
#define PIM_V2_JOIN_PRUNE PIM_JOIN_PRUNE
|
||||
#define PIM_V2_BOOTSTRAP PIM_BOOTSTRAP
|
||||
#define PIM_V2_ASSERT PIM_ASSERT
|
||||
#define PIM_V2_GRAFT PIM_GRAFT
|
||||
#define PIM_V2_GRAFT_ACK PIM_GRAFT_ACK
|
||||
#define PIM_V2_CAND_RP_ADV PIM_CAND_RP_ADV
|
||||
#define PIM_V2_HELLO PIM_HELLO
|
||||
#define PIM_V2_REGISTER PIM_REGISTER
|
||||
#define PIM_V2_REGISTER_STOP PIM_REGISTER_STOP
|
||||
#define PIM_V2_JOIN_PRUNE PIM_JOIN_PRUNE
|
||||
#define PIM_V2_BOOTSTRAP PIM_BOOTSTRAP
|
||||
#define PIM_V2_ASSERT PIM_ASSERT
|
||||
#define PIM_V2_GRAFT PIM_GRAFT
|
||||
#define PIM_V2_GRAFT_ACK PIM_GRAFT_ACK
|
||||
#define PIM_V2_CAND_RP_ADV PIM_CAND_RP_ADV
|
||||
|
||||
#define PIM_V1_QUERY 0
|
||||
#define PIM_V1_REGISTER 1
|
||||
#define PIM_V1_REGISTER_STOP 2
|
||||
#define PIM_V1_JOIN_PRUNE 3
|
||||
#define PIM_V1_RP_REACHABILITY 4
|
||||
#define PIM_V1_ASSERT 5
|
||||
#define PIM_V1_GRAFT 6
|
||||
#define PIM_V1_GRAFT_ACK 7
|
||||
#define PIM_V1_QUERY 0
|
||||
#define PIM_V1_REGISTER 1
|
||||
#define PIM_V1_REGISTER_STOP 2
|
||||
#define PIM_V1_JOIN_PRUNE 3
|
||||
#define PIM_V1_RP_REACHABILITY 4
|
||||
#define PIM_V1_ASSERT 5
|
||||
#define PIM_V1_GRAFT 6
|
||||
#define PIM_V1_GRAFT_ACK 7
|
||||
|
||||
/* Vartious options from PIM messages definitions */
|
||||
/* PIM_HELLO definitions */
|
||||
#define PIM_MESSAGE_HELLO_HOLDTIME 1
|
||||
#define PIM_MESSAGE_HELLO_HOLDTIME_LENGTH 2
|
||||
#define PIM_MESSAGE_HELLO_HOLDTIME_FOREVER 0xffff
|
||||
#define PIM_MESSAGE_HELLO_HOLDTIME 1
|
||||
#define PIM_MESSAGE_HELLO_HOLDTIME_LENGTH 2
|
||||
#define PIM_MESSAGE_HELLO_HOLDTIME_FOREVER 0xffff
|
||||
|
||||
|
||||
#define MASK_TO_MASKLEN(mask, masklen) \
|
||||
#define MASK_TO_MASKLEN(mask, masklen) \
|
||||
do { \
|
||||
register u_int32 tmp_mask = ntohl((mask)); \
|
||||
register u_int8 tmp_masklen = sizeof((mask)) << 3; \
|
||||
@ -292,12 +292,12 @@ typedef struct pim_jp_encod_grp_ {
|
||||
(masklen) = tmp_masklen; \
|
||||
} while (0)
|
||||
|
||||
#define MASKLEN_TO_MASK(masklen, mask) \
|
||||
#define MASKLEN_TO_MASK(masklen, mask) \
|
||||
do { \
|
||||
(mask) = (masklen)? htonl(~0 << ((sizeof((mask)) << 3) - (masklen))) : 0;\
|
||||
} while (0)
|
||||
|
||||
#define MASKLEN_TO_MASK6(masklen, mask6) \
|
||||
#define MASKLEN_TO_MASK6(masklen, mask6) \
|
||||
do {\
|
||||
u_char maskarray[8] = \
|
||||
{0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff}; \
|
||||
@ -326,10 +326,10 @@ do { \
|
||||
* GET_HOSTLONG gets the data, but in the memory it is in "host order"
|
||||
* The same for all {PUT,GET}_{NET,HOST}{SHORT,LONG}
|
||||
*/
|
||||
#define GET_BYTE(val, cp) ((val) = *(cp)++)
|
||||
#define PUT_BYTE(val, cp) (*(cp)++ = (u_int8)(val))
|
||||
#define GET_BYTE(val, cp) ((val) = *(cp)++)
|
||||
#define PUT_BYTE(val, cp) (*(cp)++ = (u_int8)(val))
|
||||
|
||||
#define GET_HOSTSHORT(val, cp) \
|
||||
#define GET_HOSTSHORT(val, cp) \
|
||||
do { \
|
||||
register u_int16 Xv; \
|
||||
Xv = (*(cp)++) << 8; \
|
||||
@ -337,7 +337,7 @@ do { \
|
||||
(val) = Xv; \
|
||||
} while (0)
|
||||
|
||||
#define PUT_HOSTSHORT(val, cp) \
|
||||
#define PUT_HOSTSHORT(val, cp) \
|
||||
do { \
|
||||
register u_int16 Xv; \
|
||||
Xv = (u_int16)(val); \
|
||||
@ -346,14 +346,14 @@ do { \
|
||||
} while (0)
|
||||
|
||||
#if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)
|
||||
#define GET_NETSHORT(val, cp) \
|
||||
#define GET_NETSHORT(val, cp) \
|
||||
do { \
|
||||
register u_int16 Xv; \
|
||||
Xv = *(cp)++; \
|
||||
Xv |= (*(cp)++) << 8; \
|
||||
(val) = Xv; \
|
||||
} while (0)
|
||||
#define PUT_NETSHORT(val, cp) \
|
||||
#define PUT_NETSHORT(val, cp) \
|
||||
do { \
|
||||
register u_int16 Xv; \
|
||||
Xv = (u_int16)(val); \
|
||||
@ -361,11 +361,11 @@ do { \
|
||||
*(cp)++ = (u_int8)(Xv >> 8); \
|
||||
} while (0)
|
||||
#else
|
||||
#define GET_NETSHORT(val, cp) GET_HOSTSHORT(val, cp)
|
||||
#define PUT_NETSHORT(val, cp) PUT_HOSTSHORT(val, cp)
|
||||
#define GET_NETSHORT(val, cp) GET_HOSTSHORT(val, cp)
|
||||
#define PUT_NETSHORT(val, cp) PUT_HOSTSHORT(val, cp)
|
||||
#endif /* {GET,PUT}_NETSHORT */
|
||||
|
||||
#define GET_HOSTLONG(val, cp) \
|
||||
#define GET_HOSTLONG(val, cp) \
|
||||
do { \
|
||||
register u_long Xv; \
|
||||
Xv = (*(cp)++) << 24; \
|
||||
@ -375,7 +375,7 @@ do { \
|
||||
(val) = Xv; \
|
||||
} while (0)
|
||||
|
||||
#define PUT_HOSTLONG(val, cp) \
|
||||
#define PUT_HOSTLONG(val, cp) \
|
||||
do { \
|
||||
register u_int32 Xv; \
|
||||
Xv = (u_int32)(val); \
|
||||
@ -386,7 +386,7 @@ do { \
|
||||
} while (0)
|
||||
|
||||
#if defined(BYTE_ORDER) && (BYTE_ORDER == LITTLE_ENDIAN)
|
||||
#define GET_NETLONG(val, cp) \
|
||||
#define GET_NETLONG(val, cp) \
|
||||
do { \
|
||||
register u_long Xv; \
|
||||
Xv = *(cp)++; \
|
||||
@ -396,7 +396,7 @@ do { \
|
||||
(val) = Xv; \
|
||||
} while (0)
|
||||
|
||||
#define PUT_NETLONG(val, cp) \
|
||||
#define PUT_NETLONG(val, cp) \
|
||||
do { \
|
||||
register u_int32 Xv; \
|
||||
Xv = (u_int32)(val); \
|
||||
@ -406,12 +406,12 @@ do { \
|
||||
*(cp)++ = (u_int8)(Xv >> 24); \
|
||||
} while (0)
|
||||
#else
|
||||
#define GET_NETLONG(val, cp) GET_HOSTLONG(val, cp)
|
||||
#define PUT_NETLONG(val, cp) PUT_HOSTLONG(val, cp)
|
||||
#define GET_NETLONG(val, cp) GET_HOSTLONG(val, cp)
|
||||
#define PUT_NETLONG(val, cp) PUT_HOSTLONG(val, cp)
|
||||
#endif /* {GET,PUT}_HOSTLONG */
|
||||
|
||||
|
||||
#define GET_ESADDR(esa, cp) \
|
||||
#define GET_ESADDR(esa, cp) \
|
||||
do { \
|
||||
(esa)->addr_family = *(cp)++; \
|
||||
(esa)->encod_type = *(cp)++; \
|
||||
@ -420,7 +420,7 @@ do { \
|
||||
GET_NETLONG((esa)->src_addr, (cp)); \
|
||||
} while(0)
|
||||
|
||||
#define GET_ESADDR6(esa, cp) /* XXX: hard coding */ \
|
||||
#define GET_ESADDR6(esa, cp) /* XXX: hard coding */ \
|
||||
do { \
|
||||
(esa)->addr_family = *(cp)++; \
|
||||
(esa)->encod_type = *(cp)++; \
|
||||
@ -430,7 +430,7 @@ do { \
|
||||
(cp) += sizeof(struct in6_addr); \
|
||||
} while(0)
|
||||
|
||||
#define PUT_ESADDR(addr, masklen, flags, cp) \
|
||||
#define PUT_ESADDR(addr, masklen, flags, cp) \
|
||||
do { \
|
||||
u_int32 mask; \
|
||||
MASKLEN_TO_MASK((masklen), mask); \
|
||||
@ -441,7 +441,7 @@ do { \
|
||||
PUT_NETLONG((addr) & mask, (cp)); \
|
||||
} while(0)
|
||||
|
||||
#define PUT_ESADDR6(addr, masklen, flags, cp) \
|
||||
#define PUT_ESADDR6(addr, masklen, flags, cp) \
|
||||
do { \
|
||||
int i; \
|
||||
struct in6_addr maskaddr; \
|
||||
@ -454,7 +454,7 @@ do { \
|
||||
*(cp) = maskaddr.s6_addr[i] & (addr).s6_addr[i]; \
|
||||
} while(0)
|
||||
|
||||
#define GET_EGADDR(ega, cp) \
|
||||
#define GET_EGADDR(ega, cp) \
|
||||
do { \
|
||||
(ega)->addr_family = *(cp)++; \
|
||||
(ega)->encod_type = *(cp)++; \
|
||||
@ -463,7 +463,7 @@ do { \
|
||||
GET_NETLONG((ega)->mcast_addr, (cp)); \
|
||||
} while(0)
|
||||
|
||||
#define GET_EGADDR6(ega, cp) /* XXX: hard coding */ \
|
||||
#define GET_EGADDR6(ega, cp) /* XXX: hard coding */ \
|
||||
do { \
|
||||
(ega)->addr_family = *(cp)++; \
|
||||
(ega)->encod_type = *(cp)++; \
|
||||
@ -473,7 +473,7 @@ do { \
|
||||
(cp) += sizeof(struct in6_addr); \
|
||||
} while(0)
|
||||
|
||||
#define PUT_EGADDR(addr, masklen, reserved, cp) \
|
||||
#define PUT_EGADDR(addr, masklen, reserved, cp) \
|
||||
do { \
|
||||
u_int32 mask; \
|
||||
MASKLEN_TO_MASK((masklen), mask); \
|
||||
@ -484,7 +484,7 @@ do { \
|
||||
PUT_NETLONG((addr) & mask, (cp)); \
|
||||
} while(0)
|
||||
|
||||
#define PUT_EGADDR6(addr, masklen, reserved, cp) \
|
||||
#define PUT_EGADDR6(addr, masklen, reserved, cp) \
|
||||
do { \
|
||||
int i; \
|
||||
struct in6_addr maskaddr; \
|
||||
@ -497,14 +497,14 @@ do { \
|
||||
*(cp) = maskaddr.s6_addr[i] & (addr).s6_addr[i]; \
|
||||
} while(0)
|
||||
|
||||
#define GET_EUADDR(eua, cp) \
|
||||
#define GET_EUADDR(eua, cp) \
|
||||
do { \
|
||||
(eua)->addr_family = *(cp)++; \
|
||||
(eua)->encod_type = *(cp)++; \
|
||||
GET_NETLONG((eua)->unicast_addr, (cp)); \
|
||||
} while(0)
|
||||
|
||||
#define GET_EUADDR6(eua, cp) /* XXX hard conding */ \
|
||||
#define GET_EUADDR6(eua, cp) /* XXX hard conding */ \
|
||||
do { \
|
||||
(eua)->addr_family = *(cp)++; \
|
||||
(eua)->encod_type = *(cp)++; \
|
||||
@ -512,14 +512,14 @@ do { \
|
||||
(cp) += sizeof(struct in6_addr); \
|
||||
} while(0)
|
||||
|
||||
#define PUT_EUADDR(addr, cp) \
|
||||
#define PUT_EUADDR(addr, cp) \
|
||||
do { \
|
||||
*(cp)++ = ADDRF_IPv4; /* family */ \
|
||||
*(cp)++ = ADDRT_IPv4; /* type */ \
|
||||
PUT_NETLONG((addr), (cp)); \
|
||||
} while(0)
|
||||
|
||||
#define PUT_EUADDR6(addr, cp) \
|
||||
#define PUT_EUADDR6(addr, cp) \
|
||||
do { \
|
||||
*(cp)++ = ADDRF_IPv6; /* family */ \
|
||||
*(cp)++ = ADDRT_IPv6; /* type */ \
|
||||
@ -530,21 +530,21 @@ do { \
|
||||
/* TODO: Currently not used. Probably not need at all. Delete! */
|
||||
#ifdef NOSUCHDEF
|
||||
/* This is completely IGMP related stuff? */
|
||||
#define PIM_LEAF_TIMEOUT (3.5 * IGMP_QUERY_INTERVAL)
|
||||
#define PIM_LEAF_TIMEOUT (3.5 * IGMP_QUERY_INTERVAL)
|
||||
#endif /* NOSUCHDEF */
|
||||
|
||||
#if defined(__bsdi__) || defined(__NetBSD__)
|
||||
/*
|
||||
* Struct used to communicate from kernel to multicast router
|
||||
* note the convenient similarity to an IP packet
|
||||
*/
|
||||
*/
|
||||
struct igmpmsg {
|
||||
u_long unused1;
|
||||
u_long unused2;
|
||||
u_char im_msgtype; /* what type of message */
|
||||
#define IGMPMSG_NOCACHE 1
|
||||
#define IGMPMSG_WRONGVIF 2
|
||||
#define IGMPMSG_WHOLEPKT 3 /* used for user level encap*/
|
||||
#define IGMPMSG_NOCACHE 1
|
||||
#define IGMPMSG_WRONGVIF 2
|
||||
#define IGMPMSG_WHOLEPKT 3 /* used for user level encap*/
|
||||
u_char im_mbz; /* must be zero */
|
||||
u_char im_vif; /* vif rec'd on */
|
||||
u_char unused3;
|
||||
|
@ -10,15 +10,15 @@
|
||||
* documentation, and that any documentation, advertising materials,
|
||||
* and other materials related to such distribution and use acknowledge
|
||||
* that the software was developed by the University of Oregon.
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THE UNIVERSITY OF OREGON DOES NOT MAKE ANY REPRESENTATIONS
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL UO, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -30,7 +30,7 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Kurt Windisch (kurtw@antc.uoregon.edu)
|
||||
*
|
||||
* $Id: route.c,v 1.3 1999/10/27 11:40:30 jinmei Exp $
|
||||
@ -39,13 +39,13 @@
|
||||
* Part of this program has been derived from PIM sparse-mode pimd.
|
||||
* The pimd program is covered by the license in the accompanying file
|
||||
* named "LICENSE.pimd".
|
||||
*
|
||||
*
|
||||
* The pimd program is COPYRIGHT 1998 by University of Southern California.
|
||||
*
|
||||
* Part of this program has been derived from mrouted.
|
||||
* The mrouted program is covered by the license in the accompanying file
|
||||
* named "LICENSE.mrouted".
|
||||
*
|
||||
*
|
||||
* The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
|
||||
* Leland Stanford Junior University.
|
||||
*
|
||||
@ -119,7 +119,7 @@ find_pim6_nbr(source)
|
||||
* Set the iif, upstream router, preference and metric for the route
|
||||
* toward the source. Return TRUE is the route was found, othewise FALSE.
|
||||
* If srctype==PIM_IIF_SOURCE and if the source is directly connected
|
||||
* then the "upstream" is set to NULL.
|
||||
* then the "upstream" is set to NULL.
|
||||
* Note that srctype is a hold-over from the PIM-SM daemon and is unused.
|
||||
*/
|
||||
int
|
||||
@ -134,7 +134,7 @@ set_incoming(srcentry_ptr, srctype)
|
||||
register pim_nbr_entry_t *n;
|
||||
|
||||
/* Preference will be 0 if directly connected */
|
||||
srcentry_ptr->preference = 0;
|
||||
srcentry_ptr->preference = 0;
|
||||
srcentry_ptr->metric = 0;
|
||||
|
||||
if ((srcentry_ptr->incoming = local_address(source)) != NO_VIF) {
|
||||
@ -160,7 +160,7 @@ set_incoming(srcentry_ptr, srctype)
|
||||
neighbor_addr = &rpfc.rpfneighbor;
|
||||
}
|
||||
else {
|
||||
/* The source is directly connected.
|
||||
/* The source is directly connected.
|
||||
*/
|
||||
srcentry_ptr->upstream = (pim_nbr_entry_t *)NULL;
|
||||
return (TRUE);
|
||||
@ -193,13 +193,13 @@ set_incoming(srcentry_ptr, srctype)
|
||||
}
|
||||
else break;
|
||||
}
|
||||
|
||||
|
||||
/* TODO: control the number of messages! */
|
||||
log(LOG_INFO, 0,
|
||||
"For src %s, iif is %d, next hop router is %s: NOT A PIM ROUTER",
|
||||
inet6_fmt(&source->sin6_addr), srcentry_ptr->incoming,
|
||||
inet6_fmt(&neighbor_addr->sin6_addr));
|
||||
srcentry_ptr->upstream = (pim_nbr_entry_t *)NULL;
|
||||
srcentry_ptr->upstream = (pim_nbr_entry_t *)NULL;
|
||||
|
||||
return(FALSE);
|
||||
}
|
||||
@ -211,10 +211,10 @@ void set_leaves(mrtentry_ptr)
|
||||
{
|
||||
vifi_t vifi;
|
||||
struct uvif *v;
|
||||
|
||||
|
||||
/* Check for a group report on each vif */
|
||||
for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v)
|
||||
if(check_multicast_listener(v, &mrtentry_ptr->group->group))
|
||||
for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v)
|
||||
if(check_multicast_listener(v, &mrtentry_ptr->group->group))
|
||||
IF_SET(vifi, &mrtentry_ptr->leaves);
|
||||
}
|
||||
|
||||
@ -245,21 +245,21 @@ add_leaf(vifi, source, group)
|
||||
mrtentry_srcs = mrtentry_srcs->grpnext) {
|
||||
|
||||
/* if applicable, add the vif to the leaves */
|
||||
if (mrtentry_srcs->incoming == vifi)
|
||||
if (mrtentry_srcs->incoming == vifi)
|
||||
continue;
|
||||
|
||||
if(!(IF_ISSET(vifi, &mrtentry_srcs->leaves))) {
|
||||
|
||||
IF_DEBUG(DEBUG_MRT)
|
||||
log(LOG_DEBUG, 0, "Adding leaf vif %d for src %s group %s",
|
||||
log(LOG_DEBUG, 0, "Adding leaf vif %d for src %s group %s",
|
||||
vifi,
|
||||
inet6_fmt(&mrtentry_srcs->source->address.sin6_addr),
|
||||
inet6_fmt(&group->sin6_addr));
|
||||
|
||||
IF_COPY(&mrtentry_srcs->leaves, &new_leaves);
|
||||
IF_SET(vifi, &new_leaves); /* Add the leaf */
|
||||
|
||||
state_change =
|
||||
|
||||
state_change =
|
||||
change_interfaces(mrtentry_srcs,
|
||||
mrtentry_srcs->incoming,
|
||||
&mrtentry_srcs->pruned_oifs,
|
||||
@ -267,7 +267,7 @@ add_leaf(vifi, source, group)
|
||||
&mrtentry_srcs->asserted_oifs);
|
||||
|
||||
/* Handle transition from negative cache */
|
||||
if(state_change == 1)
|
||||
if(state_change == 1)
|
||||
trigger_join_alert(mrtentry_srcs);
|
||||
}
|
||||
}
|
||||
@ -306,7 +306,7 @@ delete_leaf(vifi, source, group)
|
||||
mrtentry_srcs = mrtentry_srcs->grpnext) {
|
||||
|
||||
/* if applicable, delete the vif from the leaves */
|
||||
if (mrtentry_srcs->incoming == vifi)
|
||||
if (mrtentry_srcs->incoming == vifi)
|
||||
continue;
|
||||
|
||||
if(IF_ISSET(vifi, &mrtentry_srcs->leaves)) {
|
||||
@ -314,13 +314,13 @@ delete_leaf(vifi, source, group)
|
||||
IF_DEBUG(DEBUG_MRT)
|
||||
log(LOG_DEBUG, 0, "Deleting leaf vif %d for src %s, group %s",
|
||||
vifi,
|
||||
inet6_fmt(&mrtentry_srcs->source->address.sin6_addr),
|
||||
inet6_fmt(&mrtentry_srcs->source->address.sin6_addr),
|
||||
inet6_fmt(&group->sin6_addr));
|
||||
|
||||
|
||||
IF_COPY(&mrtentry_srcs->leaves, &new_leaves);
|
||||
IF_CLR(vifi, &new_leaves); /* Remove the leaf */
|
||||
|
||||
state_change =
|
||||
|
||||
state_change =
|
||||
change_interfaces(mrtentry_srcs,
|
||||
mrtentry_srcs->incoming,
|
||||
&mrtentry_srcs->pruned_oifs,
|
||||
@ -344,7 +344,7 @@ calc_oifs(mrtentry_ptr, oifs_ptr)
|
||||
/*
|
||||
* oifs =
|
||||
* ((nbr_ifs - my_prune) + my_leaves) - my_filters - incoming_interface,
|
||||
* i.e.`leaves` have higher priority than `prunes`, but lower than `filters'.
|
||||
* i.e.`leaves` have higher priority than `prunes`, but lower than `filters'.
|
||||
* Asserted oifs (those that lost assert) are handled as pruned oifs.
|
||||
* The incoming interface is always deleted from the oifs
|
||||
*/
|
||||
@ -353,7 +353,7 @@ calc_oifs(mrtentry_ptr, oifs_ptr)
|
||||
IF_ZERO(oifs_ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
IF_COPY(&nbr_mifs, &oifs);
|
||||
IF_CLR_MASK(&oifs, &mrtentry_ptr->pruned_oifs);
|
||||
IF_MERGE(&oifs, &mrtentry_ptr->leaves, &oifs);
|
||||
@ -372,7 +372,7 @@ calc_oifs(mrtentry_ptr, oifs_ptr)
|
||||
* else return 0
|
||||
* If the iif change or if the oifs change from NULL to non-NULL
|
||||
* or vice-versa, then schedule that mrtentry join/prune timer to
|
||||
* timeout immediately.
|
||||
* timeout immediately.
|
||||
*/
|
||||
int
|
||||
change_interfaces(mrtentry_ptr, new_iif, new_pruned_oifs,
|
||||
@ -391,7 +391,7 @@ change_interfaces(mrtentry_ptr, new_iif, new_pruned_oifs,
|
||||
if_set old_asserted_oifs; /* unnecessary? */
|
||||
vifi_t old_iif;
|
||||
int return_value;
|
||||
|
||||
|
||||
if (mrtentry_ptr == (mrtentry_t *)NULL)
|
||||
return (0);
|
||||
|
||||
@ -403,7 +403,7 @@ change_interfaces(mrtentry_ptr, new_iif, new_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);
|
||||
@ -427,7 +427,7 @@ change_interfaces(mrtentry_ptr, new_iif, new_pruned_oifs,
|
||||
return 0; /* Nothing to change */
|
||||
|
||||
IF_COPY(&new_real_oifs, &mrtentry_ptr->oifs);
|
||||
|
||||
|
||||
k_chg_mfc(mld6_socket, &mrtentry_ptr->source->address,
|
||||
&mrtentry_ptr->group->group, new_iif, &new_real_oifs);
|
||||
|
||||
@ -437,7 +437,7 @@ change_interfaces(mrtentry_ptr, new_iif, new_pruned_oifs,
|
||||
|
||||
return (return_value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* TODO: implement it. Required to allow changing of the physical interfaces
|
||||
* configuration without need to restart pimd.
|
||||
@ -457,22 +457,22 @@ max_prune_timeout(mrtentry_ptr)
|
||||
vifi_t vifi;
|
||||
#if 0
|
||||
/* XXX: I don't understand how the variable works...(jinmei@kame.net) */
|
||||
u_int16 time_left = 0;
|
||||
#endif
|
||||
u_int16 time_left = 0;
|
||||
#endif
|
||||
u_int16 max_holdtime = 0;
|
||||
|
||||
for(vifi=0; vifi < numvifs; ++vifi)
|
||||
if(IF_ISSET(vifi, &mrtentry_ptr->pruned_oifs) &&
|
||||
mrtentry_ptr->prune_timers[vifi])
|
||||
for(vifi=0; vifi < numvifs; ++vifi)
|
||||
if(IF_ISSET(vifi, &mrtentry_ptr->pruned_oifs) &&
|
||||
mrtentry_ptr->prune_timers[vifi])
|
||||
/* XXX - too expensive ? */
|
||||
if(mrtentry_ptr->prune_timers[vifi] > max_holdtime)
|
||||
max_holdtime = mrtentry_ptr->prune_timers[vifi];
|
||||
#if 0
|
||||
/* XXX: This is original. But does it have any meaning? */
|
||||
max_holdtime = time_left;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
if(max_holdtime == 0)
|
||||
if(max_holdtime == 0)
|
||||
max_holdtime = (u_int16)PIM_JOIN_PRUNE_HOLDTIME;
|
||||
|
||||
return(max_holdtime);
|
||||
@ -483,9 +483,9 @@ void
|
||||
process_kernel_call()
|
||||
{
|
||||
register struct mrt6msg *im; /* igmpmsg control struct */
|
||||
|
||||
|
||||
im = (struct mrt6msg *) mld6_recv_buf;
|
||||
|
||||
|
||||
switch (im->im6_msgtype) {
|
||||
case MRT6MSG_NOCACHE:
|
||||
process_cache_miss(im);
|
||||
@ -523,23 +523,23 @@ process_cache_miss(im)
|
||||
source.sin6_addr = im->im6_src;
|
||||
group.sin6_scope_id = inet6_uvif2scopeid(&group, &uvifs[im->im6_mif]);
|
||||
source.sin6_scope_id = inet6_uvif2scopeid(&source, &uvifs[im->im6_mif]);
|
||||
|
||||
|
||||
IF_DEBUG(DEBUG_MFC)
|
||||
log(LOG_DEBUG, 0, "Cache miss, src %s, dst %s",
|
||||
inet6_fmt(&source.sin6_addr), inet6_fmt(&group.sin6_addr));
|
||||
inet6_fmt(&source.sin6_addr), inet6_fmt(&group.sin6_addr));
|
||||
|
||||
/* Don't create routing entries for the LAN scoped addresses */
|
||||
if (IN6_IS_ADDR_MC_NODELOCAL(&group.sin6_addr) ||/* sanity? */
|
||||
IN6_IS_ADDR_MC_LINKLOCAL(&group.sin6_addr))
|
||||
return;
|
||||
|
||||
return;
|
||||
|
||||
/* Create the (S,G) entry */
|
||||
mrtentry_ptr = find_route(&source, &group, MRTF_SG, CREATE);
|
||||
if (mrtentry_ptr == (mrtentry_t *)NULL)
|
||||
return;
|
||||
mrtentry_ptr->flags &= ~MRTF_NEW;
|
||||
|
||||
/* Set oifs */
|
||||
|
||||
/* Set oifs */
|
||||
set_leaves(mrtentry_ptr);
|
||||
calc_oifs(mrtentry_ptr, &(mrtentry_ptr->oifs));
|
||||
|
||||
@ -560,7 +560,7 @@ process_cache_miss(im)
|
||||
/*
|
||||
* A multicast packet has been received on wrong iif by the kernel.
|
||||
* If the packet was received on a point-to-point interface, rate-limit
|
||||
* prunes. if the packet was received on a LAN interface, rate-limit
|
||||
* prunes. if the packet was received on a LAN interface, rate-limit
|
||||
* asserts.
|
||||
*/
|
||||
static void
|
||||
@ -581,7 +581,7 @@ process_wrong_iif(im)
|
||||
/* PIMDM TODO Don't create routing entries for the LAN scoped addresses */
|
||||
if (IN6_IS_ADDR_MC_NODELOCAL(&group.sin6_addr) ||/* sanity? */
|
||||
IN6_IS_ADDR_MC_LINKLOCAL(&group.sin6_addr))
|
||||
return;
|
||||
return;
|
||||
|
||||
mrtentry_ptr = find_route(&source, &group, MRTF_SG, DONT_CREATE);
|
||||
if(mrtentry_ptr == (mrtentry_t *)NULL)
|
||||
@ -599,14 +599,14 @@ process_wrong_iif(im)
|
||||
mrtentry_ptr->last_prune[mifi] = virtual_time;
|
||||
|
||||
if(uvifs[mifi].uv_rmt_addr)
|
||||
send_pim6_jp(mrtentry_ptr, PIM_ACTION_PRUNE, mifi,
|
||||
uvifs[mifi].uv_rmt_addr,
|
||||
send_pim6_jp(mrtentry_ptr, PIM_ACTION_PRUNE, mifi,
|
||||
uvifs[mifi].uv_rmt_addr,
|
||||
max_prune_timeout(mrtentry_ptr), 0);
|
||||
else
|
||||
log(LOG_WARNING, 0,
|
||||
else
|
||||
log(LOG_WARNING, 0,
|
||||
"Can't send wrongvif prune on p2p %s: no remote address",
|
||||
uvifs[mifi].uv_lcl_addr);
|
||||
} else
|
||||
} else
|
||||
#endif
|
||||
{
|
||||
|
||||
@ -629,16 +629,16 @@ trigger_prune_alert(mrtentry_ptr)
|
||||
{
|
||||
IF_DEBUG(DEBUG_MRT)
|
||||
log(LOG_DEBUG, 0, "Now negative cache for src %s, grp %s - pruning",
|
||||
inet6_fmt(&mrtentry_ptr->source->address.sin6_addr),
|
||||
inet6_fmt(&mrtentry_ptr->source->address.sin6_addr),
|
||||
inet6_fmt(&mrtentry_ptr->group->group.sin6_addr));
|
||||
|
||||
/* Set the entry timer to the max of the prune timers */
|
||||
SET_TIMER(mrtentry_ptr->timer, max_prune_timeout(mrtentry_ptr));
|
||||
|
||||
/* Send a prune */
|
||||
if(mrtentry_ptr->upstream)
|
||||
if(mrtentry_ptr->upstream)
|
||||
send_pim6_jp(mrtentry_ptr, PIM_ACTION_PRUNE, mrtentry_ptr->incoming,
|
||||
&mrtentry_ptr->upstream->address,
|
||||
&mrtentry_ptr->upstream->address,
|
||||
max_prune_timeout(mrtentry_ptr), 0);
|
||||
}
|
||||
|
||||
@ -648,7 +648,7 @@ trigger_join_alert(mrtentry_ptr)
|
||||
{
|
||||
IF_DEBUG(DEBUG_MRT)
|
||||
log(LOG_DEBUG, 0, "Now forwarding state for src %s, grp %s - grafting",
|
||||
inet6_fmt(&mrtentry_ptr->source->address.sin6_addr),
|
||||
inet6_fmt(&mrtentry_ptr->source->address.sin6_addr),
|
||||
inet6_fmt(&mrtentry_ptr->group->group.sin6_addr));
|
||||
|
||||
/* Refresh the entry timer */
|
||||
|
@ -19,7 +19,7 @@
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL USC, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -31,7 +31,7 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
|
||||
*
|
||||
* $Id: routesock.c,v 1.4 1999/11/19 04:05:48 sumikawa Exp $
|
||||
@ -81,17 +81,17 @@ static int getmsg __P((register struct rt_msghdr *, int,
|
||||
* TODO: check again!
|
||||
*/
|
||||
#ifdef IRIX
|
||||
#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(__uint64_t) - 1))) \
|
||||
#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(__uint64_t) - 1))) \
|
||||
: sizeof(__uint64_t))
|
||||
#else
|
||||
#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) \
|
||||
#define ROUNDUP(a) ((a) > 0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) \
|
||||
: sizeof(long))
|
||||
#endif /* IRIX */
|
||||
|
||||
#ifdef HAVE_SA_LEN
|
||||
#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
|
||||
#define ADVANCE(x, n) (x += ROUNDUP((n)->sa_len))
|
||||
#else
|
||||
#define ADVANCE(x, n) (x += ROUNDUP(4)) /* TODO: a hack!! */
|
||||
#define ADVANCE(x, n) (x += ROUNDUP(4)) /* TODO: a hack!! */
|
||||
#endif
|
||||
|
||||
/* Open and initialize the routing socket */
|
||||
@ -111,7 +111,7 @@ init_routesock()
|
||||
#if 0
|
||||
{
|
||||
int off;
|
||||
|
||||
|
||||
off = 0;
|
||||
if (setsockopt(routing_socket, SOL_SOCKET,
|
||||
SO_USELOOPBACK, (char *)&off,
|
||||
@ -120,7 +120,7 @@ init_routesock()
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -137,22 +137,22 @@ k_req_incoming(source, rpfp)
|
||||
struct sockaddr_in6 *source;
|
||||
struct rpfctl *rpfp;
|
||||
{
|
||||
int flags = RTF_STATIC;
|
||||
int flags = RTF_STATIC;
|
||||
register sup su;
|
||||
static int seq;
|
||||
int rlen;
|
||||
register char *cp = m_rtmsg.m_space;
|
||||
register int l;
|
||||
struct rpfctl rpfinfo;
|
||||
|
||||
|
||||
/* TODO: a hack!!!! */
|
||||
#ifdef HAVE_SA_LEN
|
||||
#define NEXTADDR(w, u) \
|
||||
#define NEXTADDR(w, u) \
|
||||
if (rtm_addrs & (w)) { \
|
||||
l = ROUNDUP(u.sa.sa_len); bcopy((char *)&(u), cp, l); cp += l;\
|
||||
}
|
||||
#else
|
||||
#define NEXTADDR(w, u) \
|
||||
#define NEXTADDR(w, u) \
|
||||
if (rtm_addrs & (w)) { \
|
||||
l = ROUNDUP(4); bcopy((char *)&(u), cp, l); cp += l;\
|
||||
}
|
||||
@ -161,7 +161,7 @@ k_req_incoming(source, rpfp)
|
||||
/* initialize */
|
||||
memset(&rpfp->rpfneighbor, 0, sizeof(rpfp->rpfneighbor));
|
||||
rpfp->source = *source;
|
||||
|
||||
|
||||
/* check if local address or directly connected before calling the
|
||||
* routing socket
|
||||
*/
|
||||
@ -169,7 +169,7 @@ k_req_incoming(source, rpfp)
|
||||
if ((rpfp->iif = find_vif_direct_local(source)) != NO_VIF) {
|
||||
rpfp->rpfneighbor = *source;
|
||||
return(TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
/* prepare the routing socket params */
|
||||
rtm_addrs |= RTA_DST;
|
||||
@ -191,7 +191,7 @@ k_req_incoming(source, rpfp)
|
||||
errno = 0;
|
||||
bzero((char *)&m_rtmsg, sizeof(m_rtmsg));
|
||||
|
||||
#define rtm m_rtmsg.m_rtm
|
||||
#define rtm m_rtmsg.m_rtm
|
||||
rtm.rtm_type = RTM_GET;
|
||||
rtm.rtm_flags = flags;
|
||||
rtm.rtm_version = RTM_VERSION;
|
||||
@ -203,7 +203,7 @@ k_req_incoming(source, rpfp)
|
||||
NEXTADDR(RTA_DST, so_dst);
|
||||
NEXTADDR(RTA_IFP, so_ifp);
|
||||
rtm.rtm_msglen = l = cp - (char *)&m_rtmsg;
|
||||
|
||||
|
||||
if ((rlen = write(routing_socket, (char *)&m_rtmsg, l)) < 0) {
|
||||
IF_DEBUG(DEBUG_RPF | DEBUG_KERN) {
|
||||
if (errno == ESRCH)
|
||||
@ -212,19 +212,19 @@ k_req_incoming(source, rpfp)
|
||||
else
|
||||
log(LOG_DEBUG, 0, "Error writing to routing socket");
|
||||
}
|
||||
return(FALSE);
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
do {
|
||||
l = read(routing_socket, (char *)&m_rtmsg, sizeof(m_rtmsg));
|
||||
} while (l > 0 && (rtm.rtm_seq != seq || rtm.rtm_pid != pid));
|
||||
|
||||
|
||||
if (l < 0) {
|
||||
IF_DEBUG(DEBUG_RPF | DEBUG_KERN)
|
||||
log(LOG_DEBUG, 0, "Read from routing socket failed: %s", strerror(errno));
|
||||
return(FALSE);
|
||||
}
|
||||
|
||||
|
||||
if (getmsg(&rtm, l, &rpfinfo)){
|
||||
rpfp->rpfneighbor = rpfinfo.rpfneighbor;
|
||||
rpfp->iif = rpfinfo.iif;
|
||||
@ -237,7 +237,7 @@ k_req_incoming(source, rpfp)
|
||||
/*
|
||||
* Returns TRUE on success, FALSE otherwise. rpfinfo contains the result.
|
||||
*/
|
||||
int
|
||||
int
|
||||
getmsg(rtm, msglen, rpfinfop)
|
||||
register struct rt_msghdr *rtm;
|
||||
int msglen;
|
||||
@ -252,10 +252,10 @@ getmsg(rtm, msglen, rpfinfop)
|
||||
vifi_t vifi;
|
||||
struct uvif *v;
|
||||
char in6txt[INET6_ADDRSTRLEN];
|
||||
|
||||
|
||||
if (rpfinfop == (struct rpfctl *)NULL)
|
||||
return(FALSE);
|
||||
|
||||
|
||||
sin6 = (struct sockaddr_in6 *)&so_dst;
|
||||
IF_DEBUG(DEBUG_RPF)
|
||||
log(LOG_DEBUG, 0, "route to: %s",
|
||||
@ -283,7 +283,7 @@ getmsg(rtm, msglen, rpfinfop)
|
||||
}
|
||||
ADVANCE(cp, sa);
|
||||
}
|
||||
|
||||
|
||||
if (!ifp){ /* No incoming interface */
|
||||
IF_DEBUG(DEBUG_RPF)
|
||||
log(LOG_DEBUG, 0,
|
||||
@ -320,18 +320,18 @@ getmsg(rtm, msglen, rpfinfop)
|
||||
rpfinfop->rpfneighbor.sin6_addr.s6_addr[3] = 0;
|
||||
}
|
||||
}
|
||||
|
||||
for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v)
|
||||
|
||||
for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v)
|
||||
/* get the number of the interface by matching the name */
|
||||
if ((strlen(v->uv_name) == ifp->sdl_nlen) &&
|
||||
!(strncmp(v->uv_name,ifp->sdl_data,ifp->sdl_nlen)))
|
||||
break;
|
||||
|
||||
|
||||
IF_DEBUG(DEBUG_RPF)
|
||||
log(LOG_DEBUG, 0, " iif is %d", vifi);
|
||||
|
||||
|
||||
rpfinfop->iif = vifi;
|
||||
|
||||
|
||||
if (vifi >= numvifs){
|
||||
IF_DEBUG(DEBUG_RPF)
|
||||
log(LOG_DEBUG, 0,
|
||||
@ -339,7 +339,7 @@ getmsg(rtm, msglen, rpfinfop)
|
||||
inet_ntop(AF_INET6, &sin6->sin6_addr, in6txt, INET6_ADDRSTRLEN));
|
||||
return(FALSE);/* invalid iif */
|
||||
}
|
||||
|
||||
|
||||
return(TRUE);
|
||||
}
|
||||
|
||||
@ -361,7 +361,7 @@ k_req_incoming(source, rpfcinfo)
|
||||
rpfcinfo->iif = NO_VIF; /* just initialized, will be */
|
||||
/* changed in kernel */
|
||||
memset(&rpfcinfo->rpfneighbor, 0, sizeof(rpfcinfo->rpfneighbor)); /* initialized */
|
||||
|
||||
|
||||
if (ioctl(udp_socket, SIOCGETRPF, (char *) rpfcinfo) < 0){
|
||||
log(LOG_ERR, errno, "ioctl SIOCGETRPF k_req_incoming");
|
||||
return(FALSE);
|
||||
|
@ -10,15 +10,15 @@
|
||||
* documentation, and that any documentation, advertising materials,
|
||||
* and other materials related to such distribution and use acknowledge
|
||||
* that the software was developed by the University of Oregon.
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* The name of the University of Oregon may not be used to endorse or
|
||||
* promote products derived from this software without specific prior
|
||||
* written permission.
|
||||
*
|
||||
* THE UNIVERSITY OF OREGON DOES NOT MAKE ANY REPRESENTATIONS
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL UO, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -30,22 +30,22 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Kurt Windisch (kurtw@antc.uoregon.edu)
|
||||
*
|
||||
* $Id: timer.c,v 1.3 1999/09/15 07:45:12 jinmei Exp $
|
||||
* $Id: timer.c,v 1.5 2000/05/18 16:09:39 itojun Exp $
|
||||
*/
|
||||
/*
|
||||
* Part of this program has been derived from PIM sparse-mode pimd.
|
||||
* The pimd program is covered by the license in the accompanying file
|
||||
* named "LICENSE.pimd".
|
||||
*
|
||||
*
|
||||
* The pimd program is COPYRIGHT 1998 by University of Southern California.
|
||||
*
|
||||
* Part of this program has been derived from mrouted.
|
||||
* The mrouted program is covered by the license in the accompanying file
|
||||
* named "LICENSE.mrouted".
|
||||
*
|
||||
*
|
||||
* The mrouted program is COPYRIGHT 1989 by The Board of Trustees of
|
||||
* Leland Stanford Junior University.
|
||||
*
|
||||
@ -116,7 +116,7 @@ age_vifs()
|
||||
|
||||
/* XXX: TODO: currently, sending to qe* interface which is DOWN
|
||||
* doesn't return error (ENETDOWN) on my Solaris machine,
|
||||
* so have to check periodically the
|
||||
* so have to check periodically the
|
||||
* interfaces status. If this is fixed, just remove the defs around
|
||||
* the "if (vifs_down)" line.
|
||||
*/
|
||||
@ -130,6 +130,20 @@ age_vifs()
|
||||
for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) {
|
||||
if (v->uv_flags & (VIFF_DISABLED | VIFF_DOWN))
|
||||
continue;
|
||||
|
||||
/* Timeout the MLD querier (unless we re the querier) */
|
||||
if ((v->uv_flags & VIFF_QUERIER) == 0 &&
|
||||
v->uv_querier) { /* this must be non-NULL, but check for safety. */
|
||||
IF_TIMEOUT(v->uv_querier->al_timer) {
|
||||
/* act as a querier by myself */
|
||||
v->uv_flags |= VIFF_QUERIER;
|
||||
v->uv_querier->al_addr = v->uv_linklocal->pa_addr;
|
||||
v->uv_querier->al_timer = MLD6_OTHER_QUERIER_PRESENT_INTERVAL;
|
||||
time(&v->uv_querier->al_ctime); /* reset timestamp */
|
||||
query_groups(v);
|
||||
}
|
||||
}
|
||||
|
||||
/* Timeout neighbors */
|
||||
for (curr_nbr = v->uv_pim_neighbors; curr_nbr != NULL;
|
||||
curr_nbr = next_nbr) {
|
||||
@ -146,7 +160,7 @@ age_vifs()
|
||||
|
||||
delete_pim6_nbr(curr_nbr);
|
||||
}
|
||||
|
||||
|
||||
/* PIM_HELLO periodic */
|
||||
IF_TIMEOUT(v->uv_pim_hello_timer)
|
||||
send_pim6_hello(v, PIM_TIMER_HELLO_HOLDTIME);
|
||||
@ -191,16 +205,16 @@ age_routes()
|
||||
ucast_flag = FALSE;
|
||||
}
|
||||
|
||||
/* Walk the the (S,G) entries */
|
||||
if(grplist == (grpentry_t *)NULL)
|
||||
/* Walk the (S,G) entries */
|
||||
if(grplist == (grpentry_t *)NULL)
|
||||
return;
|
||||
for(grpentry_ptr = grplist;
|
||||
grpentry_ptr != (grpentry_t *)NULL;
|
||||
grpentry_ptr != (grpentry_t *)NULL;
|
||||
grpentry_ptr = grpentry_next) {
|
||||
grpentry_next = grpentry_ptr->next;
|
||||
|
||||
for(mrtentry_ptr = grpentry_ptr->mrtlink;
|
||||
mrtentry_ptr != (mrtentry_t *)NULL;
|
||||
for(mrtentry_ptr = grpentry_ptr->mrtlink;
|
||||
mrtentry_ptr != (mrtentry_t *)NULL;
|
||||
mrtentry_ptr = mrtentry_next) {
|
||||
mrtentry_next = mrtentry_ptr->grpnext;
|
||||
|
||||
@ -214,21 +228,21 @@ age_routes()
|
||||
delete_mrtentry(mrtentry_ptr);
|
||||
continue;
|
||||
}
|
||||
if(!(IF_ISEMPTY(&mrtentry_ptr->oifs)) &&
|
||||
if(!(IF_ISEMPTY(&mrtentry_ptr->oifs)) &&
|
||||
curr_bytecnt != mrtentry_ptr->sg_count.bytecnt) {
|
||||
/* Packets have been forwarded - refresh timer
|
||||
* Note that these counters count packets received,
|
||||
* Note that these counters count packets received,
|
||||
* not packets forwarded. So only refresh if packets
|
||||
* received and non-null oiflist.
|
||||
*/
|
||||
IF_DEBUG(DEBUG_MFC)
|
||||
log(LOG_DEBUG, 0,
|
||||
log(LOG_DEBUG, 0,
|
||||
"Refreshing src %s, dst %s after %d bytes forwarded",
|
||||
inet6_fmt(&mrtentry_ptr->source->address.sin6_addr),
|
||||
inet6_fmt(&mrtentry_ptr->group->group.sin6_addr),
|
||||
mrtentry_ptr->sg_count.bytecnt);
|
||||
mrtentry_ptr->sg_count.bytecnt);
|
||||
SET_TIMER(mrtentry_ptr->timer, PIM_DATA_TIMEOUT);
|
||||
}
|
||||
}
|
||||
|
||||
/* Time out the entry */
|
||||
IF_TIMEOUT(mrtentry_ptr->timer) {
|
||||
@ -237,7 +251,7 @@ age_routes()
|
||||
}
|
||||
|
||||
/* Time out asserts */
|
||||
if(mrtentry_ptr->flags & MRTF_ASSERTED)
|
||||
if(mrtentry_ptr->flags & MRTF_ASSERTED)
|
||||
IF_TIMEOUT(mrtentry_ptr->assert_timer) {
|
||||
mrtentry_ptr->flags &= ~MRTF_ASSERTED;
|
||||
mrtentry_ptr->upstream = mrtentry_ptr->source->upstream;
|
||||
@ -255,7 +269,7 @@ age_routes()
|
||||
change_flag = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Unicast Route changes */
|
||||
update_src_iif = FALSE;
|
||||
if (ucast_flag == TRUE) {
|
||||
@ -264,7 +278,7 @@ age_routes()
|
||||
srcentry_save.upstream = mrtentry_ptr->source->upstream;
|
||||
srcentry_save.preference = mrtentry_ptr->source->preference;
|
||||
srcentry_save.metric = mrtentry_ptr->source->metric;
|
||||
|
||||
|
||||
if (set_incoming(mrtentry_ptr->source,
|
||||
PIM_IIF_SOURCE) != TRUE) {
|
||||
/*
|
||||
@ -277,7 +291,7 @@ age_routes()
|
||||
}
|
||||
else {
|
||||
/* iif info found */
|
||||
if (!(mrtentry_ptr->flags & MRTF_ASSERTED) &&
|
||||
if (!(mrtentry_ptr->flags & MRTF_ASSERTED) &&
|
||||
((srcentry_save.incoming !=
|
||||
mrtentry_ptr->incoming)
|
||||
|| (srcentry_save.upstream !=
|
||||
@ -294,9 +308,9 @@ age_routes()
|
||||
* larger and thus the correct assert winner
|
||||
* from upstream will be chosen.
|
||||
*/
|
||||
mrtentry_ptr->preference =
|
||||
mrtentry_ptr->preference =
|
||||
mrtentry_ptr->source->preference;
|
||||
mrtentry_ptr->metric =
|
||||
mrtentry_ptr->metric =
|
||||
mrtentry_ptr->source->metric;
|
||||
}
|
||||
}
|
||||
@ -304,7 +318,7 @@ age_routes()
|
||||
|
||||
if ((change_flag == TRUE) || (update_src_iif == TRUE)) {
|
||||
/* Flush the changes */
|
||||
state_change =
|
||||
state_change =
|
||||
change_interfaces(mrtentry_ptr,
|
||||
mrtentry_ptr->incoming,
|
||||
&mrtentry_ptr->pruned_oifs,
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 1999 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:
|
||||
@ -13,7 +13,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
|
||||
@ -47,7 +47,7 @@
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL USC, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -59,7 +59,7 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
|
||||
*
|
||||
* $Id: trace.c,v 1.5 1999/09/16 08:46:00 jinmei Exp $
|
||||
@ -113,7 +113,7 @@ accept_mtrace(src, dst, group, ifindex, data, no, datalen)
|
||||
struct sockaddr_in6 *sa_global;
|
||||
#ifdef SM_ONLY
|
||||
rpentry_t *rpentry_ptr;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* Remember qid across invocations */
|
||||
static u_int32 oqid = 0;
|
||||
@ -202,9 +202,9 @@ accept_mtrace(src, dst, group, ifindex, data, no, datalen)
|
||||
} else
|
||||
log(LOG_DEBUG, 0, "...no route");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Query type packet - check if rte exists
|
||||
* Query type packet - check if rte exists
|
||||
* Check if the query destination is a vif connected to me.
|
||||
* and if so, whether I should start response back
|
||||
*/
|
||||
@ -238,7 +238,7 @@ accept_mtrace(src, dst, group, ifindex, data, no, datalen)
|
||||
#endif
|
||||
}
|
||||
vifi = find_vif_direct(&dst_sa6);
|
||||
|
||||
|
||||
if (vifi == NO_VIF) {
|
||||
/*
|
||||
* The traceroute destination is not on one of
|
||||
@ -276,21 +276,21 @@ accept_mtrace(src, dst, group, ifindex, data, no, datalen)
|
||||
"Wrong interface for packet");
|
||||
errcode = TR_WRONG_IF;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* Now that we've decided to send a response, save the qid */
|
||||
oqid = qry->tr_qid;
|
||||
|
||||
IF_DEBUG(DEBUG_TRACE)
|
||||
log(LOG_DEBUG, 0, "Sending traceroute response");
|
||||
|
||||
|
||||
/* 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.
|
||||
@ -309,7 +309,7 @@ accept_mtrace(src, dst, group, ifindex, data, no, datalen)
|
||||
bzero(resp, sizeof(struct tr6_resp));
|
||||
datalen += (RLEN + sizeof(struct mld6_hdr));
|
||||
|
||||
resp->tr_qarr = htonl(((tp.tv_sec + JAN_1970) << 16) +
|
||||
resp->tr_qarr = htonl(((tp.tv_sec + JAN_1970) << 16) +
|
||||
((tp.tv_usec << 10) / 15625));
|
||||
|
||||
resp->tr_rproto = PROTO_PIM;
|
||||
@ -532,7 +532,7 @@ accept_mtrace(src, dst, group, ifindex, data, no, datalen)
|
||||
"reply" : "request on",
|
||||
inet6_fmt(dst),
|
||||
sa6 ? inet6_fmt(&sa6->sin6_addr) : "unspecified");
|
||||
|
||||
|
||||
send_mld6(resptype, no, sa6, &resp_sa6, group, ifindex,
|
||||
0, datalen, 0);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* Copyright (C) 1999 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:
|
||||
@ -13,7 +13,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
|
||||
@ -47,7 +47,7 @@
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL USC, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -59,7 +59,7 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
|
||||
*
|
||||
* $Id: trace.h,v 1.2 1999/09/12 17:00:10 jinmei Exp $
|
||||
@ -96,8 +96,8 @@ struct tr6_query {
|
||||
#endif /* BYTE_ORDER */
|
||||
};
|
||||
|
||||
#define tr_rhlim q.rhlim
|
||||
#define tr_qid q.qid
|
||||
#define tr_rhlim q.rhlim
|
||||
#define tr_qid q.qid
|
||||
|
||||
/*
|
||||
* Traceroute response format. A traceroute response has a tr_query at the
|
||||
@ -126,60 +126,60 @@ struct tr6_resp {
|
||||
};
|
||||
|
||||
/* defs within mtrace */
|
||||
#define QUERY 1
|
||||
#define RESP 2
|
||||
#define QLEN sizeof(struct tr6_query)
|
||||
#define RLEN sizeof(struct tr6_resp)
|
||||
#define QUERY 1
|
||||
#define RESP 2
|
||||
#define QLEN sizeof(struct tr6_query)
|
||||
#define RLEN sizeof(struct tr6_resp)
|
||||
|
||||
/* fields for tr_inifid and tr_outifid */
|
||||
#define TR_NO_VIF 0xffffffff/* interface can't be determined */
|
||||
#define TR_NO_VIF 0xffffffff/* interface can't be determined */
|
||||
|
||||
/* fields for tr_rflags (forwarding error codes) */
|
||||
#define TR_NO_ERR 0 /* No error */
|
||||
#define TR_WRONG_IF 1 /* traceroute arrived on non-oif */
|
||||
#define TR_PRUNED 2 /* router has sent a prune upstream */
|
||||
#define TR_OPRUNED 3 /* stop forw. after request from next hop rtr*/
|
||||
#define TR_SCOPED 4 /* group adm. scoped at this hop */
|
||||
#define TR_NO_RTE 5 /* no route for the source */
|
||||
#define TR_NO_LHR 6 /* not the last-hop router */
|
||||
#define TR_NO_FWD 7 /* not forwarding for this (S,G). Reason = ? */
|
||||
#define TR_RP 8 /* I am the RP/Core */
|
||||
#define TR_IIF 9 /* request arrived on the iif */
|
||||
#define TR_NO_MULTI 0x0a /* multicast disabled on that interface */
|
||||
#define TR_NO_SPACE 0x81 /* no space to insert responce data block */
|
||||
#define TR_OLD_ROUTER 0x82 /* previous hop does not support traceroute */
|
||||
#define TR_ADMIN_PROHIB 0x83 /* traceroute adm. prohibited */
|
||||
#define TR_NO_ERR 0 /* No error */
|
||||
#define TR_WRONG_IF 1 /* traceroute arrived on non-oif */
|
||||
#define TR_PRUNED 2 /* router has sent a prune upstream */
|
||||
#define TR_OPRUNED 3 /* stop forw. after request from next hop rtr*/
|
||||
#define TR_SCOPED 4 /* group adm. scoped at this hop */
|
||||
#define TR_NO_RTE 5 /* no route for the source */
|
||||
#define TR_NO_LHR 6 /* not the last-hop router */
|
||||
#define TR_NO_FWD 7 /* not forwarding for this (S,G). Reason = ? */
|
||||
#define TR_RP 8 /* I am the RP/Core */
|
||||
#define TR_IIF 9 /* request arrived on the iif */
|
||||
#define TR_NO_MULTI 0x0a /* multicast disabled on that interface */
|
||||
#define TR_NO_SPACE 0x81 /* no space to insert responce data block */
|
||||
#define TR_OLD_ROUTER 0x82 /* previous hop does not support traceroute */
|
||||
#define TR_ADMIN_PROHIB 0x83 /* traceroute adm. prohibited */
|
||||
|
||||
/* fields for tr_flags */
|
||||
#define TR_SUBNET_COUNT 0x80 /* pkt count for (S,G) is for source network */
|
||||
#define TR_SUBNET_COUNT 0x80 /* pkt count for (S,G) is for source network */
|
||||
|
||||
/* fields for r_plen */
|
||||
#define TR_GROUP_ONLY 0xff /* forwarding solely on group state */
|
||||
#define TR_GROUP_ONLY 0xff /* forwarding solely on group state */
|
||||
|
||||
/* fields for packets count */
|
||||
#define TR_CANT_COUNT 0xffffffff /* no count can be reported */
|
||||
#define TR_CANT_COUNT 0xffffffff /* no count can be reported */
|
||||
|
||||
/* fields for tr_rproto (routing protocol) */
|
||||
#define PROTO_DVMRP 1
|
||||
#define PROTO_MOSPF 2
|
||||
#define PROTO_PIM 3
|
||||
#define PROTO_CBT 4
|
||||
#define PROTO_PIM_SPECIAL 5
|
||||
#define PROTO_PIM_STATIC 6
|
||||
#define PROTO_DVMRP_STATIC 7
|
||||
#define PROTO_DVMRP 1
|
||||
#define PROTO_MOSPF 2
|
||||
#define PROTO_PIM 3
|
||||
#define PROTO_CBT 4
|
||||
#define PROTO_PIM_SPECIAL 5
|
||||
#define PROTO_PIM_STATIC 6
|
||||
#define PROTO_DVMRP_STATIC 7
|
||||
|
||||
#define MASK_TO_VAL(x, i) { \
|
||||
#define MASK_TO_VAL(x, i) { \
|
||||
u_int32_t _x = ntohl(x); \
|
||||
(i) = 1; \
|
||||
while ((_x) <<= 1) \
|
||||
(i)++; \
|
||||
};
|
||||
|
||||
#define VAL_TO_MASK(x, i) { \
|
||||
#define VAL_TO_MASK(x, i) { \
|
||||
x = htonl(~((1 << (32 - (i))) - 1)); \
|
||||
};
|
||||
|
||||
#define MASKLEN_TO_MASK6(masklen, mask6) \
|
||||
#define MASKLEN_TO_MASK6(masklen, mask6) \
|
||||
do {\
|
||||
u_char maskarray[8] = \
|
||||
{0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff}; \
|
||||
@ -195,10 +195,10 @@ struct tr6_resp {
|
||||
|
||||
/* obnoxious gcc gives an extraneous warning about this constant... */
|
||||
#if defined(__STDC__) || defined(__GNUC__)
|
||||
#define JAN_1970 2208988800UL /* 1970 - 1900 in seconds */
|
||||
#define JAN_1970 2208988800UL /* 1970 - 1900 in seconds */
|
||||
#else
|
||||
#define JAN_1970 2208988800L /* 1970 - 1900 in seconds */
|
||||
#define const /**/
|
||||
#define JAN_1970 2208988800L /* 1970 - 1900 in seconds */
|
||||
#define const /**/
|
||||
#endif
|
||||
|
||||
#define NBR_VERS(n) (((n)->al_pv << 8) + (n)->al_mv)
|
||||
#define NBR_VERS(n) (((n)->al_pv << 8) + (n)->al_mv)
|
||||
|
@ -19,7 +19,7 @@
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL USC, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -31,10 +31,10 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
|
||||
*
|
||||
* $Id: vif.c,v 1.3 1999/09/12 17:00:11 jinmei Exp $
|
||||
* $Id: vif.c,v 1.5 2000/05/18 15:29:40 itojun Exp $
|
||||
*/
|
||||
/*
|
||||
* Part of this program has been derived from mrouted.
|
||||
@ -83,7 +83,7 @@ init_vifs()
|
||||
vifi_t vifi;
|
||||
struct uvif *v;
|
||||
int enabled_vifs;
|
||||
|
||||
|
||||
numvifs = 0;
|
||||
vifs_down = FALSE;
|
||||
|
||||
@ -137,7 +137,7 @@ init_vifs()
|
||||
*/
|
||||
enabled_vifs = 0;
|
||||
phys_vif = -1;
|
||||
|
||||
|
||||
for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) {
|
||||
if (v->uv_flags & (VIFF_DISABLED | VIFF_DOWN))
|
||||
continue;
|
||||
@ -184,11 +184,11 @@ start_all_vifs()
|
||||
if (v->uv_flags & (VIFF_DISABLED | VIFF_DOWN)) {
|
||||
if (v->uv_flags & VIFF_DISABLED)
|
||||
log(LOG_INFO, 0,
|
||||
"%s is DISABLED; if #%u out of service",
|
||||
"%s is DISABLED; if #%u out of service",
|
||||
v->uv_name, vifi);
|
||||
else
|
||||
log(LOG_INFO, 0,
|
||||
"%s is DOWN; if #%u out of service",
|
||||
"%s is DOWN; if #%u out of service",
|
||||
v->uv_name, vifi);
|
||||
}
|
||||
else
|
||||
@ -220,7 +220,7 @@ stop_all_vifs()
|
||||
* physical, tunnel (tunnels will be used in the future
|
||||
* when this code becomes PIM multicast boarder router.)
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
start_vif(vifi)
|
||||
vifi_t vifi;
|
||||
{
|
||||
@ -234,29 +234,36 @@ start_vif(vifi)
|
||||
/* TODO: CHECK THE TIMERS!!!!! Set or reset? */
|
||||
v->uv_gq_timer = 0;
|
||||
v->uv_pim_neighbors = (pim_nbr_entry_t *)NULL;
|
||||
|
||||
|
||||
/* Tell kernel to add, i.e. start this vif */
|
||||
k_add_vif(mld6_socket, vifi, &uvifs[vifi]);
|
||||
k_add_vif(mld6_socket, vifi, &uvifs[vifi]);
|
||||
log(LOG_INFO, 0, "%s comes up; if #%u now in service", v->uv_name, vifi);
|
||||
|
||||
|
||||
/*
|
||||
* Join the PIM multicast group on the interface.
|
||||
*/
|
||||
k_join(mld6_socket, &allpim6routers_group.sin6_addr, v->uv_ifindex);
|
||||
|
||||
|
||||
/*
|
||||
* Join the ALL-ROUTERS multicast group on the interface.
|
||||
* This allows mtrace requests to loop back if they are run
|
||||
* on the multicast router.
|
||||
*/
|
||||
k_join(mld6_socket, &allrouters_group.sin6_addr, v->uv_ifindex);
|
||||
|
||||
|
||||
/*
|
||||
* Until neighbors are discovered, assume responsibility for sending
|
||||
* periodic group membership queries to the subnet. Send the first
|
||||
* query.
|
||||
*/
|
||||
v->uv_flags |= VIFF_QUERIER;
|
||||
if (!v->uv_querier) {
|
||||
v->uv_querier = (struct listaddr *)malloc(sizeof(*v->uv_querier));
|
||||
memset(v->uv_querier, 0, sizeof(*v->uv_querier));
|
||||
}
|
||||
v->uv_querier->al_addr = v->uv_linklocal->pa_addr;
|
||||
v->uv_querier->al_timer = MLD6_OTHER_QUERIER_PRESENT_INTERVAL;
|
||||
time(&v->uv_querier->al_ctime); /* reset timestamp */
|
||||
query_groups(v);
|
||||
|
||||
/*
|
||||
@ -272,7 +279,7 @@ start_vif(vifi)
|
||||
* Stop a vif (either physical interface or tunnel).
|
||||
* If we are running only PIM we don't have tunnels.
|
||||
*/
|
||||
static void
|
||||
static void
|
||||
stop_vif(vifi)
|
||||
vifi_t vifi;
|
||||
{
|
||||
@ -280,11 +287,11 @@ stop_vif(vifi)
|
||||
struct listaddr *a;
|
||||
register pim_nbr_entry_t *n, *next;
|
||||
struct vif_acl *acl;
|
||||
|
||||
|
||||
/*
|
||||
* TODO: make sure that the kernel viftable is
|
||||
* TODO: make sure that the kernel viftable is
|
||||
* consistent with the daemon table
|
||||
*/
|
||||
*/
|
||||
v = &uvifs[vifi];
|
||||
k_leave(mld6_socket, &allpim6routers_group.sin6_addr, v->uv_ifindex);
|
||||
k_leave(mld6_socket, &allrouters_group.sin6_addr, v->uv_ifindex);
|
||||
@ -297,15 +304,15 @@ stop_vif(vifi)
|
||||
v->uv_groups = a->al_next;
|
||||
free((char *)a);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* TODO: inform (eventually) the neighbors I am going down by sending
|
||||
* PIM_HELLO with holdtime=0 so someone else should become a DR.
|
||||
*/
|
||||
*/
|
||||
|
||||
/* TODO: dummy! Implement it!! Any problems if don't use it? */
|
||||
delete_vif_from_mrt(vifi);
|
||||
|
||||
|
||||
/*
|
||||
* Delete the interface from the kernel's vif structure.
|
||||
*/
|
||||
@ -331,7 +338,7 @@ stop_vif(vifi)
|
||||
vifs_down = TRUE;
|
||||
log(LOG_INFO, 0,
|
||||
"%s goes down; if #%u out of service", v->uv_name, vifi);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* return the max global Ipv6 address of an UP and ENABLED interface
|
||||
@ -368,7 +375,7 @@ max_global_address()
|
||||
&p->pa_addr) &&
|
||||
!IN6_IS_ADDR_LINKLOCAL(&p->pa_addr.sin6_addr) &&
|
||||
!IN6_IS_ADDR_SITELOCAL(&p->pa_addr.sin6_addr))
|
||||
pmax=p;
|
||||
pmax=p;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -422,7 +429,7 @@ check_vif_state()
|
||||
for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) {
|
||||
if (v->uv_flags & VIFF_DISABLED)
|
||||
continue;
|
||||
|
||||
|
||||
strncpy(ifr.ifr_name, v->uv_name, IFNAMSIZ);
|
||||
/* get the interface flags */
|
||||
if (ioctl(udp_socket, SIOCGIFFLAGS, (char *)&ifr) < 0)
|
||||
@ -455,14 +462,14 @@ check_vif_state()
|
||||
* Local addresses are excluded.
|
||||
* Return the vif number or NO_VIF if not found.
|
||||
*/
|
||||
vifi_t
|
||||
vifi_t
|
||||
find_vif_direct(src)
|
||||
struct sockaddr_in6 *src;
|
||||
{
|
||||
vifi_t vifi;
|
||||
register struct uvif *v;
|
||||
register struct phaddr *p;
|
||||
|
||||
|
||||
for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) {
|
||||
if (v->uv_flags & (VIFF_DISABLED | VIFF_DOWN | VIFF_TUNNEL))
|
||||
continue;
|
||||
@ -474,7 +481,7 @@ find_vif_direct(src)
|
||||
}
|
||||
}
|
||||
return (NO_VIF);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
@ -488,7 +495,7 @@ local_address(src)
|
||||
vifi_t vifi;
|
||||
register struct uvif *v;
|
||||
register struct phaddr *p;
|
||||
|
||||
|
||||
for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) {
|
||||
if (v->uv_flags & (VIFF_DISABLED | VIFF_DOWN))
|
||||
continue;
|
||||
@ -496,9 +503,9 @@ local_address(src)
|
||||
if (inet6_equal(src, &p->pa_addr))
|
||||
return(vifi);
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Returning NO_VIF means not a local address */
|
||||
return (NO_VIF);
|
||||
return (NO_VIF);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -507,14 +514,14 @@ local_address(src)
|
||||
* (tunnels excluded).
|
||||
* Return the vif number or NO_VIF if not found.
|
||||
*/
|
||||
vifi_t
|
||||
vifi_t
|
||||
find_vif_direct_local(src)
|
||||
struct sockaddr_in6 *src;
|
||||
{
|
||||
vifi_t vifi;
|
||||
register struct uvif *v;
|
||||
register struct phaddr *p;
|
||||
|
||||
|
||||
for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) {
|
||||
if (v->uv_flags & (VIFF_DISABLED | VIFF_DOWN | VIFF_TUNNEL))
|
||||
continue;
|
||||
@ -525,4 +532,4 @@ find_vif_direct_local(src)
|
||||
}
|
||||
}
|
||||
return (NO_VIF);
|
||||
}
|
||||
}
|
||||
|
@ -19,7 +19,7 @@
|
||||
* ABOUT THE SUITABILITY OF THIS SOFTWARE FOR ANY PURPOSE. THIS SOFTWARE IS
|
||||
* PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND
|
||||
* NON-INFRINGEMENT.
|
||||
*
|
||||
* IN NO EVENT SHALL USC, OR ANY OTHER CONTRIBUTOR BE LIABLE FOR ANY
|
||||
@ -31,7 +31,7 @@
|
||||
* noted when applicable.
|
||||
*/
|
||||
/*
|
||||
* Questions concerning this software should be directed to
|
||||
* Questions concerning this software should be directed to
|
||||
* Pavlin Ivanov Radoslavov (pavlin@catarina.usc.edu)
|
||||
*
|
||||
* $Id: vif.h,v 1.2 1999/08/24 16:45:23 jinmei Exp $
|
||||
@ -65,9 +65,9 @@ typedef u_int32 vifbitmap_t;
|
||||
#define VIFM_SET(n, m) ((m) |= (1 << (n)))
|
||||
#define VIFM_CLR(n, m) ((m) &= ~(1 << (n)))
|
||||
#define VIFM_ISSET(n, m) ((m) & (1 << (n)))
|
||||
#define VIFM_CLRALL(m) ((m) = 0x00000000)
|
||||
#define VIFM_COPY(mfrom, mto) ((mto) = (mfrom))
|
||||
#define VIFM_SAME(m1, m2) ((m1) == (m2))
|
||||
#define VIFM_CLRALL(m) ((m) = 0x00000000)
|
||||
#define VIFM_COPY(mfrom, mto) ((mto) = (mfrom))
|
||||
#define VIFM_SAME(m1, m2) ((m1) == (m2))
|
||||
#endif
|
||||
/*
|
||||
* And <netinet/ip_mroute.h> was missing some required functions anyway
|
||||
@ -79,31 +79,31 @@ typedef u_int32 vifbitmap_t;
|
||||
#define VIFM_ISEMPTY(m) ((m) == 0)
|
||||
#define VIFM_CLR_MASK(m, mask) ((m) &= ~(mask))
|
||||
#define VIFM_SET_MASK(m, mask) ((m) |= (mask))
|
||||
#define VIFM_MERGE(m1, m2, result) ((result) = (m1) | (m2))
|
||||
#define VIFM_MERGE(m1, m2, result) ((result) = (m1) | (m2))
|
||||
|
||||
/*
|
||||
* And <netinet6/ip6_mroute.h> was missing some required functions anyway
|
||||
*/
|
||||
extern if_set if_nullset;
|
||||
#define IF_ISEMPTY(p) (memcmp((p), &if_nullset, sizeof(if_nullset)) == 0)
|
||||
#define IF_CLR_MASK(p, mask) \
|
||||
#define IF_ISEMPTY(p) (memcmp((p), &if_nullset, sizeof(if_nullset)) == 0)
|
||||
#define IF_CLR_MASK(p, mask) \
|
||||
{\
|
||||
int idx;\
|
||||
for (idx = 0; idx < sizeof(*(p))/sizeof(fd_mask); idx++) {\
|
||||
(p)->ifs_bits[idx] &= ~((mask)->ifs_bits[idx]);\
|
||||
}\
|
||||
}
|
||||
#define IF_MERGE(p1, p2, result) \
|
||||
#define IF_MERGE(p1, p2, result) \
|
||||
{\
|
||||
int idx;\
|
||||
for (idx = 0; idx < sizeof(*(p1))/sizeof(fd_mask); idx++) {\
|
||||
(result)->ifs_bits[idx] = (p1)->ifs_bits[idx]|(p2)->ifs_bits[idx]; \
|
||||
}\
|
||||
}
|
||||
#define IF_SAME(p1, p2) (memcmp((p1),(p2),sizeof(*(p1))) == 0)
|
||||
#define IF_SAME(p1, p2) (memcmp((p1),(p2),sizeof(*(p1))) == 0)
|
||||
|
||||
/* Check whether I am the forwarder on some LAN */
|
||||
#define VIFM_FORWARDER(leaves, oifs) ((leaves) & (oifs))
|
||||
#define VIFM_FORWARDER(leaves, oifs) ((leaves) & (oifs))
|
||||
|
||||
/*
|
||||
* Neighbor bitmaps are, for efficiency, implemented as a struct
|
||||
@ -111,7 +111,7 @@ extern if_set if_nullset;
|
||||
* have a native type that's bigger than a long, define it below.
|
||||
*/
|
||||
#define NBRTYPE u_long
|
||||
#define NBRBITS sizeof(NBRTYPE) * 8
|
||||
#define NBRBITS sizeof(NBRTYPE) * 8
|
||||
|
||||
typedef struct {
|
||||
NBRTYPE hi;
|
||||
@ -153,8 +153,8 @@ typedef struct {
|
||||
* (called a "phyint"), a virtual point-to-point link (called a "tunnel")
|
||||
* or a "register vif" used by PIM. The register vif is used by the
|
||||
* Designated Router (DR) to send encapsulated data packets to the
|
||||
* Rendevous Point (RP) for a particular group. The data packets are
|
||||
* encapsulated in PIM messages (IPPROTO_PIM = 103) and then unicast to
|
||||
* Rendevous Point (RP) for a particular group. The data packets are
|
||||
* encapsulated in PIM messages (IPPROTO_PIM = 103) and then unicast to
|
||||
* the RP.
|
||||
* (Note: all addresses, subnet numbers and masks are kept in NETWORK order.)
|
||||
*/
|
||||
@ -164,13 +164,13 @@ struct uvif {
|
||||
u_char uv_admetric; /* advertised cost of this vif */
|
||||
#if 0 /* unused for IPv6? */
|
||||
u_char uv_threshold; /* min ttl required to forward on vif */
|
||||
#endif
|
||||
#endif
|
||||
u_int uv_rate_limit; /* rate limit on this vif */
|
||||
struct sockaddr_in6 uv_lcl_addr;/* local address of this vif */
|
||||
struct phaddr *uv_linklocal;/* link-local address of this vif */
|
||||
#if 0
|
||||
u_int32 uv_rmt_addr; /* remote end-point addr (tunnels only) */
|
||||
#endif
|
||||
#endif
|
||||
struct sockaddr_in6 uv_dst_addr; /* destination for PIM messages */
|
||||
struct sockaddr_in6 uv_prefix; /* prefix (phyints only) */
|
||||
struct in6_addr uv_subnetmask; /* subnet mask (phyints only) */
|
||||
@ -194,24 +194,24 @@ struct uvif {
|
||||
};
|
||||
|
||||
/* TODO: define VIFF_KERNEL_FLAGS */
|
||||
#define VIFF_KERNEL_FLAGS (VIFF_TUNNEL | VIFF_SRCRT)
|
||||
#define VIFF_DOWN 0x000100 /* kernel state of interface */
|
||||
#define VIFF_DISABLED 0x000200 /* administratively disabled */
|
||||
#define VIFF_QUERIER 0x000400 /* I am the subnet's querier */
|
||||
#define VIFF_ONEWAY 0x000800 /* Maybe one way interface */
|
||||
#define VIFF_LEAF 0x001000 /* all neighbors are leaves */
|
||||
#define VIFF_IGMPV1 0x002000 /* Act as an IGMPv1 Router */
|
||||
#define VIFF_KERNEL_FLAGS (VIFF_TUNNEL | VIFF_SRCRT)
|
||||
#define VIFF_DOWN 0x000100 /* kernel state of interface */
|
||||
#define VIFF_DISABLED 0x000200 /* administratively disabled */
|
||||
#define VIFF_QUERIER 0x000400 /* I am the subnet's querier */
|
||||
#define VIFF_ONEWAY 0x000800 /* Maybe one way interface */
|
||||
#define VIFF_LEAF 0x001000 /* all neighbors are leaves */
|
||||
#define VIFF_IGMPV1 0x002000 /* Act as an IGMPv1 Router */
|
||||
#define VIFF_REXMIT_PRUNES 0x004000 /* retransmit prunes */
|
||||
#define VIFF_PASSIVE 0x008000 /* passive tunnel */
|
||||
#define VIFF_PASSIVE 0x008000 /* passive tunnel */
|
||||
#define VIFF_ALLOW_NONPRUNERS 0x010000 /* ok to peer with nonprunrs */
|
||||
#define VIFF_NOFLOOD 0x020000 /* don't flood on this vif */
|
||||
#define VIFF_NOFLOOD 0x020000 /* don't flood on this vif */
|
||||
#define VIFF_DR 0x040000 /* designated router */
|
||||
/* TODO: VIFF_NONBRS == VIFF_ONEWAY? */
|
||||
#define VIFF_NONBRS 0x080000 /* no neighbor on vif */
|
||||
#define VIFF_POINT_TO_POINT 0x100000 /* point-to-point link */
|
||||
#define VIFF_PIM_NBR 0x200000 /* PIM neighbor */
|
||||
#define VIFF_DVMRP_NBR 0x400000 /* DVMRP neighbor */
|
||||
#define VIFF_NOLISTENER 0x800000 /* no listener on the link */
|
||||
#define VIFF_POINT_TO_POINT 0x100000 /* point-to-point link */
|
||||
#define VIFF_PIM_NBR 0x200000 /* PIM neighbor */
|
||||
#define VIFF_DVMRP_NBR 0x400000 /* DVMRP neighbor */
|
||||
#define VIFF_NOLISTENER 0x800000 /* no listener on the link */
|
||||
|
||||
struct phaddr {
|
||||
struct phaddr *pa_next;
|
||||
@ -278,12 +278,12 @@ struct listaddr {
|
||||
#define NBRF_DONTPEER (NBRF_WAITING|NBRF_ONEWAY|NBRF_TOOOLD| \
|
||||
NBRF_TOOMANYROUTES|NBRF_NOTPRUNING)
|
||||
|
||||
#define NO_VIF ((vifi_t)MAXMIFS) /* An invalid vif index */
|
||||
|
||||
#define NO_VIF ((vifi_t)MAXMIFS) /* An invalid vif index */
|
||||
|
||||
|
||||
/*
|
||||
* Used to get the RPF neighbor and IIF info
|
||||
* for a given source from the unicast routing table.
|
||||
* for a given source from the unicast routing table.
|
||||
*/
|
||||
struct rpfctl {
|
||||
struct sockaddr_in6 source; /* the source for which we want iif and rpfnbr */
|
||||
|
Loading…
x
Reference in New Issue
Block a user