Subject: Re: Conditionalize expensive BPF operation
To: Martin Husemann <martin@duskware.de>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-net
Date: 04/30/2001 13:32:37
On Mon, Apr 30, 2001 at 09:57:26PM +0200, Martin Husemann wrote:
> which would return 0 if there are no listeners attached to the struct bpf_if
> (that hides behind "arg"); i.e. would do something like this:
>
> int bpf_haslisteners(caddr_t arg)
> {
> struct bpf_if *bp = (struct bpf_if *)arg;
> return (bp->bif_dlist != NULL);
> }
>
> This would be usefull for interface where the bpf_mtap call needs some
> special, maybe expensive work.
I don't think you need to do this. Checking ifp->if_bpf != NULL should
be sufficient.
--
-- Jason R. Thorpe <thorpej@zembu.com>