xfrm: fix policy lookup for ipv6 gre packets
authorGhalem Boudour <ghalem.boudour@6wind.com>
Fri, 19 Nov 2021 17:20:16 +0000 (18:20 +0100)
committerSteffen Klassert <steffen.klassert@secunet.com>
Tue, 23 Nov 2021 09:12:21 +0000 (10:12 +0100)
commitbcf141b2eb551b3477b24997ebc09c65f117a803
treeb4f482db1463cfdd01d9e66b9ba0a489bf95d95f
parent03a000bfd7193cacefb40e309283578c6ae207b5
xfrm: fix policy lookup for ipv6 gre packets

On egress side, xfrm lookup is called from __gre6_xmit() with the
fl6_gre_key field not initialized leading to policies selectors check
failure. Consequently, gre packets are sent without encryption.

On ingress side, INET6_PROTO_NOPOLICY was set, thus packets were not
checked against xfrm policies. Like for egress side, fl6_gre_key should be
correctly set, this is now done in decode_session6().

Fixes: c12b395a4664 ("gre: Support GRE over IPv6")
Cc: stable@vger.kernel.org
Signed-off-by: Ghalem Boudour <ghalem.boudour@6wind.com>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/ipv6/ip6_gre.c
net/xfrm/xfrm_policy.c