]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
xfrm: Treat already-verified secpath entries as optional
authorBenedict Wong <benedictwong@google.com>
Wed, 10 May 2023 01:30:21 +0000 (01:30 +0000)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 28 Jun 2023 09:14:11 +0000 (11:14 +0200)
commit74dcf228bba43aaa2ff6fcdaed69edd4b4829883
treedf992ae5aadbbcf4df6518927f85cd4e5ce718f6
parente43c93ede27ad9c13653315092943d271a487573
xfrm: Treat already-verified secpath entries as optional

[ Upstream commit 1f8b6df6a997a430b0c48b504638154b520781ad ]

This change allows inbound traffic through nested IPsec tunnels to
successfully match policies and templates, while retaining the secpath
stack trace as necessary for netfilter policies.

Specifically, this patch marks secpath entries that have already matched
against a relevant policy as having been verified, allowing it to be
treated as optional and skipped after a tunnel decapsulation (during
which the src/dst/proto/etc may have changed, and the correct policy
chain no long be resolvable).

This approach is taken as opposed to the iteration in b0355dbbf13c,
where the secpath was cleared, since that breaks subsequent validations
that rely on the existence of the secpath entries (netfilter policies, or
transport-in-tunnel mode, where policies remain resolvable).

Fixes: b0355dbbf13c ("Fix XFRM-I support for nested ESP tunnels")
Test: Tested against Android Kernel Unit Tests
Test: Tested against Android CTS
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>
include/net/xfrm.h
net/xfrm/xfrm_input.c
net/xfrm/xfrm_policy.c