[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 Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux