xfrm: Check if_id in inbound policy/secpath match
authorBenedict Wong <benedictwong@google.com>
Wed, 10 May 2023 01:14:14 +0000 (01:14 +0000)
committerSteffen Klassert <steffen.klassert@secunet.com>
Wed, 10 May 2023 05:56:05 +0000 (07:56 +0200)
commit8680407b6f8f5fba59e8f1d63c869abc280f04df
tree348112beaab4cedb426f37f881971c848c8016e5
parentcf3128a7aca55b2eefb68281d44749c683bdc96f
xfrm: Check if_id in inbound policy/secpath match

This change ensures that if configured in the policy, the if_id set in
the policy and secpath states match during the inbound policy check.
Without this, there is potential for ambiguity where entries in the
secpath differing by only the if_id could be mismatched.

Notably, this is checked in the outbound direction when resolving
templates to SAs, but not on the inbound path when matching SAs and
policies.

Test: Tested against Android kernel unit tests & CTS
Signed-off-by: Benedict Wong <benedictwong@google.com>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
net/xfrm/xfrm_policy.c