Re: [PATCH net-next v2] net: filter: add insn for loading internal transport header offset
From: David Miller <davem@davemloft.net>
Date: 2014-05-03 02:52:56
From: David Miller <davem@davemloft.net>
Date: 2014-05-03 02:52:56
From: Chema Gonzalez <redacted> Date: Fri, 2 May 2014 17:53:01 -0700
On Fri, May 2, 2014 at 2:49 PM, David Miller [off-list ref] wrote:quoted
We can probably add an extension to AF_PACKET which provides the flow key at the end of the tpacket3_hdr if a certain socket option is set. That would provide the transport header as well as a side effect, and be much more powerful and efficient than this particular BPF instruction.Once you get the L3 proto and noff/toff, you get everything. The rationale of adding toff/noff is that it's very similar to poff, which we already have.
But you're implementation is calling a function to do all of that work already, just to get only the transport header and then throwing away all of the other useful bits that function is calculating, so you'll end up doing it twice which is wasted work.