Skip to content

Commit d80fc10

Browse files
lxindavem330
authored andcommitted
erspan: get the proto with the md version for collect_md
In commit 20704bd ("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: 20704bd ("erspan: build the header with the right proto according to erspan_ver") Fixes: 94d7d8f ("ip6_gre: add erspan v2 support") Reported-by: Kevin Traynor <[email protected]> Signed-off-by: Xin Long <[email protected]> Reviewed-by: Simon Horman <[email protected]> Reviewed-by: William Tu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 1e306ec commit d80fc10

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

net/ipv6/ip6_gre.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1015,12 +1015,14 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
10151015
ntohl(tun_id),
10161016
ntohl(md->u.index), truncate,
10171017
false);
1018+
proto = htons(ETH_P_ERSPAN);
10181019
} else if (md->version == 2) {
10191020
erspan_build_header_v2(skb,
10201021
ntohl(tun_id),
10211022
md->u.md2.dir,
10221023
get_hwid(&md->u.md2),
10231024
truncate, false);
1025+
proto = htons(ETH_P_ERSPAN2);
10241026
} else {
10251027
goto tx_err;
10261028
}
@@ -1043,24 +1045,25 @@ static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
10431045
break;
10441046
}
10451047

1046-
if (t->parms.erspan_ver == 1)
1048+
if (t->parms.erspan_ver == 1) {
10471049
erspan_build_header(skb, ntohl(t->parms.o_key),
10481050
t->parms.index,
10491051
truncate, false);
1050-
else if (t->parms.erspan_ver == 2)
1052+
proto = htons(ETH_P_ERSPAN);
1053+
} else if (t->parms.erspan_ver == 2) {
10511054
erspan_build_header_v2(skb, ntohl(t->parms.o_key),
10521055
t->parms.dir,
10531056
t->parms.hwid,
10541057
truncate, false);
1055-
else
1058+
proto = htons(ETH_P_ERSPAN2);
1059+
} else {
10561060
goto tx_err;
1061+
}
10571062

10581063
fl6.daddr = t->parms.raddr;
10591064
}
10601065

10611066
/* Push GRE header. */
1062-
proto = (t->parms.erspan_ver == 1) ? htons(ETH_P_ERSPAN)
1063-
: htons(ETH_P_ERSPAN2);
10641067
gre_build_header(skb, 8, TUNNEL_SEQ, proto, 0, htonl(atomic_fetch_inc(&t->o_seqno)));
10651068

10661069
/* TooBig packet may have updated dst->dev's mtu */

0 commit comments

Comments
 (0)