[ovs-dev,ERSPAN,RFC,23/25] erspan: fix erspan config overwrite

Message ID 1521756461-3870-24-git-send-email-gvrose8192@gmail.com
State RFC
Headers show
Series
  • Introduce ERSPAN for OVS
Related show

Commit Message

Gregory Rose March 22, 2018, 10:07 p.m.
From: William Tu <u9012063@gmail.com>

Upsteam commit:
    commit 39f57f6799cdd437277122d4cd1c470c08f527c0
    Author: William Tu <u9012063@gmail.com>
    Date:   Mon Feb 5 13:35:35 2018 -0800

    net: erspan: fix erspan config overwrite

    When an erspan tunnel device receives an erpsan packet with different
    tunnel metadata (ex: version, index, hwid, direction), existing code
    overwrites the tunnel device's erspan configuration with the received
    packet's metadata.  The patch fixes it.

    Fixes: 1a66a836da63 ("gre: add collect_md mode to ERSPAN tunnel")
    Fixes: f551c91de262 ("net: erspan: introduce erspan v2 for ip_gre")
    Fixes: ef7baf5e083c ("ip6_gre: add ip6 erspan collect_md mode")
    Fixes: 94d7d8f29287 ("ip6_gre: add erspan v2 support")
    Signed-off-by: William Tu <u9012063@gmail.com>
    Signed-off-by: David S. Miller <davem@davemloft.net>

This is just the ip_gre portion of the commit.  The ip6_gre part
of the commit was folded in during the prior commit to introduce
ip6 gre and ip6 tunneling.

Cc: William Tu <u9012063@gmail.com>
Signed-off-by: Greg Rose <gvrose8192@gmail.com>
---
 datapath/linux/compat/ip_gre.c | 14 --------------
 1 file changed, 14 deletions(-)

Patch

diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c
index 5ebbdb5..08d3351 100644
--- a/datapath/linux/compat/ip_gre.c
+++ b/datapath/linux/compat/ip_gre.c
@@ -178,20 +178,6 @@  static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
 			info = &tun_dst->u.tun_info;
 			info->key.tun_flags |= TUNNEL_ERSPAN_OPT;
 			info->options_len = sizeof(*md);
-		} else {
-			tunnel->erspan_ver = ver;
-			if (ver == 1) {
-				tunnel->index = ntohl(pkt_md->u.index);
-			} else {
-				u16 md2_flags;
-				u16 dir, hwid;
-
-				md2_flags = ntohs(pkt_md->u.md2.flags);
-				dir = (md2_flags & DIR_MASK) >> DIR_OFFSET;
-				hwid = (md2_flags & HWID_MASK) >> HWID_OFFSET;
-				tunnel->dir = dir;
-				tunnel->hwid = hwid;
-			}
 		}
 
 		skb_reset_mac_header(skb);