linux-stable/net/xfrm
Benedict Wong b0355dbbf1 Fix XFRM-I support for nested ESP tunnels
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>
2023-01-09 07:11:05 +01:00
..
espintcp.c Treewide: Stop corrupting socket's task_frag 2022-12-19 17:28:49 -08:00
Kconfig xfrm/compat: Add 32=>64-bit messages translator 2020-09-24 08:53:03 +02:00
Makefile xfrm: interface: Add unstable helpers for setting/getting XFRM metadata from TC-BPF 2022-12-05 21:58:27 -08:00
xfrm_algo.c xfrm: Add support for SM4 symmetric cipher algorithm 2021-12-23 09:32:51 +01:00
xfrm_compat.c xfrm: rate limit SA mapping change message to user space 2021-12-23 09:32:51 +01:00
xfrm_device.c xfrm: Fix spelling mistake "oflload" -> "offload" 2022-12-09 09:09:40 +01:00
xfrm_hash.c
xfrm_hash.h xfrm: add state hashtable keyed by seq 2021-05-14 13:52:01 +02:00
xfrm_inout.h
xfrm_input.c xfrm: update x->lastused for every packet 2022-10-25 10:24:08 +02:00
xfrm_interface_bpf.c xfrm: interface: Add unstable helpers for setting/getting XFRM metadata from TC-BPF 2022-12-05 21:58:27 -08:00
xfrm_interface_core.c Fix XFRM-I support for nested ESP tunnels 2023-01-09 07:11:05 +01:00
xfrm_ipcomp.c Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net 2022-10-03 17:44:18 -07:00
xfrm_output.c xfrm: add TX datapath support for IPsec packet offload mode 2022-12-05 10:34:49 +01:00
xfrm_policy.c Fix XFRM-I support for nested ESP tunnels 2023-01-09 07:11:05 +01:00
xfrm_proc.c
xfrm_replay.c xfrm: replay: Fix ESN wrap around for GSO 2022-10-19 09:00:53 +02:00
xfrm_state.c Networking changes for 6.2. 2022-12-13 15:47:48 -08:00
xfrm_sysctl.c
xfrm_user.c xfrm: add an interface to offload policy 2022-12-05 10:33:13 +01:00