]> git.baikalelectronics.ru Git - kernel.git/commitdiff
xfrm: Allow transport-mode states with AF_UNSPEC selector
authorHerbert Xu <herbert@gondor.apana.org.au>
Tue, 21 Feb 2023 05:54:00 +0000 (13:54 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 22 Mar 2023 12:28:03 +0000 (13:28 +0100)
[ Upstream commit c276a706ea1f51cf9723ed8484feceaf961b8f89 ]

xfrm state selectors are matched against the inner-most flow
which can be of any address family.  Therefore middle states
in nested configurations need to carry a wildcard selector in
order to work at all.

However, this is currently forbidden for transport-mode states.

Fix this by removing the unnecessary check.

Fixes: 4701323acddc ("[IPSEC]: Rename mode to outer_mode and add inner_mode")
Reported-by: David George <David.George@sophos.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/xfrm/xfrm_state.c

index bee1a8143d75fb41d97695a5d8276bca14f230f3..e8be18bff09603f8b77949c62b83e6e04e1a6906 100644 (file)
@@ -2511,9 +2511,6 @@ int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload)
                if (inner_mode == NULL)
                        goto error;
 
-               if (!(inner_mode->flags & XFRM_MODE_FLAG_TUNNEL))
-                       goto error;
-
                x->inner_mode = *inner_mode;
 
                if (x->props.family == AF_INET)