From owner-freebsd-net@freebsd.org Thu Apr 20 13:13:46 2017 Return-Path: Delivered-To: freebsd-net@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1D775D48C12 for ; Thu, 20 Apr 2017 13:13:46 +0000 (UTC) (envelope-from srs0=haqt=34=sigsegv.be=kristof@codepro.be) Received: from venus.codepro.be (venus.codepro.be [IPv6:2a01:4f8:162:1127::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.codepro.be", Issuer "Gandi Standard SSL CA 2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DCCC21F6A for ; Thu, 20 Apr 2017 13:13:45 +0000 (UTC) (envelope-from srs0=haqt=34=sigsegv.be=kristof@codepro.be) Received: from [172.16.5.2] (vega.codepro.be [IPv6:2a01:4f8:162:1127::3]) (Authenticated sender: kp) by venus.codepro.be (Postfix) with ESMTPSA id 75E5E965A; Thu, 20 Apr 2017 15:13:43 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sigsegv.be; s=mail; t=1492694023; bh=oUGg27Cnn+blytplCr+Bgebh5qCB9J0dhEu8NNHo4dU=; h=From:To:Cc:Subject:Date:In-Reply-To:References; b=klQiO3ZuF1LdPmvH+pV3iGFyYYmPaShl6sNAI6h9vc7GuIEL+/y4bkixIAxfOwE6O nPQXf7Q/wojozA2xXLJHjC/uAS2zl01g5oXQQonRLUKFaaa+699FhEjEZFNSo4m3sX 71IWbMrc30z6SXgyBM3tNkR+sDQIQbBXdIV7gAzg= From: "Kristof Provost" To: "Marko Zec" Cc: peter.blok@bsd4all.org, freebsd-net@freebsd.org Subject: Re: MFC VIMAGE fixes to 11-stable Date: Thu, 20 Apr 2017 15:13:42 +0200 Message-ID: <60C3FBF7-7CF3-49AF-9DDF-0589AE9D9146@sigsegv.be> In-Reply-To: <20170420124256.1190665d@x23> References: <8E6FC1CD-24D5-46D5-A6A1-760DD612F92D@bsd4all.org> <20170420124256.1190665d@x23> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Mailer: MailMate (2.0BETAr6082) X-BeenThere: freebsd-net@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Networking and TCP/IP with FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 20 Apr 2017 13:13:46 -0000 On 20 Apr 2017, at 12:42, Marko Zec wrote: > The real culprit lies somewhere in PF code which operates on a wrong > vnet. Without a backtrace it's difficult to guess, but a quick read > reveals that > > pfi_initialize() > > is called from the default vnet context, and subsequently registers > interface eventhandlers so that all interface attach, change and > detach > events will be always executed in the default vnet, regardless of the > real vnet where the interfaces bound to the events actually reside. > In > other words, > > pfi_attach_group_event() > pfi_change_group_event() > pfi_detach_group_event() > > will operate fine only in the default vnet, but will wreak havoc > otherwise. Hence, those handlers should be fixed first. > I don’t think that’s right. The event handler doesn’t carry vnet information. It’s just called in whatever vnet is active when it’s invoked. There's no CURVNET_SET() in the EVENTHANDLER_INVOKE() macro. That means that we end up in pf_attach_group_event() with CURVNET set to the relevant vnet, not to the default vnet. There are certainly still issues with pf and vnets, but I don't think this is one. Regards, Kristof