xfrm: Use xfrm_state selector for BEET input

commit 842665a900 upstream.

For BEET the inner address and therefore family is stored in the
xfrm_state selector.  Use that when decapsulating an input packet
instead of incorrectly relying on a non-existent tunnel protocol.

Fixes: 5f24f41e8e ("xfrm: Remove inner/outer modes from input path")
Reported-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
Herbert Xu 2023-06-07 16:38:47 +08:00 committed by Greg Kroah-Hartman
parent 1e4432d463
commit cf3c891686
1 changed files with 3 additions and 4 deletions

View File

@ -331,11 +331,10 @@ xfrm_inner_mode_encap_remove(struct xfrm_state *x,
{
switch (x->props.mode) {
case XFRM_MODE_BEET:
switch (XFRM_MODE_SKB_CB(skb)->protocol) {
case IPPROTO_IPIP:
case IPPROTO_BEETPH:
switch (x->sel.family) {
case AF_INET:
return xfrm4_remove_beet_encap(x, skb);
case IPPROTO_IPV6:
case AF_INET6:
return xfrm6_remove_beet_encap(x, skb);
}
break;