Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 21 May 2018 10:14:23 +0200
From:      Marko Zec <zec@fer.hr>
To:        Matthew Macy <mmacy@freebsd.org>
Cc:        <src-committers@freebsd.org>, <svn-src-all@freebsd.org>, <svn-src-head@freebsd.org>
Subject:   Re: svn commit: r333967 - head/sys/netinet
Message-ID:  <20180521101423.5fd869be@x23.koncar-institut.local>
In-Reply-To: <CAPrugNrs0CvaqNfXdizn4WCueTMcUCLS3Rpj7dicQFQ8=MvXXg@mail.gmail.com>
References:  <201805210712.w4L7C62h081191@repo.freebsd.org> <20180521094734.3270cccb@x23.koncar-institut.local> <CAPrugNrs0CvaqNfXdizn4WCueTMcUCLS3Rpj7dicQFQ8=MvXXg@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 21 May 2018 01:03:53 -0700
Matthew Macy <mmacy@freebsd.org> wrote:
> On Mon, May 21, 2018 at 00:47 Marko Zec <zec@fer.hr> wrote:
> > On Mon, 21 May 2018 07:12:06 +0000 Matt Macy <mmacy@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);
> > >       }
> > >  
> >
> >  




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20180521101423.5fd869be>