It's currently possible to add a RTF_LOCAL route on an interface with a 
DOWN link state (em(4) to not say which one).

Diff below prevents a race and make sure such routes will be UP until
if_link_state_change() is executed.

ok?

Index: net/route.c
===================================================================
RCS file: /cvs/src/sys/net/route.c,v
retrieving revision 1.249
diff -u -p -r1.249 route.c
--- net/route.c 7 Oct 2015 10:50:35 -0000       1.249
+++ net/route.c 12 Oct 2015 12:00:40 -0000
@@ -856,6 +856,7 @@ rtrequest1(int req, struct rt_addrinfo *
 #ifndef SMALL_KERNEL
                /* Check the link state if the table supports it. */
                if (rtable_mpath_capable(tableid, ndst->sa_family) &&
+                   !ISSET(rt->rt_flags, RTF_LOCAL) &&
                    (!LINK_STATE_IS_UP(ifa->ifa_ifp->if_link_state) ||
                    !ISSET(ifa->ifa_ifp->if_flags, IFF_UP))) {
                        rt->rt_flags &= ~RTF_UP;

Reply via email to