[PATCH] xfrm: Skip on EOPNOTSUPP in compat mode

Andrea Cervesato <[email protected]>
Newsgroups gmane.linux.ltp
Message-ID <[email protected]>
From: Andrea Cervesato <andrea.cervesato-IBi9RG/[email protected]>

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-IBi9RG/[email protected]>
---
 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,
-- 
Andrea Cervesato <andrea.cervesato-IBi9RG/[email protected]>


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.