net: erspan: fix erspan config overwrite
authorWilliam Tu <u9012063@gmail.com>
Mon, 5 Feb 2018 21:35:35 +0000 (13:35 -0800)
committerDavid S. Miller <davem@davemloft.net>
Tue, 6 Feb 2018 16:32:49 +0000 (11:32 -0500)
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>
net/ipv4/ip_gre.c
net/ipv6/ip6_gre.c

index 9b50eddd18823e705274c2d1021a4f74977c4313..45d97e9b2759dc7430f56cd4e563eab5bf7d3e44 100644 (file)
@@ -322,15 +322,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 {
-                               tunnel->dir = pkt_md->u.md2.dir;
-                               tunnel->hwid = get_hwid(&pkt_md->u.md2);
-                       }
-
                }
 
                skb_reset_mac_header(skb);
index 50913dbd0612e985164b0017de2ddbfa45697dfe..3c353125546d8701febaad95f81bdaa675cd5d7d 100644 (file)
@@ -562,15 +562,6 @@ static int ip6erspan_rcv(struct sk_buff *skb, int gre_hdr_len,
                        ip6_tnl_rcv(tunnel, skb, tpi, tun_dst, log_ecn_error);
 
                } else {
-                       tunnel->parms.erspan_ver = ver;
-
-                       if (ver == 1) {
-                               tunnel->parms.index = ntohl(pkt_md->u.index);
-                       } else {
-                               tunnel->parms.dir = pkt_md->u.md2.dir;
-                               tunnel->parms.hwid = get_hwid(&pkt_md->u.md2);
-                       }
-
                        ip6_tnl_rcv(tunnel, skb, tpi, NULL, log_ecn_error);
                }