xfrm: Allow transport-mode states with AF_UNSPEC selector

[ Upstream commit c276a706ea ]

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: 13996378e6 ("[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>
This commit is contained in:
Herbert Xu 2023-02-21 13:54:00 +08:00 committed by Greg Kroah-Hartman
parent 7eaef76fbc
commit c436a17433
1 changed files with 0 additions and 5 deletions

View File

@ -2649,11 +2649,6 @@ int __xfrm_init_state(struct xfrm_state *x, bool init_replay, bool offload,
goto error; goto error;
} }
if (!(inner_mode->flags & XFRM_MODE_FLAG_TUNNEL)) {
NL_SET_ERR_MSG(extack, "Only tunnel modes can accommodate an AF_UNSPEC selector");
goto error;
}
x->inner_mode = *inner_mode; x->inner_mode = *inner_mode;
if (x->props.family == AF_INET) if (x->props.family == AF_INET)