[ovs-dev] [PATCH V2 2/2] datapath: Add missing code in ip_tunnel_lookup()

Greg Rose gvrose8192 at gmail.com
Fri Jun 29 03:31:26 UTC 2018


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 <u9012063 at gmail.com>
Signed-off-by: Greg Rose <gvrose8192 at gmail.com>

---

V2 - Address the missing code problem brought up by William in
     review of the initial patch
---
 datapath/linux/compat/ip_gre.c    | 3 +--
 datapath/linux/compat/ip_tunnel.c | 4 ++++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c
index df0217e..92de701 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 5ab6035..54af1f1 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);
 
-- 
1.8.3.1



More information about the dev mailing list