Re: [B.A.T.M.A.N.] Antwort: Re: [PATCHv2 2/7] batman-adv: speed up dat by snooping received ip traffic

Sven Eckelmann
2016-03-01T16:02:57Z

[-- Attachment #1: Type: text/plain, Size: 1034 bytes --]

On Tuesday 01 March 2016 16:52:47 Andreas Pape wrote:
[...]
> > Where is the code to check that there is enough data for the iphdr
> > (pskb_may_pull)? Same question goes to Marek for his initial change in
> > 48628bb9419f ("batman-adv: softif bridge loop avoidance") that
> introduced the
> > vhdr->vlan_ethhdr check
> >
>
> I will leave this to the result of the discussion in [1] which you started
> and will not handle this in the next version of my patchset. Correct?

You definitely have to check the size for the IP header. The vlan ethernet
header check is a different playground and mostly unrelated to your problem.

Btw. you can skip this check when you just use skb_header_pointer to access
the IPv4 header. It will return NULL when the data cannot be accessed. It
will also take care of copying data out of the fragments in your temporary
"buffer" when the bytes are not in the main buffer of the skb. You just have
to prepare a large enough buffer on the stack and only use the returned
pointer.