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

Sven Eckelmann
2016-02-26T16:00:49Z

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

On Friday 26 February 2016 14:18:17 Andreas Pape wrote:
> Speeding up dat address lookup is achieved by snooping all incoming ip
> traffic. This especially increases the propability in bla setups that
> a gateway into a common backbone network already has a fitting dat entry
> to answer incoming ARP requests directly coming from the backbone
> network thus further reducing ARP traffic in the mesh.
>
> Signed-off-by: Andreas Pape <apape@phoenixcontact.com>
> ---
[...]
> switch (ntohs(ethhdr->h_proto)) {
> + case ETH_P_IP:
> + iphdr = (struct iphdr *)(skb->data + ETH_HLEN);
> + /* snoop incoming traffic for dat update using the source mac
> + * and source ip to speed up dat.
> + */
> + batadv_dat_entry_check(bat_priv, iphdr->saddr,
> + ethhdr->h_source, vid);
> + break;
> case ETH_P_8021Q:
> vhdr = (struct vlan_ethhdr *)skb->data;
>
> - if (vhdr->h_vlan_encapsulated_proto != ethertype)
> + if (vhdr->h_vlan_encapsulated_proto != ethertype) {
> + /* snoop incoming traffic for dat update also for vlan
> + * tagged frames.
> + */
> + if (vhdr->h_vlan_encapsulated_proto == ETH_P_IP) {
> + iphdr = (struct iphdr *)(vhdr +
> + sizeof(struct vlan_ethhdr));
> + batadv_dat_entry_check(bat_priv, iphdr->saddr,
> + vhdr->h_source, vid);
> + }

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