summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2008-05-07 02:45:25 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2008-05-07 02:45:25 +0000
commit6a964d7c26564757b512ed53d3bd9991d81ff7e4 (patch)
tree95f7dd62367f9c3aae5cccc41e79fec2c1ba128f /sys
parentafe3f783c7dd9a2e636d8a5a28c564423ecd3c8c (diff)
Redo rev 1.8 but this time with an additional fix to solve the dhclient crashes
seen by krw. This is a prerequisite for upcomming routing priorities: Always compare the nexthop if one is specified even if it is a non-multipath route. This mostly affects "route delete" and it will not remove the last route if previous delete is redone. OK henning@
Diffstat (limited to 'sys')
-rw-r--r--sys/net/radix_mpath.c16
-rw-r--r--sys/net/route.c5
2 files changed, 11 insertions, 10 deletions
diff --git a/sys/net/radix_mpath.c b/sys/net/radix_mpath.c
index 09929dc3b02..1f72136f376 100644
--- a/sys/net/radix_mpath.c
+++ b/sys/net/radix_mpath.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: radix_mpath.c,v 1.9 2007/12/05 01:18:52 krw Exp $ */
+/* $OpenBSD: radix_mpath.c,v 1.10 2008/05/07 02:45:24 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;
}
diff --git a/sys/net/route.c b/sys/net/route.c
index 6be379a9c08..567d759463a 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.88 2008/05/05 13:06:37 henning Exp $ */
+/* $OpenBSD: route.c,v 1.89 2008/05/07 02:45:24 claudio Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -1028,7 +1028,8 @@ rtinit(struct ifaddr *ifa, int cmd, int flags)
info.rti_ifa = ifa;
info.rti_flags = flags | ifa->ifa_flags;
info.rti_info[RTAX_DST] = dst;
- info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr;
+ if (cmd == RTM_ADD)
+ info.rti_info[RTAX_GATEWAY] = ifa->ifa_addr;
if (ifa->ifa_ifp->if_rtlabelid &&
(label = rtlabel_id2name(ifa->ifa_ifp->if_rtlabelid)) != NULL) {
bzero(&sa_rl, sizeof(sa_rl));