linux/net/xfrm
Benedict Wong 503e3d93cf Fix XFRM-I support for nested ESP tunnels
[ Upstream commit b0355dbbf1 ]

This change adds support for nested IPsec tunnels by ensuring that
XFRM-I verifies existing policies before decapsulating a subsequent
policies. Addtionally, this clears the secpath entries after policies
are verified, ensuring that previous tunnels with no-longer-valid
do not pollute subsequent policy checks.

This is necessary especially for nested tunnels, as the IP addresses,
protocol and ports may all change, thus not matching the previous
policies. In order to ensure that packets match the relevant inbound
templates, the xfrm_policy_check should be done before handing off to
the inner XFRM protocol to decrypt and decapsulate.

Notably, raw ESP/AH packets did not perform policy checks inherently,
whereas all other encapsulated packets (UDP, TCP encapsulated) do policy
checks after calling xfrm_input handling in the respective encapsulation
layer.

Test: Verified with additional Android Kernel Unit tests
Signed-off-by: Benedict Wong <benedictwong@google.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2023-03-03 11:45:51 +01:00
..
espintcp.c net: Fix data-races around netdev_max_backlog. 2022-08-31 17:16:42 +02:00
Kconfig
Makefile
xfrm_algo.c
xfrm_compat.c xfrm/compat: prevent potential spectre v1 gadget in xfrm_xlate32_attr() 2023-02-14 19:17:58 +01:00
xfrm_device.c xfrm: replay: Fix ESN wrap around for GSO 2022-12-02 17:41:02 +01:00
xfrm_hash.c
xfrm_hash.h
xfrm_inout.h
xfrm_input.c xfrm: fix bug with DSCP copy to v6 from v4 tunnel 2023-02-14 19:17:58 +01:00
xfrm_interface.c Fix XFRM-I support for nested ESP tunnels 2023-03-03 11:45:51 +01:00
xfrm_ipcomp.c xfrm: Update ipcomp_scratches with NULL when freed 2022-10-26 12:35:34 +02:00
xfrm_output.c net/xfrm: IPsec tunnel mode fix inner_ipproto setting in sec_path 2022-01-27 11:03:49 +01:00
xfrm_policy.c Fix XFRM-I support for nested ESP tunnels 2023-03-03 11:45:51 +01:00
xfrm_proc.c
xfrm_replay.c xfrm: replay: Fix ESN wrap around for GSO 2022-12-02 17:41:02 +01:00
xfrm_state.c xfrm: clone missing x->lastused in xfrm_do_migrate 2022-08-31 17:16:36 +02:00
xfrm_sysctl.c
xfrm_user.c xfrm: rework default policy structure 2022-05-25 09:57:30 +02:00