I should not have committed this chunk. Spotted by krw@
authormpi <mpi@openbsd.org>
Sun, 25 Oct 2015 16:25:23 +0000 (16:25 +0000)
committermpi <mpi@openbsd.org>
Sun, 25 Oct 2015 16:25:23 +0000 (16:25 +0000)
sys/net/route.c

index 7fa4988..f2c9457 100644 (file)
@@ -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