summaryrefslogtreecommitdiff
path: root/sys/net/radix_mpath.c
diff options
context:
space:
mode:
authorKenneth R Westerback <krw@cvs.openbsd.org>2007-12-05 01:18:53 +0000
committerKenneth R Westerback <krw@cvs.openbsd.org>2007-12-05 01:18:53 +0000
commit233f4cb26ab2a0cc65931c418457c246742a9e18 (patch)
tree19bf6be6f8ed7ae55fc34795f24c6a351ffe8e67 /sys/net/radix_mpath.c
parent5424d15729d1b5915d87e909b47eabdfaf06cd12 (diff)
Revert change which seems to break things like dhclient. Requested by
deraadt@.
Diffstat (limited to 'sys/net/radix_mpath.c')
-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 3ecfd2f983a..09929dc3b02 100644
--- a/sys/net/radix_mpath.c
+++ b/sys/net/radix_mpath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radix_mpath.c,v 1.8 2007/12/04 19:43:04 claudio Exp $ */
+/* $OpenBSD: radix_mpath.c,v 1.9 2007/12/05 01:18:52 krw 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 *)rt;
+ struct radix_node *rn;
- /*
- * 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))
+ if (!rn_mpath_next((struct radix_node *)rt))
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;
}