diff options
author | Martin Pieuchot <mpi@cvs.openbsd.org> | 2018-09-27 12:36:58 +0000 |
---|---|---|
committer | Martin Pieuchot <mpi@cvs.openbsd.org> | 2018-09-27 12:36:58 +0000 |
commit | c9f4d814b3fa45307c057b15b2c3e826ea53a401 (patch) | |
tree | 15b896910edb1c884fa4a74c91f58056e97fd269 /sys/net/route.c | |
parent | 03e0c316e0aa34577b574e09ec860a0b08a7049a (diff) |
Make sure the L2 entry is cloned before dereferencing its parent.
RTF_LOCAL entries or static ARP entries don't have parents, so the logic
was incorrect. Note that it might be possible to extend the logic to work
with non-cloned L2 entries but the few use cases do not justify the
complexity (yet).
Problem reported & fix tested by Elie Bouttier.
ok bluhm@, visa@, claudio@
Diffstat (limited to 'sys/net/route.c')
-rw-r--r-- | sys/net/route.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/sys/net/route.c b/sys/net/route.c index ac773074dcb..7f21d9f118d 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.377 2018/07/11 19:52:19 henning Exp $ */ +/* $OpenBSD: route.c,v 1.378 2018/09/27 12:36:57 mpi Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -395,11 +395,8 @@ rt_setgwroute(struct rtentry *rt, u_int rtableid) if (nhrt->rt_ifidx != rt->rt_ifidx) { struct sockaddr_in6 sa_mask; - /* - * If we found a non-L2 entry on a different interface - * there's nothing we can do. - */ - if (!ISSET(nhrt->rt_flags, RTF_LLINFO)) { + if (!ISSET(nhrt->rt_flags, RTF_LLINFO) || + !ISSET(nhrt->rt_flags, RTF_CLONED)) { rtfree(nhrt); return (EHOSTUNREACH); } |