svn commit: r333967 - head/sys/netinet

Marko Zec zec at fer.hr
Mon May 21 08:13:33 UTC 2018


On Mon, 21 May 2018 01:03:53 -0700
Matthew Macy <mmacy at freebsd.org> wrote:
> On Mon, May 21, 2018 at 00:47 Marko Zec <zec at fer.hr> wrote:
> > On Mon, 21 May 2018 07:12:06 +0000 Matt Macy <mmacy at freebsd.org> wrote:
...
> > > +             if (ifp)
> > > +                     CURVNET_SET(ifp->if_vnet);  
> >
> > Unfortunately, this won't work because CURVNET_SET() expands to a
> > sequence of declarations and assignments which are NOT enclosed in a
> > single block.  Instead, only the first statement in CURVNET_SET()
> > sequence, which is an assert, will be executed conditionally only if
> > ifp != NULL, while the rest of the CURVNET_SET() body will fall out
> > of the scope of the if (ifp) conditional.
> 
> That's pretty counter to the way macros are done _everywhere_ else in
> the kernel. 

Agreed, unfortunately it is.

> You should probably fix that.

This problem was discussed on numerous occasions but no better / more
convenient and workable proposals come up so far.

Bjoern clearly documented and emphasized this problem in vnet(9).

Marko

> 
> 
> > I'd recommend backing out this patch, and instead extending the
> > struct ip_moptions with an struct vnet * entry, which would be
> > populated before scheduling inp_gcmoptions().  Then
> > CURVNET_SET(imo->imo_vnet) could be called only once (and
> > unconditionally) in gcmoptions(), instead of (attempts at) doing
> > this multiple times in a for loop.
> >
> > Marko
> >
> >  
> > > +             (void)in_leavegroup(inm, imf);
> > > +             if (ifp)
> > > +                     CURVNET_RESTORE();
> > >               if (imf)
> > >                       imf_purge(imf);
> > >       }
> > >  
> >
> >  



More information about the svn-src-all mailing list