From: Greg Rose Date: Fri, 29 Jun 2018 03:31:26 +0000 (-0700) Subject: datapath: Add missing code in ip_tunnel_lookup() X-Git-Url: https://git.proxmox.com/?a=commitdiff_plain;h=6690de401904217e9c824197b0aa84d68d2c363a;p=ovs.git datapath: Add missing code in ip_tunnel_lookup() The compat rpl_ip_tunnel_lookup() function was missing some code added in Linux kernel release 4.3 but not backported in the initial commit. This also allows us to remove an old hack in erspan_rcv() that was zeroing out the key parameter so that the tunnel lookups wouldn't fail. Fixes: 8e53509c ("gre: introduce native tunnel support for ERSPAN") Reported-by: William Tu Signed-off-by: Greg Rose Acked-by: William Tu Signed-off-by: Justin Pettit --- diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c index df0217e3b..92de70127 100644 --- a/datapath/linux/compat/ip_gre.c +++ b/datapath/linux/compat/ip_gre.c @@ -208,10 +208,9 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, * Use ERSPAN 10-bit session ID as key. */ tpi->key = cpu_to_be32(get_session_id(ershdr)); - /* OVS doesn't set tunnel key - so don't bother with it */ tunnel = ip_tunnel_lookup(itn, skb->dev->ifindex, tpi->flags, - iph->saddr, iph->daddr, 0); + iph->saddr, iph->daddr, tpi->key); if (tunnel) { len = gre_hdr_len + erspan_hdr_len(ver); diff --git a/datapath/linux/compat/ip_tunnel.c b/datapath/linux/compat/ip_tunnel.c index 5ab6035ed..54af1f178 100644 --- a/datapath/linux/compat/ip_tunnel.c +++ b/datapath/linux/compat/ip_tunnel.c @@ -749,6 +749,10 @@ skip_key_lookup: if (cand) return cand; + t = rcu_dereference(itn->collect_md_tun); + if (t) + return t; + if (itn->fb_tunnel_dev && itn->fb_tunnel_dev->flags & IFF_UP) return netdev_priv(itn->fb_tunnel_dev);