Commit 39f57f67 authored by William Tu's avatar William Tu Committed by David S. Miller

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: 1a66a836 ("gre: add collect_md mode to ERSPAN tunnel")
Fixes: f551c91d ("net: erspan: introduce erspan v2 for ip_gre")
Fixes: ef7baf5e ("ip6_gre: add ip6 erspan collect_md mode")
Fixes: 94d7d8f2 ("ip6_gre: add erspan v2 support")
Signed-off-by: default avatarWilliam Tu <u9012063@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 3df19283
...@@ -322,15 +322,6 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi, ...@@ -322,15 +322,6 @@ static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
info = &tun_dst->u.tun_info; info = &tun_dst->u.tun_info;
info->key.tun_flags |= TUNNEL_ERSPAN_OPT; info->key.tun_flags |= TUNNEL_ERSPAN_OPT;
info->options_len = sizeof(*md); 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); skb_reset_mac_header(skb);
......
...@@ -562,15 +562,6 @@ static int ip6erspan_rcv(struct sk_buff *skb, int gre_hdr_len, ...@@ -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); ip6_tnl_rcv(tunnel, skb, tpi, tun_dst, log_ecn_error);
} else { } 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); ip6_tnl_rcv(tunnel, skb, tpi, NULL, log_ecn_error);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment