Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Dec 2015 16:43:17 +0800
From:      Julian Elischer <julian@freebsd.org>
To:        Juan Herrera <mybsdmailing@gmail.com>, freebsd-net@freebsd.org
Subject:   Re: BPF Berkeley Packet Filter
Message-ID:  <56839925.5030907@freebsd.org>
In-Reply-To: <CAAN2wCD6Bdzzy=sHSww5QLR94bi52R=cDvq-sk%2Bmo3sViFGjUQ@mail.gmail.com>
References:  <CAAN2wCD6Bdzzy=sHSww5QLR94bi52R=cDvq-sk%2Bmo3sViFGjUQ@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 30/12/2015 6:26 AM, Juan Herrera wrote:
> Hello,
>
> I have a question regarding Berkeley Packet filter, which is Can I read an
> incoming packet length with BPF, I am working on a project that requires to
> filter the receiving packets in the kernel before they get to userspace,
> but I need to be able to read the packet length when applying BPF because I
> (previously) encapsulated the packet with my own metadata before sending it
> to the machine with BPF so I want to read packet length to decapsulate as I
> know the value for the metadata at the end of the packet?
https://www.freebsd.org/cgi/man.cgi?bpf%284%29
should show you what you need.

there is a structure prepended to the packet that includes the 
original length.

or do you want to know the length BEFORE reading it?
or do you want your filter to know the length?

what do you mean by "applying BPF"?




>
>
> Thank you in advance!
> _______________________________________________
> freebsd-net@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
>




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