diff options
Diffstat (limited to 'usr.sbin/mrouted')
-rw-r--r-- | usr.sbin/mrouted/callout.c | 58 | ||||
-rw-r--r-- | usr.sbin/mrouted/config.c | 20 | ||||
-rw-r--r-- | usr.sbin/mrouted/igmp.c | 10 | ||||
-rw-r--r-- | usr.sbin/mrouted/kern.c | 4 | ||||
-rw-r--r-- | usr.sbin/mrouted/main.c | 14 | ||||
-rw-r--r-- | usr.sbin/mrouted/mapper.c | 22 | ||||
-rw-r--r-- | usr.sbin/mrouted/mrinfo.c | 22 | ||||
-rw-r--r-- | usr.sbin/mrouted/mtrace.c | 24 | ||||
-rw-r--r-- | usr.sbin/mrouted/prune.c | 338 | ||||
-rw-r--r-- | usr.sbin/mrouted/prune.h | 12 | ||||
-rw-r--r-- | usr.sbin/mrouted/route.c | 12 | ||||
-rw-r--r-- | usr.sbin/mrouted/vif.c | 38 |
12 files changed, 287 insertions, 287 deletions
diff --git a/usr.sbin/mrouted/callout.c b/usr.sbin/mrouted/callout.c index 51437e4..04b1521 100644 --- a/usr.sbin/mrouted/callout.c +++ b/usr.sbin/mrouted/callout.c @@ -7,7 +7,7 @@ * Leland Stanford Junior University. * * - * $Id: callout.c,v 1.2 1994/09/08 02:51:11 wollman Exp $ + * $Id: callout.c,v 1.3 1995/05/16 00:28:42 jkh Exp $ */ #include "defs.h" @@ -22,7 +22,7 @@ typedef void (* cfunc_t)(); struct timeout_q { struct timeout_q *next; /* next event */ - int id; + int id; cfunc_t func ; /* function to call */ char *data; /* func's data */ int time; /* time offset to next event*/ @@ -31,7 +31,7 @@ struct timeout_q { static void print_Q(); -void callout_init() +void callout_init() { Q = (struct timeout_q *) 0; } @@ -43,20 +43,20 @@ void callout_init() void age_callout_queue() { struct timeout_q *ptr; - + if (in_callout) return; in_callout = 1; ptr = Q; - + while (ptr){ if (!ptr->time ) { /* timeout has happened */ if(ptr->func) ptr->func(ptr->data); Q = Q->next; - + free(ptr); ptr = Q; } @@ -73,7 +73,7 @@ void age_callout_queue() } -/* +/* * sets the timer */ int timer_setTimer(delay, action, data) @@ -82,39 +82,39 @@ int timer_setTimer(delay, action, data) char *data; /* what to call the timeout function with */ { struct timeout_q *ptr, *node, *prev; - + if (in_callout) return -1; in_callout = 1; - - /* create a node */ + + /* create a node */ node = (struct timeout_q *)malloc(sizeof(struct timeout_q)); if ((int) node <= 0) { log(LOG_WARNING, 0, "Malloc Failed in timer_settimer\n"); in_callout = 0; 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; @@ -127,7 +127,7 @@ int timer_setTimer(delay, action, data) } else { /* keep moving */ - + delay -= ptr->time; node->time = delay; prev = ptr; ptr = ptr->next; @@ -146,35 +146,35 @@ void timer_clearTimer( id) int id; { struct timeout_q *ptr, *prev; - + if (in_callout) return; in_callout = 1; - - + + if ( !id ) {in_callout = 0; return;} - + prev = ptr = Q; - + /* * find the right node, delete it. the subsequent node's time * gets bumped up */ - + print_Q(); while (ptr){ if (ptr->id == 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; - + free(ptr->data); free(ptr); print_Q(); @@ -195,7 +195,7 @@ static void print_Q() { #ifdef IGMP_DEBUG struct timeout_q *ptr; - + for(ptr = Q; ptr; ptr = ptr->next) log(LOG_DEBUG,0,"(%d,%d) ", ptr->id, ptr->time); #endif IGMP_DEBUG diff --git a/usr.sbin/mrouted/config.c b/usr.sbin/mrouted/config.c index 75e4b6a..8f232ff 100644 --- a/usr.sbin/mrouted/config.c +++ b/usr.sbin/mrouted/config.c @@ -7,7 +7,7 @@ * Leland Stanford Junior University. * * - * $Id: config.c,v 1.2 1994/09/08 02:51:12 wollman Exp $ + * $Id: config.c,v 1.3 1995/04/10 18:42:10 wollman Exp $ */ @@ -254,7 +254,7 @@ void config_vifs_from_file() break; } prev_vif = NO_VIF; - cache_lifetime = n; + cache_lifetime = n; max_prune_lifetime = cache_lifetime * 2; } @@ -277,7 +277,7 @@ void config_vifs_from_file() else if (EQUAL(w, "boundary") && prev_vif != NO_VIF) { register struct vif_acl *v_acl; register u_long baddr; - + v = &uvifs[prev_vif]; if (EQUAL((w = next_word(&s)), "")) { @@ -287,7 +287,7 @@ void config_vifs_from_file() w = "garbage"; break; } - + if ((sscanf(w, "%[0-9.]/%d", s1, &n) != 2) || n < 0 || n> 32) { log(LOG_ERR, 0, @@ -296,7 +296,7 @@ void config_vifs_from_file() w = "garbage"; break; } - + if ((baddr = inet_parse(s1)) == 0xffffffff || (ntohl(baddr) & 0xff000000) != 0xef000000) { log(LOG_ERR, 0, @@ -304,14 +304,14 @@ void config_vifs_from_file() s1, configfilename); continue; } - + v_acl = (struct vif_acl *)malloc(sizeof(struct vif_acl)); if (v_acl == NULL) log(LOG_ERR, 0, "out of memory"); VAL_TO_MASK(v_acl->acl_mask, n); v_acl->acl_addr = baddr & v_acl->acl_mask; - + /* * link into data structure */ @@ -329,7 +329,7 @@ void config_vifs_from_file() * Check if phyint was the first line - scream if not */ if (order) { - log(LOG_ERR, 0, + log(LOG_ERR, 0, "phyint stmnts should occur before tunnel stmnts in %s", configfilename); continue; @@ -619,7 +619,7 @@ void config_vifs_from_file() v->uv_acl = NULL; /* - * set variable to define which interface + * set variable to define which interface */ prev_vif = numvifs; @@ -761,7 +761,7 @@ void config_vifs_from_file() * lower-cased and null terminated, and advance '*s' to point beyond the word. * Words are separated by blanks and/or tabs, and the input string is * considered to terminate at a newline, '#' (comment), or null character. - * If no words remain, a pointer to a null string ("") is returned. + * If no words remain, a pointer to a null string ("") is returned. * Warning: This function clobbers the input string. */ static char *next_word(s) diff --git a/usr.sbin/mrouted/igmp.c b/usr.sbin/mrouted/igmp.c index f7a04df..f814e67 100644 --- a/usr.sbin/mrouted/igmp.c +++ b/usr.sbin/mrouted/igmp.c @@ -32,7 +32,7 @@ void init_igmp() { struct ip *ip; - if ((igmp_socket = socket(AF_INET, SOCK_RAW, IPPROTO_IGMP)) < 0) + if ((igmp_socket = socket(AF_INET, SOCK_RAW, IPPROTO_IGMP)) < 0) log(LOG_ERR, errno, "IGMP socket"); k_hdr_include(TRUE); /* include IP header when sending */ @@ -124,9 +124,9 @@ void accept_igmp(recvlen) src = ip->ip_src.s_addr; dst = ip->ip_dst.s_addr; - /* + /* * this is most likely a message from the kernel indicating that - * a new src grp pair message has arrived and so, it would be + * a new src grp pair message has arrived and so, it would be * necessary to install a route into the kernel for this. */ if (ip->ip_p == 0) { @@ -170,7 +170,7 @@ void accept_igmp(recvlen) case IGMP_HOST_NEW_MEMBERSHIP_REPORT: accept_group_report(src, dst, group,igmp->igmp_type); return; - + case IGMP_HOST_LEAVE_MESSAGE: leave_group_message(src, dst, group); return; @@ -226,7 +226,7 @@ void accept_igmp(recvlen) return; } - + case IGMP_PIM: /* %%% hack for PIM %%% */ return; diff --git a/usr.sbin/mrouted/kern.c b/usr.sbin/mrouted/kern.c index a44a15f..8ef3571 100644 --- a/usr.sbin/mrouted/kern.c +++ b/usr.sbin/mrouted/kern.c @@ -7,7 +7,7 @@ * Leland Stanford Junior University. * * - * $Id: kern.c,v 1.6 1994/08/24 23:53:37 thyagara Exp $ + * $Id: kern.c,v 1.2 1994/09/08 02:51:17 wollman Exp $ */ @@ -180,4 +180,4 @@ void k_del_rg(kt) if (setsockopt(igmp_socket, IPPROTO_IP, DVMRP_DEL_MFC, (char *)&mc, sizeof(mc)) < 0) log(LOG_WARNING, errno, "setsockopt DVMRP_DEL_MFC"); -} +} diff --git a/usr.sbin/mrouted/main.c b/usr.sbin/mrouted/main.c index d11f807..d7292c7 100644 --- a/usr.sbin/mrouted/main.c +++ b/usr.sbin/mrouted/main.c @@ -7,7 +7,7 @@ * Leland Stanford Junior University. * * - * $Id: main.c,v 1.2 1994/09/08 02:51:18 wollman Exp $ + * $Id: main.c,v 1.3 1995/03/31 21:16:43 wollman Exp $ */ /* @@ -89,7 +89,7 @@ main(argc, argv) } if (argc > 0) { -usage: fprintf(stderr, +usage: fprintf(stderr, "usage: mrouted [-p] [-c configfile] [-d [debug_level]]\n"); exit(1); } @@ -128,7 +128,7 @@ usage: fprintf(stderr, srandom(gethostid()); /* - * Get generation id + * Get generation id */ gettimeofday(&tv, &tzp); dvmrp_genid = tv.tv_sec; @@ -157,7 +157,7 @@ usage: fprintf(stderr, if (debug) fprintf(stderr, "pruning %s\n", pruning ? "on" : "off"); - fp = fopen(pidfilename, "w"); + fp = fopen(pidfilename, "w"); if (fp != NULL) { fprintf(fp, "%d\n", getpid()); (void) fclose(fp); @@ -184,7 +184,7 @@ usage: fprintf(stderr, for(;;) { recvlen = recvfrom(igmp_socket, recv_buf, sizeof(recv_buf), 0, NULL, &dummy); - if (recvlen < 0) { + if (recvlen < 0) { if (errno != EINTR) log(LOG_ERR, errno, "recvfrom"); continue; } @@ -235,7 +235,7 @@ static void fasttimer() timer(); age_callout_queue();/* Advance the timer for the callout queue - for groups */ + for groups */ alarm(1); } @@ -355,7 +355,7 @@ static void cdump() fp = fopen(cachefilename, "w"); if (fp != NULL) { - dump_cache(fp); + dump_cache(fp); (void) fclose(fp); } } diff --git a/usr.sbin/mrouted/mapper.c b/usr.sbin/mrouted/mapper.c index 5dba17c..bd1dfaa 100644 --- a/usr.sbin/mrouted/mapper.c +++ b/usr.sbin/mrouted/mapper.c @@ -1,23 +1,23 @@ /* Mapper for connections between MRouteD multicast routers. * Written by Pavel Curtis <Pavel@PARC.Xerox.Com> * - * $Id: mapper.c,v 1.8 1994/08/24 23:53:54 thyagara Exp $ + * $Id: mapper.c,v 1.2 1994/09/08 02:51:19 wollman Exp $ */ /* * Copyright (c) Xerox Corporation 1992. All rights reserved. - * + * * License is granted to copy, to use, and to make and to use derivative * works for research and evaluation purposes, provided that Xerox is * acknowledged in all documentation pertaining to any such copy or derivative * work. Xerox grants no other licenses expressed or implied. The Xerox trade * name should not be used in any advertising without its written permission. - * + * * XEROX CORPORATION MAKES NO REPRESENTATIONS CONCERNING EITHER THE * MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS SOFTWARE * FOR ANY PARTICULAR PURPOSE. The software is provided "as is" without * express or implied warranty of any kind. - * + * * These notices must be retained in any copies of any part of this software. */ @@ -354,10 +354,10 @@ void accept_neighbors(src, dst, p, datalen, level) ifc_node->tries = -1; ifc_node->u.alias = node; } - + ifc = find_interface(ifc_addr, node); old_neighbors = ifc->neighbors; - + /* Add the neighbors for this interface */ while (ncount--) { u_long neighbor; @@ -490,10 +490,10 @@ void accept_neighbors2(src, dst, p, datalen) ifc_node->tries = -1; ifc_node->u.alias = node; } - + ifc = find_interface(ifc_addr, node); old_neighbors = ifc->neighbors; - + /* Add the neighbors for this interface */ while (ncount--) { u_long neighbor; @@ -586,7 +586,7 @@ void print_map(node) { if (node) { char *name, *addr; - + print_map(node->left); addr = inet_fmt(node->addr, s1); @@ -794,7 +794,7 @@ main(argc, argv) char *argv[]; { int flood = FALSE, graph = FALSE; - + #ifdef SYSV setvbuf(stderr, NULL, _IOLBF, 0); #else @@ -837,7 +837,7 @@ main(argc, argv) } if (argc > 1) { - usage: + usage: fprintf(stderr, "Usage: map-mbone [-f] [-g] [-n] [-t timeout] %s\n\n", "[-r retries] [-d [debug-level]] [router]"); diff --git a/usr.sbin/mrouted/mrinfo.c b/usr.sbin/mrouted/mrinfo.c index f82b671..d0d9e6b 100644 --- a/usr.sbin/mrouted/mrinfo.c +++ b/usr.sbin/mrouted/mrinfo.c @@ -44,24 +44,24 @@ * SUCH DAMAGE. * --------------------------------- * Copyright (c) Xerox Corporation 1992. All rights reserved. - * + * * License is granted to copy, to use, and to make and to use derivative works * for research and evaluation purposes, provided that Xerox is acknowledged * in all documentation pertaining to any such copy or derivative work. Xerox * grants no other licenses expressed or implied. The Xerox trade name should * not be used in any advertising without its written permission. - * + * * XEROX CORPORATION MAKES NO REPRESENTATIONS CONCERNING EITHER THE * MERCHANTABILITY OF THIS SOFTWARE OR THE SUITABILITY OF THIS SOFTWARE FOR * ANY PARTICULAR PURPOSE. The software is provided "as is" without express * or implied warranty of any kind. - * + * * These notices must be retained in any copies of any part of this software. */ #ifndef lint static char rcsid[] = - "@(#) $Id: mrinfo.c,v 1.2 1994/09/08 02:51:20 wollman Exp $"; + "@(#) $Id: mrinfo.c,v 1.3 1995/05/16 00:28:46 jkh Exp $"; /* original rcsid: "@(#) Header: mrinfo.c,v 1.6 93/04/08 15:14:16 van Exp (LBL)"; */ @@ -98,7 +98,7 @@ inet_name(addr) * message and the current debug level. For errors of severity LOG_ERR or * worse, terminate the program. */ -void +void log(severity, syserr, format, a, b, c, d, e) int severity, syserr; char *format; @@ -137,7 +137,7 @@ log(severity, syserr, format, a, b, c, d, e) /* * Send a neighbors-list request. */ -void +void ask(dst) u_long dst; { @@ -145,7 +145,7 @@ ask(dst) htonl(MROUTED_LEVEL), 0); } -void +void ask2(dst) u_long dst; { @@ -156,7 +156,7 @@ ask2(dst) /* * Process an incoming neighbor-list message. */ -void +void accept_neighbors(src, dst, p, datalen) u_long src, dst; u_char *p; @@ -189,7 +189,7 @@ accept_neighbors(src, dst, p, datalen) } } -void +void accept_neighbors2(src, dst, p, datalen) u_long src, dst; u_char *p; @@ -232,7 +232,7 @@ accept_neighbors2(src, dst, p, datalen) } } -int +int get_number(var, deflt, pargv, pargc) int *var, *pargc, deflt; char ***pargv; @@ -258,7 +258,7 @@ get_number(var, deflt, pargv, pargc) } } -u_long +u_long host_addr(name) char *name; { diff --git a/usr.sbin/mrouted/mtrace.c b/usr.sbin/mrouted/mtrace.c index 590fe94..d3e7f5f 100644 --- a/usr.sbin/mrouted/mtrace.c +++ b/usr.sbin/mrouted/mtrace.c @@ -22,7 +22,7 @@ inet_name(addr) return e ? e->h_name : "?"; } -u_long +u_long host_addr(name) char *name; { @@ -75,7 +75,7 @@ flag_type(type) default: return ("INVALID ERR"); } -} +} int t_diff(a, b) @@ -245,7 +245,7 @@ usage: printf("usage: mtrace -s <src> -g <grp> -d <dst> -n <# reports> \n"); if (dst == NULL) dst = qgrp; - + /* * set timer to calculate delays & send query */ @@ -256,7 +256,7 @@ usage: printf("usage: mtrace -s <src> -g <grp> -d <dst> -n <# reports> \n"); qgrp, datalen); /* - * If the response is to be a multicast address, make sure we + * If the response is to be a multicast address, make sure we * are listening on that multicast address. */ if (IN_MULTICAST(ntohl(raddr))) @@ -278,13 +278,13 @@ usage: printf("usage: mtrace -s <src> -g <grp> -d <dst> -n <# reports> \n"); FD_ZERO(&fds); FD_SET(igmp_socket, &fds); - + /* need to input timeout as optional argument */ tv.tv_sec = timeout; tv.tv_usec = 0; - + count = select(igmp_socket + 1, &fds, 0, 0, &tv); - + if (count < 0) { if (errno != EINTR) perror("select"); @@ -305,7 +305,7 @@ usage: printf("usage: mtrace -s <src> -g <grp> -d <dst> -n <# reports> \n"); perror("recvfrom"); continue; } - + if (recvlen < sizeof(struct ip)) { log(LOG_WARNING, 0, "packet too short (%u bytes) for IP header", @@ -331,7 +331,7 @@ usage: printf("usage: mtrace -s <src> -g <grp> -d <dst> -n <# reports> \n"); continue; } - if (igmp->igmp_type != IGMP_MTRACE && + if (igmp->igmp_type != IGMP_MTRACE && igmp->igmp_type != IGMP_MTRACE_RESP) continue; @@ -348,13 +348,13 @@ usage: printf("usage: mtrace -s <src> -g <grp> -d <dst> -n <# reports> \n"); /* If this is query with a different id, ignore! */ if (query->tr_qid != qid) continue; - + /* * Most of the sanity checking done at this point. * This is the packet we have been waiting for all this time */ resp = (struct tr_resp *)(query + 1); - + rno = (igmpdatalen - QLEN)/RLEN; /* @@ -381,7 +381,7 @@ usage: printf("usage: mtrace -s <src> -g <grp> -d <dst> -n <# reports> \n"); printf("hop: %d ms ", t_diff(resptime, r->tr_qarr)); printf("%s ", proto_type(r->tr_rproto)); printf("%s\n", flag_type(r->tr_rflags)); - + printf(" %-15s ", inet_fmt(r->tr_outaddr, s1)); printf("v_in: %ld ", r->tr_vifin); printf("v_out: %ld ", r->tr_vifout); diff --git a/usr.sbin/mrouted/prune.c b/usr.sbin/mrouted/prune.c index b18530a..3269288 100644 --- a/usr.sbin/mrouted/prune.c +++ b/usr.sbin/mrouted/prune.c @@ -7,7 +7,7 @@ * Leland Stanford Junior University. * * - * $Id: prune.c,v 1.3 1995/03/16 16:25:55 wollman Exp $ + * $Id: prune.c,v 1.4 1995/05/16 00:28:48 jkh Exp $ */ @@ -37,7 +37,7 @@ extern int max_prune_lifetime; default: y = 0; \ } \ } - + static struct ktable *kernel_rtable; /* ptr to list of kernel rt entries */ unsigned int kroutes; /* current number of cache entries */ @@ -51,7 +51,7 @@ void init_ktable() kroutes = 0; } -/* +/* * Determine if mcastgrp has a listener on vifi */ int grplst_mem(vifi, mcastgrp) @@ -60,17 +60,17 @@ int grplst_mem(vifi, mcastgrp) { register struct listaddr *g; register struct uvif *v; - + v = &uvifs[vifi]; - + for (g = v->uv_groups; g != NULL; g = g->al_next) - if (mcastgrp == g->al_addr) + if (mcastgrp == g->al_addr) return 1; - + return 0; } -/* +/* * Updates the ttl values for each vif. */ void prun_add_ttls(kt) @@ -78,11 +78,11 @@ void prun_add_ttls(kt) { struct uvif *v; vifi_t vifi; - + for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) { if (VIFM_ISSET(vifi, kt->kt_grpmems)) kt->kt_ttls[vifi] = v->uv_threshold; - else + else kt->kt_ttls[vifi] = 0; } } @@ -111,7 +111,7 @@ int scoped_addr(vifi, addr) return 0; } -/* +/* * Add a new table entry for (origin, mcastgrp) */ void add_table_entry(origin, mcastgrp) @@ -121,22 +121,22 @@ void add_table_entry(origin, mcastgrp) struct rtentry *r; struct ktable *kt; int i; - + if ((kt = find_src_grp(origin, mcastgrp)) != NULL) { log(LOG_DEBUG, 0, "kernel entry exists for (%s %s)", inet_fmt(origin, s1), inet_fmt(mcastgrp, s2)); return; } - + r = determine_route(origin); - + /* allocate space for the new entry */ kt = (struct ktable *)malloc(sizeof(struct ktable)); if (kt == NULL) log(LOG_ERR, 0, "ran out of memory"); /* fatal */ - + kroutes++; - + /* add the new values in */ if (r == NULL) { kt->kt_origin = origin; @@ -173,10 +173,10 @@ void add_table_entry(origin, mcastgrp) /* obtain the multicast group membership list */ for (i = 0; i < numvifs; i++) { - if (VIFM_ISSET(i, kt->kt_children) && + if (VIFM_ISSET(i, kt->kt_children) && !(VIFM_ISSET(i, kt->kt_leaves))) VIFM_SET(i, kt->kt_grpmems); - + if (VIFM_ISSET(i, kt->kt_leaves) && grplst_mem(i, mcastgrp)) VIFM_SET(i, kt->kt_grpmems); } @@ -188,23 +188,23 @@ void add_table_entry(origin, mcastgrp) else kt->kt_grpmems &= ~kt->kt_scope; } - + /* update the kernel_rtable pointer */ kt->kt_next = kernel_rtable; kernel_rtable = kt; - + /* update ttls and add entry into kernel */ prun_add_ttls(kt); k_add_rg(kt); - + log(LOG_DEBUG, 0, "add entry (%s %s) vif-list:%x", - inet_fmt(kt->kt_origin, s1), + inet_fmt(kt->kt_origin, s1), inet_fmt(kt->kt_mcastgrp, s2), kt->kt_grpmems); - + /* If there are no leaf vifs * which have this group, then - * mark this src-grp as a prune candidate. + * mark this src-grp as a prune candidate. * One thing to do is to check if parent vif is the source * and not send a prune to that. */ @@ -222,13 +222,13 @@ void reset_neighbor_state(vifi, addr) { struct ktable *prev_kt, *kt; struct prunlst *prev_krl, *krl; - + /* Check each src-grp entry to see if it was pruned on that interface If so, forward on that interface */ for (prev_kt = (struct ktable *)&kernel_rtable, kt = kernel_rtable; kt; prev_kt = kt, kt = kt->kt_next) { - for (prev_krl = (struct prunlst *)&kt->kt_rlist, + for (prev_krl = (struct prunlst *)&kt->kt_rlist, krl = prev_krl->rl_next; krl; prev_krl = krl, krl = krl->rl_next) { @@ -267,14 +267,14 @@ void reset_neighbor_state(vifi, addr) } if (!VIFM_ISSET(vifi, kt->kt_grpmems)) { - if (VIFM_ISSET(vifi, kt->kt_children) && + if (VIFM_ISSET(vifi, kt->kt_children) && !(VIFM_ISSET(vifi, kt->kt_leaves))) VIFM_SET(vifi, kt->kt_grpmems); - - if (VIFM_ISSET(vifi, kt->kt_leaves) && + + if (VIFM_ISSET(vifi, kt->kt_leaves) && grplst_mem(vifi, kt->kt_mcastgrp)) VIFM_SET(vifi, kt->kt_grpmems); - + kt->kt_grpmems &= ~kt->kt_scope; prun_add_ttls(kt); k_add_rg(kt); @@ -293,7 +293,7 @@ void del_table_entry(r, mcastgrp, del_flag) { struct ktable *kt, *prev_kt; struct prunlst *krl; - + if (del_flag == DEL_ALL_ROUTES) { for (prev_kt = (struct ktable *)&kernel_rtable; kt = prev_kt->kt_next; @@ -301,16 +301,16 @@ void del_table_entry(r, mcastgrp, del_flag) if ((kt->kt_origin & r->rt_originmask) == r->rt_origin) { log(LOG_DEBUG, 0, "delete all rtes %s", inet_fmt(kt->kt_origin, s1)); - + k_del_rg(kt); - + /* free prun list entries */ while (kt->kt_rlist) { krl = kt->kt_rlist; kt->kt_rlist = krl->rl_next; free((char *)krl); } - + /* free the source mcastgrp entry */ prev_kt->kt_next = kt->kt_next; free((char *)kt); @@ -319,25 +319,25 @@ void del_table_entry(r, mcastgrp, del_flag) } } } - + if (del_flag == DEL_RTE_GROUP) { for (prev_kt = (struct ktable *)&kernel_rtable; (prev_kt) && (kt = prev_kt->kt_next); prev_kt = kt) { if ((kt->kt_origin & r->rt_originmask) == r->rt_origin && kt->kt_mcastgrp == mcastgrp) { - log(LOG_DEBUG, 0, "delete (%s, %s)", + log(LOG_DEBUG, 0, "delete (%s, %s)", inet_fmt(kt->kt_origin, s1), inet_fmt(mcastgrp, s2)); - + k_del_rg(kt); - + /* free prun list entries */ while (kt->kt_rlist) { krl = kt->kt_rlist; kt->kt_rlist = krl->rl_next; free((char *)krl); } - + /* free the source mcastgrp entry */ prev_kt->kt_next = kt->kt_next; free((char *)kt); @@ -358,45 +358,45 @@ void update_table_entry(r) struct prunlst *krl; int i; int changed; - + for (kt = kernel_rtable; kt; kt = kt->kt_next) if ((kt->kt_origin & r->rt_originmask)== r->rt_origin) { changed = 0; - + if (kt->kt_leaves != r->rt_leaves) changed |= 0x1; if (kt->kt_children != r->rt_children) changed |= 0x2; if (kt->kt_parent != r->rt_parent) changed |= 0x4; - + if (!changed) continue; - + log(LOG_DEBUG, 0, "updating entry: (%s %s) code:%x", inet_fmt(kt->kt_origin, s1), inet_fmt(kt->kt_mcastgrp, s2), changed); - + /* free prun list entries */ while (kt->kt_rlist) { krl = kt->kt_rlist; kt->kt_rlist = krl->rl_next; free((char *)krl); } - + kt->kt_parent = r->rt_parent; kt->kt_gateway = r->rt_gateway; kt->kt_grpmems = 0; kt->kt_prun_count = 0; VIFM_COPY(r->rt_children, kt->kt_children); VIFM_COPY(r->rt_leaves, kt->kt_leaves); - + /* obtain the multicast group membership list */ for (i = 0; i < numvifs; i++) { - if (VIFM_ISSET(i, kt->kt_children) && + if (VIFM_ISSET(i, kt->kt_children) && !(VIFM_ISSET(i, kt->kt_leaves))) VIFM_SET(i, kt->kt_grpmems); - + if (VIFM_ISSET(i, kt->kt_leaves) && grplst_mem(i, kt->kt_mcastgrp)) VIFM_SET(i, kt->kt_grpmems); } @@ -406,21 +406,21 @@ void update_table_entry(r) } else kt->kt_grpmems &= ~kt->kt_scope; - + if (kt->kt_grpmems && kt->kt_prsent_timer) { kt->kt_grftsnt = 1; send_graft(kt); kt->kt_prsent_timer = 0; } - + /* update ttls and add entry into kernel */ prun_add_ttls(kt); k_add_rg(kt); - + if (!kt->kt_grpmems && kt->kt_gateway) { kt->kt_timer = CACHE_LIFETIME(cache_lifetime); send_prune(kt); - } + } } } @@ -434,10 +434,10 @@ void update_lclgrp(vifi, mcastgrp) u_long mcastgrp; { struct ktable *kt; - + log(LOG_DEBUG, 0, "group %s joined at vif %d", inet_fmt(mcastgrp, s1), vifi); - + for (kt = kernel_rtable; kt; kt = kt->kt_next) if (kt->kt_mcastgrp == mcastgrp && VIFM_ISSET(vifi, kt->kt_children)) { VIFM_SET(vifi, kt->kt_grpmems); @@ -446,7 +446,7 @@ void update_lclgrp(vifi, mcastgrp) continue; prun_add_ttls(kt); k_add_rg(kt); - } + } } /* @@ -457,10 +457,10 @@ void delete_lclgrp(vifi, mcastgrp) u_long mcastgrp; { struct ktable *kt; - + log(LOG_DEBUG, 0, "group %s left at vif %d", inet_fmt(mcastgrp, s1), vifi); - + for (kt = kernel_rtable; kt; kt = kt->kt_next) if (kt->kt_mcastgrp == mcastgrp) { struct listaddr *vr; @@ -476,7 +476,7 @@ void delete_lclgrp(vifi, mcastgrp) VIFM_CLR(vifi, kt->kt_grpmems); prun_add_ttls(kt); k_add_rg(kt); - + /* * If there are no more members of this particular group, * send prune upstream @@ -484,7 +484,7 @@ void delete_lclgrp(vifi, mcastgrp) if (kt->kt_grpmems == NULL && kt->kt_gateway) send_prune(kt); } - } + } } /* @@ -495,7 +495,7 @@ int pruning_neighbor(vifi, addr) u_long addr; { struct listaddr *u; - + for (u = uvifs[vifi].uv_neighbors; u; u = u->al_next) if ((u->al_addr == addr) && (u->al_pv > 2)) return 1; @@ -505,8 +505,8 @@ int pruning_neighbor(vifi, addr) /* * Send a prune message to the upstream router - * given by the kt->kt_gateway argument. The origin and - * multicast group can be determined from the kt + * given by the kt->kt_gateway argument. The origin and + * multicast group can be determined from the kt * structure. * * Also, record an entry that a prune was sent for this group @@ -520,24 +520,24 @@ void send_prune(kt) int datalen; u_long src; u_long dst; - + /* Don't process any prunes if router is not pruning */ if (pruning == 0) return; - + /* Don't send a prune to a non-pruning router */ if (!pruning_neighbor(kt->kt_parent, kt->kt_gateway)) return; - - /* + + /* * sends a prune message to the router upstream. */ src = uvifs[kt->kt_parent].uv_lcl_addr; dst = kt->kt_gateway; - + p = send_buf + MIN_IP_HEADER_LEN + IGMP_MINLEN; datalen = 0; - + /* * determine prune lifetime */ @@ -545,7 +545,7 @@ void send_prune(kt) for (krl = kt->kt_rlist; krl; krl = krl->rl_next) if (krl->rl_timer < kt->kt_prsent_timer) kt->kt_prsent_timer = krl->rl_timer; - + for (i = 0; i < 4; i++) *p++ = ((char *)&(kt->kt_origin))[i]; for (i = 0; i < 4; i++) @@ -558,10 +558,10 @@ void send_prune(kt) #endif *p++ = ((char *)&(kt->kt_prsent_timer))[i]; datalen += 12; - + send_igmp(src, dst, IGMP_DVMRP, DVMRP_PRUNE, htonl(MROUTED_LEVEL), datalen); - + /* log(LOG_DEBUG, 0, "send prune for src:%x, grp:%x up to %x", kt->kt_origin, kt->kt_mcastgrp, kt->kt_gateway);*/ } @@ -587,22 +587,22 @@ void accept_prune(src, dst, p, datalen) u_long prun_tmr; vifi_t vifi; int i; - int stop_sending; + int stop_sending; struct ktable *kt; struct prunlst *pr_recv; struct listaddr *vr; - + /* Don't process any prunes if router is not pruning */ if (pruning == 0) return; - + if ((vifi = find_vif(src, dst)) == NO_VIF) { log(LOG_INFO, 0, "ignoring prune report from non-neighbor %s", inet_fmt(src, s1)); return; } - + /* Check if enough data is present */ if (datalen < 12) { log(LOG_WARNING, 0, @@ -610,7 +610,7 @@ void accept_prune(src, dst, p, datalen) inet_fmt(src, s1)); return; } - + for (i = 0; i< 4; i++) ((char *)&prun_src)[i] = *p++; for (i = 0; i< 4; i++) @@ -622,15 +622,15 @@ void accept_prune(src, dst, p, datalen) for (i = 3; i >= 0; i--) #endif ((char *)&prun_tmr)[i] = *p++; - + kt = find_src_grp(prun_src, prun_dst); - - if (kt == NULL) + + if (kt == NULL) { log(LOG_WARNING, 0, "prune message received incorrectly"); return; } - + if (!VIFM_ISSET(vifi, kt->kt_children)) { log(LOG_INFO, 0, @@ -649,35 +649,35 @@ void accept_prune(src, dst, p, datalen) log(LOG_INFO, 0, "duplicate prune from %s", inet_fmt(src, s1)); return; } - + log(LOG_DEBUG, 0, "%s on vif %d prunes (%s %s) tmr %d", inet_fmt(src, s1), vifi, inet_fmt(prun_src, s2), inet_fmt(prun_dst, s3), prun_tmr); - + /* allocate space for the prune structure */ pr_recv = (struct prunlst *)(malloc(sizeof(struct prunlst))); - + if (pr_recv == NULL) log(LOG_ERR, 0, "pr_recv: ran out of memory"); - + pr_recv->rl_vifi = vifi; pr_recv->rl_router = src; pr_recv->rl_timer = prun_tmr; - - /* - * add this prune message to the list of prunes received - * for this src group pair + + /* + * add this prune message to the list of prunes received + * for this src group pair */ pr_recv->rl_next = kt->kt_rlist; kt->kt_rlist = pr_recv; - + kt->kt_prun_count++; kt->kt_timer = CACHE_LIFETIME(cache_lifetime); if (kt->kt_timer < prun_tmr) kt->kt_timer = prun_tmr; - + /* - * check if any more packets need to be sent on the + * check if any more packets need to be sent on the * vif which sent this message */ for (vr = uvifs[vifi].uv_neighbors, stop_sending = 1; @@ -686,16 +686,16 @@ void accept_prune(src, dst, p, datalen) stop_sending = 0; break; } - + if (stop_sending && !grplst_mem(vifi, prun_dst)) { VIFM_CLR(vifi, kt->kt_grpmems); prun_add_ttls(kt); k_add_rg(kt); } - + /* * check if all the child routers have expressed no interest - * in this group and if this group does not exist in the + * in this group and if this group does not exist in the * interface * Send a prune message then upstream */ @@ -713,11 +713,11 @@ int no_entry_exists(vr, kt) struct ktable *kt; { struct prunlst *krl; - + for (krl = kt->kt_rlist; krl; krl = krl->rl_next) if (krl->rl_router == vr) return 0; - + return 1; } @@ -729,16 +729,16 @@ struct ktable *find_src_grp(src, grp) u_long grp; { struct ktable *kt; - + for (kt = kernel_rtable; kt; kt = kt->kt_next) - if ((kt->kt_origin == (src & kt->kt_originmask)) && + if ((kt->kt_origin == (src & kt->kt_originmask)) && (kt->kt_mcastgrp == grp)) return kt; - + return NULL; } -/* +/* * scans through the neighbor list of this router and then * determines the total no. of child routers present */ @@ -748,12 +748,12 @@ int rtr_cnt(kt) int ri; int rcount = 0; struct listaddr *u; - + for (ri = 0; ri < numvifs; ri++) if (VIFM_ISSET(ri, kt->kt_children)) for(u = uvifs[ri].uv_neighbors; u; u = u->al_next) rcount++; - + return rcount; } @@ -766,7 +766,7 @@ void chkgrp_graft(vifi, mcastgrp) u_long mcastgrp; { struct ktable *kt; - + for (kt = kernel_rtable; kt; kt = kt->kt_next) if (kt->kt_mcastgrp == mcastgrp && VIFM_ISSET(vifi, kt->kt_children)) if (kt->kt_prsent_timer) { @@ -781,33 +781,33 @@ void chkgrp_graft(vifi, mcastgrp) /* set the flag for graft retransmission */ kt->kt_grftsnt = 1; - + /* send graft upwards */ send_graft(kt); - + /* reset the prune timer and update cache timer*/ kt->kt_prsent_timer = 0; kt->kt_timer = max_prune_lifetime; - + prun_add_ttls(kt); k_add_rg(kt); } } /* determine the multicast group and src - * - * if it does, then determine if a prune was sent + * + * if it does, then determine if a prune was sent * upstream. * if prune sent upstream, send graft upstream and send * ack downstream. - * + * * if no prune sent upstream, change the forwarding bit * for this interface and send ack downstream. * * if no entry exists for this group just ignore the message - * [this may not be the right thing to do. but lets see what + * [this may not be the right thing to do. but lets see what * happens for the time being and then we might decide to do - * a modification to the code depending on the type of behaviour + * a modification to the code depending on the type of behaviour * that we see in this] */ void accept_graft(src, dst, p, datalen) @@ -823,64 +823,64 @@ void accept_graft(src, dst, p, datalen) int i; struct prunlst *krl; struct prunlst *prev_krl; - + if ((vifi = find_vif(src, dst)) == NO_VIF) { log(LOG_INFO, 0, "ignoring graft from non-neighbor %s", inet_fmt(src, s1)); return; } - + if (datalen < 8) { log(LOG_WARNING, 0, "received non-decipherable graft from %s", inet_fmt(src, s1)); return; } - + for (i = 0; i< 4; i++) ((char *)&prun_src)[i] = *p++; for (i = 0; i< 4; i++) ((char *)&prun_dst)[i] = *p++; - + log(LOG_DEBUG, 0, "%s on vif %d grafts (%s %s)", inet_fmt(src, s1), vifi, inet_fmt(prun_src, s2), inet_fmt(prun_dst, s3)); - + kt = find_src_grp(prun_src, prun_dst); if (kt == NULL) { log(LOG_DEBUG, 0, "incorrect graft received from %s", inet_fmt(src, s1)); return; } - + if (VIFM_ISSET(vifi, kt->kt_scope)) { log(LOG_INFO, 0, "incorrect graft received from %s on scoped vif %d", inet_fmt(src, s1), vifi); return; } - /* remove prune entry from the list + /* remove prune entry from the list * allow forwarding on that vif, make change in the kernel */ for (prev_krl = (struct prunlst *)&kt->kt_rlist; - krl = prev_krl->rl_next; + krl = prev_krl->rl_next; prev_krl = krl) if ((krl->rl_vifi) == vifi && (krl->rl_router == src)) { prev_krl->rl_next = krl->rl_next; free((char *)krl); krl = prev_krl; - + kt->kt_prun_count--; VIFM_SET(vifi, kt->kt_grpmems); prun_add_ttls(kt); k_add_rg(kt); - break; + break; } - + /* send ack downstream */ send_graft_ack(kt, src); kt->kt_timer = max_prune_lifetime; - + if (kt->kt_prsent_timer) { /* set the flag for graft retransmission */ kt->kt_grftsnt = 1; @@ -905,22 +905,22 @@ void send_graft_ack(kt, to) int datalen; u_long src; u_long dst; - + src = uvifs[kt->kt_parent].uv_lcl_addr; dst = to; - + p = send_buf + MIN_IP_HEADER_LEN + IGMP_MINLEN; datalen = 0; - + for (i = 0; i < 4; i++) *p++ = ((char *)&(kt->kt_origin))[i]; for (i = 0; i < 4; i++) *p++ = ((char *)&(kt->kt_mcastgrp))[i]; datalen += 8; - + send_igmp(src, dst, IGMP_DVMRP, DVMRP_GRAFT_ACK, htonl(MROUTED_LEVEL), datalen); - + log(LOG_DEBUG, 0, "sent graft ack (%s, %s) to %s", inet_fmt(kt->kt_origin, s1), inet_fmt(kt->kt_mcastgrp, s2), inet_fmt(dst, s3)); @@ -930,7 +930,7 @@ void send_graft_ack(kt, to) /* * a prune was sent upstream * so, a graft has to be sent to annul the prune - * set up a graft timer so that if an ack is not + * set up a graft timer so that if an ack is not * heard within that time, another graft request * is sent out. */ @@ -942,19 +942,19 @@ void send_graft(kt) int datalen; u_long src; u_long dst; - + src = uvifs[kt->kt_parent].uv_lcl_addr; dst = kt->kt_gateway; - + p = send_buf + MIN_IP_HEADER_LEN + IGMP_MINLEN; datalen = 0; - + for (i = 0; i < 4; i++) *p++ = ((char *)&(kt->kt_origin))[i]; for (i = 0; i < 4; i++) *p++ = ((char *)&(kt->kt_mcastgrp))[i]; datalen += 8; - + if (datalen != 0) { send_igmp(src, dst, IGMP_DVMRP, DVMRP_GRAFT, htonl(MROUTED_LEVEL), datalen); @@ -965,11 +965,11 @@ void send_graft(kt) } /* - * find out which group is involved first of all + * find out which group is involved first of all * then determine if a graft was sent. * if no graft sent, ignore the message - * if graft was sent and the ack is from the right - * source, remove the graft timer so that we don't + * if graft was sent and the ack is from the right + * source, remove the graft timer so that we don't * have send a graft again */ void accept_g_ack(src, dst, p, datalen) @@ -983,37 +983,37 @@ void accept_g_ack(src, dst, p, datalen) u_long grft_dst; struct ktable *kt; int i; - + if ((vifi = find_vif(src, dst)) == NO_VIF) { log(LOG_INFO, 0, "ignoring graft ack report from non-neighbor %s", inet_fmt(src, s1)); return; } - + if (datalen < 8) { log(LOG_WARNING, 0, "received non-decipherable graft ack report from %s", inet_fmt(src, s1)); return; } - + for (i = 0; i< 4; i++) ((char *)&grft_src)[i] = *p++; for (i = 0; i< 4; i++) ((char *)&grft_dst)[i] = *p++; - + log(LOG_DEBUG, 0, "%s on vif %d acks graft (%s %s)", inet_fmt(src, s1), vifi, inet_fmt(grft_src, s2), inet_fmt(grft_dst, s3)); - + kt = find_src_grp(grft_src, grft_dst); - + if (kt == NULL) { log(LOG_WARNING, 0, "received wrong graft ack from %s", inet_fmt(src, s1)); return; } - + if (kt->kt_grftsnt) kt->kt_grftsnt = 0; } @@ -1026,7 +1026,7 @@ void free_all_prunes() { register struct ktable *kt; register struct prunlst *krl; - + while (kernel_rtable != NULL) { kt = kernel_rtable; kernel_rtable = kt->kt_next; @@ -1054,10 +1054,10 @@ void age_table_entry() struct ktable *prev_kt; struct prunlst *krl; struct prunlst *prev_krl; - + log(LOG_DEBUG, 0, "kr:%x pr:%x", kernel_rtable, (struct ktable *)&kernel_rtable); - + for (prev_kt = (struct ktable *)&kernel_rtable; kt = prev_kt->kt_next; prev_kt = kt) { @@ -1072,10 +1072,10 @@ void age_table_entry() send_graft(kt); } - /* delete the entry only if there are no subordinate + /* delete the entry only if there are no subordinate routers - - Now, if there are subordinate routers, then, what we + + Now, if there are subordinate routers, then, what we have to do is to decrement each and every router's prune time entry too and decide if we want to forward on that link basically @@ -1090,8 +1090,8 @@ void age_table_entry() inet_fmt(kt->kt_origin, s1), inet_fmt(kt->kt_mcastgrp, s2), krl->rl_vifi); - - /* + + /* * forwarding now, so entry is not pruned anymore * reset the cache timer to a largish value also */ @@ -1103,13 +1103,13 @@ void age_table_entry() prun_add_ttls(kt); k_add_rg(kt); } - + /* remove the router's prune entry and await new one */ kt->kt_prun_count--; prev_krl->rl_next = krl->rl_next; free((char *)krl); krl = prev_krl; - + if (krl == NULL) break; } @@ -1117,7 +1117,7 @@ void age_table_entry() if (kt->kt_timer <= 0) { /* - * If there are prune entries still outstanding, + * If there are prune entries still outstanding, * update the cache timer otherwise expire entry. */ if (kt->kt_rlist) { @@ -1127,10 +1127,10 @@ void age_table_entry() log(LOG_DEBUG, 0, "aging entry (%s, %s)", inet_fmt(kt->kt_origin, s1), inet_fmt(kt->kt_mcastgrp, s2)); - + k_del_rg(kt); prev_kt->kt_next = kt->kt_next; - + /* free all the prune list entries */ krl = kt->kt_rlist; while(krl) { @@ -1138,7 +1138,7 @@ void age_table_entry() krl = krl->rl_next; free((char *)prev_krl); } - + free((char *)kt); kroutes--; kt = prev_kt; @@ -1161,7 +1161,7 @@ void dump_cache(fp2) fprintf(fp2, "Multicast Routing Cache Table (%d entries)\n%s", kroutes, " Origin-Subnet Mcast-group CTmr IVif Prcv# Psnt Forwvifs\n"); - + for (kt = kernel_rtable, count = 0; kt != NULL; kt = kt->kt_next) { fprintf(fp2, " %-15s %-15s", @@ -1205,12 +1205,12 @@ int can_forward(vifi) vifi_t vifi; { struct listaddr *u; - + for (u = uvifs[vifi].uv_neighbors; u; u = u->al_next) if (((u->al_pv > 2) && (u->al_mv > 2)) || (u->al_pv > 3)) return 1; - + return 0; } @@ -1279,7 +1279,7 @@ void mtrace(src, dst, group, data, no, datalen) rt = determine_route(qry->tr_src); /* - * 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 */ @@ -1294,7 +1294,7 @@ void mtrace(src, dst, group, data, no, datalen) if (!(v->uv_flags & VIFF_TUNNEL) && ((qry->tr_dst & v->uv_subnetmask) == v->uv_subnet)) break; - + if (vifi == numvifs) { printf("Destination %s not an interface\n", inet_fmt(qry->tr_dst, s1)); @@ -1314,22 +1314,22 @@ void mtrace(src, dst, group, data, no, datalen) printf("Wrong interface for packet\n"); return; } - } - + } + printf("Sending traceroute response\n"); - + /* copy the packet to the sending buffer */ p = send_buf + MIN_IP_HEADER_LEN + IGMP_MINLEN; - + bcopy(data, p, datalen); - + p += datalen; - + /* * fill in initial response fields */ resp = (struct tr_resp *)p; - resp->tr_qarr = ((tp.tv_sec + JAN_1970) << 16) + + resp->tr_qarr = ((tp.tv_sec + JAN_1970) << 16) + ((tp.tv_usec << 10) / 15625); resp->tr_vifin = 0; /* default values */ diff --git a/usr.sbin/mrouted/prune.h b/usr.sbin/mrouted/prune.h index 3cce25e..fd1fd23 100644 --- a/usr.sbin/mrouted/prune.h +++ b/usr.sbin/mrouted/prune.h @@ -7,12 +7,12 @@ * Leland Stanford Junior University. * * - * $Id: prune.h,v 1.3 1994/08/24 23:54:40 thyagara Exp $ + * $Id: prune.h,v 1.2 1994/09/08 02:51:24 wollman Exp $ */ -/* +/* * Macro for copying the user-level cache table to the kernel - * level table variable passed on by the setsock option + * level table variable passed on by the setsock option */ #define COPY_TABLES(from, to) { \ @@ -34,7 +34,7 @@ * an extra field in the user level table. * */ -struct ktable +struct ktable { struct ktable *kt_next; /* pointer to the next entry */ u_long kt_origin; /* subnet origin of multicasts */ @@ -57,7 +57,7 @@ struct ktable /* * structure to store incoming prunes */ -struct prunlst +struct prunlst { struct prunlst *rl_next; u_long rl_router; @@ -120,4 +120,4 @@ struct tr_resp { #define VAL_TO_MASK(x, i) { \ x = ~((1 << (32 - (i))) - 1); \ - } + } diff --git a/usr.sbin/mrouted/route.c b/usr.sbin/mrouted/route.c index 2debcc7..70ee5a5 100644 --- a/usr.sbin/mrouted/route.c +++ b/usr.sbin/mrouted/route.c @@ -7,7 +7,7 @@ * Leland Stanford Junior University. * * - * $Id: route.c,v 1.8 1994/08/24 23:54:42 thyagara Exp $ + * $Id: route.c,v 1.2 1994/09/08 02:51:25 wollman Exp $ */ @@ -703,7 +703,7 @@ struct newrt { u_long origin; int metric; int pad; -}; +}; int compare_rts(r1, r2) register struct newrt *r1; @@ -763,7 +763,7 @@ void accept_report(src, dst, p, datalen, level) if (datalen < 3) { log(LOG_WARNING, 0, - "received truncated route report from %s", + "received truncated route report from %s", inet_fmt(src, s1)); return; } @@ -776,7 +776,7 @@ void accept_report(src, dst, p, datalen, level) do { /* Loop through (origin, metric) pairs */ if (datalen < width + 1) { log(LOG_WARNING, 0, - "received truncated route report from %s", + "received truncated route report from %s", inet_fmt(src, s1)); return; } @@ -794,7 +794,7 @@ void accept_report(src, dst, p, datalen, level) qsort((char*)rt, nrt, sizeof(rt[0]), compare_rts); start_route_updates(); for (i = 0; i < nrt; ++i) - update_route(rt[i].origin, rt[i].mask, (rt[i].metric & 0x7f), + update_route(rt[i].origin, rt[i].mask, (rt[i].metric & 0x7f), src, vifi); if (routes_changed && !delay_change_reports) @@ -1068,7 +1068,7 @@ struct rtentry *determine_route(src) struct rtentry *rt; for (rt = routing_table; rt != NULL; rt = rt->rt_next) { - if (rt->rt_origin == (src & rt->rt_originmask)) + if (rt->rt_origin == (src & rt->rt_originmask)) break; } return rt; diff --git a/usr.sbin/mrouted/vif.c b/usr.sbin/mrouted/vif.c index 75115ad..56aae3f 100644 --- a/usr.sbin/mrouted/vif.c +++ b/usr.sbin/mrouted/vif.c @@ -7,7 +7,7 @@ * Leland Stanford Junior University. * * - * $Id: vif.c,v 1.2 1994/09/08 02:51:27 wollman Exp $ + * $Id: vif.c,v 1.3 1995/05/16 00:28:50 jkh Exp $ */ @@ -187,7 +187,7 @@ static void start_vif(vifi) * query. */ v->uv_flags |= VIFF_QUERIER; - send_igmp(src, allhosts_group, IGMP_HOST_MEMBERSHIP_QUERY, + send_igmp(src, allhosts_group, IGMP_HOST_MEMBERSHIP_QUERY, IGMP_MAX_HOST_REPORT_DELAY * IGMP_TIMER_SCALE, 0, 0); age_old_hosts(); } @@ -206,7 +206,7 @@ static void start_vif(vifi) * add the neighbor list on the interface to the message */ nbr = v->uv_neighbors; - + while (nbr) { for (i = 0; i < 4; i++) *p++ = ((char *)&nbr->al_addr)[i]; @@ -214,7 +214,7 @@ static void start_vif(vifi) nbr = nbr->al_next; } - send_igmp(src, dst, IGMP_DVMRP, DVMRP_PROBE, + send_igmp(src, dst, IGMP_DVMRP, DVMRP_PROBE, htonl(MROUTED_LEVEL), datalen); } @@ -366,7 +366,7 @@ void query_groups() for (vifi = 0, v = uvifs; vifi < numvifs; vifi++, v++) { if (v->uv_flags & VIFF_QUERIER) { send_igmp(v->uv_lcl_addr, allhosts_group, - IGMP_HOST_MEMBERSHIP_QUERY, + IGMP_HOST_MEMBERSHIP_QUERY, IGMP_MAX_HOST_REPORT_DELAY * IGMP_TIMER_SCALE, 0, 0); } } @@ -415,7 +415,7 @@ void accept_group_report(src, dst, group, r_type) g->al_query = DeleteTimer(g->al_query); if (g->al_timerid) g->al_timerid = DeleteTimer(g->al_timerid); - g->al_timerid = SetTimer(vifi, g); + g->al_timerid = SetTimer(vifi, g); break; } } @@ -448,7 +448,7 @@ void accept_group_report(src, dst, group, r_type) update_lclgrp(vifi, group); } - /* + /* * Check if a graft is necessary for this group */ chkgrp_graft(vifi, group); @@ -493,12 +493,12 @@ void leave_group_message( src, dst, group) /** send a group specific querry **/ g->al_timer = GROUP_EXPIRE_TIME / 10; send_igmp(v->uv_lcl_addr, g->al_addr, - IGMP_HOST_MEMBERSHIP_QUERY, + IGMP_HOST_MEMBERSHIP_QUERY, GROUP_EXPIRE_TIME / 30 * IGMP_TIMER_SCALE, g->al_addr, 0); g->al_query = SetQueryTimer(g, vifi, g->al_timer / 3 , GROUP_EXPIRE_TIME / 30 * IGMP_TIMER_SCALE); - g->al_timerid = SetTimer(vifi, g); + g->al_timerid = SetTimer(vifi, g); break; } } @@ -584,7 +584,7 @@ void accept_neighbor_request(src, dst) close(udp); us = addr.sin_addr.s_addr; } else /* query sent to us alone */ - us = dst; + us = dst; #define PUT_ADDR(a) temp_addr = ntohl(a); \ *p++ = temp_addr >> 24; \ @@ -668,7 +668,7 @@ void accept_neighbor_request2(src, dst) close(udp); us = addr.sin_addr.s_addr; } else /* query sent to us alone */ - us = dst; + us = dst; p = (u_char *) (send_buf + MIN_IP_HEADER_LEN + IGMP_MINLEN); datalen = 0; @@ -843,13 +843,13 @@ int update_neighbor(vifi, addr, msgtype, p, datalen, level) for (i = 0; i < 4; i++) ((char *)&genid)[i] = *p++; datalen -=4; - - /* + + /* * loop through router list and check for one-way ifs. */ - + he_hears_me = FALSE; - + while (datalen > 0) { if (datalen < 4) { log(LOG_WARNING, 0, @@ -876,7 +876,7 @@ int update_neighbor(vifi, addr, msgtype, p, datalen, level) n->al_timer = 0; /* If probe message and version no >= 3.3 check genid */ - if (msgtype == DVMRP_PROBE && + if (msgtype == DVMRP_PROBE && ((n->al_pv >= 3 && n->al_mv > 2) || n->al_pv > 3)) { if (he_hears_me == TRUE && v->uv_flags & VIFF_ONEWAY) v->uv_flags &= ~VIFF_ONEWAY; @@ -886,7 +886,7 @@ int update_neighbor(vifi, addr, msgtype, p, datalen, level) if ((n->al_genid != 0) && (n->al_genid != genid)) { log(LOG_DEBUG, 0, - "old:%d new:%dreset neighbor %s", + "old:%d new:%dreset neighbor %s", n->al_genid, genid, inet_fmt(addr, s1)); reset_neighbor_state(vifi, addr); @@ -904,7 +904,7 @@ int update_neighbor(vifi, addr, msgtype, p, datalen, level) /* * update the neighbors version and protocol number - * if changed => router went down and came up, + * if changed => router went down and came up, * so take action immediately. */ if ((n->al_pv != (level & 0xff)) || @@ -913,7 +913,7 @@ int update_neighbor(vifi, addr, msgtype, p, datalen, level) "resetting neighbor %s [old:%d.%d, new:%d.%d]", inet_fmt(addr, s1), n->al_pv, n->al_mv, level&0xff, (level>>8)&0xff); - + n->al_pv = level & 0xff; n->al_mv = (level >> 8) & 0xff; |