[ovs-dev] [PATCH 2/2] datapath: Ignore key in ip_tunnel_lookup

Gregory Rose gvrose8192 at gmail.com
Fri Jun 29 02:56:14 UTC 2018


On 6/28/2018 5:03 PM, William Tu wrote:
> On Thu, Jun 28, 2018 at 4:01 PM, Greg Rose <gvrose8192 at gmail.com> wrote:
>> The key value is always zero in ip_tunnel_lookup() for all OVS
>> tunnels but in received packets it is set.  Just ignore it for
>> the ip_tunnel_lookup() in the same manner as erspan_rcv().
>>
>> Fixes: 8e53509c ("gre: introduce native tunnel support for ERSPAN")
>> Signed-off-by: Greg Rose <gvrose8192 at gmail.com>
>> ---
>>   datapath/linux/compat/ip_gre.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c
>> index df0217e..5670bdf 100644
>> --- a/datapath/linux/compat/ip_gre.c
>> +++ b/datapath/linux/compat/ip_gre.c
>> @@ -272,7 +272,7 @@ static int __ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
>>
>>          iph = ip_hdr(skb);
>>          tunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, tpi->flags,
>> -                                 iph->saddr, iph->daddr, tpi->key);
>> +                                 iph->saddr, iph->daddr, 0);
>>
>>          if (tunnel) {
>>                  if (__iptunnel_pull_header(skb, hdr_len, tpi->proto,
>> --
>> 1.8.3.1
>>
> looking at the rpl_ip_tunnel_lookup, how come we did not return the
> collect_md_tun?
>
> skip_key_lookup:
>          if (cand)
>                  return cand;
>
> +        t = rcu_dereference(itn->collect_md_tun);
> +        if (t && t->dev->flags & IFF_UP)
>                  return t;

Good catch!!!  That was added in the 4.3 timeframe and I just missed it 
during the backport.  That explains
a lot.

So that means I can also put back the key for the lookup in erspan_rcv() 
as well.  Good work!

I'll spin up V2 of the series.

Thanks,

- Greg

>
>          if (itn->fb_tunnel_dev && itn->fb_tunnel_dev->flags & IFF_UP)
>
> ---
> OVS is using the collect_md mode tunnel device.
> The lookup can have key, and since there is no other gre tunnel device
> has this key, it will in the end return the collect_md_tun device, which
> is the "gre_sys"
>
> Can you try adding the code above?
>
> Thanks
> William



More information about the dev mailing list