Re: [B.A.T.M.A.N.] [PATCHv4 4/7] batman-adv: Distributed ARP Table - add ARP parsing functions

Andrew Lunn
2011-11-25T08:31:25Z

> +/* Returns arphdr->ar_op if the skb contains a valid ARP packet, otherwise
> + * returns 0 */
> +static uint16_t arp_get_type(struct bat_priv *bat_priv, struct sk_buff *skb)
> +{
> + struct arphdr *arphdr;
> + struct ethhdr *ethhdr;
> + uint16_t type = 0;
> +
> + if (unlikely(!pskb_may_pull(skb, ETH_HLEN)))
> + goto out;
> +
> + ethhdr = (struct ethhdr *)skb_mac_header(skb);
> +
> + if (ethhdr->h_proto != htons(ETH_P_ARP))
> + goto out;

Do we have any idea how many people run vlans over B.A.T.M.A.N? It
would not be too hard to skip over the VLAN tag if there is one to see
if it is an ARP message inside.

Andrew