>> +     struct metadata_dst *tun_dst = NULL;
>> +     const struct iphdr *iph;
>> +     struct erspanhdr *ershdr;
>> +     __be32 index;
>> +     __be32 session_id;
>> +     int len;
>
> Please order local variables from longest to shortest line, ie. reverse
> christmas tree format.
>
thanks for the review, I will fix the ordering in next version.

>> +
>> +     itn = net_generic(net, erspan_net_id);
>> +     iph = ip_hdr(skb);
>> +     len =  iph->ihl * 4 + gre_hdr_len + sizeof(*ershdr);
>> +
>> +     if (unlikely(!pskb_may_pull(skb, len)))
>> +             return -ENOMEM;
>
> I think the len passed here is wrong, it should be
> "gre_hdr_len + sizeof(*ershdr)".

yes, thanks.
The skb->data at this point points to the beginning of GRE header. So
I should check pull of gre + erspan header.

Regards,
William

Reply via email to