Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 30 May 2000 18:19:27 -0700 (PDT)
From:      Archie Cobbs <archie@whistle.com>
To:        itojun@iijlab.net
Cc:        freebsd-net@FreeBSD.ORG
Subject:   Re: BPF fix to if_loop.c
Message-ID:  <200005310119.SAA86718@bubba.whistle.com>
In-Reply-To: <4814.959735171@coconut.itojun.org> from "itojun@iijlab.net" at "May 31, 2000 10:06:11 am"

next in thread | previous in thread | raw e-mail | index | archive | help
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




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