From a5f2711eee712027b2d2fb98a3aa8cf1770564c4 Mon Sep 17 00:00:00 2001 From: Qing Li Date: Fri, 30 May 2008 09:34:35 +0000 Subject: [PATCH] When RADIX_MPATH is enabled, the route selection is not rotating through the multipath entries. The hash value was a signed integer and was always giving a -1 value. PR: 123991 Submitted by: Barrett Lyon --- sys/net/radix_mpath.c | 8 ++++---- sys/net/radix_mpath.h | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/net/radix_mpath.c b/sys/net/radix_mpath.c index b04b42a1bd1d..03800f663d32 100644 --- a/sys/net/radix_mpath.c +++ b/sys/net/radix_mpath.c @@ -76,10 +76,10 @@ rn_mpath_next(struct radix_node *rn) return NULL; } -int +u_int32_t rn_mpath_count(struct radix_node *rn) { - int i; + u_int32_t i; i = 1; while ((rn = rn_mpath_next(rn)) != NULL) @@ -255,10 +255,10 @@ rt_mpath_conflict(struct radix_node_head *rnh, struct rtentry *rt, } void -rtalloc_mpath_fib(struct route *ro, int hash, u_int fibnum) +rtalloc_mpath_fib(struct route *ro, u_int32_t hash, u_int fibnum) { struct radix_node *rn0, *rn; - int n; + u_int32_t n; /* * XXX we don't attempt to lookup cached route again; what should diff --git a/sys/net/radix_mpath.h b/sys/net/radix_mpath.h index b9224c8ecb8e..bcb210e37cff 100644 --- a/sys/net/radix_mpath.h +++ b/sys/net/radix_mpath.h @@ -46,11 +46,11 @@ struct rtentry; struct sockaddr; int rn_mpath_capable(struct radix_node_head *); struct radix_node *rn_mpath_next(struct radix_node *); -int rn_mpath_count(struct radix_node *); +u_int32_t rn_mpath_count(struct radix_node *); struct rtentry *rt_mpath_matchgate(struct rtentry *, struct sockaddr *); int rt_mpath_conflict(struct radix_node_head *, struct rtentry *, struct sockaddr *); -void rtalloc_mpath_fib(struct route *, int, u_int); +void rtalloc_mpath_fib(struct route *, u_int32_t, u_int); #define rtalloc_mpath(_route, _hash) rtalloc_mpath_fib((_route), (_hash), 0) struct radix_node *rn_mpath_lookup(void *, void *, struct radix_node_head *);