# Using bpf filter in a  kernel module



## TBH (May 18, 2010)

Hi,
I'm new to FreeBSD. I was wondering if it is possible to filter the packets with bpf using a kernel module? Or is it only possible to filter packet from the user level by using the filter machine and ioctl?


----------



## richardpl (May 18, 2010)

I thought that PF is filtering packets from kernel level and not from user level otherwise things would be terribly slow.

Seriously, from where you got such information?


----------



## TBH (May 18, 2010)

oops sorry. what i meant is usually bpf filters packets at kernel level and then sends it to the user level. But is it possible for me to filter the packets using a kernel module which uses bpf? 

Thanks.


----------



## expl (May 18, 2010)

You could at least read Kernel Interface man pages before asking. bpf(9)


----------

