[LTP] [PATCH] xfrm: Skip on EOPNOTSUPP in compat mode

Martin Doucha mdoucha@suse.cz
Thu Jun 11 14:55:20 CEST 2026


Hi,
I would change the TCONF message a bit to something like "xfrm compat 
mode is not available". The compat module may be available but it 
doesn't load automatically. We could try loading it in setup() but then 
we'd either need to check insmod() result or add .needs_root. But since 
the bug is not compat-specific, this patch is good enough.

Reviewed-by: Martin Doucha <mdoucha@suse.cz>

On 6/11/26 11:37, Andrea Cervesato wrote:
> From: Andrea Cervesato <andrea.cervesato@suse.com>
> 
> A 32-bit binary running on a 64-bit kernel uses the XFRM netlink compat
> layer, which is only available when CONFIG_XFRM_USER_COMPAT is enabled
> (and its module loaded). Without it the kernel returns EOPNOTSUPP for
> any XFRM netlink message, which is a configuration limitation rather
> than a test failure.
> 
> Report TCONF instead of TBROK in that case for xfrm01, xfrm02 and
> xfrm03.
> 
> Signed-off-by: Andrea Cervesato <andrea.cervesato@suse.com>
> ---
>   testcases/network/sockets/xfrm01.c | 3 +++
>   testcases/network/sockets/xfrm02.c | 3 +++
>   testcases/network/sockets/xfrm03.c | 3 +++
>   3 files changed, 9 insertions(+)
> 
> diff --git a/testcases/network/sockets/xfrm01.c b/testcases/network/sockets/xfrm01.c
> index 5490d6b8a9f7fde79478ae0484e6ea8156d07cf3..22244032a521a42331b0c1411ae33f75622e64ce 100644
> --- a/testcases/network/sockets/xfrm01.c
> +++ b/testcases/network/sockets/xfrm01.c
> @@ -126,6 +126,9 @@ static void setup(void)
>   		if (TST_ERR == EPROTONOSUPPORT)
>   			tst_brk(TCONF, "xfrm ESP is not supported by kernel");
>   
> +		if (tst_is_compat_mode() && TST_ERR == EOPNOTSUPP)
> +			tst_brk(TCONF, "xfrm netlink unsupported in compat mode (missing CONFIG_XFRM_USER_COMPAT)");
> +
>   		tst_brk(TBROK | TTERRNO, "Failed to install xfrm ESP state");
>   	}
>   }
> diff --git a/testcases/network/sockets/xfrm02.c b/testcases/network/sockets/xfrm02.c
> index 43edb77d43c8c99e9883fc9922031d559ef31c40..376f6ebe551dd81fbc6a982503eacd68da636f93 100644
> --- a/testcases/network/sockets/xfrm02.c
> +++ b/testcases/network/sockets/xfrm02.c
> @@ -126,6 +126,9 @@ static void setup(void)
>   		if (TST_ERR == EPROTONOSUPPORT)
>   			tst_brk(TCONF, "xfrm ESP is not supported by kernel");
>   
> +		if (tst_is_compat_mode() && TST_ERR == EOPNOTSUPP)
> +			tst_brk(TCONF, "xfrm netlink unsupported in compat mode (missing CONFIG_XFRM_USER_COMPAT)");
> +
>   		tst_brk(TBROK | TTERRNO, "Failed to install xfrm ESP state");
>   	}
>   
> diff --git a/testcases/network/sockets/xfrm03.c b/testcases/network/sockets/xfrm03.c
> index 02ab95c6b7a87f8f206b30a39bb6feb097117998..fa5df9c285d540d5cad0e890a73d43ad9aeba1c2 100644
> --- a/testcases/network/sockets/xfrm03.c
> +++ b/testcases/network/sockets/xfrm03.c
> @@ -202,6 +202,9 @@ static void setup(void)
>   		if (TST_ERR == EPROTONOSUPPORT)
>   			tst_brk(TCONF, "xfrm ESP is not supported by kernel");
>   
> +		if (tst_is_compat_mode() && TST_ERR == EOPNOTSUPP)
> +			tst_brk(TCONF, "xfrm netlink unsupported in compat mode (missing CONFIG_XFRM_USER_COMPAT)");
> +
>   		tst_brk(TBROK | TTERRNO, "Failed to install xfrm ESP state");
>   	}
>   
> 
> ---
> base-commit: c685f1b774fab694c42dfb7522bc42d999904373
> change-id: 20260611-fix_xfrm_compat_mode-0503f1f9bb8d
> 
> Best regards,


-- 
Martin Doucha   mdoucha@suse.cz
SW Quality Engineer
SUSE LINUX, s.r.o.
CORSO IIa
Krizikova 148/34
186 00 Prague 8
Czech Republic


More information about the ltp mailing list