On 12/10/15(Mon) 14:59, Mike Belopuhov wrote:
> On Mon, Oct 12, 2015 at 14:06 +0200, Martin Pieuchot wrote:
> > 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?
> >
>
> So this code runs after the interface SIOCSIFADDR ioctl handler
> has UP'ped the inteface. This rtrequest1 adds an RTF_LOCAL route
> which should not depend on the actual link state since packets
> for this destination will never go out on the wire.
Exactly.
> If my understanding is correct, OK mikeb
Thanks.
>
> > 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;
> >