Subject: Re: [PATCH net v2] vti: fix spd lookup: match plaintext pkt, not ipsec pkt

From: Christophe Gouault <[email-masked]>
Date: Tue, 05 Nov 2013 18:24:58 +0100

Hello Eric,

On 11/05/2013 06:01 PM, Eric Dumazet wrote:
> On Tue, 2013-11-05 at 16:58 +0100, Christophe Gouault wrote:
>
>> diff --git a/net/ipv4/ip_vti.c b/net/ipv4/ip_vti.c
>> index 6e87f85..bcd85be 100644
>> --- a/net/ipv4/ip_vti.c
>> +++ b/net/ipv4/ip_vti.c
>> @@ -126,6 +126,7 @@ static int vti_rcv(struct sk_buff *skb)
>>   	if (tunnel != NULL) {
>>   		struct pcpu_tstats *tstats;
>>   		u32 oldmark = skb->mark;
>> +		u16 netoff = skb_network_header(skb) - skb->data;
> 		unsigned int nhoff = skb_network_offset(skb);
>
> There is no need to assume u16 here, even if the implementation
> currently has this assumption.
>
> You also could just use faster operation (no need to access
> skb->data/head)
>
> 	unsigned int old_nh = skb->network_header;
>
> ...
> at restore, use :
> 	skb->network_header = old_nh;
>
> instead of the more expensive skb_set_network_header()
OK, I was not sure if it was generally agreed to directly manipulate the 
skb->network_header. I will send a v3 tomorrow with your suggested 
optimization.

Best Regards,
Christophe