diff options
author | 2009-09-01 06:10:01 +0000 | |
---|---|---|
committer | 2009-09-01 06:10:01 +0000 | |
commit | 2523f380fd16586ce55b7be2d0bf0ffb51fcf560 (patch) | |
tree | c9b521d2b91f6d42c70414f3aa857e2e4b24b667 | |
parent | also, like ssh, set up MAIL to the location we've just checked (diff) | |
download | wireguard-openbsd-2523f380fd16586ce55b7be2d0bf0ffb51fcf560.tar.xz wireguard-openbsd-2523f380fd16586ce55b7be2d0bf0ffb51fcf560.zip |
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
-rw-r--r-- | sys/net/route.c | 8 |
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 |