Subject: Re: [PATCH] xfrm: Remove inner/outer modes from input path

From: Steffen Klassert <[email-masked]>
Date: Tue, 6 Jun 2023 12:45:29 +0200

Hi Herbert,

On Fri, Mar 10, 2023 at 05:26:05PM +0800, Herbert Xu wrote:
...
> @@ -369,17 +366,12 @@ static int xfrm_prepare_input(struct xfrm_state *x, struct sk_buff *skb)
>  		return -EAFNOSUPPORT;
>  	}
>  
> -	if (x->sel.family == AF_UNSPEC) {
> -		inner_mode = xfrm_ip2inner_mode(x, XFRM_MODE_SKB_CB(skb)->protocol);
> -		if (!inner_mode)
> -			return -EAFNOSUPPORT;
> -	}
> -
> -	switch (inner_mode->family) {
> -	case AF_INET:
> +	switch (XFRM_MODE_SKB_CB(skb)->protocol) {
> +	case IPPROTO_IPIP:
> +	case IPPROTO_BEETPH:

the assumption that the L4 protocol on BEET mode can be
just IPIP or BEETPH seems not to be correct. One of
our testcaces hit the second WARN_ON_ONCE() in
xfrm_prepare_input. In that case the L4 protocol
is UDP. Looks like we need some other way to
dertermine the inner protocol family.