From patchwork Tue Nov 26 12:02:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Doucha X-Patchwork-Id: 1200995 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47MjG04sR5z9sPZ for ; Tue, 26 Nov 2019 23:02:48 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id C6C603C2026 for ; Tue, 26 Nov 2019 13:02:45 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id 266CC3C01FC for ; Tue, 26 Nov 2019 13:02:43 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id CA7B2600F60 for ; Tue, 26 Nov 2019 13:02:42 +0100 (CET) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 18113B459 for ; Tue, 26 Nov 2019 12:02:42 +0000 (UTC) From: Martin Doucha To: ltp@lists.linux.it Date: Tue, 26 Nov 2019 13:02:39 +0100 Message-Id: <20191126120241.5460-2-mdoucha@suse.cz> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191126120241.5460-1-mdoucha@suse.cz> References: <20191126120241.5460-1-mdoucha@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH 1/3] Add SAFE_ACCEPT() to LTP safe net library X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Martin Doucha Reviewed-by: Petr Vorel --- include/safe_net_fn.h | 3 +++ include/tst_safe_net.h | 3 +++ lib/safe_net.c | 16 ++++++++++++++++ 3 files changed, 22 insertions(+) diff --git a/include/safe_net_fn.h b/include/safe_net_fn.h index fdbb3791c..2fda11fab 100644 --- a/include/safe_net_fn.h +++ b/include/safe_net_fn.h @@ -57,6 +57,9 @@ int safe_bind(const char *file, const int lineno, void (cleanup_fn)(void), int safe_listen(const char *file, const int lineno, void (cleanup_fn)(void), int socket, int backlog); +int safe_accept(const char *file, const int lineno, void (cleanup_fn)(void), + int sockfd, struct sockaddr *addr, socklen_t *addrlen); + int safe_connect(const char *file, const int lineno, void (cleanup_fn)(void), int sockfd, const struct sockaddr *addr, socklen_t addrlen); diff --git a/include/tst_safe_net.h b/include/tst_safe_net.h index d49a36073..9bc257ce8 100644 --- a/include/tst_safe_net.h +++ b/include/tst_safe_net.h @@ -64,6 +64,9 @@ #define SAFE_LISTEN(socket, backlog) \ safe_listen(__FILE__, __LINE__, NULL, socket, backlog) +#define SAFE_ACCEPT(sockfd, addr, addrlen) \ + safe_accept(__FILE__, __LINE__, NULL, sockfd, addr, addrlen) + #define SAFE_CONNECT(sockfd, addr, addrlen) \ safe_connect(__FILE__, __LINE__, NULL, sockfd, addr, addrlen) diff --git a/lib/safe_net.c b/lib/safe_net.c index abebd1899..499368007 100644 --- a/lib/safe_net.c +++ b/lib/safe_net.c @@ -322,6 +322,22 @@ int safe_listen(const char *file, const int lineno, void (cleanup_fn)(void), return rval; } +int safe_accept(const char *file, const int lineno, void (cleanup_fn)(void), + int sockfd, struct sockaddr *addr, socklen_t *addrlen) +{ + int rval; + + rval = accept(sockfd, addr, addrlen); + + if (rval < 0) { + tst_brkm(TBROK | TERRNO, cleanup_fn, + "%s:%d: accept(%d, %p, %d) failed", file, lineno, + sockfd, addr, *addrlen); + } + + return rval; +} + int safe_connect(const char *file, const int lineno, void (cleanup_fn)(void), int sockfd, const struct sockaddr *addr, socklen_t addrlen) { From patchwork Tue Nov 26 12:02:40 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Doucha X-Patchwork-Id: 1200997 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47MjGP0Cbmz9sPZ for ; Tue, 26 Nov 2019 23:03:08 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 0529B3C2428 for ; Tue, 26 Nov 2019 13:03:06 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [217.194.8.5]) by picard.linux.it (Postfix) with ESMTP id 9BDCC3C226C for ; Tue, 26 Nov 2019 13:02:43 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id D4738600F8C for ; Tue, 26 Nov 2019 13:02:42 +0100 (CET) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 1DFC1B461 for ; Tue, 26 Nov 2019 12:02:42 +0000 (UTC) From: Martin Doucha To: ltp@lists.linux.it Date: Tue, 26 Nov 2019 13:02:40 +0100 Message-Id: <20191126120241.5460-3-mdoucha@suse.cz> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191126120241.5460-1-mdoucha@suse.cz> References: <20191126120241.5460-1-mdoucha@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH 2/3] Port test_1_to_1_initmsg_connect (SCTP) to new API X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" Signed-off-by: Martin Doucha Reviewed-by: Petr Vorel --- .../func_tests/test_1_to_1_initmsg_connect.c | 109 +++++++----------- 1 file changed, 42 insertions(+), 67 deletions(-) diff --git a/utils/sctp/func_tests/test_1_to_1_initmsg_connect.c b/utils/sctp/func_tests/test_1_to_1_initmsg_connect.c index 8efb4f59c..d85474ad6 100644 --- a/utils/sctp/func_tests/test_1_to_1_initmsg_connect.c +++ b/utils/sctp/func_tests/test_1_to_1_initmsg_connect.c @@ -1,38 +1,10 @@ +// SPDX-License-Identifier: GPL-2.0-or-later /* SCTP kernel Implementation * Copyright (c) 2003 Hewlett-Packard Development Company, L.P * (C) Copyright IBM Corp. 2004 * * When init timeout is set to zero, a connect () crashed the system. This case * tests the fix for the same. - * - * The SCTP implementation is free software; - * you can redistribute it and/or modify it under the terms of - * the GNU General Public License as published by - * the Free Software Foundation; either version 2, or (at your option) - * any later version. - * - * The SCTP implementation is distributed in the hope that it - * will be useful, but WITHOUT ANY WARRANTY; without even the implied - * ************************ - * warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - * See the GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with GNU CC; see the file COPYING. If not, write to - * the Free Software Foundation, 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Please send any bug reports or fixes you make to the - * email address(es): - * lksctp developers - * - * Or submit a bug report through the following website: - * http://www.sf.net/projects/lksctp - * - * - * Any bugs reported given to us we will try to fix... any fixes shared will - * be incorporated into the next SCTP release. - * */ #include #include @@ -43,38 +15,32 @@ #include #include /* for sockaddr_in */ #include -#include #include -#include -#include +#include "tst_test.h" +#include "tst_net.h" + +#ifdef PROT_SOCK +#define SCTP_TESTPORT_1 PROT_SOCK +#else +#define SCTP_TESTPORT_1 1024 +#endif -char *TCID = __FILE__; -int TST_TOTAL = 1; -int TST_CNT = 0; +#define SCTP_IP_LOOPBACK htonl(0x7f000001) -int -main (int argc, char **argv) +static void test_sctp(void) { - int sk1, sk2, sk3, pf_class; + int sk1, sk2, sk3, pf_class, msglen; socklen_t len; struct sockaddr_in lstn_addr, acpt_addr; struct sockaddr_in conn_addr; - char * buffer_rcv; + char *buffer_rcv; struct sctp_initmsg sinmsg; - char *message = "Hello World!\n"; + const char *message = "Hello World!\n"; - /* Rather than fflush() throughout the code, set stdout to - * be unbuffered. - */ - setvbuf(stdout, NULL, _IONBF, 0); - setvbuf(stderr, NULL, _IONBF, 0); - - /* Opening the socket*/ - pf_class = PF_INET; - sk1 = test_socket(pf_class, SOCK_STREAM, IPPROTO_SCTP); - sk3 = test_socket(pf_class, SOCK_STREAM, IPPROTO_SCTP); + sk1 = SAFE_SOCKET(pf_class, SOCK_STREAM, IPPROTO_SCTP); + sk3 = SAFE_SOCKET(pf_class, SOCK_STREAM, IPPROTO_SCTP); conn_addr.sin_family = AF_INET; conn_addr.sin_addr.s_addr = SCTP_IP_LOOPBACK; @@ -84,37 +50,46 @@ main (int argc, char **argv) lstn_addr.sin_addr.s_addr = SCTP_IP_LOOPBACK; lstn_addr.sin_port = htons(SCTP_TESTPORT_1); - test_bind(sk3, (struct sockaddr *) &lstn_addr, sizeof(lstn_addr)); + SAFE_BIND(sk3, (struct sockaddr *) &lstn_addr, sizeof(lstn_addr)); len = sizeof(struct sctp_initmsg); sinmsg.sinit_num_ostreams = 65535; sinmsg.sinit_max_instreams = 10; sinmsg.sinit_max_attempts = 1; sinmsg.sinit_max_init_timeo = 0; - test_setsockopt(sk1, SCTP_INITMSG, &sinmsg, len); + SAFE_SETSOCKOPT(sk1, SOL_SCTP, SCTP_INITMSG, &sinmsg, len); sinmsg.sinit_num_ostreams = 10; sinmsg.sinit_max_instreams = 65535; - test_setsockopt(sk3, SCTP_INITMSG, &sinmsg, len); + SAFE_SETSOCKOPT(sk3, SOL_SCTP, SCTP_INITMSG, &sinmsg, len); - test_listen(sk3, 1); + SAFE_LISTEN(sk3, 1); len = sizeof(struct sockaddr_in); - test_connect(sk1, (struct sockaddr *) &conn_addr, len); + SAFE_CONNECT(sk1, (struct sockaddr *) &conn_addr, len); + sk2 = SAFE_ACCEPT(sk3, (struct sockaddr *) &acpt_addr, &len); - sk2 = test_accept(sk3, (struct sockaddr *) &acpt_addr, &len); + msglen = strlen(message) + 1; + TEST(sctp_sendmsg(sk1, message, msglen, (struct sockaddr *)&conn_addr, + len, 0, 0, 65534, 0, 0)); - test_sctp_sendmsg(sk1, message, strlen(message) + 1, - (struct sockaddr *)&conn_addr, len, - 0, 0, 65534, 0, 0); + if (TST_RET != msglen) { + tst_brk(TBROK | TTERRNO, "sctp_sendmsg() failed"); + } - buffer_rcv = malloc(100); - test_recv(sk2, buffer_rcv, (strlen(message) + 1), MSG_NOSIGNAL); + buffer_rcv = malloc(msglen); + TEST(recv(sk2, buffer_rcv, msglen, MSG_NOSIGNAL)); - tst_resm(TPASS, "connect() with init timeout set to 0 - SUCCESS"); + if (TST_RET != msglen) { + tst_res(TFAIL | TTERRNO, "recv() failed"); + } else { + tst_res(TPASS, "connect() with init timeout set to 0 - SUCCESS"); + } - close (sk1); - close (sk2); - close (sk3); - - return 0; + SAFE_CLOSE(sk1); + SAFE_CLOSE(sk2); + SAFE_CLOSE(sk3); } + +static struct tst_test test = { + .test_all = test_sctp, +}; From patchwork Tue Nov 26 12:02:41 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Doucha X-Patchwork-Id: 1200999 X-Patchwork-Delegate: petr.vorel@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.linux.it (client-ip=2001:1418:10:5::2; helo=picard.linux.it; envelope-from=ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=suse.cz Received: from picard.linux.it (picard.linux.it [IPv6:2001:1418:10:5::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 47MjGc3Qtzz9sPK for ; Tue, 26 Nov 2019 23:03:20 +1100 (AEDT) Received: from picard.linux.it (localhost [IPv6:::1]) by picard.linux.it (Postfix) with ESMTP id 8AF0F3C2367 for ; Tue, 26 Nov 2019 13:03:17 +0100 (CET) X-Original-To: ltp@lists.linux.it Delivered-To: ltp@picard.linux.it Received: from in-5.smtp.seeweb.it (in-5.smtp.seeweb.it [IPv6:2001:4b78:1:20::5]) by picard.linux.it (Postfix) with ESMTP id CCA883C23EE for ; Tue, 26 Nov 2019 13:02:43 +0100 (CET) Received: from mx1.suse.de (mx2.suse.de [195.135.220.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by in-5.smtp.seeweb.it (Postfix) with ESMTPS id C7062600F15 for ; Tue, 26 Nov 2019 13:02:42 +0100 (CET) Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 297D7B46F for ; Tue, 26 Nov 2019 12:02:42 +0000 (UTC) From: Martin Doucha To: ltp@lists.linux.it Date: Tue, 26 Nov 2019 13:02:41 +0100 Message-Id: <20191126120241.5460-4-mdoucha@suse.cz> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191126120241.5460-1-mdoucha@suse.cz> References: <20191126120241.5460-1-mdoucha@suse.cz> MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.99.2 at in-5.smtp.seeweb.it X-Virus-Status: Clean X-Spam-Status: No, score=0.0 required=7.0 tests=SPF_HELO_NONE,SPF_PASS autolearn=disabled version=3.4.0 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on in-5.smtp.seeweb.it Subject: [LTP] [PATCH 3/3] Split SCTP initmsg test into two test cases X-BeenThere: ltp@lists.linux.it X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux Test Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ltp-bounces+incoming=patchwork.ozlabs.org@lists.linux.it Sender: "ltp" The original test allocates 65535 output streams which may fail on older kernels due to lack of memory. Split the test into two test cases: - allocate 10 output streams and accept no errors (functional test) - allocate 65535 output streams and accept ENOMEM (stress test) Also clean up some unnecessary code and check that the test message is transferred correctly. Signed-off-by: Martin Doucha Reviewed-by: Petr Vorel --- .../func_tests/test_1_to_1_initmsg_connect.c | 56 ++++++++++++------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/utils/sctp/func_tests/test_1_to_1_initmsg_connect.c b/utils/sctp/func_tests/test_1_to_1_initmsg_connect.c index d85474ad6..a98e0c003 100644 --- a/utils/sctp/func_tests/test_1_to_1_initmsg_connect.c +++ b/utils/sctp/func_tests/test_1_to_1_initmsg_connect.c @@ -27,50 +27,64 @@ #define SCTP_IP_LOOPBACK htonl(0x7f000001) -static void test_sctp(void) +static const struct test_case { + __u16 streams; + int accept_err; +} testcase_list[] = { + {10, 0}, + {65535, ENOMEM} +}; + +static void test_sctp(unsigned int n) { - int sk1, sk2, sk3, pf_class, msglen; + int sk1, sk2, sk3, msglen; socklen_t len; struct sockaddr_in lstn_addr, acpt_addr; - struct sockaddr_in conn_addr; char *buffer_rcv; struct sctp_initmsg sinmsg; const char *message = "Hello World!\n"; + const struct test_case *tc = testcase_list + n; - pf_class = PF_INET; - - sk1 = SAFE_SOCKET(pf_class, SOCK_STREAM, IPPROTO_SCTP); - sk3 = SAFE_SOCKET(pf_class, SOCK_STREAM, IPPROTO_SCTP); + tst_res(TINFO, "Running test with %u streams", tc->streams); - conn_addr.sin_family = AF_INET; - conn_addr.sin_addr.s_addr = SCTP_IP_LOOPBACK; - conn_addr.sin_port = htons(SCTP_TESTPORT_1); + sk1 = SAFE_SOCKET(PF_INET, SOCK_STREAM, IPPROTO_SCTP); + sk3 = SAFE_SOCKET(PF_INET, SOCK_STREAM, IPPROTO_SCTP); - lstn_addr.sin_family = AF_INET; - lstn_addr.sin_addr.s_addr = SCTP_IP_LOOPBACK; - lstn_addr.sin_port = htons(SCTP_TESTPORT_1); + lstn_addr.sin_family = AF_INET; + lstn_addr.sin_addr.s_addr = SCTP_IP_LOOPBACK; + lstn_addr.sin_port = htons(SCTP_TESTPORT_1); SAFE_BIND(sk3, (struct sockaddr *) &lstn_addr, sizeof(lstn_addr)); len = sizeof(struct sctp_initmsg); - sinmsg.sinit_num_ostreams = 65535; + sinmsg.sinit_num_ostreams = tc->streams; sinmsg.sinit_max_instreams = 10; sinmsg.sinit_max_attempts = 1; sinmsg.sinit_max_init_timeo = 0; SAFE_SETSOCKOPT(sk1, SOL_SCTP, SCTP_INITMSG, &sinmsg, len); sinmsg.sinit_num_ostreams = 10; - sinmsg.sinit_max_instreams = 65535; + sinmsg.sinit_max_instreams = tc->streams; SAFE_SETSOCKOPT(sk3, SOL_SCTP, SCTP_INITMSG, &sinmsg, len); SAFE_LISTEN(sk3, 1); len = sizeof(struct sockaddr_in); - SAFE_CONNECT(sk1, (struct sockaddr *) &conn_addr, len); + TEST(connect(sk1, (struct sockaddr *) &lstn_addr, len)); + + if (TST_RET == -1 && tc->accept_err && TST_ERR == tc->accept_err) { + tst_res(TPASS, "connect() failed in an acceptable way"); + SAFE_CLOSE(sk1); + SAFE_CLOSE(sk3); + return; + } else if (TST_RET < 0) { + tst_brk(TBROK | TTERRNO, "connect() failed"); + } + sk2 = SAFE_ACCEPT(sk3, (struct sockaddr *) &acpt_addr, &len); msglen = strlen(message) + 1; - TEST(sctp_sendmsg(sk1, message, msglen, (struct sockaddr *)&conn_addr, - len, 0, 0, 65534, 0, 0)); + TEST(sctp_sendmsg(sk1, message, msglen, (struct sockaddr *)&lstn_addr, + len, 0, 0, tc->streams - 1, 0, 0)); if (TST_RET != msglen) { tst_brk(TBROK | TTERRNO, "sctp_sendmsg() failed"); @@ -79,17 +93,19 @@ static void test_sctp(void) buffer_rcv = malloc(msglen); TEST(recv(sk2, buffer_rcv, msglen, MSG_NOSIGNAL)); - if (TST_RET != msglen) { + if (TST_RET != msglen || strncmp(buffer_rcv, message, msglen)) { tst_res(TFAIL | TTERRNO, "recv() failed"); } else { tst_res(TPASS, "connect() with init timeout set to 0 - SUCCESS"); } + free(buffer_rcv); SAFE_CLOSE(sk1); SAFE_CLOSE(sk2); SAFE_CLOSE(sk3); } static struct tst_test test = { - .test_all = test_sctp, + .test = test_sctp, + .tcnt = ARRAY_SIZE(testcase_list), };