summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
Diffstat (limited to 'sys')
-rw-r--r--sys/net/radix_mpath.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/sys/net/radix_mpath.c b/sys/net/radix_mpath.c
index 8b375f18acd..3ecfd2f983a 100644
--- a/sys/net/radix_mpath.c
+++ b/sys/net/radix_mpath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radix_mpath.c,v 1.7 2006/06/18 12:03:19 pascoe Exp $ */
+/* $OpenBSD: radix_mpath.c,v 1.8 2007/12/04 19:43:04 claudio Exp $ */
/* $KAME: radix_mpath.c,v 1.13 2002/10/28 21:05:59 itojun Exp $ */
/*
@@ -92,23 +92,23 @@ rn_mpath_count(struct radix_node *rn)
struct rtentry *
rt_mpath_matchgate(struct rtentry *rt, struct sockaddr *gate)
{
- struct radix_node *rn;
+ struct radix_node *rn = (struct radix_node *)rt;
- if (!rn_mpath_next((struct radix_node *)rt))
+ /*
+ * if gate is set it must be compared, if not set the route must be
+ * a non-multipath one.
+ */
+ if (!gate && !rn_mpath_next(rn))
return rt;
-
if (!gate)
return NULL;
- /* beyond here, we use rn as the master copy */
- rn = (struct radix_node *)rt;
+
do {
rt = (struct rtentry *)rn;
if (rt->rt_gateway->sa_len == gate->sa_len &&
!memcmp(rt->rt_gateway, gate, gate->sa_len))
break;
} while ((rn = rn_mpath_next(rn)) != NULL);
- if (!rn)
- return NULL;
return (struct rtentry *)rn;
}