From owner-svn-src-all@freebsd.org Mon May 21 08:13:33 2018 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 21BD8EE7D61; Mon, 21 May 2018 08:13:33 +0000 (UTC) (envelope-from zec@fer.hr) Received: from mail.fer.hr (mail.fer.hr [161.53.72.233]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (Client CN "mail.fer.hr", Issuer "TERENA SSL CA 3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 91BA57317E; Mon, 21 May 2018 08:13:32 +0000 (UTC) (envelope-from zec@fer.hr) Received: from x23.koncar-institut.local (161.53.98.245) by MAIL.fer.hr (161.53.72.233) with Microsoft SMTP Server (TLS) id 14.3.399.0; Mon, 21 May 2018 10:13:30 +0200 Date: Mon, 21 May 2018 10:14:23 +0200 From: Marko Zec To: Matthew Macy CC: , , Subject: Re: svn commit: r333967 - head/sys/netinet Message-ID: <20180521101423.5fd869be@x23.koncar-institut.local> In-Reply-To: References: <201805210712.w4L7C62h081191@repo.freebsd.org> <20180521094734.3270cccb@x23.koncar-institut.local> X-Mailer: Claws Mail 3.16.0 (GTK+ 2.24.31; amd64-portbld-freebsd11.1) MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit X-Originating-IP: [161.53.98.245] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 May 2018 08:13:33 -0000 On Mon, 21 May 2018 01:03:53 -0700 Matthew Macy wrote: > On Mon, May 21, 2018 at 00:47 Marko Zec wrote: > > On Mon, 21 May 2018 07:12:06 +0000 Matt Macy 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); > > > } > > > > > > >