From 3503d0c3074963f30fcbd7bb847fa999655fbfb9 Mon Sep 17 00:00:00 2001 From: Martin Pieuchot Date: Tue, 17 Nov 2015 10:28:25 +0000 Subject: Unbreak next-hop caching on multipath setups. When multiple gateways are in use, the next-hop entrie might not be on the same interface. This is due to the fact that ARP entries are unique and attached to their cloning interface. Found the hard way by and ok dlg@ --- sys/net/route.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'sys/net') diff --git a/sys/net/route.c b/sys/net/route.c index 15ae1d86c40..cbbfb8e785f 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.270 2015/11/11 11:25:16 mpi Exp $ */ +/* $OpenBSD: route.c,v 1.271 2015/11/17 10:28:24 mpi Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -405,10 +405,14 @@ rtalloc(struct sockaddr *dst, int flags, unsigned int rtableid) return (rt); } - /* - * Next hop entry must be UP and on the same interface. - */ - if (!ISSET(nhrt->rt_flags, RTF_UP) || nhrt->rt_ifidx != rt->rt_ifidx) { + /* Next hop entry must be UP... */ + if (!ISSET(nhrt->rt_flags, RTF_UP)) { + rtfree(nhrt); + return (rt); + } + + /* ...and on the same interface unless we have multiple gateways. */ + if (nhrt->rt_ifidx != rt->rt_ifidx && !ISSET(rt->rt_flags, RTF_MPATH)) { rtfree(nhrt); return (rt); } -- cgit v1.2.3