summaryrefslogtreecommitdiffstats
path: root/net/xfrm/xfrm_input.c
diff options
context:
space:
mode:
authorBenedict Wong <benedictwong@google.com>2023-05-10 03:30:21 +0200
committerSteffen Klassert <steffen.klassert@secunet.com>2023-05-21 09:21:37 +0200
commit1f8b6df6a997a430b0c48b504638154b520781ad (patch)
treee74b3e927438f0e59ad49d7e8bb40c18b92f0af9 /net/xfrm/xfrm_input.c
parentMerge tag 'for-net-2023-05-19' of git://git.kernel.org/pub/scm/linux/kernel/g... (diff)
downloadlinux-1f8b6df6a997a430b0c48b504638154b520781ad.tar.xz
linux-1f8b6df6a997a430b0c48b504638154b520781ad.zip
xfrm: Treat already-verified secpath entries as optional
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>
Diffstat (limited to 'net/xfrm/xfrm_input.c')
-rw-r--r--net/xfrm/xfrm_input.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/xfrm/xfrm_input.c b/net/xfrm/xfrm_input.c
index 39fb91ff23d9..b731687b5f3e 100644
--- a/net/xfrm/xfrm_input.c
+++ b/net/xfrm/xfrm_input.c
@@ -131,6 +131,7 @@ struct sec_path *secpath_set(struct sk_buff *skb)
memset(sp->ovec, 0, sizeof(sp->ovec));
sp->olen = 0;
sp->len = 0;
+ sp->verified_cnt = 0;
return sp;
}