[PATCH bpf-next 09/15] selftests/bpf: Use start_server_str in crypto_sanity

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Geliang Tang <tanggeliang@xxxxxxxxxx>

This patch uses start_server_str() to start a AF_ALG server in test
crypto_sanity, since no listen is needed in this test, nolisten flag
of network_helper_opts is set.

Signed-off-by: Geliang Tang <tanggeliang@xxxxxxxxxx>
---
 .../testing/selftests/bpf/prog_tests/crypto_sanity.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/tools/testing/selftests/bpf/prog_tests/crypto_sanity.c b/tools/testing/selftests/bpf/prog_tests/crypto_sanity.c
index b1a3a49a822a..9b7a26c79123 100644
--- a/tools/testing/selftests/bpf/prog_tests/crypto_sanity.c
+++ b/tools/testing/selftests/bpf/prog_tests/crypto_sanity.c
@@ -20,16 +20,12 @@ static int opfd = -1, tfmfd = -1;
 static const char algo[] = "ecb(aes)";
 static int init_afalg(void)
 {
-	struct sockaddr_alg sa = {
-		.salg_family = AF_ALG,
-		.salg_type = "skcipher",
-		.salg_name = "ecb(aes)"
+	struct network_helper_opts opts = {
+		.nolisten = true,
 	};
 
-	tfmfd = socket(AF_ALG, SOCK_SEQPACKET, 0);
-	if (tfmfd == -1)
-		return errno;
-	if (bind(tfmfd, (struct sockaddr *)&sa, sizeof(sa)) == -1)
+	tfmfd = start_server_str(AF_ALG, SOCK_SEQPACKET, "skcipher ecb(aes)", 0, &opts);
+	if (!ASSERT_OK_FD(tfmfd, "start_server_addr"))
 		return errno;
 	if (setsockopt(tfmfd, SOL_ALG, ALG_SET_KEY, crypto_key, 16) == -1)
 		return errno;
-- 
2.43.0





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux