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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 27 Jan 2022 10:05:14 +0000 (11:05 +0100)
commit491c3ae9fbb6eecdc880aef608d35f28fc7481d3
treead48b603a8849c2868ba665cc92d4e7b235f1f73
parent9473abe5b5bff6c34e8cda352c4b5ce6a7bc82aa
xfrm: fix policy lookup for ipv6 gre packets

commit bcf141b2eb551b3477b24997ebc09c65f117a803 upstream.

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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
net/ipv6/ip6_gre.c
net/xfrm/xfrm_policy.c