Commit d80fc101 authored by Xin Long's avatar Xin Long Committed by David S. Miller

erspan: get the proto with the md version for collect_md

In commit 20704bd1 ("erspan: build the header with the right proto
according to erspan_ver"), it gets the proto with t->parms.erspan_ver,
but t->parms.erspan_ver is not used by collect_md branch, and instead
it should get the proto with md->version for collect_md.

Thanks to Kevin for pointing this out.

Fixes: 20704bd1 ("erspan: build the header with the right proto according to erspan_ver")
Fixes: 94d7d8f2 ("ip6_gre: add erspan v2 support")
Reported-by: default avatarKevin Traynor <ktraynor@redhat.com>
Signed-off-by: default avatarXin Long <lucien.xin@gmail.com>
Reviewed-by: default avatarSimon Horman <simon.horman@corigine.com>
Reviewed-by: default avatarWilliam Tu <u9012063@gmail.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 1e306ec4
...@@ -1015,12 +1015,14 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, ...@@ -1015,12 +1015,14 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
ntohl(tun_id), ntohl(tun_id),
ntohl(md->u.index), truncate, ntohl(md->u.index), truncate,
false); false);
proto = htons(ETH_P_ERSPAN);
} else if (md->version == 2) { } else if (md->version == 2) {
erspan_build_header_v2(skb, erspan_build_header_v2(skb,
ntohl(tun_id), ntohl(tun_id),
md->u.md2.dir, md->u.md2.dir,
get_hwid(&md->u.md2), get_hwid(&md->u.md2),
truncate, false); truncate, false);
proto = htons(ETH_P_ERSPAN2);
} else { } else {
goto tx_err; goto tx_err;
} }
...@@ -1043,24 +1045,25 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb, ...@@ -1043,24 +1045,25 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
break; break;
} }
if (t->parms.erspan_ver == 1) if (t->parms.erspan_ver == 1) {
erspan_build_header(skb, ntohl(t->parms.o_key), erspan_build_header(skb, ntohl(t->parms.o_key),
t->parms.index, t->parms.index,
truncate, false); truncate, false);
else if (t->parms.erspan_ver == 2) proto = htons(ETH_P_ERSPAN);
} else if (t->parms.erspan_ver == 2) {
erspan_build_header_v2(skb, ntohl(t->parms.o_key), erspan_build_header_v2(skb, ntohl(t->parms.o_key),
t->parms.dir, t->parms.dir,
t->parms.hwid, t->parms.hwid,
truncate, false); truncate, false);
else proto = htons(ETH_P_ERSPAN2);
} else {
goto tx_err; goto tx_err;
}
fl6.daddr = t->parms.raddr; fl6.daddr = t->parms.raddr;
} }
/* Push GRE header. */ /* Push GRE header. */
proto = (t->parms.erspan_ver == 1) ? htons(ETH_P_ERSPAN)
: htons(ETH_P_ERSPAN2);
gre_build_header(skb, 8, TUNNEL_SEQ, proto, 0, htonl(atomic_fetch_inc(&t->o_seqno))); gre_build_header(skb, 8, TUNNEL_SEQ, proto, 0, htonl(atomic_fetch_inc(&t->o_seqno)));
/* TooBig packet may have updated dst->dev's mtu */ /* TooBig packet may have updated dst->dev's mtu */
......
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