diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-03-03 14:58:24 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-03-03 14:58:24 +0000 |
commit | 44fb9a7e8707e33c715d2281b745640f6b6e3ba8 (patch) | |
tree | 550f93484014fc65201ee49e64ef3b741e72ad0a /usr.sbin/mrouted | |
parent | d64becd498d0922ed40238a8e27d33afde224d8f (diff) |
ansi, from cloder
Diffstat (limited to 'usr.sbin/mrouted')
-rw-r--r-- | usr.sbin/mrouted/callout.c | 21 | ||||
-rw-r--r-- | usr.sbin/mrouted/igmp.c | 18 | ||||
-rw-r--r-- | usr.sbin/mrouted/inet.c | 24 | ||||
-rw-r--r-- | usr.sbin/mrouted/kern.c | 44 | ||||
-rw-r--r-- | usr.sbin/mrouted/main.c | 42 | ||||
-rw-r--r-- | usr.sbin/mrouted/prune.c | 165 | ||||
-rw-r--r-- | usr.sbin/mrouted/route.c | 77 | ||||
-rw-r--r-- | usr.sbin/mrouted/vif.c | 110 |
8 files changed, 155 insertions, 346 deletions
diff --git a/usr.sbin/mrouted/callout.c b/usr.sbin/mrouted/callout.c index 38fe5c11f28..e19fb8d0fea 100644 --- a/usr.sbin/mrouted/callout.c +++ b/usr.sbin/mrouted/callout.c @@ -32,7 +32,7 @@ static void print_Q(void); #endif void -callout_init() +callout_init(void) { Q = (struct timeout_q *) 0; } @@ -42,7 +42,7 @@ callout_init() * signal handler for SIGALARM that is called once every second */ void -age_callout_queue() +age_callout_queue(void) { struct timeout_q *ptr; @@ -80,12 +80,12 @@ age_callout_queue() /* * sets the timer + * delay number of units for timeout + * action function to be called on timeout + * data what to call the timeout function with */ int -timer_setTimer(delay, action, data) - int delay; /* number of units for timeout */ - cfunc_t action; /* function to be called on timeout */ - char *data; /* what to call the timeout function with */ +timer_setTimer(int delay, cfunc_t action, char *data) { struct timeout_q *ptr, *node, *prev; @@ -148,8 +148,7 @@ timer_setTimer(delay, action, data) /* clears the associated timer */ void -timer_clearTimer(timer_id) - int timer_id; +timer_clearTimer(int timer_id) { struct timeout_q *ptr, *prev; @@ -200,7 +199,7 @@ timer_clearTimer(timer_id) * debugging utility */ static void -print_Q() +print_Q(void) { struct timeout_q *ptr; @@ -208,9 +207,9 @@ print_Q() log(LOG_DEBUG,0,"(%d,%d) ", ptr->id, ptr->time); } #endif /* IGMP_DEBUG */ + int -secs_remaining( timer_id) - int timer_id; +secs_remaining(int timer_id) { struct timeout_q *ptr; int left=0; diff --git a/usr.sbin/mrouted/igmp.c b/usr.sbin/mrouted/igmp.c index 85a45177789..475be1e250c 100644 --- a/usr.sbin/mrouted/igmp.c +++ b/usr.sbin/mrouted/igmp.c @@ -36,7 +36,7 @@ static int igmp_log_level(u_int type, u_int code); * IP header fields in the output packet buffer. */ void -init_igmp() +init_igmp(void) { struct ip *ip; @@ -74,8 +74,7 @@ init_igmp() #define PIM_GRAFT_ACK 7 static char * -packet_kind(type, code) - u_int type, code; +packet_kind(u_int type, u_int code) { switch (type) { case IGMP_HOST_MEMBERSHIP_QUERY: return "membership query "; @@ -120,8 +119,7 @@ packet_kind(type, code) * packet buffer. */ void -accept_igmp(recvlen) - int recvlen; +accept_igmp(int recvlen) { register u_int32_t src, dst, group; struct ip *ip; @@ -277,8 +275,7 @@ accept_igmp(recvlen) * reachability and someone is trying to, i.e., mrinfo me periodically. */ static int -igmp_log_level(type, code) - u_int type, code; +igmp_log_level(u_int type, u_int code) { switch (type) { case IGMP_MTRACE_REPLY: @@ -300,11 +297,8 @@ igmp_log_level(type, code) * the message from the interface with IP address 'src' to destination 'dst'. */ void -send_igmp(src, dst, type, code, group, datalen) - u_int32_t src, dst; - int type, code; - u_int32_t group; - int datalen; +send_igmp(u_int32_t src, u_int32_t dst, int type, int code, + u_int32_t group, int datalen) { struct sockaddr_in sdst; struct ip *ip; diff --git a/usr.sbin/mrouted/inet.c b/usr.sbin/mrouted/inet.c index c223bc957de..2b11d43a1c5 100644 --- a/usr.sbin/mrouted/inet.c +++ b/usr.sbin/mrouted/inet.c @@ -28,8 +28,7 @@ char s4[19]; * {subnet,-1}.) */ int -inet_valid_host(naddr) - u_int32_t naddr; +inet_valid_host(u_int32_t naddr) { register u_int32_t addr; @@ -46,8 +45,7 @@ inet_valid_host(naddr) * a series of 0's with no discontiguous 1's. */ int -inet_valid_mask(mask) - u_int32_t mask; +inet_valid_mask(u_int32_t mask) { if (~(((mask & -mask) - 1) | mask) != 0) { /* Mask is not contiguous */ @@ -67,8 +65,7 @@ inet_valid_mask(mask) * are all 0. */ int -inet_valid_subnet(nsubnet, nmask) - u_int32_t nsubnet, nmask; +inet_valid_subnet(u_int32_t nsubnet, u_int32_t nmask) { register u_int32_t subnet, mask; @@ -106,9 +103,7 @@ inet_valid_subnet(nsubnet, nmask) * Convert an IP address in u_long (network) format into a printable string. */ char * -inet_fmt(addr, s) - u_int32_t addr; - char *s; +inet_fmt(u_int32_t addr, char *s) { register u_char *a; @@ -123,9 +118,7 @@ inet_fmt(addr, s) * string including the netmask as a number of bits. */ char * -inet_fmts(addr, mask, s) - u_int32_t addr, mask; - char *s; +inet_fmts(u_int32_t addr, u_int32_t mask, char *s) { register u_char *a, *m; int bits; @@ -154,8 +147,7 @@ inet_fmts(addr, mask, s) * with "255.255.255.255".) */ u_int32_t -inet_parse(s) - char *s; +inet_parse(char *s) { u_int32_t a = 0; u_int a0, a1, a2, a3; @@ -193,9 +185,7 @@ inet_parse(s) * */ int -inet_cksum(addr, len) - u_int16_t *addr; - u_int len; +inet_cksum(u_int16_t *addr, u_int len) { register int nleft = (int)len; register u_int16_t *w = addr; diff --git a/usr.sbin/mrouted/kern.c b/usr.sbin/mrouted/kern.c index f41edce77c4..9588ca301c6 100644 --- a/usr.sbin/mrouted/kern.c +++ b/usr.sbin/mrouted/kern.c @@ -13,8 +13,7 @@ #include "defs.h" -void k_set_rcvbuf(bufsize) - int bufsize; +void k_set_rcvbuf(int bufsize) { if (setsockopt(igmp_socket, SOL_SOCKET, SO_RCVBUF, (char *)&bufsize, sizeof(bufsize)) < 0) @@ -22,8 +21,7 @@ void k_set_rcvbuf(bufsize) } -void k_hdr_include(bool) - int bool; +void k_hdr_include(int bool) { #ifdef IP_HDRINCL if (setsockopt(igmp_socket, IPPROTO_IP, IP_HDRINCL, @@ -33,8 +31,7 @@ void k_hdr_include(bool) } -void k_set_ttl(t) - int t; +void k_set_ttl(int t) { u_char ttl; @@ -45,8 +42,7 @@ void k_set_ttl(t) } -void k_set_loop(l) - int l; +void k_set_loop(int l) { u_char loop; @@ -57,8 +53,7 @@ void k_set_loop(l) } -void k_set_if(ifa) - u_int32_t ifa; +void k_set_if(u_int32_t ifa) { struct in_addr adr; @@ -70,9 +65,7 @@ void k_set_if(ifa) } -void k_join(grp, ifa) - u_int32_t grp; - u_int32_t ifa; +void k_join(u_int32_t grp, u_int32_t ifa) { struct ip_mreq mreq; @@ -86,9 +79,7 @@ void k_join(grp, ifa) } -void k_leave(grp, ifa) - u_int32_t grp; - u_int32_t ifa; +void k_leave(u_int32_t grp, u_int32_t ifa) { struct ip_mreq mreq; @@ -102,7 +93,7 @@ void k_leave(grp, ifa) } -void k_init_dvmrp() +void k_init_dvmrp(void) { #ifdef OLD_KERNEL if (setsockopt(igmp_socket, IPPROTO_IP, MRT_INIT, @@ -117,7 +108,7 @@ void k_init_dvmrp() } -void k_stop_dvmrp() +void k_stop_dvmrp(void) { if (setsockopt(igmp_socket, IPPROTO_IP, MRT_DONE, (char *)NULL, 0) < 0) @@ -125,9 +116,7 @@ void k_stop_dvmrp() } -void k_add_vif(vifi, v) - vifi_t vifi; - struct uvif *v; +void k_add_vif(vifi_t vifi, struct uvif *v) { struct vifctl vc; @@ -144,8 +133,7 @@ void k_add_vif(vifi, v) } -void k_del_vif(vifi) - vifi_t vifi; +void k_del_vif(vifi_t vifi) { if (setsockopt(igmp_socket, IPPROTO_IP, MRT_DEL_VIF, (char *)&vifi, sizeof(vifi)) < 0) @@ -156,9 +144,7 @@ void k_del_vif(vifi) /* * Adds a (source, mcastgrp) entry to the kernel */ -void k_add_rg(origin, g) - u_int32_t origin; - struct gtable *g; +void k_add_rg(u_int32_t origin, struct gtable *g) { struct mfcctl mc; vifi_t i; @@ -190,9 +176,7 @@ void k_add_rg(origin, g) /* * Deletes a (source, mcastgrp) entry from the kernel */ -int k_del_rg(origin, g) - u_int32_t origin; - struct gtable *g; +int k_del_rg(u_int32_t origin, struct gtable *g) { struct mfcctl mc; int retval; @@ -222,7 +206,7 @@ int k_del_rg(origin, g) /* * Get the kernel's idea of what version of mrouted needs to run with it. */ -int k_get_version() +int k_get_version(void) { #ifdef OLD_KERNEL return -1; diff --git a/usr.sbin/mrouted/main.c b/usr.sbin/mrouted/main.c index da9bd956ddb..e6861cb5401 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.10 2002/08/09 02:27:16 itojun Exp $"; + "@(#) $Id: main.c,v 1.11 2003/03/03 14:58:23 deraadt Exp $"; #endif extern char *configfilename; @@ -71,13 +71,8 @@ static void timer(void); static void cleanup(void); static void resetlogging(void *); -/* To shut up gcc -Wstrict-prototypes */ -int main(int argc, char **argv); - int -register_input_handler(fd, func) - int fd; - ihfunc_t func; +register_input_handler(int fd, ihfunc_t func) { if (nhandlers >= NHANDLERS) return -1; @@ -89,9 +84,7 @@ register_input_handler(fd, func) } int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { register int recvlen; int dummy; @@ -379,8 +372,7 @@ usage: fprintf(stderr, * do all the other time-based processing. */ static void -fasttimer(i) - int i; +fasttimer(int i) { static unsigned int tlast; static unsigned int nsent; @@ -443,7 +435,7 @@ static u_long virtual_time = 0; * virtual interface data structures. */ static void -timer() +timer(void) { age_routes(); /* Advance the timers in the route entries */ age_vifs(); /* Advance the timers for neighbors */ @@ -495,8 +487,7 @@ timer() * On termination, let everyone know we're going away. */ static void -done(i) - int i; +done(int i) { log(LOG_NOTICE, 0, "%s exiting", versionstring); cleanup(); @@ -504,7 +495,7 @@ done(i) } static void -cleanup() +cleanup(void) { static in_cleanup = 0; @@ -524,8 +515,7 @@ cleanup() * Dump internal data structures to stderr. */ static void -dump(i) - int i; +dump(int i) { dump_vifs(stderr); dump_routes(stderr); @@ -536,8 +526,7 @@ dump(i) * Dump internal data structures to a file. */ static void -fdump(i) - int i; +fdump(int i) { FILE *fp; @@ -554,8 +543,7 @@ fdump(i) * Dump local cache contents to a file. */ static void -cdump(i) - int i; +cdump(int i) { FILE *fp; @@ -571,8 +559,7 @@ cdump(i) * Restart mrouted */ static void -restart(i) - int i; +restart(int i) { sigset_t mask, omask; @@ -613,8 +600,7 @@ restart(i) static int log_nmsgs = 0; static void -resetlogging(arg) - void *arg; +resetlogging(void *arg) { int nxttime = 60; void *narg = NULL; @@ -686,9 +672,7 @@ log(int severity, int syserr, char *format, ...) #ifdef DEBUG_MFC void -md_log(what, origin, mcastgrp) - int what; - u_int32_t origin, mcastgrp; +md_log(int what, u_int32_t origin, u_int32_t mcastgrp) { static FILE *f = NULL; struct timeval tv; diff --git a/usr.sbin/mrouted/prune.c b/usr.sbin/mrouted/prune.c index 6c3f6ba63c9..fcd4c2a5e49 100644 --- a/usr.sbin/mrouted/prune.c +++ b/usr.sbin/mrouted/prune.c @@ -66,8 +66,7 @@ static char * scaletime(u_long t); * Updates the ttl values for each vif. */ static void -prun_add_ttls(gt) - struct gtable *gt; +prun_add_ttls(struct gtable *gt) { struct uvif *v; vifi_t vifi; @@ -92,9 +91,7 @@ prun_add_ttls(gt) } int -scoped_addr(vifi, addr) - vifi_t vifi; - u_int32_t addr; +scoped_addr(vifi_t vifi, u_int32_t addr) { struct vif_acl *acl; @@ -109,9 +106,7 @@ scoped_addr(vifi, addr) * Determine if mcastgrp has a listener on vifi */ int -grplst_mem(vifi, mcastgrp) - vifi_t vifi; - u_int32_t mcastgrp; +grplst_mem(vifi_t vifi, u_int32_t mcastgrp) { register struct listaddr *g; register struct uvif *v; @@ -136,10 +131,7 @@ grplst_mem(vifi, mcastgrp) * head of the list. */ int -find_src_grp(src, mask, grp) - u_int32_t src; - u_int32_t mask; - u_int32_t grp; +find_src_grp(u_int32_t src, u_int32_t mask, u_int32_t grp) { struct gtable *gt; @@ -169,9 +161,7 @@ find_src_grp(src, mask, grp) * Check if the neighbor supports pruning */ static int -pruning_neighbor(vifi, addr) - vifi_t vifi; - u_int32_t addr; +pruning_neighbor(vifi_t vifi, u_int32_t addr) { struct listaddr *n = neighbor_info(vifi, addr); int vers; @@ -194,9 +184,7 @@ pruning_neighbor(vifi, addr) * Can the neighbor in question handle multicast traceroute? */ static int -can_mtrace(vifi, addr) - vifi_t vifi; - u_int32_t addr; +can_mtrace(vifi_t vifi, u_int32_t addr) { struct listaddr *n = neighbor_info(vifi, addr); int vers; @@ -219,9 +207,7 @@ can_mtrace(vifi, addr) * Returns the prune entry of the router, or NULL if none exists */ static struct ptable * -find_prune_entry(vr, pt) - u_int32_t vr; - struct ptable *pt; +find_prune_entry(u_int32_t vr, struct ptable *pt) { while (pt) { if (pt->pt_router == vr) @@ -239,8 +225,7 @@ find_prune_entry(vr, pt) * Record an entry that a prune was sent for this group */ static void -send_prune(gt) - struct gtable *gt; +send_prune(struct gtable *gt) { struct ptable *pt; char *p; @@ -311,8 +296,7 @@ send_prune(gt) * is sent out. */ static void -send_graft(gt) - struct gtable *gt; +send_graft(struct gtable *gt) { register char *p; register int i; @@ -350,11 +334,7 @@ send_graft(gt) * Send an ack that a graft was received */ static void -send_graft_ack(src, dst, origin, grp) - u_int32_t src; - u_int32_t dst; - u_int32_t origin; - u_int32_t grp; +send_graft_ack(u_int32_t src, u_int32_t dst, u_int32_t origin, u_int32_t grp) { register char *p; register int i; @@ -380,8 +360,7 @@ send_graft_ack(src, dst, origin, grp) * Update the kernel cache with all the routes hanging off the group entry */ static void -update_kernel(g) - struct gtable *g; +update_kernel(struct gtable *g) { struct stable *st; @@ -401,8 +380,7 @@ update_kernel(g) * Find a specific group entry in the group table */ struct gtable * -find_grp(grp) - u_long grp; +find_grp(u_long grp) { struct gtable *gt; @@ -420,9 +398,7 @@ find_grp(grp) * entry */ struct stable * -find_grp_src(gt, src) - struct gtable *gt; - u_long src; +find_grp_src(struct gtable *gt, u_long src) { struct stable *st; u_long grp = gt->gt_mcastgrp; @@ -438,14 +414,12 @@ find_grp_src(gt, src) /* * Find next entry > specification + * gtpp: ordered by group + * stpp: ordered by source */ int -next_grp_src_mask(gtpp, stpp, grp, src, mask) - struct gtable **gtpp; /* ordered by group */ - struct stable **stpp; /* ordered by source */ - u_long grp; - u_long src; - u_long mask; +next_grp_src_mask(struct gtable *gtpp, struct gtable *stpp, u_long grp, + u_long src, u_long mask) { struct gtable *gt, *gbest = NULL; struct stable *st, *sbest = NULL; @@ -490,10 +464,7 @@ next_grp_src_mask(gtpp, stpp, grp, src, mask) * read at the same time. */ void -refresh_sg(sg, gt, st) - struct sioc_sg_req *sg; - struct gtable *gt; - struct stable *st; +refresh_sg(struct sioc_sg_req *sg, struct gtable *gt, struct gtable *st) { static int lastq = -1; @@ -511,8 +482,7 @@ refresh_sg(sg, gt, st) * function from find_route() which modifies rtp. */ struct rtentry * -snmp_find_route(src, mask) - register u_long src, mask; +snmp_find_route(u_long src, u_long mask) { register struct rtentry *rt; @@ -527,10 +497,7 @@ snmp_find_route(src, mask) * Find next route entry > specification */ int -next_route(rtpp, src, mask) - struct rtentry **rtpp; - u_long src; - u_long mask; +next_route(struct rtentry **rtpp, u_long src, u_long mask) { struct rtentry *rt, *rbest = NULL; @@ -550,13 +517,10 @@ next_route(rtpp, src, mask) /* * Given a routing table entry, and a vifi, find the next vifi/entry + * vifi: vif at which to start looking */ int -next_route_child(rtpp, src, mask, vifi) - struct rtentry **rtpp; - u_long src; - u_long mask; - vifi_t *vifi; /* vif at which to start looking */ +next_route_child(struct rtentry **rtpp, u_long src, u_long mask, vifi_t vifi) { struct rtentry *rt; @@ -579,15 +543,11 @@ next_route_child(rtpp, src, mask, vifi) /* * Given a routing table entry, and a vifi, find the next entry * equal to or greater than those + * vifi: vif at which to start looking */ int -next_child(gtpp, stpp, grp, src, mask, vifi) - struct gtable **gtpp; - struct stable **stpp; - u_long grp; - u_long src; - u_long mask; - vifi_t *vifi; /* vif at which to start looking */ +next_child(struct gtable *gtpp, struct gtable *stpp, u_long grp, + u_long src, u_long mask, vifi_t *vifi) { struct stable *st; @@ -615,7 +575,7 @@ next_child(gtpp, stpp, grp, src, mask, vifi) * Initialize the kernel table structure */ void -init_ktable() +init_ktable(void) { kernel_table = NULL; kernel_no_route = NULL; @@ -626,9 +586,7 @@ init_ktable() * Add a new table entry for (origin, mcastgrp) */ void -add_table_entry(origin, mcastgrp) - u_int32_t origin; - u_int32_t mcastgrp; +add_table_entry(u_int32_t origin, u_int32_t mcastgrp) { struct rtentry *r; struct gtable *gt,**gtnp,*prev_gt; @@ -784,9 +742,7 @@ add_table_entry(origin, mcastgrp) * Forward on that interface immediately */ void -reset_neighbor_state(vifi, addr) - vifi_t vifi; - u_int32_t addr; +reset_neighbor_state(vifi_t vifi, u_int32_t addr) { struct rtentry *r; struct gtable *g; @@ -873,10 +829,7 @@ reset_neighbor_state(vifi, addr) * del_flag determines how many entries to delete */ void -del_table_entry(r, mcastgrp, del_flag) - struct rtentry *r; - u_int32_t mcastgrp; - u_int del_flag; +del_table_entry(struct rtentry *r, u_int32_t mcastgrp, u_int del_flag) { struct gtable *g, *prev_g; struct stable *st, *prev_st; @@ -994,8 +947,7 @@ del_table_entry(r, mcastgrp, del_flag) * update kernel table entry when a route entry changes */ void -update_table_entry(r) - struct rtentry *r; +update_table_entry(struct rtentry *r) { struct gtable *g; struct ptable *pt, *prev_pt; @@ -1056,9 +1008,7 @@ update_table_entry(r) * set the forwarding flag for all mcastgrps on this vifi */ void -update_lclgrp(vifi, mcastgrp) - vifi_t vifi; - u_int32_t mcastgrp; +update_lclgrp(vifi_t vifi, u_int32_t mcastgrp) { struct rtentry *r; struct gtable *g; @@ -1097,9 +1047,7 @@ update_lclgrp(vifi, mcastgrp) * reset forwarding flag for all mcastgrps on this vifi */ void -delete_lclgrp(vifi, mcastgrp) - vifi_t vifi; - u_int32_t mcastgrp; +delete_lclgrp(vifi_t vifi, u_int32_t mcastgrp) { struct rtentry *r; struct gtable *g; @@ -1164,11 +1112,7 @@ delete_lclgrp(vifi, mcastgrp) * Determines if a corresponding prune message has to be generated */ void -accept_prune(src, dst, p, datalen) - u_int32_t src; - u_int32_t dst; - char *p; - int datalen; +accept_prune(u_int32_t src, u_int32_t dst, char *p, int datalen) { u_int32_t prun_src; u_int32_t prun_grp; @@ -1317,9 +1261,7 @@ accept_prune(src, dst, p, datalen) * If so and if a prune was sent, it sends a graft upwards */ void -chkgrp_graft(vifi, mcastgrp) - vifi_t vifi; - u_int32_t mcastgrp; +chkgrp_graft(vifi_t vifi, u_int32_t mcastgrp) { struct rtentry *r; struct gtable *g; @@ -1378,11 +1320,7 @@ chkgrp_graft(vifi, mcastgrp) * if no entry exists for this group send ack downstream. */ void -accept_graft(src, dst, p, datalen) - u_int32_t src; - u_int32_t dst; - char *p; - int datalen; +accept_graft(u_int32_t src, u_int32_t dst, char *p, int datalen) { vifi_t vifi; u_int32_t graft_src; @@ -1491,11 +1429,7 @@ accept_graft(src, dst, p, datalen) * have send a graft again */ void -accept_g_ack(src, dst, p, datalen) - u_int32_t src; - u_int32_t dst; - char *p; - int datalen; +accept_g_ack(u_int32_t src, u_int32_t dst, char *p, int datalen) { struct gtable *g; vifi_t vifi; @@ -1549,7 +1483,7 @@ accept_g_ack(src, dst, p, datalen) * about to call MRT_DONE which does that anyway. */ void -free_all_prunes() +free_all_prunes(void) { register struct rtentry *r; register struct gtable *g, *prev_g; @@ -1603,8 +1537,7 @@ free_all_prunes() * them is easier, and letting the kernel re-request them. */ void -steal_sources(rt) - struct rtentry *rt; +steal_sources(struct rtentry *rt) { register struct rtentry *rp; register struct gtable *gt, **gtnp; @@ -1674,7 +1607,7 @@ steal_sources(rt) * remove these entries from the kernel cache. */ void -age_table_entry() +age_table_entry(void) { struct rtentry *r; struct gtable *gt, **gtnptr; @@ -1863,9 +1796,7 @@ age_table_entry() * have expired. */ static void -expire_prune(vifi, gt) - vifi_t vifi; - struct gtable *gt; +expire_prune(vifi_t vifi, struct gtable *gt) { /* * No need to send a graft, any prunes that we sent @@ -1896,8 +1827,7 @@ expire_prune(vifi, gt) static char * -scaletime(t) - u_long t; +scaletime(u_long t) { static char buf1[5]; static char buf2[5]; @@ -1938,8 +1868,7 @@ scaletime(t) * Print the contents of the cache table on file 'fp2'. */ void -dump_cache(fp2) - FILE *fp2; +dump_cache(FILE *fp2) { register struct rtentry *r; register struct gtable *gt; @@ -2001,15 +1930,11 @@ dump_cache(fp2) /* * Traceroute function which returns traceroute replies to the requesting * router. Also forwards the request to downstream routers. + * NOTE: u_int no is narrowed to u_char */ void -accept_mtrace(src, dst, group, data, no, datalen) - u_int32_t src; - u_int32_t dst; - u_int32_t group; - char *data; - u_int no; /* promoted u_char */ - int datalen; +accept_mtrace(u_int32_t src, u_int32_t dst, u_int32_t group, + char *data, u_int no, int datalen) { u_char type; struct rtentry *rt; diff --git a/usr.sbin/mrouted/route.c b/usr.sbin/mrouted/route.c index ec4cfc07102..7fd5ed93d64 100644 --- a/usr.sbin/mrouted/route.c +++ b/usr.sbin/mrouted/route.c @@ -68,9 +68,7 @@ init_routes() * leaf bitmaps for 'r'. */ static int -init_children_and_leaves(r, parent) - register struct rtentry *r; - register vifi_t parent; +init_children_and_leaves(struct rtentry *r, vifi_t parent) { register vifi_t vifi; register struct uvif *v; @@ -113,8 +111,7 @@ init_children_and_leaves(r, parent) * entries to take that into account. */ void -add_vif_to_routes(vifi) - register vifi_t vifi; +add_vif_to_routes(vifi_t vifi) { register struct rtentry *r; register struct uvif *v; @@ -147,8 +144,7 @@ add_vif_to_routes(vifi) * account the failed vif. */ void -delete_vif_from_routes(vifi) - register vifi_t vifi; +delete_vif_from_routes(vifi_t vifi) { register struct rtentry *r; @@ -182,9 +178,7 @@ delete_vif_from_routes(vifi) * take appropriate action. */ void -delete_neighbor_from_routes(addr, vifi) - register u_int32_t addr; - register vifi_t vifi; +delete_neighbor_from_routes(u_int32_t addr, vifi_t vifi) { register struct rtentry *r; register struct uvif *v; @@ -238,7 +232,7 @@ delete_neighbor_from_routes(addr, vifi) * table. */ void -start_route_updates() +start_route_updates(void) { rtp = RT_ADDR; } @@ -254,8 +248,7 @@ start_route_updates() * be examined is the matching entry. */ static int -find_route(origin, mask) - register u_int32_t origin, mask; +find_route(u_int32_t origin, u_int32_t mask) { register struct rtentry *r; @@ -287,8 +280,7 @@ find_route(origin, mask) * rest. */ static void -create_route(origin, mask) - u_int32_t origin, mask; +create_route(u_int32_t origin, u_int32_t mask) { register struct rtentry *r; @@ -325,8 +317,7 @@ create_route(origin, mask) * Discard the routing table entry following the one to which 'prev_r' points. */ static void -discard_route(prev_r) - register struct rtentry *prev_r; +discard_route(struct rtentry *prev_r) { register struct rtentry *r; @@ -348,11 +339,8 @@ discard_route(prev_r) * to indicate a change of status of one of our own interfaces. */ void -update_route(origin, mask, metric, src, vifi) - u_int32_t origin, mask; - u_int metric; - u_int32_t src; - vifi_t vifi; +update_route(u_int32_t origin, u_int32_t mask, u_int metric, u_int32_t src, + vifi_t vifi) { register struct rtentry *r; u_int adj_metric; @@ -580,7 +568,7 @@ update_route(origin, mask, metric, src, vifi) * On every timer interrupt, advance the timer in each routing entry. */ void -age_routes() +age_routes(void) { register struct rtentry *r; register struct rtentry *prev_r; @@ -662,7 +650,7 @@ age_routes() * expensive kernel calls now. */ void -expire_all_routes() +expire_all_routes(void) { register struct rtentry *r; @@ -678,7 +666,7 @@ expire_all_routes() * Delete all the routes in the routing table. */ void -free_all_routes() +free_all_routes(void) { register struct rtentry *r; @@ -693,12 +681,8 @@ free_all_routes() * Process an incoming neighbor probe message. */ void -accept_probe(src, dst, p, datalen, level) - u_int32_t src; - u_int32_t dst; - char *p; - int datalen; - u_int32_t level; +accept_probe(u_int32_t src, u_int32_t dst, char *p, int datalen, + u_int32_t level) { vifi_t vifi; @@ -719,9 +703,7 @@ struct newrt { }; static int -compare_rts(rt1, rt2) - const void *rt1; - const void *rt2; +compare_rts(const void *rt1, const void *rt2) { register struct newrt *r1 = (struct newrt *)rt1; register struct newrt *r2 = (struct newrt *)rt2; @@ -748,10 +730,8 @@ compare_rts(rt1, rt2) * Process an incoming route report message. */ void -accept_report(src, dst, p, datalen, level) - u_int32_t src, dst, level; - register char *p; - register int datalen; +accept_report(u_int32_t src, u_int32_t dst, char *p, int datalen, + u_int32_t level) { vifi_t vifi; register int width, i, nrt = 0; @@ -846,10 +826,7 @@ accept_report(src, dst, p, datalen, level) * 'vifi'. 'which_routes' specifies ALL_ROUTES or CHANGED_ROUTES. */ void -report(which_routes, vifi, dst) - int which_routes; - vifi_t vifi; - u_int32_t dst; +report(int which_routes, vifi_t vifi, u_int32_t dst) { register struct rtentry *r; register char *p; @@ -935,8 +912,7 @@ report(which_routes, vifi, dst) * 'which_routes' specifies ALL_ROUTES or CHANGED_ROUTES. */ void -report_to_all_neighbors(which_routes) - int which_routes; +report_to_all_neighbors(int which_routes) { register vifi_t vifi; register struct uvif *v; @@ -984,10 +960,7 @@ report_to_all_neighbors(which_routes) * 'vifi'. 'which_routes' specifies ALL_ROUTES or CHANGED_ROUTES. */ static int -report_chunk(start_rt, vifi, dst) - register struct rtentry *start_rt; - vifi_t vifi; - u_int32_t dst; +report_chunk(struct rtentry *start_rt, vifi_t vifi, u_int32_t dst) { register struct rtentry *r; register char *p; @@ -1058,7 +1031,7 @@ report_chunk(start_rt, vifi, dst) * return the length of the smallest chunk we sent out. */ int -report_next_chunk() +report_next_chunk(void) { register vifi_t vifi; register struct uvif *v; @@ -1111,8 +1084,7 @@ report_next_chunk() * Print the contents of the routing table on file 'fp'. */ void -dump_routes(fp) - FILE *fp; +dump_routes(FILE *fp) { register struct rtentry *r; register vifi_t i; @@ -1146,8 +1118,7 @@ dump_routes(fp) } struct rtentry * -determine_route(src) - u_int32_t src; +determine_route(u_int32_t src) { struct rtentry *rt; diff --git a/usr.sbin/mrouted/vif.c b/usr.sbin/mrouted/vif.c index 9d7b657e27b..d75512f52a0 100644 --- a/usr.sbin/mrouted/vif.c +++ b/usr.sbin/mrouted/vif.c @@ -55,7 +55,7 @@ static int SetQueryTimer(struct listaddr *g, vifi_t vifi, int to_expire, * not down or disabled. */ void -init_vifs() +init_vifs(void) { vifi_t vifi; struct uvif *v; @@ -126,7 +126,7 @@ init_vifs() * administratively disabled. */ void -init_installvifs() +init_installvifs(void) { vifi_t vifi; struct uvif *v; @@ -157,7 +157,7 @@ init_installvifs() * disabled. */ void -check_vif_state() +check_vif_state(void) { register vifi_t vifi; register struct uvif *v; @@ -200,8 +200,7 @@ check_vif_state() * Send a probe message on vif v */ static void -send_probe_on_vif(v) - register struct uvif *v; +send_probe_on_vif(struct uvif *v) { register char *p; register int datalen = 0; @@ -239,8 +238,7 @@ send_probe_on_vif(v) * Add a vifi to the kernel and start routing on it. */ static void -start_vif(vifi) - vifi_t vifi; +start_vif(vifi_t vifi) { /* * Install the interface in the kernel's vif structure. @@ -255,8 +253,7 @@ start_vif(vifi) * it to the kernel yet. */ static void -start_vif2(vifi) - vifi_t vifi; +start_vif2(vifi_t vifi) { struct uvif *v; u_int32_t src; @@ -322,8 +319,7 @@ start_vif2(vifi) * Stop routing on the specified virtual interface. */ static void -stop_vif(vifi) - vifi_t vifi; +stop_vif(vifi_t vifi) { struct uvif *v; struct listaddr *a; @@ -395,7 +391,7 @@ stop_vif(vifi) * stop routing on all vifs */ void -stop_all_vifs() +stop_all_vifs(void) { vifi_t vifi; struct uvif *v; @@ -428,9 +424,7 @@ stop_all_vifs() * based on the packet's source and destination IP addresses. */ vifi_t -find_vif(src, dst) - register u_int32_t src; - register u_int32_t dst; +find_vif(u_int32_t src, u_int32_t dst) { register vifi_t vifi; register struct uvif *v; @@ -460,7 +454,7 @@ find_vif(src, dst) } static void -age_old_hosts() +age_old_hosts(void) { register vifi_t vifi; register struct uvif *v; @@ -481,7 +475,7 @@ age_old_hosts() * Send group membership queries to all subnets for which I am querier. */ void -query_groups() +query_groups(void) { register vifi_t vifi; register struct uvif *v; @@ -501,9 +495,8 @@ query_groups() * Process an incoming host membership query */ void -accept_membership_query(src, dst, group, tmo) - u_int32_t src, dst, group; - int tmo; +accept_membership_query(u_int32_t src, u_int32_t dst, u_int32_t group, + int tmo) { register vifi_t vifi; register struct uvif *v; @@ -539,9 +532,8 @@ accept_membership_query(src, dst, group, tmo) * Process an incoming group membership report. */ void -accept_group_report(src, dst, group, r_type) - u_int32_t src, dst, group; - int r_type; +accept_group_report(u_int32_t src, u_int32_t dst, u_int32_t group, + int r_type) { register vifi_t vifi; register struct uvif *v; @@ -615,8 +607,7 @@ accept_group_report(src, dst, group, r_type) void -accept_leave_message(src, dst, group) - u_int32_t src, dst, group; +accept_leave_message(u_int32_t src, u_int32_t dst, u_int32_t group) { register vifi_t vifi; register struct uvif *v; @@ -678,7 +669,7 @@ accept_leave_message(src, dst, group) * Detect neighbor loss faster. */ void -probe_for_neighbors() +probe_for_neighbors(void) { register vifi_t vifi; register struct uvif *v; @@ -695,8 +686,7 @@ probe_for_neighbors() * Send a list of all of our neighbors to the requestor, `src'. */ void -accept_neighbor_request(src, dst) - u_int32_t src, dst; +accept_neighbor_request(u_int32_t src, u_int32_t dst) { vifi_t vifi; struct uvif *v; @@ -783,8 +773,7 @@ accept_neighbor_request(src, dst) * Send a list of all of our neighbors to the requestor, `src'. */ void -accept_neighbor_request2(src, dst) - u_int32_t src, dst; +accept_neighbor_request2(u_int32_t src, u_int32_t dst) { vifi_t vifi; struct uvif *v; @@ -896,10 +885,7 @@ accept_neighbor_request2(src, dst) } void -accept_info_request(src, dst, p, datalen) - u_int32_t src, dst; - u_char *p; - int datalen; +accept_info_request(u_int32_t src, u_int32_t dst, char *p, int datalen) { u_char *q; int len; @@ -942,8 +928,7 @@ accept_info_request(src, dst, p, datalen) * Information response -- return version string */ static int -info_version(p) - char *p; +info_version(char *p) { int len; extern char versionstring[]; @@ -962,10 +947,8 @@ info_version(p) * Process an incoming neighbor-list message. */ void -accept_neighbors(src, dst, p, datalen, level) - u_int32_t src, dst, level; - u_char *p; - int datalen; +accept_neighbors(u_int32_t src, u_int32_t dst, u_char *p, int datalen, + u_int32_t level) { log(LOG_INFO, 0, "ignoring spurious DVMRP neighbor list from %s to %s", inet_fmt(src, s1), inet_fmt(dst, s2)); @@ -976,10 +959,8 @@ accept_neighbors(src, dst, p, datalen, level) * Process an incoming neighbor-list message. */ void -accept_neighbors2(src, dst, p, datalen, level) - u_int32_t src, dst, level; - u_char *p; - int datalen; +accept_neighbors2(u_int32_t src, u_int32_t dst, u_char *p, int datalen, + u_int32_t level) { log(LOG_INFO, 0, "ignoring spurious DVMRP neighbor list2 from %s to %s", inet_fmt(src, s1), inet_fmt(dst, s2)); @@ -989,10 +970,7 @@ accept_neighbors2(src, dst, p, datalen, level) * Process an incoming info reply message. */ void -accept_info_reply(src, dst, p, datalen) - u_int32_t src, dst; - u_char *p; - int datalen; +accept_info_reply(u_int32_t src, u_int32_t dst, char *p, int datalen) { log(LOG_INFO, 0, "ignoring spurious DVMRP info reply from %s to %s", inet_fmt(src, s1), inet_fmt(dst, s2)); @@ -1005,13 +983,8 @@ accept_info_reply(src, dst, p, datalen) * Return TRUE if 'addr' is a valid neighbor, FALSE otherwise. */ int -update_neighbor(vifi, addr, msgtype, p, datalen, level) - vifi_t vifi; - u_int32_t addr; - int msgtype; - char *p; - int datalen; - u_int32_t level; +update_neighbor(vifi_t vifi, u_int32_t addr, int msgtype, char *p, + int datalen, u_int32_t level) { register struct uvif *v; register struct listaddr *n; @@ -1212,7 +1185,7 @@ update_neighbor(vifi, addr, msgtype, p, datalen, level) * group entry on every vif. */ void -age_vifs() +age_vifs(void) { register vifi_t vifi; register struct uvif *v; @@ -1269,9 +1242,7 @@ age_vifs() * Returns the neighbor info struct for a given neighbor */ struct listaddr * -neighbor_info(vifi, addr) - vifi_t vifi; - u_int32_t addr; +neighbor_info(vifi_t vifi, u_int32_t addr) { struct listaddr *u; @@ -1286,8 +1257,7 @@ neighbor_info(vifi, addr) * Print the contents of the uvifs array on file 'fp'. */ void -dump_vifs(fp) - FILE *fp; +dump_vifs(FILE *fp) { register vifi_t vifi; register struct uvif *v; @@ -1390,8 +1360,7 @@ dump_vifs(fp) * Time out record of a group membership on a vif */ static void -DelVif(arg) - void *arg; +DelVif(void *arg) { cbk_t *cbk = (cbk_t *)arg; vifi_t vifi = cbk->vifi; @@ -1424,9 +1393,7 @@ DelVif(arg) * Set a timer to delete the record of a group membership on a vif. */ static int -SetTimer(vifi, g) - vifi_t vifi; - struct listaddr *g; +SetTimer(int vifi, struct listaddr *g) { cbk_t *cbk; @@ -1440,8 +1407,7 @@ SetTimer(vifi, g) * Delete a timer that was set above. */ static int -DeleteTimer(id) - int id; +DeleteTimer(int id) { timer_clearTimer(id); return 0; @@ -1451,8 +1417,7 @@ DeleteTimer(id) * Send a group-specific query. */ static void -SendQuery(arg) - void *arg; +SendQuery(void *arg) { cbk_t *cbk = (cbk_t *)arg; register struct uvif *v = &uvifs[cbk->vifi]; @@ -1468,10 +1433,7 @@ SendQuery(arg) * Set a timer to send a group-specific query. */ static int -SetQueryTimer(g, vifi, to_expire, q_time) - struct listaddr *g; - vifi_t vifi; - int to_expire, q_time; +SetQueryTimer(struct listaddr *g, vifi_t vifi, int to_expire, int q_time) { cbk_t *cbk; |