summaryrefslogtreecommitdiff
path: root/sys/net/route.c
diff options
context:
space:
mode:
authorClaudio Jeker <claudio@cvs.openbsd.org>2009-09-01 06:10:02 +0000
committerClaudio Jeker <claudio@cvs.openbsd.org>2009-09-01 06:10:02 +0000
commit4e6a8645d5ace03e41e59440cb998cf28ad137f1 (patch)
tree48b26938b3d2864e6a27477990f61865cb709537 /sys/net/route.c
parent10e5a92aaab1d27d06becb6b1bd7597228647e19 (diff)
Make rtinit() cope when there is a more specific route available then
the one planned to remove. Do this by going through the dupedkey list looking for the right ifa. Problem found by and OK dlg, OK henning
Diffstat (limited to 'sys/net/route.c')
-rw-r--r--sys/net/route.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sys/net/route.c b/sys/net/route.c
index d3c3696ddbb..d4fd0256976 100644
--- a/sys/net/route.c
+++ b/sys/net/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.110 2009/07/28 20:54:57 claudio Exp $ */
+/* $OpenBSD: route.c,v 1.111 2009/09/01 06:10:01 claudio Exp $ */
/* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */
/*
@@ -1075,7 +1075,11 @@ rtinit(struct ifaddr *ifa, int cmd, int flags)
}
if ((rt = rtalloc1(dst, 0, rtableid)) != NULL) {
rt->rt_refcnt--;
- if (rt->rt_ifa != ifa) {
+ /* try to find the right route */
+ while (rt && rt->rt_ifa != ifa)
+ rt = (struct rtentry *)
+ ((struct radix_node *)rt)->rn_dupedkey;
+ if (!rt) {
if (m != NULL)
(void) m_free(m);
return (flags & RTF_HOST ? EHOSTUNREACH