diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-03-03 15:14:29 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-03-03 15:14:29 +0000 |
commit | 3055b12bd8bc07c75be9a8debbb332ab9f0f8836 (patch) | |
tree | 3f18b636362177d2f432d48939f8497ebd259879 | |
parent | 44fb9a7e8707e33c715d2281b745640f6b6e3ba8 (diff) |
spaces
-rw-r--r-- | usr.sbin/mrouted/callout.c | 60 | ||||
-rw-r--r-- | usr.sbin/mrouted/cfparse.y | 6 | ||||
-rw-r--r-- | usr.sbin/mrouted/defs.h | 12 | ||||
-rw-r--r-- | usr.sbin/mrouted/dvmrp.h | 6 | ||||
-rw-r--r-- | usr.sbin/mrouted/igmp.c | 60 | ||||
-rw-r--r-- | usr.sbin/mrouted/kern.c | 4 | ||||
-rw-r--r-- | usr.sbin/mrouted/main.c | 20 | ||||
-rw-r--r-- | usr.sbin/mrouted/mrouted.8 | 6 | ||||
-rw-r--r-- | usr.sbin/mrouted/prune.c | 232 | ||||
-rw-r--r-- | usr.sbin/mrouted/prune.h | 10 | ||||
-rw-r--r-- | usr.sbin/mrouted/route.c | 18 | ||||
-rw-r--r-- | usr.sbin/mrouted/route.h | 4 | ||||
-rw-r--r-- | usr.sbin/mrouted/rsrr.c | 72 | ||||
-rw-r--r-- | usr.sbin/mrouted/rsrr.h | 6 | ||||
-rw-r--r-- | usr.sbin/mrouted/snmp.c | 128 | ||||
-rw-r--r-- | usr.sbin/mrouted/snmp.h | 12 | ||||
-rw-r--r-- | usr.sbin/mrouted/vif.c | 42 |
17 files changed, 349 insertions, 349 deletions
diff --git a/usr.sbin/mrouted/callout.c b/usr.sbin/mrouted/callout.c index e19fb8d0fea..bbb9b4595ad 100644 --- a/usr.sbin/mrouted/callout.c +++ b/usr.sbin/mrouted/callout.c @@ -19,16 +19,16 @@ static int in_callout = 0; struct timeout_q { struct timeout_q *next; /* next event */ - int id; - cfunc_t func; /* function to call */ - char *data; /* func's data */ - int time; /* time offset to next event*/ + int id; + cfunc_t func; /* function to call */ + char *data; /* func's data */ + int time; /* time offset to next event*/ }; #ifdef IGMP_DEBUG static void print_Q(void); #else -#define print_Q() +#define print_Q() #endif void @@ -45,13 +45,13 @@ void age_callout_queue(void) { struct timeout_q *ptr; - + if (in_callout) return; in_callout = 1; ptr = Q; - + while (ptr) { if (!ptr->time) { /* timeout has happened */ @@ -61,7 +61,7 @@ age_callout_queue(void) if (ptr->func) ptr->func(ptr->data); in_callout = 1; - + free(ptr); ptr = Q; } @@ -78,49 +78,49 @@ age_callout_queue(void) } -/* +/* * sets the timer * delay number of units for timeout * action function to be called on timeout - * data what to call the timeout function with + * data what to call the timeout function with */ int timer_setTimer(int delay, cfunc_t action, char *data) { 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 (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; @@ -132,7 +132,7 @@ timer_setTimer(int delay, cfunc_t action, char *data) return node->id; } else { /* keep moving */ - + delay -= ptr->time; node->time = delay; prev = ptr; ptr = ptr->next; @@ -151,36 +151,36 @@ void timer_clearTimer(int timer_id) { struct timeout_q *ptr, *prev; - + if (in_callout) return; if (!timer_id) return; in_callout = 1; - + prev = ptr = Q; - + /* * find the right node, delete it. the subsequent node's time * gets bumped up */ - + print_Q(); 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; - + free(ptr->data); free(ptr); print_Q(); @@ -202,7 +202,7 @@ static void print_Q(void) { struct timeout_q *ptr; - + for(ptr = Q; ptr; ptr = ptr->next) log(LOG_DEBUG,0,"(%d,%d) ", ptr->id, ptr->time); } diff --git a/usr.sbin/mrouted/cfparse.y b/usr.sbin/mrouted/cfparse.y index 47dc14510d5..1072893de12 100644 --- a/usr.sbin/mrouted/cfparse.y +++ b/usr.sbin/mrouted/cfparse.y @@ -107,7 +107,7 @@ stmts : /* Empty */ ; stmt : error - | PHYINT interface { + | PHYINT interface { vifi_t vifi; @@ -120,7 +120,7 @@ stmt : error if (!(v->uv_flags & VIFF_TUNNEL) && $2 == v->uv_lcl_addr) break; - + if (vifi == numvifs) fatal("%s is not a configured interface", inet_fmt($2,s1)); @@ -525,7 +525,7 @@ yylex() } if (sscanf(q,"%[.0-9]%c",s1,s2) == 1) { if ((addr = inet_parse(s1)) != 0xffffffff && - inet_valid_host(addr)) { + inet_valid_host(addr)) { yylval.addr = addr; return ADDR; } diff --git a/usr.sbin/mrouted/defs.h b/usr.sbin/mrouted/defs.h index 49ebd4c4c2e..03a50cab947 100644 --- a/usr.sbin/mrouted/defs.h +++ b/usr.sbin/mrouted/defs.h @@ -89,7 +89,7 @@ typedef void (*ihfunc_t)(int, fd_set *); #ifdef SYSV #define bcopy(a, b, c) memcpy(b, a, c) -#define bzero(s, n) memset((s), 0, (n)) +#define bzero(s, n) memset((s), 0, (n)) #define setlinebuf(s) setvbuf(s, NULL, _IOLBF, 0) #define signal(s,f) sigset(s,f) #endif @@ -227,25 +227,25 @@ extern int inet_cksum(u_int16_t *addr, u_int len); /* prune.c */ extern unsigned kroutes; extern void add_table_entry(u_int32_t origin, u_int32_t mcastgrp); -extern void del_table_entry(struct rtentry *r, +extern void del_table_entry(struct rtentry *r, u_int32_t mcastgrp, u_int del_flag); extern void update_table_entry(struct rtentry *r); extern void init_ktable(void); -extern void accept_prune(u_int32_t src, u_int32_t dst, char *p, +extern void accept_prune(u_int32_t src, u_int32_t dst, char *p, int datalen); extern void steal_sources(struct rtentry *rt); extern void reset_neighbor_state(vifi_t vifi, u_int32_t addr); extern int grplst_mem(vifi_t vifi, u_int32_t mcastgrp); extern int scoped_addr(vifi_t vifi, u_int32_t addr); extern void free_all_prunes(void); -extern void age_table_entry(void); +extern void age_table_entry(void); extern void dump_cache(FILE *fp2); -extern void update_lclgrp(vifi_t vifi, u_int32_t mcastgrp); +extern void update_lclgrp(vifi_t vifi, u_int32_t mcastgrp); extern void delete_lclgrp(vifi_t vifi, u_int32_t mcastgrp); extern void chkgrp_graft(vifi_t vifi, u_int32_t mcastgrp); extern void accept_graft(u_int32_t src, u_int32_t dst, char *p, int datalen); -extern void accept_g_ack(u_int32_t src, u_int32_t dst, char *p, +extern void accept_g_ack(u_int32_t src, u_int32_t dst, char *p, int datalen); /* u_int is promoted u_char */ extern void accept_mtrace(u_int32_t src, u_int32_t dst, diff --git a/usr.sbin/mrouted/dvmrp.h b/usr.sbin/mrouted/dvmrp.h index b4f2bf440bf..18cc3732a34 100644 --- a/usr.sbin/mrouted/dvmrp.h +++ b/usr.sbin/mrouted/dvmrp.h @@ -163,11 +163,11 @@ #define DEFAULT_METRIC 1 /* default subnet/tunnel metric */ #define DEFAULT_THRESHOLD 1 /* default subnet/tunnel threshold */ -#define MAX_RATE_LIMIT 100000 /* max rate limit */ -#define DEFAULT_PHY_RATE_LIMIT 0 /* default phyint rate limit */ +#define MAX_RATE_LIMIT 100000 /* max rate limit */ +#define DEFAULT_PHY_RATE_LIMIT 0 /* default phyint rate limit */ #define DEFAULT_TUN_RATE_LIMIT 500 /* default tunnel rate limit */ -#define DEFAULT_CACHE_LIFETIME 300 /* kernel route entry discard time */ +#define DEFAULT_CACHE_LIFETIME 300 /* kernel route entry discard time */ #define GRAFT_TIMEOUT_VAL 5 /* retransmission time for grafts */ #define OLD_AGE_THRESHOLD 2 diff --git a/usr.sbin/mrouted/igmp.c b/usr.sbin/mrouted/igmp.c index 475be1e250c..0fbd8ef33b8 100644 --- a/usr.sbin/mrouted/igmp.c +++ b/usr.sbin/mrouted/igmp.c @@ -16,8 +16,8 @@ /* * Exported variables. */ -char *recv_buf; /* input packet buffer */ -char *send_buf; /* output packet buffer */ +char *recv_buf; /* input packet buffer */ +char *send_buf; /* output packet buffer */ int igmp_socket; /* socket for all network I/O */ u_int32_t allhosts_group; /* All hosts addr in net order */ u_int32_t allrtrs_group; /* All-Routers " in net order */ @@ -43,7 +43,7 @@ init_igmp(void) recv_buf = malloc(RECV_BUF_SIZE); send_buf = malloc(RECV_BUF_SIZE); - 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 */ @@ -66,7 +66,7 @@ init_igmp(void) #define PIM_QUERY 0 #define PIM_REGISTER 1 -#define PIM_REGISTER_STOP 2 +#define PIM_REGISTER_STOP 2 #define PIM_JOIN_PRUNE 3 #define PIM_RP_REACHABLE 4 #define PIM_ASSERT 5 @@ -83,34 +83,34 @@ packet_kind(u_int type, u_int code) case IGMP_HOST_LEAVE_MESSAGE: return "leave message "; case IGMP_DVMRP: switch (code) { - case DVMRP_PROBE: return "neighbor probe "; - case DVMRP_REPORT: return "route report "; - case DVMRP_ASK_NEIGHBORS: return "neighbor request "; - case DVMRP_NEIGHBORS: return "neighbor list "; - case DVMRP_ASK_NEIGHBORS2: return "neighbor request 2"; - case DVMRP_NEIGHBORS2: return "neighbor list 2 "; + case DVMRP_PROBE: return "neighbor probe "; + case DVMRP_REPORT: return "route report "; + case DVMRP_ASK_NEIGHBORS: return "neighbor request "; + case DVMRP_NEIGHBORS: return "neighbor list "; + case DVMRP_ASK_NEIGHBORS2: return "neighbor request 2"; + case DVMRP_NEIGHBORS2: return "neighbor list 2 "; case DVMRP_PRUNE: return "prune message "; case DVMRP_GRAFT: return "graft message "; case DVMRP_GRAFT_ACK: return "graft message ack "; case DVMRP_INFO_REQUEST: return "info request "; case DVMRP_INFO_REPLY: return "info reply "; - default: return "unknown DVMRP msg "; + default: return "unknown DVMRP msg "; + } + case IGMP_PIM: + switch (code) { + case PIM_QUERY: return "PIM Router-Query "; + case PIM_REGISTER: return "PIM Register "; + case PIM_REGISTER_STOP: return "PIM Register-Stop "; + case PIM_JOIN_PRUNE: return "PIM Join/Prune "; + case PIM_RP_REACHABLE: return "PIM RP-Reachable "; + case PIM_ASSERT: return "PIM Assert "; + case PIM_GRAFT: return "PIM Graft "; + case PIM_GRAFT_ACK: return "PIM Graft-Ack "; + default: return "unknown PIM msg "; } - case IGMP_PIM: - switch (code) { - case PIM_QUERY: return "PIM Router-Query "; - case PIM_REGISTER: return "PIM Register "; - case PIM_REGISTER_STOP: return "PIM Register-Stop "; - case PIM_JOIN_PRUNE: return "PIM Join/Prune "; - case PIM_RP_REACHABLE: return "PIM RP-Reachable "; - case PIM_ASSERT: return "PIM Assert "; - case PIM_GRAFT: return "PIM Graft "; - case PIM_GRAFT_ACK: return "PIM Graft-Ack "; - default: return "unknown PIM msg "; - } case IGMP_MTRACE_QUERY: return "IGMP trace query "; case IGMP_MTRACE_REPLY: return "IGMP trace reply "; - default: return "unknown IGMP msg "; + default: return "unknown IGMP msg "; } } @@ -136,9 +136,9 @@ accept_igmp(int 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) { @@ -182,7 +182,7 @@ accept_igmp(int recvlen) case IGMP_v2_HOST_MEMBERSHIP_REPORT: accept_group_report(src, dst, group, igmp->igmp_type); return; - + case IGMP_HOST_LEAVE_MESSAGE: accept_leave_message(src, dst, group); return; @@ -197,7 +197,7 @@ accept_igmp(int recvlen) return; case DVMRP_REPORT: - accept_report(src, dst, + accept_report(src, dst, (char *)(igmp+1), igmpdatalen, group); return; @@ -248,8 +248,8 @@ accept_igmp(int recvlen) return; } - case IGMP_PIM: - return; + case IGMP_PIM: + return; case IGMP_MTRACE_REPLY: return; diff --git a/usr.sbin/mrouted/kern.c b/usr.sbin/mrouted/kern.c index 9588ca301c6..3e972785ba3 100644 --- a/usr.sbin/mrouted/kern.c +++ b/usr.sbin/mrouted/kern.c @@ -61,7 +61,7 @@ void k_set_if(u_int32_t ifa) if (setsockopt(igmp_socket, IPPROTO_IP, IP_MULTICAST_IF, (char *)&adr, sizeof(adr)) < 0) log(LOG_ERR, errno, "setsockopt IP_MULTICAST_IF %s", - inet_fmt(ifa, s1)); + inet_fmt(ifa, s1)); } @@ -201,7 +201,7 @@ int k_del_rg(u_int32_t origin, struct gtable *g) } return retval; -} +} /* * Get the kernel's idea of what version of mrouted needs to run with it. diff --git a/usr.sbin/mrouted/main.c b/usr.sbin/mrouted/main.c index e6861cb5401..da0f9f3d434 100644 --- a/usr.sbin/mrouted/main.c +++ b/usr.sbin/mrouted/main.c @@ -30,7 +30,7 @@ #ifndef lint static char rcsid[] = - "@(#) $Id: main.c,v 1.11 2003/03/03 14:58:23 deraadt Exp $"; + "@(#) $Id: main.c,v 1.12 2003/03/03 15:14:28 deraadt Exp $"; #endif extern char *configfilename; @@ -40,8 +40,8 @@ static char dumpfilename[] = _PATH_MROUTED_DUMP; static char cachefilename[] = _PATH_MROUTED_CACHE; static char genidfilename[] = _PATH_MROUTED_GENID; -int cache_lifetime = DEFAULT_CACHE_LIFETIME; -int max_prune_lifetime = DEFAULT_CACHE_LIFETIME * 2; +int cache_lifetime = DEFAULT_CACHE_LIFETIME; +int max_prune_lifetime = DEFAULT_CACHE_LIFETIME * 2; int debug = 0; u_char pruning = 1; /* Enable pruning by default */ @@ -137,7 +137,7 @@ main(int argc, char *argv[]) } if (argc > 0) { -usage: fprintf(stderr, +usage: fprintf(stderr, "usage: mrouted [-p] [-c configfile] [-d [debug_level]]\n"); exit(1); } @@ -191,7 +191,7 @@ usage: fprintf(stderr, #endif /* - * Get generation id + * Get generation id */ gettimeofday(&tv, 0); dvmrp_genid = tv.tv_sec; @@ -325,9 +325,9 @@ usage: fprintf(stderr, snmp_select_info(&nfds, &rfds, tvp, &block); if (block == 1) tvp = NULL; /* block without timeout */ - if ((n = select(nfds, &rfds, NULL, NULL, tvp)) < 0) + if ((n = select(nfds, &rfds, NULL, NULL, tvp)) < 0) #else - if ((n = select(nfds, &rfds, NULL, NULL, NULL)) < 0) + if ((n = select(nfds, &rfds, NULL, NULL, NULL)) < 0) #endif { if (errno != EINTR) /* SIGALRM is expected */ @@ -357,7 +357,7 @@ usage: fprintf(stderr, } #ifdef SNMP - snmp_read(&rfds); + snmp_read(&rfds); snmp_timeout(); /* poll */ #endif } @@ -405,7 +405,7 @@ fasttimer(int i) timer(); age_callout_queue();/* Advance the timer for the callout queue - for groups */ + for groups */ alarm(1); } @@ -549,7 +549,7 @@ cdump(int i) fp = fopen(cachefilename, "w"); if (fp != NULL) { - dump_cache(fp); + dump_cache(fp); (void) fclose(fp); } } diff --git a/usr.sbin/mrouted/mrouted.8 b/usr.sbin/mrouted/mrouted.8 index f82c66fd26c..4a2f3c07c23 100644 --- a/usr.sbin/mrouted/mrouted.8 +++ b/usr.sbin/mrouted/mrouted.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: mrouted.8,v 1.10 2003/03/01 01:56:56 deraadt Exp $ +.\" $OpenBSD: mrouted.8,v 1.11 2003/03/03 15:14:28 deraadt Exp $ .\" The mrouted program is covered by the license in the accompanying file .\" named "LICENSE". Use of the mrouted program represents acceptance of .\" the terms and conditions listed in that file. @@ -39,7 +39,7 @@ routers that do not support IP multicasting, .Nm includes support for "tunnels", which are virtual point-to-point links between pairs of -.Nm +.Nm daemons located anywhere in an internet. IP multicast packets are encapsulated for transmission through tunnels, so that they look like normal unicast datagrams to intervening routers and subnets. The encapsulation is added on @@ -293,7 +293,7 @@ dumps the internal routing tables to stderr (only if was invoked with a non-zero debug level). .El .Pp -For convenience in sending signals, +For convenience in sending signals, .Nm writes its pid to .Pa /var/run/mrouted.pid diff --git a/usr.sbin/mrouted/prune.c b/usr.sbin/mrouted/prune.c index fcd4c2a5e49..e1676395631 100644 --- a/usr.sbin/mrouted/prune.c +++ b/usr.sbin/mrouted/prune.c @@ -41,7 +41,7 @@ extern int phys_vif; default: y = 0; \ } \ } - + struct gtable *kernel_table; /* ptr to list of kernel grp entries*/ static struct gtable *kernel_no_route; /* list of grp entries w/o routes */ struct gtable *gtp; /* pointer for kernel rt entries */ @@ -62,7 +62,7 @@ static void send_graft_ack(u_int32_t src, u_int32_t dst, static void update_kernel(struct gtable *g); static char * scaletime(u_long t); -/* +/* * Updates the ttl values for each vif. */ static void @@ -70,11 +70,11 @@ prun_add_ttls(struct gtable *gt) { struct uvif *v; vifi_t vifi; - + for (vifi = 0, v = uvifs; vifi < numvifs; ++vifi, ++v) { if (VIFM_ISSET(vifi, gt->gt_grpmems)) gt->gt_ttls[vifi] = v->uv_threshold; - else + else gt->gt_ttls[vifi] = 0; } } @@ -102,7 +102,7 @@ scoped_addr(vifi_t vifi, u_int32_t addr) return 0; } -/* +/* * Determine if mcastgrp has a listener on vifi */ int @@ -110,13 +110,13 @@ grplst_mem(vifi_t vifi, u_int32_t 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; } @@ -234,11 +234,11 @@ send_prune(struct gtable *gt) u_int32_t src; u_int32_t dst; u_int32_t tmp; - + /* Don't process any prunes if router is not pruning */ if (pruning == 0) return; - + /* Can't process a prune if we don't have an associated route */ if (gt->gt_route == NULL) return; @@ -246,16 +246,16 @@ send_prune(struct gtable *gt) /* Don't send a prune to a non-pruning router */ if (!pruning_neighbor(gt->gt_route->rt_parent, gt->gt_route->rt_gateway)) return; - - /* + + /* * sends a prune message to the router upstream. */ src = uvifs[gt->gt_route->rt_parent].uv_lcl_addr; dst = gt->gt_route->rt_gateway; - + p = send_buf + MIN_IP_HEADER_LEN + IGMP_MINLEN; datalen = 0; - + /* * determine prune lifetime */ @@ -263,7 +263,7 @@ send_prune(struct gtable *gt) for (pt = gt->gt_pruntbl; pt; pt = pt->pt_next) if (pt->pt_timer < gt->gt_prsent_timer) gt->gt_prsent_timer = pt->pt_timer; - + /* * If we have a graft pending, cancel graft retransmission */ @@ -277,10 +277,10 @@ send_prune(struct gtable *gt) for (i = 0; i < 4; i++) *p++ = ((char *)&(tmp))[i]; datalen += 12; - + send_igmp(src, dst, IGMP_DVMRP, DVMRP_PRUNE, htonl(MROUTED_LEVEL), datalen); - + log(LOG_DEBUG, 0, "sent prune for (%s %s)/%d on vif %d to %s", inet_fmts(gt->gt_route->rt_origin, gt->gt_route->rt_originmask, s1), inet_fmt(gt->gt_mcastgrp, s2), @@ -291,7 +291,7 @@ send_prune(struct gtable *gt) /* * 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. */ @@ -307,19 +307,19 @@ send_graft(struct gtable *gt) /* Can't send a graft without an associated route */ if (gt->gt_route == NULL) return; - + src = uvifs[gt->gt_route->rt_parent].uv_lcl_addr; dst = gt->gt_route->rt_gateway; - + p = send_buf + MIN_IP_HEADER_LEN + IGMP_MINLEN; datalen = 0; - + for (i = 0; i < 4; i++) *p++ = ((char *)&(gt->gt_route->rt_origin))[i]; for (i = 0; i < 4; i++) *p++ = ((char *)&(gt->gt_mcastgrp))[i]; datalen += 8; - + if (datalen != 0) { send_igmp(src, dst, IGMP_DVMRP, DVMRP_GRAFT, htonl(MROUTED_LEVEL), datalen); @@ -342,13 +342,13 @@ send_graft_ack(u_int32_t src, u_int32_t dst, u_int32_t origin, u_int32_t grp) p = send_buf + MIN_IP_HEADER_LEN + IGMP_MINLEN; datalen = 0; - + for (i = 0; i < 4; i++) *p++ = ((char *)&(origin))[i]; for (i = 0; i < 4; i++) *p++ = ((char *)&(grp))[i]; datalen += 8; - + send_igmp(src, dst, IGMP_DVMRP, DVMRP_GRAFT_ACK, htonl(MROUTED_LEVEL), datalen); @@ -386,8 +386,8 @@ find_grp(u_long grp) for (gt = kernel_table; gt; gt = gt->gt_gnext) { if (ntohl(grp) < ntohl(gt->gt_mcastgrp)) - break; - if (gt->gt_mcastgrp == grp) + break; + if (gt->gt_mcastgrp == grp) return gt; } return NULL; @@ -412,8 +412,8 @@ find_grp_src(struct gtable *gt, u_long src) return NULL; } -/* - * Find next entry > specification +/* + * Find next entry > specification * gtpp: ordered by group * stpp: ordered by source */ @@ -428,9 +428,9 @@ next_grp_src_mask(struct gtable *gtpp, struct gtable *stpp, u_long grp, (*gtpp) = kernel_table; while ((*gtpp) && ntohl((*gtpp)->gt_mcastgrp) < ntohl(grp)) (*gtpp)=(*gtpp)->gt_gnext; - if (!(*gtpp)) + if (!(*gtpp)) return 0; /* no more groups */ - + for (gt = kernel_table; gt; gt=gt->gt_gnext) { /* Since grps are ordered, we can stop when group changes from gbest */ if (gbest && gbest->gt_mcastgrp != gt->gt_mcastgrp) @@ -439,13 +439,13 @@ next_grp_src_mask(struct gtable *gtpp, struct gtable *stpp, u_long grp, /* Among those entries > spec, find "lowest" one */ if (((ntohl(gt->gt_mcastgrp)> ntohl(grp)) - || (ntohl(gt->gt_mcastgrp)==ntohl(grp) + || (ntohl(gt->gt_mcastgrp)==ntohl(grp) && ntohl(st->st_origin)> ntohl(src)) - || (ntohl(gt->gt_mcastgrp)==ntohl(grp) + || (ntohl(gt->gt_mcastgrp)==ntohl(grp) && ntohl(st->st_origin)==src && 0xFFFFFFFF>ntohl(mask))) - && (!gbest + && (!gbest || (ntohl(gt->gt_mcastgrp)< ntohl(gbest->gt_mcastgrp)) - || (ntohl(gt->gt_mcastgrp)==ntohl(gbest->gt_mcastgrp) + || (ntohl(gt->gt_mcastgrp)==ntohl(gbest->gt_mcastgrp) && ntohl(st->st_origin)< ntohl(sbest->st_origin)))) { gbest = gt; sbest = st; @@ -459,8 +459,8 @@ next_grp_src_mask(struct gtable *gtpp, struct gtable *stpp, u_long grp, /* * Ensure that sg contains current information for the given group,source. - * This is fetched from the kernel as a unit so that counts for the entry - * are consistent, i.e. packet and byte counts for the same entry are + * This is fetched from the kernel as a unit so that counts for the entry + * are consistent, i.e. packet and byte counts for the same entry are * read at the same time. */ void @@ -494,7 +494,7 @@ snmp_find_route(u_long src, u_long mask) } /* - * Find next route entry > specification + * Find next route entry > specification */ int next_route(struct rtentry **rtpp, u_long src, u_long mask) @@ -503,8 +503,8 @@ next_route(struct rtentry **rtpp, u_long src, u_long mask) /* Among all entries > spec, find "lowest" one in order */ for (rt = routing_table; rt; rt=rt->rt_next) { - if ((ntohl(rt->rt_origin) > ntohl(src) - || (ntohl(rt->rt_origin) == ntohl(src) + if ((ntohl(rt->rt_origin) > ntohl(src) + || (ntohl(rt->rt_origin) == ntohl(src) && ntohl(rt->rt_originmask) > ntohl(mask))) && (!rbest || (ntohl(rt->rt_origin) < ntohl(rbest->rt_origin)) || (ntohl(rt->rt_origin) == ntohl(rbest->rt_origin) @@ -564,7 +564,7 @@ next_child(struct gtable *gtpp, struct gtable *stpp, u_long grp, if (VIFM_ISSET(*vifi, (*gtpp)->gt_route->rt_children)) return 1; *vifi = 0; - } while (next_grp_src_mask(gtpp, stpp, (*gtpp)->gt_mcastgrp, + } while (next_grp_src_mask(gtpp, stpp, (*gtpp)->gt_mcastgrp, (*stpp)->st_origin, 0xFFFFFFFF) ); return 0; @@ -577,12 +577,12 @@ next_child(struct gtable *gtpp, struct gtable *stpp, u_long grp, void init_ktable(void) { - kernel_table = NULL; + kernel_table = NULL; kernel_no_route = NULL; kroutes = 0; } -/* +/* * Add a new table entry for (origin, mcastgrp) */ void @@ -596,7 +596,7 @@ add_table_entry(u_int32_t origin, u_int32_t mcastgrp) #ifdef DEBUG_MFC md_log(MD_MISS, origin, mcastgrp); #endif - + r = determine_route(origin); prev_gt = NULL; if (r == NULL) { @@ -625,7 +625,7 @@ add_table_entry(u_int32_t origin, u_int32_t mcastgrp) log(LOG_ERR, 0, "ran out of memory"); gt->gt_mcastgrp = mcastgrp; - gt->gt_timer = CACHE_LIFETIME(cache_lifetime); + gt->gt_timer = CACHE_LIFETIME(cache_lifetime); time(>->gt_ctime); gt->gt_grpmems = 0; gt->gt_scope = 0; @@ -715,7 +715,7 @@ add_table_entry(u_int32_t origin, u_int32_t mcastgrp) #endif log(LOG_WARNING, 0, "kernel entry already exists for (%s %s)", inet_fmt(origin, s1), inet_fmt(mcastgrp, s2)); - /* XXX Doing this should cause no harm, and may ensure + /* XXX Doing this should cause no harm, and may ensure * kernel<>mrouted synchronization */ k_add_rg(origin, gt); return; @@ -728,10 +728,10 @@ add_table_entry(u_int32_t origin, u_int32_t mcastgrp) inet_fmt(origin, s1), inet_fmt(mcastgrp, s2), gt->gt_grpmems, r ? r->rt_parent : -1); - + /* 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. */ if (!gt->gt_prsent_timer && !gt->gt_grpmems && r && r->rt_gateway) send_prune(gt); @@ -748,7 +748,7 @@ reset_neighbor_state(vifi_t vifi, u_int32_t addr) struct gtable *g; struct ptable *pt, **ptnp; struct stable *st; - + for (g = kernel_table; g; g = g->gt_gnext) { r = g->gt_route; @@ -798,14 +798,14 @@ reset_neighbor_state(vifi_t vifi, u_int32_t addr) * And see if we want to forward again. */ if (!VIFM_ISSET(vifi, g->gt_grpmems)) { - if (VIFM_ISSET(vifi, r->rt_children) && + if (VIFM_ISSET(vifi, r->rt_children) && !(VIFM_ISSET(vifi, r->rt_leaves))) VIFM_SET(vifi, g->gt_grpmems); - - if (VIFM_ISSET(vifi, r->rt_leaves) && + + if (VIFM_ISSET(vifi, r->rt_leaves) && grplst_mem(vifi, g->gt_mcastgrp)) VIFM_SET(vifi, g->gt_grpmems); - + g->gt_grpmems &= ~g->gt_scope; prun_add_ttls(g); @@ -834,7 +834,7 @@ del_table_entry(struct rtentry *r, u_int32_t mcastgrp, u_int del_flag) struct gtable *g, *prev_g; struct stable *st, *prev_st; struct ptable *pt, *prev_pt; - + if (del_flag == DEL_ALL_ROUTES) { g = r->rt_groups; while (g) { @@ -882,8 +882,8 @@ del_table_entry(struct rtentry *r, u_int32_t mcastgrp, u_int del_flag) } r->rt_groups = NULL; } - - /* + + /* * Dummy routine - someday this may be needed, so it is just there */ if (del_flag == DEL_RTE_GROUP) { @@ -966,10 +966,10 @@ update_table_entry(struct rtentry *r) /* obtain the multicast group membership list */ for (i = 0; i < numvifs; i++) { - if (VIFM_ISSET(i, r->rt_children) && + if (VIFM_ISSET(i, r->rt_children) && !(VIFM_ISSET(i, r->rt_leaves))) VIFM_SET(i, g->gt_grpmems); - + if (VIFM_ISSET(i, r->rt_leaves) && grplst_mem(i, g->gt_mcastgrp)) VIFM_SET(i, g->gt_grpmems); } @@ -1012,10 +1012,10 @@ update_lclgrp(vifi_t vifi, u_int32_t mcastgrp) { struct rtentry *r; struct gtable *g; - + log(LOG_DEBUG, 0, "group %s joined on vif %d", inet_fmt(mcastgrp, s1), vifi); - + for (g = kernel_table; g; g = g->gt_gnext) { if (ntohl(mcastgrp) < ntohl(g->gt_mcastgrp)) break; @@ -1051,10 +1051,10 @@ delete_lclgrp(vifi_t vifi, u_int32_t mcastgrp) { struct rtentry *r; struct gtable *g; - + log(LOG_DEBUG, 0, "group %s left on vif %d", inet_fmt(mcastgrp, s1), vifi); - + for (g = kernel_table; g; g = g->gt_gnext) { if (ntohl(mcastgrp) < ntohl(g->gt_mcastgrp)) break; @@ -1119,23 +1119,23 @@ accept_prune(u_int32_t src, u_int32_t dst, char *p, int datalen) u_int32_t prun_tmr; vifi_t vifi; int i; - int stop_sending; + int stop_sending; struct rtentry *r; struct gtable *g; struct ptable *pt; 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", + "ignoring prune report from non-neighbor %s", inet_fmt(src, s1)); return; } - + /* Check if enough data is present */ if (datalen < 12) { @@ -1144,7 +1144,7 @@ accept_prune(u_int32_t src, u_int32_t dst, char *p, int datalen) inet_fmt(src, s1)); return; } - + for (i = 0; i< 4; i++) ((char *)&prun_src)[i] = *p++; for (i = 0; i< 4; i++) @@ -1152,7 +1152,7 @@ accept_prune(u_int32_t src, u_int32_t dst, char *p, int datalen) for (i = 0; i< 4; i++) ((char *)&prun_tmr)[i] = *p++; prun_tmr = ntohl(prun_tmr); - + log(LOG_DEBUG, 0, "%s on vif %d prunes (%s %s)/%d", inet_fmt(src, s1), vifi, inet_fmt(prun_src, s2), inet_fmt(prun_grp, s3), prun_tmr); @@ -1162,7 +1162,7 @@ accept_prune(u_int32_t src, u_int32_t dst, char *p, int datalen) */ if (find_src_grp(prun_src, 0, prun_grp)) { g = gtp ? gtp->gt_gnext : kernel_table; - r = g->gt_route; + r = g->gt_route; if (!VIFM_ISSET(vifi, r->rt_children)) { log(LOG_WARNING, 0, "prune received from non-child %s for (%s %s)", @@ -1194,7 +1194,7 @@ accept_prune(u_int32_t src, u_int32_t dst, char *p, int datalen) pt = (struct ptable *)(malloc(sizeof(struct ptable))); if (pt == NULL) log(LOG_ERR, 0, "pt: ran out of memory"); - + pt->pt_vifi = vifi; pt->pt_router = src; pt->pt_timer = prun_tmr; @@ -1209,7 +1209,7 @@ accept_prune(u_int32_t src, u_int32_t dst, char *p, int datalen) g->gt_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 */ stop_sending = 1; @@ -1235,7 +1235,7 @@ accept_prune(u_int32_t src, u_int32_t dst, char *p, int datalen) /* * 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 */ @@ -1285,14 +1285,14 @@ chkgrp_graft(vifi_t vifi, u_int32_t mcastgrp) /* set the flag for graft retransmission */ g->gt_grftsnt = 1; - + /* send graft upwards */ send_graft(g); - + /* reset the prune timer and update cache timer*/ g->gt_prsent_timer = 0; g->gt_timer = max_prune_lifetime; - + log(LOG_DEBUG, 0, "chkgrp graft (%s %s) gm:%x", inet_fmts(r->rt_origin, r->rt_originmask, s1), inet_fmt(g->gt_mcastgrp, s2), g->gt_grpmems); @@ -1308,12 +1308,12 @@ chkgrp_graft(vifi_t vifi, u_int32_t mcastgrp) } /* 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. * @@ -1322,37 +1322,37 @@ chkgrp_graft(vifi_t vifi, u_int32_t mcastgrp) void accept_graft(u_int32_t src, u_int32_t dst, char *p, int datalen) { - vifi_t vifi; - u_int32_t graft_src; + vifi_t vifi; + u_int32_t graft_src; u_int32_t graft_grp; - int i; + int i; struct rtentry *r; struct gtable *g; struct ptable *pt, **ptnp; - + if ((vifi = find_vif(src, dst)) == NO_VIF) { log(LOG_INFO, 0, - "ignoring graft from non-neighbor %s", + "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 *)&graft_src)[i] = *p++; for (i = 0; i< 4; i++) ((char *)&graft_grp)[i] = *p++; - + log(LOG_DEBUG, 0, "%s on vif %d grafts (%s %s)", inet_fmt(src, s1), vifi, inet_fmt(graft_src, s2), inet_fmt(graft_grp, s3)); - + /* * Find the subnet for the graft */ @@ -1384,7 +1384,7 @@ accept_graft(u_int32_t src, u_int32_t dst, char *p, int datalen) /* Send route change notification to reservation protocol. */ rsrr_cache_send(g,1); #endif /* RSRR */ - break; + break; } else { ptnp = &pt->pt_next; } @@ -1393,7 +1393,7 @@ accept_graft(u_int32_t src, u_int32_t dst, char *p, int datalen) /* send ack downstream */ send_graft_ack(dst, src, graft_src, graft_grp); g->gt_timer = max_prune_lifetime; - + if (g->gt_prsent_timer) { /* set the flag for graft retransmission */ g->gt_grftsnt = 1; @@ -1421,45 +1421,45 @@ accept_graft(u_int32_t src, u_int32_t dst, char *p, int datalen) } /* - * 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(u_int32_t src, u_int32_t dst, char *p, int datalen) { struct gtable *g; - vifi_t vifi; - u_int32_t grft_src; + vifi_t vifi; + u_int32_t grft_src; u_int32_t grft_grp; - int i; - + int i; + if ((vifi = find_vif(src, dst)) == NO_VIF) { log(LOG_INFO, 0, - "ignoring graft ack from non-neighbor %s", + "ignoring graft ack from non-neighbor %s", inet_fmt(src, s1)); return; } - + if (datalen < 0 || datalen > 8) { log(LOG_WARNING, 0, "received non-decipherable graft ack 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_grp)[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_grp, s3)); - + /* * Find the subnet for the graft ack */ @@ -1614,9 +1614,9 @@ age_table_entry(void) struct stable *st, **stnp; struct ptable *pt, **ptnp; struct sioc_sg_req sg_req; - + log(LOG_DEBUG, 0, "ageing entries"); - + gtnptr = &kernel_table; while ((gt = *gtnptr) != NULL) { r = gt->gt_route; @@ -1651,7 +1651,7 @@ age_table_entry(void) ptnp = >->gt_pruntbl; while ((pt = *ptnp) != NULL) { if ((pt->pt_timer -= ROUTE_MAX_REPORT_DELAY) <= 0) { - log(LOG_DEBUG, 0, "expire prune (%s %s) from %s on vif %d", + log(LOG_DEBUG, 0, "expire prune (%s %s) from %s on vif %d", inet_fmts(r->rt_origin, r->rt_originmask, s1), inet_fmt(gt->gt_mcastgrp, s2), inet_fmt(pt->pt_router, s3), @@ -1726,7 +1726,7 @@ age_table_entry(void) log(LOG_DEBUG, 0, "timeout cache entry (%s, %s)", inet_fmts(r->rt_origin, r->rt_originmask, s1), inet_fmt(gt->gt_mcastgrp, s2)); - + if (gt->gt_prev) gt->gt_prev->gt_next = gt->gt_next; else @@ -1879,7 +1879,7 @@ dump_cache(FILE *fp2) fprintf(fp2, "Multicast Routing Cache Table (%d entries)\n%s", kroutes, " Origin Mcast-group CTmr Age Ptmr IVif Forwvifs\n"); - + for (gt = kernel_no_route; gt; gt = gt->gt_next) { if (gt->gt_srctbl) { fprintf(fp2, " %-18s %-15s %-4s %-4s - -1\n", @@ -2007,7 +2007,7 @@ accept_mtrace(u_int32_t src, u_int32_t dst, u_int32_t group, 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 */ @@ -2034,7 +2034,7 @@ accept_mtrace(u_int32_t src, u_int32_t dst, u_int32_t group, return; } vifi = find_vif(qry->tr_dst, 0); - + if (vifi == NO_VIF) { /* The traceroute destination is not on one of my subnet vifs. */ log(LOG_DEBUG, 0, "Destination %s not an interface", @@ -2060,20 +2060,20 @@ accept_mtrace(u_int32_t src, u_int32_t dst, u_int32_t group, log(LOG_DEBUG, 0, "Wrong interface for packet"); errcode = TR_WRONG_IF; } - } - + } + /* Now that we've decided to send a response, save the qid */ oqid = qry->tr_qid; log(LOG_DEBUG, 0, "Sending traceroute response"); - + /* copy the packet to the sending buffer */ p = send_buf + MIN_IP_HEADER_LEN + IGMP_MINLEN; - + 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. @@ -2092,7 +2092,7 @@ accept_mtrace(u_int32_t src, u_int32_t dst, u_int32_t group, bzero(resp, sizeof(struct tr_resp)); datalen += RLEN; - resp->tr_qarr = htonl((tp.tv_sec + JAN_1970) << 16) + + resp->tr_qarr = htonl((tp.tv_sec + JAN_1970) << 16) + ((tp.tv_usec >> 4) & 0xffff); resp->tr_rproto = PROTO_DVMRP; diff --git a/usr.sbin/mrouted/prune.h b/usr.sbin/mrouted/prune.h index b3187a89d37..20fad1d2444 100644 --- a/usr.sbin/mrouted/prune.h +++ b/usr.sbin/mrouted/prune.h @@ -30,8 +30,8 @@ struct gtable { u_char gt_ttls[MAXVIFS]; /* ttl vector for forwarding */ vifbitmap_t gt_grpmems; /* forw. vifs for src, grp */ int gt_prsent_timer; /* prune timer for this group */ - int gt_timer; /* timer for this group entry */ - time_t gt_ctime; /* time of entry creation */ + int gt_timer; /* timer for this group entry */ + time_t gt_ctime; /* time of entry creation */ u_char gt_grftsnt; /* graft sent/retransmit timer */ struct stable *gt_srctbl; /* source table */ struct ptable *gt_pruntbl; /* prune table */ @@ -46,9 +46,9 @@ struct gtable { * * When source-based prunes exist, there will be a struct ptable here as well. */ -struct stable +struct stable { - struct stable *st_next; /* pointer to the next entry */ + struct stable *st_next; /* pointer to the next entry */ u_int32_t st_origin; /* host origin of multicasts */ u_long st_pktcnt; /* packet count for src-grp entry */ }; @@ -56,7 +56,7 @@ struct stable /* * structure to store incoming prunes. Can hang off of either group or source. */ -struct ptable +struct ptable { struct ptable *pt_next; /* pointer to the next entry */ u_int32_t pt_router; /* router that sent this prune */ diff --git a/usr.sbin/mrouted/route.c b/usr.sbin/mrouted/route.c index 7fd5ed93d64..5449fd3d00a 100644 --- a/usr.sbin/mrouted/route.c +++ b/usr.sbin/mrouted/route.c @@ -306,7 +306,7 @@ create_route(u_int32_t origin, u_int32_t mask) r->rt_prev = rtp; if (r->rt_next != NULL) (r->rt_next)->rt_prev = r; - else + else rt_end = r; rtp = r; ++nroutes; @@ -688,7 +688,7 @@ accept_probe(u_int32_t src, u_int32_t dst, char *p, int datalen, if ((vifi = find_vif(src, dst)) == NO_VIF) { log(LOG_INFO, 0, - "ignoring probe from non-neighbor %s", inet_fmt(src, s1)); + "ignoring probe from non-neighbor %s", inet_fmt(src, s1)); return; } @@ -700,7 +700,7 @@ struct newrt { u_int32_t origin; int metric; int pad; -}; +}; static int compare_rts(const void *rt1, const void *rt2) @@ -742,7 +742,7 @@ accept_report(u_int32_t src, u_int32_t dst, char *p, int datalen, if ((vifi = find_vif(src, dst)) == NO_VIF) { log(LOG_INFO, 0, - "ignoring route report from non-neighbor %s", inet_fmt(src, s1)); + "ignoring route report from non-neighbor %s", inet_fmt(src, s1)); return; } @@ -751,7 +751,7 @@ accept_report(u_int32_t src, u_int32_t dst, char *p, int datalen, if (datalen > 2*4096) { log(LOG_INFO, 0, - "ignoring oversize (%d bytes) route report from %s", + "ignoring oversize (%d bytes) route report from %s", datalen, inet_fmt(src, s1)); return; } @@ -760,7 +760,7 @@ accept_report(u_int32_t src, u_int32_t dst, char *p, int datalen, if (datalen < 3) { log(LOG_WARNING, 0, - "received truncated route report from %s", + "received truncated route report from %s", inet_fmt(src, s1)); return; } @@ -779,7 +779,7 @@ accept_report(u_int32_t src, u_int32_t dst, char *p, int datalen, 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; } @@ -812,7 +812,7 @@ accept_report(u_int32_t src, u_int32_t dst, char *p, int datalen, inet_fmt(src, s1), inet_fmts(rt[i].origin, rt[i].mask, s2)); continue; } - update_route(rt[i].origin, rt[i].mask, rt[i].metric, + update_route(rt[i].origin, rt[i].mask, rt[i].metric, src, vifi); } @@ -1123,7 +1123,7 @@ determine_route(u_int32_t 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/route.h b/usr.sbin/mrouted/route.h index a01a16dac5c..2e1ce99b2f4 100644 --- a/usr.sbin/mrouted/route.h +++ b/usr.sbin/mrouted/route.h @@ -32,7 +32,7 @@ struct rtentry { u_char rt_metric; /* cost of route back to origin */ u_char rt_flags; /* RTF_ flags defined below */ u_int32_t rt_gateway; /* first-hop gateway back to origin */ - vifi_t rt_parent; /* incoming vif (ie towards origin) */ + vifi_t rt_parent; /* incoming vif (ie towards origin) */ vifbitmap_t rt_children; /* outgoing children vifs */ vifbitmap_t rt_leaves; /* subset of outgoing children vifs */ u_int32_t *rt_dominants; /* per vif dominant gateways */ @@ -40,7 +40,7 @@ struct rtentry { u_int *rt_leaf_timers; /* per vif leaf confirmation timers */ u_int rt_timer; /* for timing out the route entry */ struct rtentry *rt_prev; /* link to previous entry */ - struct gtable *rt_groups; /* link to active groups */ + struct gtable *rt_groups; /* link to active groups */ }; #define RTF_CHANGED 0x01 /* route changed but not reported */ diff --git a/usr.sbin/mrouted/rsrr.c b/usr.sbin/mrouted/rsrr.c index 26a1cb53b6c..10b3670ee88 100644 --- a/usr.sbin/mrouted/rsrr.c +++ b/usr.sbin/mrouted/rsrr.c @@ -61,7 +61,7 @@ */ int rsrr_socket; /* interface to reservation protocol */ -/* +/* * Global RSRR variables. */ char rsrr_recv_buf[RSRR_MAX_LEN]; /* RSRR receive buffer */ @@ -102,7 +102,7 @@ rsrr_init() #else servlen = sizeof(serv_addr.sun_family) + strlen(serv_addr.sun_path); #endif - + if (bind(rsrr_socket, (struct sockaddr *) &serv_addr, servlen) < 0) log(LOG_ERR, errno, "Can't bind RSRR socket"); @@ -118,11 +118,11 @@ rsrr_read(f, rfd) { int rsrr_recvlen; sigset_t mask, omask; - + bzero((char *) &client_addr, sizeof(client_addr)); rsrr_recvlen = recvfrom(rsrr_socket, rsrr_recv_buf, sizeof(rsrr_recv_buf), 0, (struct sockaddr *)&client_addr, &client_length); - if (rsrr_recvlen < 0) { + if (rsrr_recvlen < 0) { if (errno != EINTR) log(LOG_ERR, errno, "RSRR recvfrom"); return; @@ -144,23 +144,23 @@ rsrr_accept(recvlen) { struct rsrr_header *rsrr; struct rsrr_rq *route_query; - + if (recvlen < RSRR_HEADER_LEN) { log(LOG_WARNING, 0, "Received RSRR packet of %d bytes, which is less than min size", recvlen); return; } - + rsrr = (struct rsrr_header *) rsrr_recv_buf; - + if (rsrr->version > RSRR_MAX_VERSION) { log(LOG_WARNING, 0, "Received RSRR packet version %d, which I don't understand", rsrr->version); return; } - + switch (rsrr->version) { case 1: switch (rsrr->type) { @@ -194,7 +194,7 @@ rsrr_accept(recvlen) break; } break; - + default: log(LOG_WARNING, 0, "Received RSRR packet version %d, which I don't understand", @@ -211,7 +211,7 @@ rsrr_accept_iq() struct rsrr_vif *vif_list; struct uvif *v; int vifi, sendlen; - + /* Check for space. There should be room for plenty of vifs, * but we should check anyway. */ @@ -221,16 +221,16 @@ rsrr_accept_iq() numvifs); return; } - + /* Set up message */ rsrr = (struct rsrr_header *) rsrr_send_buf; rsrr->version = 1; rsrr->type = RSRR_INITIAL_REPLY; rsrr->flags = 0; rsrr->num = numvifs; - + vif_list = (struct rsrr_vif *) (rsrr_send_buf + RSRR_HEADER_LEN); - + /* Include the vif list. */ for (vifi=0, v = uvifs; vifi < numvifs; vifi++, v++) { vif_list[vifi].id = vifi; @@ -240,10 +240,10 @@ rsrr_accept_iq() vif_list[vifi].threshold = v->uv_threshold; vif_list[vifi].local_addr.s_addr = v->uv_lcl_addr; } - + /* Get the size. */ sendlen = RSRR_HEADER_LEN + numvifs*RSRR_VIF_LEN; - + /* Send it. */ log(LOG_INFO, 0, "Send RSRR Initial Reply"); rsrr_send(sendlen); @@ -268,24 +268,24 @@ rsrr_accept_rq(route_query,flags,gt_notify) struct rtentry *r; int sendlen,i; u_long mcastgrp; - + /* Set up message */ rsrr = (struct rsrr_header *) rsrr_send_buf; rsrr->version = 1; rsrr->type = RSRR_ROUTE_REPLY; rsrr->flags = 0; rsrr->num = 0; - + route_reply = (struct rsrr_rr *) (rsrr_send_buf + RSRR_HEADER_LEN); route_reply->dest_addr.s_addr = route_query->dest_addr.s_addr; route_reply->source_addr.s_addr = route_query->source_addr.s_addr; route_reply->query_id = route_query->query_id; - + /* Blank routing entry for error. */ route_reply->in_vif = 0; route_reply->reserved = 0; route_reply->out_vif_bm = 0; - + /* Get the size. */ sendlen = RSRR_RR_LEN; @@ -305,7 +305,7 @@ rsrr_accept_rq(route_query,flags,gt_notify) /* Found kernel entry. Code taken from add_table_entry() */ gt = gtp ? gtp->gt_gnext : kernel_table; - + /* Include the routing entry. */ route_reply->in_vif = gt->gt_route->rt_parent; route_reply->out_vif_bm = gt->gt_grpmems; @@ -315,11 +315,11 @@ rsrr_accept_rq(route_query,flags,gt_notify) rsrr_cache(gt,route_query); BIT_SET(rsrr->flags,RSRR_NOTIFICATION_BIT); } - + } else { /* No kernel entry; use routing table. */ r = determine_route(route_query->source_addr.s_addr); - + if (r != NULL) { /* We need to mimic what will happen if a data packet * is forwarded by multicast routing -- the kernel will @@ -328,28 +328,28 @@ rsrr_accept_rq(route_query,flags,gt_notify) * will look like. Grab code from add_table_entry(). * This is gross, but it's probably better to be accurate. */ - + gt = &local_g; mcastgrp = route_query->dest_addr.s_addr; - - gt->gt_mcastgrp = mcastgrp; + + gt->gt_mcastgrp = mcastgrp; gt->gt_grpmems = 0; gt->gt_scope = 0; gt->gt_route = r; - + /* obtain the multicast group membership list */ for (i = 0; i < numvifs; i++) { - if (VIFM_ISSET(i, r->rt_children) && + if (VIFM_ISSET(i, r->rt_children) && !(VIFM_ISSET(i, r->rt_leaves))) VIFM_SET(i, gt->gt_grpmems); - + if (VIFM_ISSET(i, r->rt_leaves) && grplst_mem(i, mcastgrp)) VIFM_SET(i, gt->gt_grpmems); } - + GET_SCOPE(gt); gt->gt_grpmems &= ~gt->gt_scope; - + /* Include the routing entry. */ route_reply->in_vif = gt->gt_route->rt_parent; route_reply->out_vif_bm = gt->gt_grpmems; @@ -359,7 +359,7 @@ rsrr_accept_rq(route_query,flags,gt_notify) BIT_SET(rsrr->flags,RSRR_ERROR_BIT); } } - + if (gt_notify) log(LOG_INFO, 0, "Route Change: Send RSRR Route Reply"); @@ -370,7 +370,7 @@ rsrr_accept_rq(route_query,flags,gt_notify) inet_fmt(route_reply->source_addr.s_addr,s1), inet_fmt(route_reply->dest_addr.s_addr,s2), route_reply->in_vif,route_reply->out_vif_bm); - + /* Send it. */ return rsrr_send(sendlen); } @@ -381,11 +381,11 @@ rsrr_send(sendlen) int sendlen; { int error; - + /* Send it. */ error = sendto(rsrr_socket, rsrr_send_buf, sendlen, 0, (struct sockaddr *)&client_addr, client_length); - + /* Check for errors. */ if (error < 0) { log(LOG_WARNING, errno, "Failed send on RSRR socket"); @@ -411,9 +411,9 @@ rsrr_cache(gt,route_query) rcnp = >->gt_rsrr_cache; while ((rc = *rcnp) != NULL) { - if ((rc->route_query.source_addr.s_addr == + if ((rc->route_query.source_addr.s_addr == route_query->source_addr.s_addr) && - (rc->route_query.dest_addr.s_addr == + (rc->route_query.dest_addr.s_addr == route_query->dest_addr.s_addr) && (!strcmp(rc->client_addr.sun_path,client_addr.sun_path))) { /* Cache entry already exists. diff --git a/usr.sbin/mrouted/rsrr.h b/usr.sbin/mrouted/rsrr.h index 58ce40123ea..0a304b11389 100644 --- a/usr.sbin/mrouted/rsrr.h +++ b/usr.sbin/mrouted/rsrr.h @@ -93,7 +93,7 @@ struct rsrr_header { * * We explicitly list the ID because we can't assume that all routing * protocols will use the same numbering scheme. - * + * * The status is a bitmask of status flags, as defined above. It is the * responsibility of the reservation protocol to perform any status checks * if it uses the MULTICAST_VIF socket option. @@ -113,13 +113,13 @@ struct rsrr_vif { }; /* Definition of an RSRR Route Query. - * + * * The query asks routing for the forwarding entry for a particular * source and destination. The query ID uniquely identifies the query * for the reservation protocol. Thus, the combination of the client's * address and the query ID forms a unique identifier for routing. * Flags are defined above. - */ + */ struct rsrr_rq { struct in_addr dest_addr; /* destination */ struct in_addr source_addr; /* source */ diff --git a/usr.sbin/mrouted/snmp.c b/usr.sbin/mrouted/snmp.c index 0428cfc0e99..9bc9bc61b05 100644 --- a/usr.sbin/mrouted/snmp.c +++ b/usr.sbin/mrouted/snmp.c @@ -3,7 +3,7 @@ /* * Copyright (c) 1992, 2001 Xerox Corporation. All rights reserved. * - * Redistribution and use in source and binary forms, with or without modification, + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, @@ -14,11 +14,11 @@ * and/or other materials provided with the distribution. * * Neither name of the Xerox, PARC, nor the names of its contributors may be used - * to endorse or promote products derived from this software - * without specific prior written permission. + * to endorse or promote products derived from this software + * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 XEROX CORPORATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR @@ -27,7 +27,7 @@ * 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. + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ #include "defs.h" @@ -160,7 +160,7 @@ put_address(name, addr, n) /* Get an IP address from an OID starting at element n */ int get_address(name, length, addr, n) - oid *name; + oid *name; int length; u_long *addr; int n; @@ -321,32 +321,32 @@ o_dvmrpBoundaryTable(vp, name, length, exact, var_len, write_method) if (len < vp->namelen + 9) { /* get first entry */ - if (len == vp->namelen) { - vifi = addr = mask = 0; - } else { - vifi = name[vp->namelen]; - get_address(name, len, &addr, vp->namelen+1); - get_address(name, len, &mask, vp->namelen+5); - } + if (len == vp->namelen) { + vifi = addr = mask = 0; + } else { + vifi = name[vp->namelen]; + get_address(name, len, &addr, vp->namelen+1); + get_address(name, len, &mask, vp->namelen+5); + } - bound = next_boundary(&vifi,addr,mask); - if (!bound) - return NULL; + bound = next_boundary(&vifi,addr,mask); + if (!bound) + return NULL; - newname[vp->namelen] = vifi; - put_address(newname, bound->acl_addr, vp->namelen+1); - put_address(newname, bound->acl_mask, vp->namelen+5); + newname[vp->namelen] = vifi; + put_address(newname, bound->acl_addr, vp->namelen+1); + put_address(newname, bound->acl_mask, vp->namelen+5); } else { /* get next entry given previous */ vifi = name[vp->namelen]; - get_address(name, *length, &addr, vp->namelen+1); - get_address(name, *length, &mask, vp->namelen+5); + get_address(name, *length, &addr, vp->namelen+1); + get_address(name, *length, &mask, vp->namelen+5); - if (!(bound = next_boundary(&vifi,addr,mask+1))) - return NULL; + if (!(bound = next_boundary(&vifi,addr,mask+1))) + return NULL; newname[vp->namelen] = vifi; - put_address(newname, bound->acl_addr, vp->namelen+1); - put_address(newname, bound->acl_mask, vp->namelen+5); + put_address(newname, bound->acl_addr, vp->namelen+1); + put_address(newname, bound->acl_mask, vp->namelen+5); } } @@ -461,8 +461,8 @@ o_dvmrpNeighborTable(vp, name, length, exact, var_len, write_method) if (!neighbor) return NULL; - newname[vp->namelen] = vifi; - put_address(newname, neighbor->al_addr, vp->namelen+1); + newname[vp->namelen] = vifi; + put_address(newname, neighbor->al_addr, vp->namelen+1); } else { /* get next entry given previous */ vifi = name[vp->namelen]; get_address(name, *length, &addr, vp->namelen+1); @@ -490,8 +490,8 @@ o_dvmrpNeighborTable(vp, name, length, exact, var_len, write_method) return (u_char *) &long_return; } - case dvmrpNeighborExpiryTime: - long_return = (NEIGHBOR_EXPIRE_TIME - neighbor->al_timer + case dvmrpNeighborExpiryTime: + long_return = (NEIGHBOR_EXPIRE_TIME - neighbor->al_timer + secs_remaining_offset()) * 100; return (u_char *) &long_return; @@ -524,10 +524,10 @@ static struct in_ifaddr in_ifaddr; Interface_Scan_Init(); for (;;) { - if (Interface_Scan_Next(&interface, (char *)0, NULL, &in_ifaddr) == 0) + if (Interface_Scan_Next(&interface, (char *)0, NULL, &in_ifaddr) == 0) return NULL; - - if (((struct sockaddr_in *) &(in_ifaddr.ia_addr))->sin_addr.s_addr + + if (((struct sockaddr_in *) &(in_ifaddr.ia_addr))->sin_addr.s_addr == ipaddr) { *ifIndex = interface; return &in_ifaddr; @@ -567,7 +567,7 @@ next_cache(addr, vifi) for (i = 0; i < numvifs; i++) { for (n = uvifs[i].uv_groups; n; n=n->al_next) { if ((n->al_addr > addr || (n->al_addr == addr && i >= *vifi)) - && (!bestn || n->al_addr < bestn->al_addr + && (!bestn || n->al_addr < bestn->al_addr || (n->al_addr == bestn->al_addr && i < besti))) { bestn = n; besti = i; @@ -625,31 +625,31 @@ o_igmpCacheTable(vp, name, length, exact, var_len, write_method) if (compare(name, *length, vp->name, vp->namelen) < 0) len = vp->namelen; - if (len < vp->namelen + 5) { /* get first entry */ + if (len < vp->namelen + 5) { /* get first entry */ - if (len == vp->namelen) { - vifi = grp = 0; - } else { - get_address(name, len, &grp, vp->namelen); - vifi = name[vp->namelen+4]; - } + if (len == vp->namelen) { + vifi = grp = 0; + } else { + get_address(name, len, &grp, vp->namelen); + vifi = name[vp->namelen+4]; + } - cache = next_cache(grp,&vifi); - if (!cache) - return NULL; + cache = next_cache(grp,&vifi); + if (!cache) + return NULL; - put_address(newname, cache->al_addr, vp->namelen); - newname[vp->namelen+4] = vifi; - } else { /* get next entry given previous */ - get_address(name, *length, &grp, vp->namelen); - vifi = name[vp->namelen+4]+1; + put_address(newname, cache->al_addr, vp->namelen); + newname[vp->namelen+4] = vifi; + } else { /* get next entry given previous */ + get_address(name, *length, &grp, vp->namelen); + vifi = name[vp->namelen+4]+1; - if (!(cache = next_cache(grp,&vifi))) - return NULL; + if (!(cache = next_cache(grp,&vifi))) + return NULL; - put_address(newname, cache->al_addr, vp->namelen); - newname[vp->namelen+4] = vifi; - } + put_address(newname, cache->al_addr, vp->namelen); + newname[vp->namelen+4] = vifi; + } } /* Save new OID */ @@ -663,7 +663,7 @@ o_igmpCacheTable(vp, name, length, exact, var_len, write_method) switch (vp->magic) { - case igmpCacheSelf: + case igmpCacheSelf: inm = in_ifaddr->ia_multiaddrs; while (inm) { klookup( (int)inm, (char *)&in_multi, sizeof(in_multi)); @@ -688,11 +688,11 @@ o_igmpCacheTable(vp, name, length, exact, var_len, write_method) return (u_char *) &long_return; } - case igmpCacheExpiryTime: + case igmpCacheExpiryTime: long_return = secs_remaining(cache->al_timerid)*100; return (u_char *) &long_return; - case igmpCacheStatus: + case igmpCacheStatus: long_return = 1; return (u_char *) &long_return; @@ -837,10 +837,10 @@ static struct sioc_vif_req v_req; long_return = 1; return (u_char *) &long_return; - case dvmrpVInterfaceLocalAddress: + case dvmrpVInterfaceLocalAddress: return (u_char *) &uvifs[ifnum].uv_lcl_addr; - case dvmrpVInterfaceRemoteAddress: + case dvmrpVInterfaceRemoteAddress: return (u_char *) ((uvifs[ifnum].uv_flags & VIFF_TUNNEL) ? &uvifs[ifnum].uv_rmt_addr : &uvifs[ifnum].uv_subnet); @@ -953,7 +953,7 @@ o_dvmrpRouteTable(vp, name, length, exact, var_len, write_method) switch (vp->magic) { - case dvmrpRouteUpstreamNeighbor: + case dvmrpRouteUpstreamNeighbor: return (u_char *) &rt->rt_gateway; case dvmrpRouteInVifIndex: @@ -965,7 +965,7 @@ o_dvmrpRouteTable(vp, name, length, exact, var_len, write_method) return (u_char *) &long_return; case dvmrpRouteExpiryTime: - long_return = (ROUTE_EXPIRE_TIME - rt->rt_timer + long_return = (ROUTE_EXPIRE_TIME - rt->rt_timer + secs_remaining_offset()) * 100; return (u_char *) &long_return; @@ -1027,7 +1027,7 @@ o_dvmrpRouteNextHopTable(vp, name, length, exact, var_len, write_method) put_address(newname, rt->rt_origin, vp->namelen); put_address(newname, rt->rt_originmask, vp->namelen+4); - newname[vp->namelen+8] = vifi; + newname[vp->namelen+8] = vifi; } else { /* get next entry given previous */ vifi = name[vp->namelen+8] + 1; if (!get_address(name, *length, &src, vp->namelen) @@ -1133,7 +1133,7 @@ static struct sioc_sg_req sg_req; switch (vp->magic) { - case ipMRouteUpstreamNeighbor: + case ipMRouteUpstreamNeighbor: return (u_char *) >->gt_route->rt_gateway; case ipMRouteInIfIndex: @@ -1238,7 +1238,7 @@ o_ipMRouteNextHopTable(vp, name, length, exact, var_len, write_method) put_address(newname, gt->gt_mcastgrp, vp->namelen); put_address(newname, st->st_origin, vp->namelen+4); put_address(newname, 0xFFFFFFFF, vp->namelen+8); - newname[vp->namelen+12] = vifi; + newname[vp->namelen+12] = vifi; put_address(newname, gt->gt_mcastgrp, vp->namelen+13); } else { /* get next entry given previous */ diff --git a/usr.sbin/mrouted/snmp.h b/usr.sbin/mrouted/snmp.h index 44e8cbd3188..e4a73ca4a8e 100644 --- a/usr.sbin/mrouted/snmp.h +++ b/usr.sbin/mrouted/snmp.h @@ -3,7 +3,7 @@ /* * Copyright (c) 1992, 2001 Xerox Corporation. All rights reserved. * - * Redistribution and use in source and binary forms, with or without modification, + * Redistribution and use in source and binary forms, with or without modification, * are permitted provided that the following conditions are met: * * Redistributions of source code must retain the above copyright notice, @@ -14,11 +14,11 @@ * and/or other materials provided with the distribution. * * Neither name of the Xerox, PARC, nor the names of its contributors may be used - * to endorse or promote products derived from this software - * without specific prior written permission. + * to endorse or promote products derived from this software + * without specific prior written permission. * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS IS'' - * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 XEROX CORPORATION OR CONTRIBUTORS * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR @@ -27,7 +27,7 @@ * 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. + * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ extern int portlist[32], sdlen; diff --git a/usr.sbin/mrouted/vif.c b/usr.sbin/mrouted/vif.c index d75512f52a0..1c7978858dc 100644 --- a/usr.sbin/mrouted/vif.c +++ b/usr.sbin/mrouted/vif.c @@ -17,9 +17,9 @@ * Exported variables. */ struct uvif uvifs[MAXVIFS]; /* array of virtual interfaces */ -vifi_t numvifs; /* number of vifs in use */ -int vifs_down; /* 1=>some interfaces are down */ -int phys_vif; /* An enabled vif */ +vifi_t numvifs; /* number of vifs in use */ +int vifs_down; /* 1=>some interfaces are down */ +int phys_vif; /* An enabled vif */ int udp_socket; /* Since the honkin' kernel doesn't support */ /* ioctls on raw IP sockets, we need a UDP */ /* socket as well as our IGMP (raw) socket. */ @@ -88,8 +88,8 @@ init_vifs(void) if (!(v->uv_flags & VIFF_DISABLED)) { ++enabled_vifs; if (!(v->uv_flags & VIFF_TUNNEL)) { - if (phys_vif == -1) - phys_vif = vifi; + if (phys_vif == -1) + phys_vif = vifi; ++enabled_phyints; } } @@ -301,7 +301,7 @@ start_vif2(vifi_t 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, (v->uv_flags & VIFF_IGMPV1) ? 0 : IGMP_MAX_HOST_REPORT_DELAY * IGMP_TIMER_SCALE, 0, 0); age_old_hosts(); @@ -483,7 +483,7 @@ query_groups(void) 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, (v->uv_flags & VIFF_IGMPV1) ? 0 : IGMP_MAX_HOST_REPORT_DELAY * IGMP_TIMER_SCALE, 0, 0); } @@ -566,7 +566,7 @@ accept_group_report(u_int32_t src, u_int32_t dst, u_int32_t group, 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; } } @@ -599,7 +599,7 @@ accept_group_report(u_int32_t src, u_int32_t dst, u_int32_t group, update_lclgrp(vifi, group); } - /* + /* * Check if a graft is necessary for this group */ chkgrp_graft(vifi, group); @@ -651,12 +651,12 @@ accept_leave_message(u_int32_t src, u_int32_t dst, u_int32_t group) /** send a group specific querry **/ g->al_timer = LEAVE_EXPIRE_TIME; send_igmp(v->uv_lcl_addr, g->al_addr, - IGMP_HOST_MEMBERSHIP_QUERY, + IGMP_HOST_MEMBERSHIP_QUERY, LEAVE_EXPIRE_TIME / 3 * IGMP_TIMER_SCALE, g->al_addr, 0); g->al_query = SetQueryTimer(g, vifi, g->al_timer / 3, - LEAVE_EXPIRE_TIME / 3 * IGMP_TIMER_SCALE); - g->al_timerid = SetTimer(vifi, g); + LEAVE_EXPIRE_TIME / 3 * IGMP_TIMER_SCALE); + g->al_timerid = SetTimer(vifi, g); break; } } @@ -720,7 +720,7 @@ accept_neighbor_request(u_int32_t src, u_int32_t 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; \ @@ -807,7 +807,7 @@ accept_neighbor_request2(u_int32_t src, u_int32_t 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; @@ -1034,7 +1034,7 @@ update_neighbor(vifi_t vifi, u_int32_t addr, int msgtype, char *p, /* * 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)) || @@ -1045,7 +1045,7 @@ update_neighbor(vifi_t vifi, u_int32_t addr, int msgtype, char *p, "version change 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; } @@ -1126,13 +1126,13 @@ update_neighbor(vifi_t vifi, u_int32_t addr, int msgtype, char *p, n->al_genid = genid; do_reset = TRUE; } - - /* + + /* * loop through router list and check for one-way ifs. */ - + v->uv_flags |= VIFF_ONEWAY; - + while (datalen > 0) { if (datalen < 4) { log(LOG_WARNING, 0, @@ -1378,7 +1378,7 @@ DelVif(void *arg) anp = &(v->uv_groups); while ((a = *anp) != NULL) { - if (a == g) { + if (a == g) { *anp = a->al_next; free((char *)a); } else { |