From owner-svn-src-all@FreeBSD.ORG Wed Apr 15 14:30:39 2015 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 4540AA7C; Wed, 15 Apr 2015 14:30:39 +0000 (UTC) Received: from cell.glebius.int.ru (glebius.int.ru [81.19.69.10]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebius.int.ru", Issuer "cell.glebius.int.ru" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id A55AF949; Wed, 15 Apr 2015 14:30:38 +0000 (UTC) Received: from cell.glebius.int.ru (localhost [127.0.0.1]) by cell.glebius.int.ru (8.14.9/8.14.9) with ESMTP id t3FEUaP0029768 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 15 Apr 2015 17:30:36 +0300 (MSK) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebius.int.ru (8.14.9/8.14.9/Submit) id t3FEUZbn029767; Wed, 15 Apr 2015 17:30:35 +0300 (MSK) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebius.int.ru: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 15 Apr 2015 17:30:35 +0300 From: Gleb Smirnoff To: Kristof Provost Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r281536 - head/sys/netpfil/pf Message-ID: <20150415143035.GF883@FreeBSD.org> References: <201504141907.t3EJ7bZp044696@svn.freebsd.org> <20150415125302.GB883@FreeBSD.org> <20150415132556.GB2058@vega.codepro.be> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150415132556.GB2058@vega.codepro.be> User-Agent: Mutt/1.5.23 (2014-03-12) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.20 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: Wed, 15 Apr 2015 14:30:39 -0000 On Wed, Apr 15, 2015 at 03:25:56PM +0200, Kristof Provost wrote: K> On 2015-04-15 15:53:02 (+0300), Gleb Smirnoff wrote: K> > On Tue, Apr 14, 2015 at 07:07:37PM +0000, Kristof Provost wrote: K> > K> Author: kp K> > K> Date: Tue Apr 14 19:07:37 2015 K> > K> New Revision: 281536 K> > K> URL: https://svnweb.freebsd.org/changeset/base/281536 K> > K> K> > K> Log: K> > K> pf: Fix forwarding detection K> > K> K> > K> If the direction is not PF_OUT we can never be forwarding. Some input packets K> > K> have rcvif != ifp (looped back packets), which lead us to ip6_forward() inbound K> > K> packets, causing panics. K> > K> K> > K> Equally, we need to ensure that packets were really received and not locally K> > K> generated before trying to ip6_forward() them. K> > K> K> > K> Differential Revision: https://reviews.freebsd.org/D2286 K> > K> Approved by: gnn(mentor) K> > K> K> > K> Modified: K> > K> head/sys/netpfil/pf/pf.c K> > K> K> > K> Modified: head/sys/netpfil/pf/pf.c K> > K> ============================================================================== K> > K> --- head/sys/netpfil/pf/pf.c Tue Apr 14 18:57:50 2015 (r281535) K> > K> +++ head/sys/netpfil/pf/pf.c Tue Apr 14 19:07:37 2015 (r281536) K> > K> @@ -6070,7 +6070,7 @@ pf_test6(int dir, struct ifnet *ifp, str K> > K> K> > K> M_ASSERTPKTHDR(m); K> > K> K> > K> - if (ifp != m->m_pkthdr.rcvif) K> > K> + if (dir == PF_OUT && m->m_pkthdr.rcvif && ifp != m->m_pkthdr.rcvif) K> > K> fwdir = PF_FWD; K> > K> > The ifp argument to pf_test6() is always not NULL, so the (m->m_pkthdr.rcvif) K> > conjunct is extraneous. K> > K> m->pkthdr.rcvif can be NULL though (e.g. when this is a locally K> generated packet). In that case we don't want to forward, which we'd end K> up doing because, as you say, ifp won't be NULL. K> K> (In other words: If m->pkthdr.rcvif is NULL we don't forward, even if K> ifp != m->pkthdr.rcvif.) I'm sorry! My braino. -- Totus tuus, Glebius.