diff options
-rw-r--r-- | sys/net/radix.c | 75 | ||||
-rw-r--r-- | sys/net/radix_mpath.c | 30 | ||||
-rw-r--r-- | sys/net/route.c | 111 |
3 files changed, 64 insertions, 152 deletions
diff --git a/sys/net/radix.c b/sys/net/radix.c index d7df4862493..3dd794817bd 100644 --- a/sys/net/radix.c +++ b/sys/net/radix.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radix.c,v 1.18 2004/04/25 20:02:39 itojun Exp $ */ +/* $OpenBSD: radix.c,v 1.19 2005/05/15 16:40:09 henning Exp $ */ /* $NetBSD: radix.c,v 1.20 2003/08/07 16:32:56 agc Exp $ */ /* @@ -105,9 +105,7 @@ static struct radix_mask *rn_new_radix_mask(struct radix_node *, */ struct radix_node * -rn_search(v_arg, head) - void *v_arg; - struct radix_node *head; +rn_search(void *v_arg, struct radix_node *head) { struct radix_node *x; caddr_t v; @@ -122,9 +120,7 @@ rn_search(v_arg, head) } struct radix_node * -rn_search_m(v_arg, head, m_arg) - struct radix_node *head; - void *v_arg, *m_arg; +rn_search_m(void *v_arg, struct radix_node *head, void *m_arg) { struct radix_node *x; caddr_t v = v_arg, m = m_arg; @@ -140,8 +136,7 @@ rn_search_m(v_arg, head, m_arg) } int -rn_refines(m_arg, n_arg) - void *m_arg, *n_arg; +rn_refines(void *m_arg, void *n_arg) { caddr_t m = m_arg, n = n_arg; caddr_t lim, lim2 = lim = n + *(u_char *)n; @@ -167,9 +162,7 @@ rn_refines(m_arg, n_arg) } struct radix_node * -rn_lookup(v_arg, m_arg, head) - void *v_arg, *m_arg; - struct radix_node_head *head; +rn_lookup(void *v_arg, void *m_arg, struct radix_node_head *head) { struct radix_node *x; caddr_t netmask = 0; @@ -188,10 +181,7 @@ rn_lookup(v_arg, m_arg, head) } static int -rn_satisfies_leaf(trial, leaf, skip) - char *trial; - struct radix_node *leaf; - int skip; +rn_satisfies_leaf(char *trial, struct radix_node *leaf, int skip) { char *cp = trial, *cp2 = leaf->rn_key, *cp3 = leaf->rn_mask; char *cplim; @@ -209,9 +199,7 @@ rn_satisfies_leaf(trial, leaf, skip) } struct radix_node * -rn_match(v_arg, head) - void *v_arg; - struct radix_node_head *head; +rn_match(void *v_arg, struct radix_node_head *head) { caddr_t v = v_arg; struct radix_node *t = head->rnh_treetop, *x; @@ -318,10 +306,7 @@ int rn_debug = 1; #endif struct radix_node * -rn_newpair(v, b, nodes) - void *v; - int b; - struct radix_node nodes[2]; +rn_newpair(void *v, int b, struct radix_node nodes[2]) { struct radix_node *tt = nodes, *t = tt + 1; t->rn_b = b; @@ -343,11 +328,8 @@ rn_newpair(v, b, nodes) } struct radix_node * -rn_insert(v_arg, head, dupentry, nodes) - void *v_arg; - struct radix_node_head *head; - int *dupentry; - struct radix_node nodes[2]; +rn_insert(void *v_arg, struct radix_node_head *head, + int *dupentry, struct radix_node nodes[2]) { caddr_t v = v_arg; struct radix_node *top = head->rnh_treetop; @@ -412,9 +394,7 @@ on1: } struct radix_node * -rn_addmask(n_arg, search, skip) - int search, skip; - void *n_arg; +rn_addmask(void *n_arg, int search, int skip) { caddr_t netmask = (caddr_t)n_arg; struct radix_node *x; @@ -486,8 +466,7 @@ rn_addmask(n_arg, search, skip) } static int /* XXX: arbitrary ordering for non-contiguous masks */ -rn_lexobetter(m_arg, n_arg) - void *m_arg, *n_arg; +rn_lexobetter(void *m_arg, void *n_arg) { u_char *mp = m_arg, *np = n_arg, *lim; @@ -501,9 +480,7 @@ rn_lexobetter(m_arg, n_arg) } static struct radix_mask * -rn_new_radix_mask(tt, next) - struct radix_node *tt; - struct radix_mask *next; +rn_new_radix_mask(struct radix_node *tt, struct radix_mask *next) { struct radix_mask *m; @@ -525,10 +502,8 @@ rn_new_radix_mask(tt, next) } struct radix_node * -rn_addroute(v_arg, n_arg, head, treenodes) - void *v_arg, *n_arg; - struct radix_node_head *head; - struct radix_node treenodes[2]; +rn_addroute(void *v_arg, void *n_arg, struct radix_node_head *head, + struct radix_node treenodes[2]) { caddr_t v = (caddr_t)v_arg, netmask = (caddr_t)n_arg; struct radix_node *t, *x = NULL, *tt; @@ -703,10 +678,8 @@ on2: } struct radix_node * -rn_delete(v_arg, netmask_arg, head, rn) - void *v_arg, *netmask_arg; - struct radix_node_head *head; - struct radix_node *rn; +rn_delete(void *v_arg, void *netmask_arg, struct radix_node_head *head, + struct radix_node *rn) { struct radix_node *t, *p, *x, *tt; struct radix_mask *m, *saved_m, **mp; @@ -915,10 +888,8 @@ out: } int -rn_walktree(h, f, w) - struct radix_node_head *h; - int (*f)(struct radix_node *, void *); - void *w; +rn_walktree(struct radix_node_head *h, int (*f)(struct radix_node *, void *), + void *w) { int error; struct radix_node *base, *next; @@ -954,9 +925,7 @@ rn_walktree(h, f, w) } int -rn_inithead(head, off) - void **head; - int off; +rn_inithead(void **head, int off) { struct radix_node_head *rnh; @@ -970,9 +939,7 @@ rn_inithead(head, off) } int -rn_inithead0(rnh, off) - struct radix_node_head *rnh; - int off; +rn_inithead0(struct radix_node_head *rnh, int off) { struct radix_node *t, *tt, *ttt; diff --git a/sys/net/radix_mpath.c b/sys/net/radix_mpath.c index 3d612bd98c8..cccd717541b 100644 --- a/sys/net/radix_mpath.c +++ b/sys/net/radix_mpath.c @@ -1,4 +1,4 @@ -/* $OpenBSD: radix_mpath.c,v 1.2 2004/06/19 19:55:53 cedric Exp $ */ +/* $OpenBSD: radix_mpath.c,v 1.3 2005/05/15 16:40:09 henning Exp $ */ /* $KAME: radix_mpath.c,v 1.13 2002/10/28 21:05:59 itojun Exp $ */ /* @@ -52,16 +52,14 @@ static u_int32_t hashjitter; int -rn_mpath_capable(rnh) - struct radix_node_head *rnh; +rn_mpath_capable(struct radix_node_head *rnh) { return rnh->rnh_multipath; } struct radix_node * -rn_mpath_next(rn) - struct radix_node *rn; +rn_mpath_next(struct radix_node *rn) { struct radix_node *next; @@ -75,8 +73,7 @@ rn_mpath_next(rn) } int -rn_mpath_count(rn) - struct radix_node *rn; +rn_mpath_count(struct radix_node *rn) { int i; @@ -87,9 +84,7 @@ rn_mpath_count(rn) } struct rtentry * -rt_mpath_matchgate(rt, gate) - struct rtentry *rt; - struct sockaddr *gate; +rt_mpath_matchgate(struct rtentry *rt, struct sockaddr *gate) { struct radix_node *rn; @@ -116,11 +111,8 @@ rt_mpath_matchgate(rt, gate) * check if we have the same key/mask/gateway on the table already. */ int -rt_mpath_conflict(rnh, rt, netmask, mpathok) - struct radix_node_head *rnh; - struct rtentry *rt; - struct sockaddr *netmask; - int mpathok; +rt_mpath_conflict(struct radix_node_head *rnh, struct rtentry *rt, + struct sockaddr *netmask, int mpathok) { struct radix_node *rn, *rn1; struct rtentry *rt1; @@ -217,9 +209,7 @@ rt_mpath_conflict(rnh, rt, netmask, mpathok) } void -rtalloc_mpath(ro, hash) - struct route *ro; - int hash; +rtalloc_mpath(struct route *ro, int hash) { struct radix_node *rn0, *rn; int n; @@ -261,9 +251,7 @@ rtalloc_mpath(ro, hash) } int -rn_mpath_inithead(head, off) - void **head; - int off; +rn_mpath_inithead(void **head, int off) { struct radix_node_head *rnh; diff --git a/sys/net/route.c b/sys/net/route.c index a78f86be3d2..c5864cbcbd0 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.50 2004/09/16 22:31:30 henning Exp $ */ +/* $OpenBSD: route.c,v 1.51 2005/05/15 16:40:09 henning Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -171,8 +171,7 @@ encap_findgwifa(struct sockaddr *gw) #endif void -rtable_init(table) - void **table; +rtable_init(void **table) { struct domain *dom; for (dom = domains; dom != NULL; dom = dom->dom_next) @@ -191,9 +190,7 @@ route_init() } void -rtalloc_noclone(ro, howstrict) - struct route *ro; - int howstrict; +rtalloc_noclone(struct route *ro, int howstrict) { if (ro->ro_rt && ro->ro_rt->rt_ifp && (ro->ro_rt->rt_flags & RTF_UP)) return; /* XXX */ @@ -201,9 +198,7 @@ rtalloc_noclone(ro, howstrict) } int -okaytoclone(flags, howstrict) - u_int flags; - int howstrict; +okaytoclone(u_int flags, int howstrict) { if (howstrict == ALL_CLONING) return (1); @@ -213,9 +208,7 @@ okaytoclone(flags, howstrict) } struct rtentry * -rtalloc2(dst, report,howstrict) - struct sockaddr *dst; - int report,howstrict; +rtalloc2(struct sockaddr *dst, int report, int howstrict) { struct radix_node_head *rnh = rt_tables[dst->sa_family]; struct rtentry *rt; @@ -258,8 +251,7 @@ miss: if (report) { * Packet routing routines. */ void -rtalloc(ro) - struct route *ro; +rtalloc(struct route *ro) { if (ro->ro_rt && ro->ro_rt->rt_ifp && (ro->ro_rt->rt_flags & RTF_UP)) return; /* XXX */ @@ -267,9 +259,7 @@ rtalloc(ro) } struct rtentry * -rtalloc1(dst, report) - struct sockaddr *dst; - int report; +rtalloc1(struct sockaddr *dst, int report) { struct radix_node_head *rnh = rt_tables[dst->sa_family]; struct rtentry *rt; @@ -325,8 +315,7 @@ rtalloc1(dst, report) } void -rtfree(rt) - struct rtentry *rt; +rtfree(struct rtentry *rt) { struct ifaddr *ifa; @@ -352,8 +341,7 @@ rtfree(rt) } void -ifafree(ifa) - struct ifaddr *ifa; +ifafree(struct ifaddr *ifa) { if (ifa == NULL) panic("ifafree"); @@ -372,10 +360,9 @@ ifafree(ifa) * N.B.: must be called at splsoftnet */ void -rtredirect(dst, gateway, netmask, flags, src, rtp) - struct sockaddr *dst, *gateway, *netmask, *src; - int flags; - struct rtentry **rtp; +rtredirect(struct sockaddr *dst, struct sockaddr *gateway, + struct sockaddr *netmask, int flags, struct sockaddr *src, + struct rtentry **rtp) { struct rtentry *rt; int error = 0; @@ -476,8 +463,7 @@ out: * Delete a route and generate a message */ int -rtdeletemsg(rt) - struct rtentry *rt; +rtdeletemsg(struct rtentry *rt) { int error; struct rt_addrinfo info; @@ -505,9 +491,7 @@ rtdeletemsg(rt) } int -rtflushclone1(rn, arg) - struct radix_node *rn; - void *arg; +rtflushclone1(struct radix_node *rn, void *arg) { struct rtentry *rt, *parent; @@ -519,9 +503,7 @@ rtflushclone1(rn, arg) } void -rtflushclone(rnh, parent) - struct radix_node_head *rnh; - struct rtentry *parent; +rtflushclone(struct radix_node_head *rnh, struct rtentry *parent) { #ifdef DIAGNOSTIC @@ -537,18 +519,13 @@ rtflushclone(rnh, parent) * Routing table ioctl interface. */ int -rtioctl(req, data, p) - u_long req; - caddr_t data; - struct proc *p; +rtioctl(u_long req, caddr_t data, struct proc *p) { return (EOPNOTSUPP); } struct ifaddr * -ifa_ifwithroute(flags, dst, gateway) - int flags; - struct sockaddr *dst, *gateway; +ifa_ifwithroute(int flags, struct sockaddr *dst, struct sockaddr *gateway) { struct ifaddr *ifa; @@ -610,10 +587,8 @@ ifa_ifwithroute(flags, dst, gateway) #define ROUNDUP(a) (a>0 ? (1 + (((a) - 1) | (sizeof(long) - 1))) : sizeof(long)) int -rtrequest(req, dst, gateway, netmask, flags, ret_nrt) - int req, flags; - struct sockaddr *dst, *gateway, *netmask; - struct rtentry **ret_nrt; +rtrequest(int req, struct sockaddr *dst, struct sockaddr *gateway, + struct sockaddr *netmask, int flags, struct rtentry **ret_nrt) { struct rt_addrinfo info; @@ -637,8 +612,7 @@ rtrequest(req, dst, gateway, netmask, flags, ret_nrt) #define flags info->rti_flags int -rt_getifa(info) - struct rt_addrinfo *info; +rt_getifa(struct rt_addrinfo *info) { struct ifaddr *ifa; int error = 0; @@ -674,10 +648,7 @@ rt_getifa(info) } int -rtrequest1(req, info, ret_nrt) - int req; - struct rt_addrinfo *info; - struct rtentry **ret_nrt; +rtrequest1(int req, struct rt_addrinfo *info, struct rtentry **ret_nrt) { int s = splsoftnet(); int error = 0; struct rtentry *rt, *crt; @@ -848,9 +819,7 @@ bad: #undef flags int -rt_setgate(rt0, dst, gate) - struct rtentry *rt0; - struct sockaddr *dst, *gate; +rt_setgate(struct rtentry *rt0, struct sockaddr *dst, struct sockaddr *gate) { caddr_t new, old; int dlen = ROUNDUP(dst->sa_len), glen = ROUNDUP(gate->sa_len); @@ -896,8 +865,8 @@ rt_setgate(rt0, dst, gate) } void -rt_maskedcopy(src, dst, netmask) - struct sockaddr *src, *dst, *netmask; +rt_maskedcopy(struct sockaddr *src, struct sockaddr *dst, + struct sockaddr *netmask) { u_char *cp1 = (u_char *)src; u_char *cp2 = (u_char *)dst; @@ -920,9 +889,7 @@ rt_maskedcopy(src, dst, netmask) * for an interface. */ int -rtinit(ifa, cmd, flags) - struct ifaddr *ifa; - int cmd, flags; +rtinit(struct ifaddr *ifa, int cmd, int flags) { struct rtentry *rt; struct sockaddr *dst; @@ -1020,7 +987,7 @@ static int rt_init_done = 0; * that this is run when the first queue is added... */ -void +void rt_timer_init() { static struct timeout rt_timer_timeout; @@ -1037,8 +1004,7 @@ rt_timer_init() } struct rttimer_queue * -rt_timer_queue_create(timeout) - u_int timeout; +rt_timer_queue_create(u_int timeout) { struct rttimer_queue *rtq; @@ -1059,18 +1025,14 @@ rt_timer_queue_create(timeout) } void -rt_timer_queue_change(rtq, timeout) - struct rttimer_queue *rtq; - long timeout; +rt_timer_queue_change(struct rttimer_queue *rtq, long timeout) { rtq->rtq_timeout = timeout; } void -rt_timer_queue_destroy(rtq, destroy) - struct rttimer_queue *rtq; - int destroy; +rt_timer_queue_destroy(struct rttimer_queue *rtq, int destroy) { struct rttimer *r; @@ -1094,16 +1056,14 @@ rt_timer_queue_destroy(rtq, destroy) } unsigned long -rt_timer_count(rtq) - struct rttimer_queue *rtq; +rt_timer_count(struct rttimer_queue *rtq) { return (rtq->rtq_count); } void -rt_timer_remove_all(rt) - struct rtentry *rt; +rt_timer_remove_all(struct rtentry *rt) { struct rttimer *r; @@ -1119,10 +1079,8 @@ rt_timer_remove_all(rt) } int -rt_timer_add(rt, func, queue) - struct rtentry *rt; - void(*func)(struct rtentry *, struct rttimer *); - struct rttimer_queue *queue; +rt_timer_add(struct rtentry *rt, void (*func)(struct rtentry *, + struct rttimer *), struct rttimer_queue *queue) { struct rttimer *r; long current_time; @@ -1165,8 +1123,7 @@ rt_timer_add(rt, func, queue) /* ARGSUSED */ void -rt_timer_timer(arg) - void *arg; +rt_timer_timer(void *arg) { struct timeout *to = (struct timeout *)arg; struct rttimer_queue *rtq; |