From owner-freebsd-net Tue May 30 18:20: 6 2000 Delivered-To: freebsd-net@freebsd.org Received: from bubba.whistle.com (bubba.whistle.com [207.76.205.7]) by hub.freebsd.org (Postfix) with ESMTP id 1490537BE29 for ; Tue, 30 May 2000 18:20:01 -0700 (PDT) (envelope-from archie@whistle.com) Received: (from archie@localhost) by bubba.whistle.com (8.9.3/8.9.2) id SAA86718; Tue, 30 May 2000 18:19:28 -0700 (PDT) From: Archie Cobbs Message-Id: <200005310119.SAA86718@bubba.whistle.com> Subject: Re: BPF fix to if_loop.c In-Reply-To: <4814.959735171@coconut.itojun.org> from "itojun@iijlab.net" at "May 31, 2000 10:06:11 am" To: itojun@iijlab.net Date: Tue, 30 May 2000 18:19:27 -0700 (PDT) Cc: freebsd-net@FreeBSD.ORG X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-net@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org itojun@iijlab.net writes: > >> sorry this was incorrect. however, I think there should be check > >> if ifp really wants DLT_NULL encapsulation or not. > >Hmm.. maybe a better fix is to remove this BPF section altogether.. ? > >It's only going to result in showing the same packet twice, right? > > there are couple of different stories here. > note that you can pass any ifp to if_simloop(). > > a. when if_simloop(ifp = lo0), there must be call to bpf_mtap, > with DLT_NULL encapsulation. if we don't do it here, nobody will. > b. when if_simloop(ifp = non-lo0), there are two cases. > b1. if it was called from layer 2 specific code like > if_ethersubr.c, if_simloop may want to inject the packet > with no encapsulation change. > b2. if it was called from ip{6,}_mloopback, if_simloop() must > not call bpf_mtap. with the current code, ifp_simloop > injects packet as is (with no layer 2 header) into, for > example to bpf for ethernet interface, passing junk to bpf > listeners. this is the problem I experienced. > > in case of b1, your description should be correct (seeing same > packet twice). in case of b2, I'm still not sure how to resolve it. > maybe I don't get the ultimate goal for this change from 4.4BSD. The commit comment to revision 1.33 of if_loop.c may be slightly enlightening.. http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/net/if_loop.c For an example of the resulting cleanup, see: http://www.freebsd.org/cgi/cvsweb.cgi/src/sys/net/if_ethersubr.c.diff?r1=1.48&r2=1.49 Maybe the caller of if_simloop() should be responsible for the BPF part.. -Archie ___________________________________________________________________________ Archie Cobbs * Whistle Communications, Inc. * http://www.whistle.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-net" in the body of the message