From b45c11be66669b24a6b07df68e4e878e47a5eefa Mon Sep 17 00:00:00 2001 From: mpi Date: Sun, 25 Oct 2015 16:25:23 +0000 Subject: [PATCH] I should not have committed this chunk. Spotted by krw@ --- sys/net/route.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/sys/net/route.c b/sys/net/route.c index 7fa49885452..f2c945733aa 100644 --- a/sys/net/route.c +++ b/sys/net/route.c @@ -1,4 +1,4 @@ -/* $OpenBSD: route.c,v 1.264 2015/10/25 15:24:03 mpi Exp $ */ +/* $OpenBSD: route.c,v 1.265 2015/10/25 16:25:23 mpi Exp $ */ /* $NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $ */ /* @@ -733,11 +733,26 @@ rtrequest1(int req, struct rt_addrinfo *info, u_int8_t prio, switch (req) { case RTM_DELETE: rt = rtable_lookup(tableid, info->rti_info[RTAX_DST], - info->rti_info[RTAX_NETMASK], info->rti_info[RTAX_GATEWAY], - prio ); + info->rti_info[RTAX_NETMASK]); + if (rt == NULL) + return (ESRCH); +#ifndef SMALL_KERNEL + rt = rtable_mpath_match(tableid, rt, + info->rti_info[RTAX_GATEWAY], prio); if (rt == NULL) return (ESRCH); + /* + * If we got multipath routes, we require users to specify + * a matching gateway. + */ + if ((rt->rt_flags & RTF_MPATH) && + info->rti_info[RTAX_GATEWAY] == NULL) { + rtfree(rt); + return (ESRCH); + } +#endif + /* * Since RTP_LOCAL cannot be set by userland, make * sure that local routes are only modified by the -- 2.20.1