From: Hangbin Liu <liuhangbin@gmail.com>
To: LTP List <ltp-list@lists.sourceforge.net>
Cc: Daniel Borkmann <dborkman@redhat.com>,
Xie Lingyun <lingyun.xie@bj.cs2c.com.cn>
Subject: [LTP] [PATCH] testcases/network/sctp: update sctp test to upstream version 1.0.15
Date: Tue, 23 Jul 2013 11:07:56 +0800 [thread overview]
Message-ID: <1374548876-24829-1-git-send-email-liuhangbin@gmail.com> (raw)
SCTP test in ltp is based on lksctp. But the last patch for sctp in ltp is
2006. It has changed a lot and fixed many bugs. Update sctp test to upstream
version 1.0.15 now.
Format code with
for file in `find ~/git/ltp/testcases/network/sctp -name *.c -o -name *.h`; do
~/git/linux/scripts/cleanfile $file
~/git/linux/scripts/Lindent $file
rm -f ${file}~
done
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
.../sctp/func_tests/test_1_to_1_accept_close.c | 26 +-
.../network/sctp/func_tests/test_1_to_1_addrs.c | 44 +-
.../network/sctp/func_tests/test_1_to_1_connect.c | 28 +-
.../network/sctp/func_tests/test_1_to_1_connectx.c | 52 ++-
.../network/sctp/func_tests/test_1_to_1_events.c | 8 +-
.../sctp/func_tests/test_1_to_1_initmsg_connect.c | 6 +-
.../network/sctp/func_tests/test_1_to_1_nonblock.c | 34 +-
.../network/sctp/func_tests/test_1_to_1_recvfrom.c | 26 +-
.../network/sctp/func_tests/test_1_to_1_recvmsg.c | 27 +-
.../network/sctp/func_tests/test_1_to_1_rtoinfo.c | 16 +-
.../network/sctp/func_tests/test_1_to_1_send.c | 23 +-
.../network/sctp/func_tests/test_1_to_1_sendmsg.c | 50 +--
.../network/sctp/func_tests/test_1_to_1_sendto.c | 14 +-
.../network/sctp/func_tests/test_1_to_1_shutdown.c | 30 +-
.../func_tests/test_1_to_1_socket_bind_listen.c | 38 +-
.../network/sctp/func_tests/test_1_to_1_sockopt.c | 72 +--
.../network/sctp/func_tests/test_1_to_1_threads.c | 46 +-
.../network/sctp/func_tests/test_assoc_abort.c | 17 +-
.../network/sctp/func_tests/test_assoc_shutdown.c | 12 +-
testcases/network/sctp/func_tests/test_autoclose.c | 13 +-
testcases/network/sctp/func_tests/test_basic.c | 22 +-
testcases/network/sctp/func_tests/test_connect.c | 30 +-
testcases/network/sctp/func_tests/test_connectx.c | 45 +-
testcases/network/sctp/func_tests/test_fragments.c | 26 +-
testcases/network/sctp/func_tests/test_getname.c | 44 +-
.../network/sctp/func_tests/test_inaddr_any.c | 16 +-
testcases/network/sctp/func_tests/test_peeloff.c | 16 +-
testcases/network/sctp/func_tests/test_recvmsg.c | 8 +-
.../sctp/func_tests/test_sctp_sendrecvmsg.c | 45 +-
testcases/network/sctp/func_tests/test_sockopt.c | 312 +++++++++++--
testcases/network/sctp/func_tests/test_tcp_style.c | 50 +--
.../network/sctp/func_tests/test_timetolive.c | 32 +-
testcases/network/sctp/include/netinet/sctp.h | 491 ++++++++++++++-------
testcases/network/sctp/lib/addrs.c | 98 ++--
testcases/network/sctp/lib/bindx.c | 4 +-
testcases/network/sctp/lib/connectx.c | 136 +++++-
testcases/network/sctp/lib/opt_info.c | 7 +-
testcases/network/sctp/lib/peeloff.c | 4 +-
testcases/network/sctp/lib/recvmsg.c | 6 +-
testcases/network/sctp/lib/sendmsg.c | 6 +-
testcases/network/sctp/testlib/sctputil.c | 53 +--
testcases/network/sctp/testlib/sctputil.h | 104 +++--
42 files changed, 1331 insertions(+), 806 deletions(-)
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_accept_close.c b/testcases/network/sctp/func_tests/test_1_to_1_accept_close.c
index e9a13e7..8bfb1bd 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_accept_close.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_accept_close.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P
* (C) Copyright IBM Corp. 2004
*
@@ -21,13 +21,13 @@
* TEST9: valid socket descriptor
* TEST10: Closed socket descriptor
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
/* accept() TEST1: Bad socket descriptor EBADF, Expected error */
error = accept(-1, (struct sockaddr *)&acpt_addr, &len);
if (error != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "accept with a bad socket descriptor"
+ tst_brkm(TBROK, tst_exit, "accept with a bad socket descriptor"
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "accept() with a bad socket descriptor - EBADF");
@@ -135,7 +135,7 @@ int main(int argc, char *argv[])
/*accept() TEST2: Invalid socket ENOTSOCK, Expected error */
error = accept(0, (struct sockaddr *)&acpt_addr, &len);
if (error != -1 || errno != ENOTSOCK)
- tst_brkm(TBROK, NULL, "accept with invalid socket"
+ tst_brkm(TBROK, tst_exit, "accept with invalid socket"
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "accept() with invalid socket - ENOTSOCK");
@@ -143,7 +143,7 @@ int main(int argc, char *argv[])
/*accept() TEST3: Invalid address EFAULT, Expected error */
error = accept(lstn_sk, (struct sockaddr *)-1, &len);
if (error != -1 || errno != EFAULT)
- tst_brkm(TBROK, NULL, "accept with invalid address"
+ tst_brkm(TBROK, tst_exit, "accept with invalid address"
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "accept() with invalid address - EFAULT");
@@ -153,7 +153,7 @@ int main(int argc, char *argv[])
/*accept() TEST4: on a non-listening socket EINVAL, Expected error */
error = accept(sk, (struct sockaddr *)&acpt_addr, &len);
if (error != -1 || errno != EINVAL)
- tst_brkm(TBROK, NULL, "accept on a non-listening socket"
+ tst_brkm(TBROK, tst_exit, "accept on a non-listening socket"
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "accept() on a non-listening socket - EINVAL");
@@ -166,7 +166,7 @@ int main(int argc, char *argv[])
/*accept() TEST5: On a established socket EINVAL, Expected error */
error = accept(acpt_sk, (struct sockaddr *)&acpt_addr, &len);
if (error != -1 || errno != EINVAL)
- tst_brkm(TBROK, NULL, "accept on an established socket"
+ tst_brkm(TBROK, tst_exit, "accept on an established socket"
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "accept() on an established socket - EINVAL");
@@ -179,7 +179,7 @@ int main(int argc, char *argv[])
/*accept() TEST6: On the CLOSED association should succeed */
acpt_sk = accept(lstn_sk, (struct sockaddr *)&acpt_addr, &len);
if (acpt_sk < 0)
- tst_brkm(TBROK, NULL, "accept a closed association"
+ tst_brkm(TBROK, tst_exit, "accept a closed association"
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "accept() a closed association - SUCCESS");
@@ -200,7 +200,7 @@ int main(int argc, char *argv[])
/*close() TEST8: Bad socket descriptor, EBADF Expected error */
error = close(-1);
if (error != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "close with a bad socket descriptor "
+ tst_brkm(TBROK, tst_exit, "close with a bad socket descriptor "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "close() with a bad socket descriptor - EBADF");
@@ -208,7 +208,7 @@ int main(int argc, char *argv[])
/*close() TEST9: valid socket descriptor should succeed */
error = close(sk);
if (error < 0)
- tst_brkm(TBROK, NULL, "close with a valid socket descriptor"
+ tst_brkm(TBROK, tst_exit, "close with a valid socket descriptor"
" error:%d, errno:%d", error, errno);
tst_resm(TPASS, "close() with a valid socket descriptor - SUCCESS");
@@ -216,7 +216,7 @@ int main(int argc, char *argv[])
/*close() TEST10: closed socket descriptor, EBADF Expected error */
error = close(sk);
if (error != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "close with a closed socket "
+ tst_brkm(TBROK, tst_exit, "close with a closed socket "
"descriptor error:%d, errno:%d", error, errno);
tst_resm(TPASS, "close() with a closed socket descriptor - EBADF");
@@ -227,5 +227,5 @@ int main(int argc, char *argv[])
close(clnt2_sk[i]);
}
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_addrs.c b/testcases/network/sctp/func_tests/test_1_to_1_addrs.c
index 7b3b86f..2b98298 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_addrs.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_addrs.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P
* (C) Copyright IBM Corp. 2004
*
@@ -27,13 +27,13 @@
* ------------------------
* TEST10: Freeing the peer's address
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -78,18 +78,16 @@ int main(int argc, char *argv[])
{
int error;
socklen_t len;
- int sk, lstn_sk, clnt_sk, acpt_sk, pf_class, sk1;
+ int lstn_sk, clnt_sk, acpt_sk, pf_class, sk1;
struct msghdr outmessage;
struct msghdr inmessage;
char *message = "hello, world!\n";
- struct iovec iov;
struct iovec iov_rcv;
struct sctp_sndrcvinfo *sinfo;
int msg_count;
char outcmsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))];
struct cmsghdr *cmsg;
struct iovec out_iov;
- char *buffer_snd;
char *buffer_rcv;
char incmsg[CMSG_SPACE(sizeof(sctp_cmsg_data_t))];
struct sockaddr *laddrs, *paddrs;
@@ -105,8 +103,6 @@ int main(int argc, char *argv[])
pf_class = PF_INET;
- sk = test_socket(pf_class, SOCK_STREAM, IPPROTO_SCTP);
-
/*Creating a regular socket */
clnt_sk = test_socket(pf_class, SOCK_STREAM, IPPROTO_SCTP);
@@ -146,8 +142,6 @@ int main(int argc, char *argv[])
msg_count = strlen(message) + 1;
memset(&outmessage, 0, sizeof(outmessage));
- buffer_snd = malloc(REALLY_BIG);
-
outmessage.msg_name = &lstn_addr;
outmessage.msg_namelen = sizeof(lstn_addr);
outmessage.msg_iov = &out_iov;
@@ -164,11 +158,9 @@ int main(int argc, char *argv[])
sinfo = (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg);
memset(sinfo, 0x00, sizeof(struct sctp_sndrcvinfo));
- iov.iov_base = buffer_snd;
- iov.iov_len = REALLY_BIG;
outmessage.msg_iov->iov_base = message;
-
outmessage.msg_iov->iov_len = msg_count;
+
test_sendmsg(clnt_sk, &outmessage, MSG_NOSIGNAL, msg_count);
test_recvmsg(acpt_sk, &inmessage, MSG_NOSIGNAL);
@@ -176,7 +168,7 @@ int main(int argc, char *argv[])
/*sctp_getladdrs() TEST1: Bad socket descriptor, EBADF Expected error */
error = sctp_getladdrs(-1, 0, &laddrs);
if (error != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "sctp_getladdrs with a bad socket "
+ tst_brkm(TBROK, tst_exit, "sctp_getladdrs with a bad socket "
"descriptor error:%d, errno:%d", error, errno);
tst_resm(TPASS, "sctp_getladdrs() with a bad socket descriptor - "
@@ -185,7 +177,7 @@ int main(int argc, char *argv[])
/*sctp_getladdrs() TEST2: Invalid socket, ENOTSOCK Expected error */
error = sctp_getladdrs(0, 0, &laddrs);
if (error != -1 || errno != ENOTSOCK)
- tst_brkm(TBROK, NULL, "sctp_getladdrs with invalid socket "
+ tst_brkm(TBROK, tst_exit, "sctp_getladdrs with invalid socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "sctp_getladdrs() with invalid socket - ENOTSOCK");
@@ -195,7 +187,7 @@ int main(int argc, char *argv[])
sk1 = socket(pf_class, SOCK_STREAM, IPPROTO_IP);
error = sctp_getladdrs(sk1, 0, &laddrs);
if (error != -1 || errno != EOPNOTSUPP)
- tst_brkm(TBROK, NULL, "sctp_getladdrs with socket of "
+ tst_brkm(TBROK, tst_exit, "sctp_getladdrs with socket of "
"different protocol error:%d, errno:%d", error, errno);
tst_resm(TPASS, "sctp_getladdrs() with socket of different protocol - "
@@ -204,20 +196,20 @@ int main(int argc, char *argv[])
/*sctp_getladdrs() TEST4: Getting the local addresses */
error = sctp_getladdrs(lstn_sk, 0, &laddrs);
if (error < 0)
- tst_brkm(TBROK, NULL, "sctp_getladdrs with valid socket "
+ tst_brkm(TBROK, tst_exit, "sctp_getladdrs with valid socket "
"error:%d, errno:%d", error, errno);
addr = (struct sockaddr_in *)laddrs;
if (addr->sin_port != lstn_addr.sin_port ||
addr->sin_family != lstn_addr.sin_family ||
addr->sin_addr.s_addr != lstn_addr.sin_addr.s_addr)
- tst_brkm(TBROK, NULL, "sctp_getladdrs comparision failed");
+ tst_brkm(TBROK, tst_exit, "sctp_getladdrs comparision failed");
tst_resm(TPASS, "sctp_getladdrs() - SUCCESS");
/*sctp_freealddrs() TEST5: freeing the local address */
if ((sctp_freeladdrs(laddrs)) < 0)
- tst_brkm(TBROK, NULL, "sctp_freeladdrs "
+ tst_brkm(TBROK, tst_exit, "sctp_freeladdrs "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "sctp_freeladdrs() - SUCCESS");
@@ -225,7 +217,7 @@ int main(int argc, char *argv[])
/*sctp_getpaddrs() TEST6: Bad socket descriptor, EBADF Expected error */
error = sctp_getpaddrs(-1, 0, &paddrs);
if (error != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "sctp_getpaddrs with a bad socket "
+ tst_brkm(TBROK, tst_exit, "sctp_getpaddrs with a bad socket "
"descriptor error:%d, errno:%d", error, errno);
tst_resm(TPASS, "sctp_getpaddrs() with a bad socket descriptor - "
@@ -234,7 +226,7 @@ int main(int argc, char *argv[])
/*sctp_getpaddrs() TEST7: Invalid socket, ENOTSOCK Expected error */
error = sctp_getpaddrs(0, 0, &paddrs);
if (error != -1 || errno != ENOTSOCK)
- tst_brkm(TBROK, NULL, "sctp_getpaddrs with invalid socket "
+ tst_brkm(TBROK, tst_exit, "sctp_getpaddrs with invalid socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "sctp_getpaddrs() with invalid socket - ENOTSOCK");
@@ -243,7 +235,7 @@ int main(int argc, char *argv[])
EOPNOTSUPP Expected error */
error = sctp_getpaddrs(sk1, 0, &laddrs);
if (error != -1 || errno != EOPNOTSUPP)
- tst_brkm(TBROK, NULL, "sctp_getpaddrs with socket of "
+ tst_brkm(TBROK, tst_exit, "sctp_getpaddrs with socket of "
"different protocol error:%d, errno:%d", error, errno);
tst_resm(TPASS, "sctp_getpaddrs() with socket of different protocol - "
@@ -252,25 +244,25 @@ int main(int argc, char *argv[])
/*sctp_getpaddrs() TEST9: Getting the peer addresses */
error = sctp_getpaddrs(acpt_sk, 0, &paddrs);
if (error < 0)
- tst_brkm(TBROK, NULL, "sctp_getpaddrs with valid socket "
+ tst_brkm(TBROK, tst_exit, "sctp_getpaddrs with valid socket "
"error:%d, errno:%d", error, errno);
addr = (struct sockaddr_in *)paddrs;
if (addr->sin_port != acpt_addr.sin_port ||
addr->sin_family != acpt_addr.sin_family ||
addr->sin_addr.s_addr != acpt_addr.sin_addr.s_addr)
- tst_brkm(TBROK, NULL, "sctp_getpaddrs comparision failed");
+ tst_brkm(TBROK, tst_exit, "sctp_getpaddrs comparision failed");
tst_resm(TPASS, "sctp_getpaddrs() - SUCCESS");
/*sctp_freeapddrs() TEST10: freeing the peer address */
if ((sctp_freepaddrs(paddrs)) < 0)
- tst_brkm(TBROK, NULL, "sctp_freepaddrs "
+ tst_brkm(TBROK, tst_exit, "sctp_freepaddrs "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "sctp_freepaddrs() - SUCCESS");
close(clnt_sk);
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_connect.c b/testcases/network/sctp/func_tests/test_1_to_1_connect.c
index 93f2caa..8ef181d 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_connect.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_connect.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P
* (C) Copyright IBM Corp. 2004
*
@@ -15,13 +15,13 @@
* TEST9: On established socket
* TEST10: Connect to re-establish a closed association.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -112,7 +112,7 @@ int main(int argc, char *argv[])
len = sizeof(struct sockaddr_in);
error = connect(-1, (const struct sockaddr *)&conn_addr, len);
if (error != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "connect with bad socket "
+ tst_brkm(TBROK, tst_exit, "connect with bad socket "
"descriptor error:%d, errno:%d", error, errno);
tst_resm(TPASS, "connect() with bad socket descriptor - EBADF");
@@ -120,7 +120,7 @@ int main(int argc, char *argv[])
/*connect () TEST2: Invalid socket, ENOTSOCK Expected error */
error = connect(0, (const struct sockaddr *)&conn_addr, len);
if (error != -1 || errno != ENOTSOCK)
- tst_brkm(TBROK, NULL, "connect with invalid socket "
+ tst_brkm(TBROK, tst_exit, "connect with invalid socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "connect() with invalid socket - ENOTSOCK");
@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
/*connect () TEST3: Invalid address, EFAULT Expected error */
error = connect(sk, (const struct sockaddr *)-1, len);
if (error != -1 || errno != EFAULT)
- tst_brkm(TBROK, NULL, "connect with invalid address "
+ tst_brkm(TBROK, tst_exit, "connect with invalid address "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "connect() with invalid address - EFAULT");
@@ -136,7 +136,7 @@ int main(int argc, char *argv[])
/*connect () TEST4: Invalid address length, EINVAL Expected error */
error = connect(sk, (const struct sockaddr *)&conn_addr, (len - 3));
if (error != -1 || errno != EINVAL)
- tst_brkm(TBROK, NULL, "connect with invalid address length "
+ tst_brkm(TBROK, tst_exit, "connect with invalid address length "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "connect() with invalid address length - EINVAL");
@@ -145,7 +145,7 @@ int main(int argc, char *argv[])
conn_addr.sin_family = 9090; /*Assigning invalid address family */
error = connect(sk, (const struct sockaddr *)&conn_addr, len);
if (error != -1 || errno != EINVAL)
- tst_brkm(TBROK, NULL, "connect with invalid address family "
+ tst_brkm(TBROK, tst_exit, "connect with invalid address family "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "connect() with invalid address family - EINVAL");
@@ -159,7 +159,7 @@ int main(int argc, char *argv[])
error = connect(clnt_sk[i], (const struct sockaddr *)&conn_addr,
len);
if (error < 0)
- tst_brkm(TBROK, NULL, "valid blocking connect "
+ tst_brkm(TBROK, tst_exit, "valid blocking connect "
"error:%d, errno:%d", error, errno);
}
@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
/*Now that accept queue is full, the below connect should fail */
error = connect(clnt2_sk, (const struct sockaddr *)&conn_addr, len);
if (error != -1 || errno != ECONNREFUSED)
- tst_brkm(TBROK, NULL, "connect when accept queue is full "
+ tst_brkm(TBROK, tst_exit, "connect when accept queue is full "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "connect() when accept queue is full - ECONNREFUSED");
@@ -183,7 +183,7 @@ int main(int argc, char *argv[])
/*connect () TEST8: from a listening socket, EISCONN Expect error */
error = connect(lstn_sk, (const struct sockaddr *)&lstn_addr, len);
if (error != -1 || errno != EISCONN)
- tst_brkm(TBROK, NULL, "connect on a listening socket "
+ tst_brkm(TBROK, tst_exit, "connect on a listening socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "connect() on a listening socket - EISCONN");
@@ -192,7 +192,7 @@ int main(int argc, char *argv[])
i = 0;
error = connect(acpt_sk[i], (const struct sockaddr *)&lstn_addr, len);
if (error != -1 || errno != EISCONN)
- tst_brkm(TBROK, NULL, "connect on an established socket "
+ tst_brkm(TBROK, tst_exit, "connect on an established socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "connect() on an established socket - EISCONN");
@@ -207,7 +207,7 @@ int main(int argc, char *argv[])
*/
error = connect(sk1, (const struct sockaddr *)&conn_addr, len);
if (error < 0)
- tst_brkm(TBROK, NULL, "Re-establish an association that "
+ tst_brkm(TBROK, tst_exit, "Re-establish an association that "
"is closed error:%d, errno:%d", error, errno);
tst_resm(TPASS, "connect() to re-establish a closed association - "
@@ -217,5 +217,5 @@ int main(int argc, char *argv[])
close(sk1);
close(lstn_sk);
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_connectx.c b/testcases/network/sctp/func_tests/test_1_to_1_connectx.c
index 551d49b..0ef6d39 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_connectx.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_connectx.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P
* (C) Copyright IBM Corp. 2004
*
@@ -15,13 +15,13 @@
* TEST9: On established socket
* TEST10: Connect to re-establish a closed association.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -111,17 +111,17 @@ int main(int argc, char *argv[])
/*sctp_connectx () TEST1: Bad socket descriptor, EBADF Expected error */
len = sizeof(struct sockaddr_in);
- error = sctp_connectx(-1, (struct sockaddr *)&conn_addr, 1);
+ error = sctp_connectx(-1, (struct sockaddr *)&conn_addr, 1, NULL);
if (error != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "sctp_connectx with bad socket "
+ tst_brkm(TBROK, tst_exit, "sctp_connectx with bad socket "
"descriptor error:%d, errno:%d", error, errno);
tst_resm(TPASS, "sctp_connectx() with bad socket descriptor - EBADF");
/*sctp_connectx () TEST2: Invalid socket, ENOTSOCK Expected error */
- error = sctp_connectx(0, (struct sockaddr *)&conn_addr, 1);
+ error = sctp_connectx(0, (struct sockaddr *)&conn_addr, 1, NULL);
if (error != -1 || errno != ENOTSOCK)
- tst_brkm(TBROK, NULL, "sctp_connectx with invalid socket "
+ tst_brkm(TBROK, tst_exit, "sctp_connectx with invalid socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "sctp_connectx() with invalid socket - ENOTSOCK");
@@ -129,17 +129,17 @@ int main(int argc, char *argv[])
/*sctp_connectx () TEST3: Invalid address, EINVAL Expected error */
tmp_addr = (struct sockaddr *)malloc(sizeof(struct sockaddr) - 1);
tmp_addr->sa_family = AF_INET;
- error = sctp_connectx(sk, tmp_addr, 1);
+ error = sctp_connectx(sk, tmp_addr, 1, NULL);
if (error != -1 || errno != EINVAL)
- tst_brkm(TBROK, NULL, "sctp_connectx with invalid address "
+ tst_brkm(TBROK, tst_exit, "sctp_connectx with invalid address "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "sctp_connectx() with invalid address - EINVAL");
/*sctp_connectx () TEST4: Invalid address length, EINVAL Expected error */
- error = sctp_connectx(sk, (struct sockaddr *)&conn_addr, 0);
+ error = sctp_connectx(sk, (struct sockaddr *)&conn_addr, 0, NULL);
if (error != -1 || errno != EINVAL)
- tst_brkm(TBROK, NULL,
+ tst_brkm(TBROK, tst_exit,
"sctp_connectx with invalid address length "
"error:%d, errno:%d", error, errno);
@@ -147,9 +147,9 @@ int main(int argc, char *argv[])
/*sctp_connectx () TEST5: Invalid address family, EINVAL Expect error */
conn_addr.sin_family = 9090; /*Assigning invalid address family */
- error = sctp_connectx(sk, (struct sockaddr *)&conn_addr, 1);
+ error = sctp_connectx(sk, (struct sockaddr *)&conn_addr, 1, NULL);
if (error != -1 || errno != EINVAL)
- tst_brkm(TBROK, NULL,
+ tst_brkm(TBROK, tst_exit,
"sctp_connectx with invalid address family "
"error:%d, errno:%d", error, errno);
@@ -162,9 +162,10 @@ int main(int argc, char *argv[])
listening SK_MAX clients */
for (i = 0; i < SK_MAX; i++) {
error = sctp_connectx(clnt_sk[i], (struct sockaddr *)&conn_addr,
- 1);
+ 1, NULL);
if (error < 0)
- tst_brkm(TBROK, NULL, "valid blocking sctp_connectx "
+ tst_brkm(TBROK, tst_exit,
+ "valid blocking sctp_connectx "
"error:%d, errno:%d", error, errno);
}
@@ -173,9 +174,10 @@ int main(int argc, char *argv[])
/*sctp_connectx () TEST7: sctp_connectx when accept queue is full, ECONNREFUSED
Expect error */
/*Now that accept queue is full, the below sctp_connectx should fail */
- error = sctp_connectx(clnt2_sk, (struct sockaddr *)&conn_addr, 1);
+ error = sctp_connectx(clnt2_sk, (struct sockaddr *)&conn_addr, 1, NULL);
if (error != -1 || errno != ECONNREFUSED)
- tst_brkm(TBROK, NULL, "sctp_connectx when accept queue is full "
+ tst_brkm(TBROK, tst_exit,
+ "sctp_connectx when accept queue is full "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS,
@@ -187,18 +189,20 @@ int main(int argc, char *argv[])
(struct sockaddr *)&acpt_addr, &len);
/*sctp_connectx () TEST8: from a listening socket, EISCONN Expect error */
- error = sctp_connectx(lstn_sk, (struct sockaddr *)&lstn_addr, 1);
+ error = sctp_connectx(lstn_sk, (struct sockaddr *)&lstn_addr, 1, NULL);
if (error != -1 || errno != EISCONN)
- tst_brkm(TBROK, NULL, "sctp_connectx on a listening socket "
+ tst_brkm(TBROK, tst_exit, "sctp_connectx on a listening socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "sctp_connectx() on a listening socket - EISCONN");
/*sctp_connectx() TEST9: On established socket, EISCONN Expect error */
i = 0;
- error = sctp_connectx(acpt_sk[i], (struct sockaddr *)&lstn_addr, 1);
+ error =
+ sctp_connectx(acpt_sk[i], (struct sockaddr *)&lstn_addr, 1, NULL);
if (error != -1 || errno != EISCONN)
- tst_brkm(TBROK, NULL, "sctp_connectx on an established socket "
+ tst_brkm(TBROK, tst_exit,
+ "sctp_connectx on an established socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "sctp_connectx() on an established socket - EISCONN");
@@ -211,9 +215,9 @@ int main(int argc, char *argv[])
/* sctp_connectx() TEST10: Re-establish an association that is closed.
* should succeed.
*/
- error = sctp_connectx(sk1, (struct sockaddr *)&conn_addr, 1);
+ error = sctp_connectx(sk1, (struct sockaddr *)&conn_addr, 1, NULL);
if (error < 0)
- tst_brkm(TBROK, NULL, "Re-establish an association that "
+ tst_brkm(TBROK, tst_exit, "Re-establish an association that "
"is closed error:%d, errno:%d", error, errno);
tst_resm(TPASS,
@@ -224,5 +228,5 @@ int main(int argc, char *argv[])
close(sk1);
close(lstn_sk);
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_events.c b/testcases/network/sctp/func_tests/test_1_to_1_events.c
index 514b25b..28056d7 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_events.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_events.c
@@ -1,16 +1,16 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P
* (C) Copyright IBM Corp. 2004
*
* This test tests the events for 1-1 style sockets.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -184,5 +184,5 @@ int main(int argc, char *argv[])
close(svr_sk);
close(acpt_sk);
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_initmsg_connect.c b/testcases/network/sctp/func_tests/test_1_to_1_initmsg_connect.c
index 11b629a..bb60abf 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_initmsg_connect.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_initmsg_connect.c
@@ -1,17 +1,17 @@
-/* SCTP kernel reference Implementation
+/* 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 reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_nonblock.c b/testcases/network/sctp/func_tests/test_1_to_1_nonblock.c
index 7b66b20..1f15dd1 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_nonblock.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_nonblock.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P
* (C) Copyright IBM Corp. 2004
*
@@ -12,13 +12,13 @@
* TEST5: recvmsg() should succeed if data present to receive in non blocking
* mode
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -68,14 +68,11 @@ int main(int argc, char *argv[])
struct msghdr outmessage;
struct msghdr inmessage;
char *message = "hello, world!\n";
- struct iovec iov;
struct iovec iov_rcv;
struct sctp_sndrcvinfo *sinfo;
- int count;
char outcmsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))];
struct cmsghdr *cmsg;
struct iovec out_iov;
- char *buffer_snd;
char *buffer_rcv;
char incmsg[CMSG_SPACE(sizeof(sctp_cmsg_data_t))];
@@ -113,18 +110,18 @@ int main(int argc, char *argv[])
/*Setting server socket non-blocking */
sflag = fcntl(lstn_sk, F_GETFL, 0);
if (sflag < 0)
- tst_brkm(TBROK, NULL, "fcnt F_GETFL failed "
+ tst_brkm(TBROK, tst_exit, "fcnt F_GETFL failed "
"sflag:%d, errno:%d", sflag, errno);
error = fcntl(lstn_sk, F_SETFL, sflag | O_NONBLOCK);
if (error < 0)
- tst_brkm(TBROK, NULL, "fcnt F_SETFL failed "
+ tst_brkm(TBROK, tst_exit, "fcnt F_SETFL failed "
"error:%d, errno:%d", error, errno);
/* TEST1: accept should return EAGAIN instead blocking. */
error = accept(lstn_sk, (struct sockaddr *)&svr_addr, &len);
if (error != -1 || errno != EAGAIN)
- tst_brkm(TBROK, NULL, "non-blocking accept "
+ tst_brkm(TBROK, tst_exit, "non-blocking accept "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "non-blocking accept() - EAGAIN");
@@ -133,17 +130,17 @@ int main(int argc, char *argv[])
/*Set client socket as non-blocking */
cflag = fcntl(sk, F_GETFL, 0);
if (cflag < 0)
- tst_brkm(TBROK, NULL, "fcnt F_GETFL failed "
+ tst_brkm(TBROK, tst_exit, "fcnt F_GETFL failed "
"cflag:%d, errno:%d", cflag, errno);
error = fcntl(sk, F_SETFL, sflag | O_NONBLOCK);
if (error < 0)
- tst_brkm(TBROK, NULL, "fcnt F_SETFL failed "
+ tst_brkm(TBROK, tst_exit, "fcnt F_SETFL failed "
"error:%d, errno:%d", error, errno);
error = connect(sk, (const struct sockaddr *)&conn_addr, len);
if (error != -1 || errno != EINPROGRESS)
- tst_brkm(TBROK, NULL, "non-blocking connect "
+ tst_brkm(TBROK, tst_exit, "non-blocking connect "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "non-blocking connect() - EINPROGRESS");
@@ -151,14 +148,12 @@ int main(int argc, char *argv[])
/* TEST3: Now that connect() called, accept will succeed */
acpt_sk = accept(lstn_sk, (struct sockaddr *)&svr_addr, &len);
if (acpt_sk < 0)
- tst_brkm(TBROK, NULL, "accept after a non-blocking connect "
+ tst_brkm(TBROK, tst_exit, "accept after a non-blocking connect "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "accept() after a non-blocking connect - SUCCESS");
memset(&outmessage, 0, sizeof(outmessage));
- buffer_snd = malloc(REALLY_BIG);
-
outmessage.msg_name = &svr_addr;
outmessage.msg_namelen = sizeof(svr_addr);
outmessage.msg_iov = &out_iov;
@@ -175,10 +170,7 @@ int main(int argc, char *argv[])
sinfo = (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg);
memset(sinfo, 0x00, sizeof(struct sctp_sndrcvinfo));
- iov.iov_base = buffer_snd;
- iov.iov_len = REALLY_BIG;
outmessage.msg_iov->iov_base = message;
-
outmessage.msg_iov->iov_len = strlen(message) + 1;
memset(&inmessage, 0, sizeof(inmessage));
@@ -196,12 +188,12 @@ int main(int argc, char *argv[])
/* TEST4: recvmsg() should return EAGAIN instead blocking */
error = recvmsg(sk, &inmessage, MSG_WAITALL);
if (error != -1 || errno != EAGAIN)
- tst_brkm(TBROK, NULL, "non-blocking recvmsg "
+ tst_brkm(TBROK, tst_exit, "non-blocking recvmsg "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "non-blocking recvmsg() - EAGAIN");
- count = test_sendmsg(acpt_sk, &outmessage, flag, msg_count);
+ test_sendmsg(acpt_sk, &outmessage, flag, msg_count);
/* TEST5: recvmsg() should succeed now as data is available. */
error = test_recvmsg(sk, &inmessage, flag);
@@ -212,5 +204,5 @@ int main(int argc, char *argv[])
close(lstn_sk);
close(acpt_sk);
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_recvfrom.c b/testcases/network/sctp/func_tests/test_1_to_1_recvfrom.c
index 658692b..b75016d 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_recvfrom.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_recvfrom.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P
* (C) Copyright IBM Corp. 2004
*
@@ -12,13 +12,13 @@
* TEST6: Reading the pending message on socket that received SHUTDOWN
* TEST7: No more message and association is shutdown
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -62,7 +62,7 @@ int TST_CNT = 0;
int main(int argc, char *argv[])
{
- int ret, msg_count;
+ int msg_count;
socklen_t len;
int sk, pf_class, lstn_sk, acpt_sk, flag;
char *message = "hello, world!\n";
@@ -115,7 +115,7 @@ int main(int argc, char *argv[])
count = recvfrom(-1, message_rcv, msg_count, flag,
(struct sockaddr *)&svr_addr, &len);
if (count != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "recvfrom with a bad socket "
+ tst_brkm(TBROK, tst_exit, "recvfrom with a bad socket "
"descriptor count:%d, errno:%d", count, errno);
tst_resm(TPASS, "recvfrom() with a bad socket descriptor - EBADF");
@@ -124,7 +124,7 @@ int main(int argc, char *argv[])
count = recvfrom(0, message_rcv, msg_count, flag,
(struct sockaddr *)&svr_addr, &len);
if (count != -1 || errno != ENOTSOCK)
- tst_brkm(TBROK, NULL, "recvfrom with invalid socket "
+ tst_brkm(TBROK, tst_exit, "recvfrom with invalid socket "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "recvfrom() with invalid socket - ENOTSOCK");
@@ -133,7 +133,7 @@ int main(int argc, char *argv[])
count = recvfrom(acpt_sk, (char *)-1, msg_count, flag,
(struct sockaddr *)&svr_addr, &len);
if (count != -1 || errno != EFAULT)
- tst_brkm(TBROK, NULL, "recvfrom with invalid message "
+ tst_brkm(TBROK, tst_exit, "recvfrom with invalid message "
"pointer count:%d, errno:%d", count, errno);
tst_resm(TPASS, "recvfrom() with invalid message ptr - EFAULT");
@@ -142,20 +142,20 @@ int main(int argc, char *argv[])
count = recvfrom(lstn_sk, message_rcv, msg_count, flag,
(struct sockaddr *)&svr_addr, &len);
if (count != -1 || errno != ENOTCONN)
- tst_brkm(TBROK, NULL, "recvfrom on listening socket "
+ tst_brkm(TBROK, tst_exit, "recvfrom on listening socket "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "recvfrom() on listening socket - ENOTCONN");
count = test_send(acpt_sk, message, msg_count, flag);
- ret = test_shutdown(sk, SHUT_WR);
+ test_shutdown(sk, SHUT_WR);
/*recvfrom () TEST5:reading on a socket that received SHUTDOWN */
count = recvfrom(acpt_sk, message_rcv, msg_count, flag,
(struct sockaddr *)&svr_addr, &len);
if (count < 0)
- tst_brkm(TBROK, NULL, "recvfrom on a socket that has "
+ tst_brkm(TBROK, tst_exit, "recvfrom on a socket that has "
"received shutdown count:%d, errno:%d", count, errno);
tst_resm(TPASS, "recvfrom() on a socket that has received shutdown - "
@@ -166,7 +166,7 @@ int main(int argc, char *argv[])
count = recvfrom(sk, message_rcv, msg_count, flag,
(struct sockaddr *)&svr_addr, &len);
if (count < 0)
- tst_brkm(TBROK, NULL, "recvfrom on a socket with pending "
+ tst_brkm(TBROK, tst_exit, "recvfrom on a socket with pending "
"message that has sent shutdown count:%d, errno:%d",
count, errno);
@@ -178,7 +178,7 @@ int main(int argc, char *argv[])
count = recvfrom(sk, message_rcv, msg_count, flag,
(struct sockaddr *)&svr_addr, &len);
if (count != -1 || errno != ENOTCONN)
- tst_brkm(TBROK, NULL, "recvfrom on a socket with no "
+ tst_brkm(TBROK, tst_exit, "recvfrom on a socket with no "
"pending messages and has sent shutdown count:%d, "
"errno:%d", count, errno);
@@ -188,6 +188,6 @@ int main(int argc, char *argv[])
close(sk);
close(lstn_sk);
close(acpt_sk);
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_recvmsg.c b/testcases/network/sctp/func_tests/test_1_to_1_recvmsg.c
index a40b16d..3e02678 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_recvmsg.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_recvmsg.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P
* (C) Copyright IBM Corp. 2004
*
@@ -13,13 +13,13 @@
* TEST7: Reading the pending message socket that received SHUTDOWN
* TEST8: No more message and association is shutdown
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -64,7 +64,6 @@ int TST_CNT = 0;
int main(int argc, char *argv[])
{
socklen_t len;
- int ret;
int sk, pf_class, lstn_sk, acpt_sk;
int flag = 0;
struct msghdr inmessage;
@@ -122,7 +121,7 @@ int main(int argc, char *argv[])
/*recvmsg () TEST1: Bad socket descriptor, EBADF Expected error */
count = recvmsg(-1, &inmessage, flag);
if (count != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "recvmsg with a bad socket "
+ tst_brkm(TBROK, tst_exit, "recvmsg with a bad socket "
"descriptor count:%d, errno:%d", count, errno);
tst_resm(TPASS, "recvmsg() with a bad socket descriptor - EBADF");
@@ -130,7 +129,7 @@ int main(int argc, char *argv[])
/*recvmsg () TEST2: Invalid socket , ENOTSOCK Expected error */
count = recvmsg(0, &inmessage, flag);
if (count != -1 || errno != ENOTSOCK)
- tst_brkm(TBROK, NULL, "recvmsg with invalid socket "
+ tst_brkm(TBROK, tst_exit, "recvmsg with invalid socket "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "recvmsg() with invalid socket - ENOTSOCK");
@@ -139,7 +138,7 @@ int main(int argc, char *argv[])
inmessage.msg_iov = (struct iovec *)-1;
count = recvmsg(acpt_sk, &inmessage, flag);
if (count != -1 || errno != EFAULT)
- tst_brkm(TBROK, NULL, "recvmsg with invalid iovec "
+ tst_brkm(TBROK, tst_exit, "recvmsg with invalid iovec "
"pointer count:%d, errno:%d", count, errno);
tst_resm(TPASS, "recvmsg() with invalid iovec ptr - EFAULT");
@@ -149,7 +148,7 @@ int main(int argc, char *argv[])
/*recvmsg () TEST4: Invalid msghdr pointer EFAULT, Expected error */
count = recvmsg(acpt_sk, (struct msghdr *)-1, flag);
if (count != -1 || errno != EFAULT)
- tst_brkm(TBROK, NULL, "recvmsg with invalid msghdr "
+ tst_brkm(TBROK, tst_exit, "recvmsg with invalid msghdr "
"pointer count:%d, errno:%d", count, errno);
tst_resm(TPASS, "recvmsg() with invalid msghdr ptr - EFAULT");
@@ -157,20 +156,20 @@ int main(int argc, char *argv[])
/*recvmsg () TEST5:recvmsg on listening socket,ENOTCONN Expected error */
count = recvmsg(lstn_sk, &inmessage, flag);
if (count != -1 || errno != ENOTCONN)
- tst_brkm(TBROK, NULL, "recvmsg on listening socket "
+ tst_brkm(TBROK, tst_exit, "recvmsg on listening socket "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "recvmsg() on listening socket - ENOTCONN");
count = test_send(acpt_sk, message1, strlen(message), 0);
- ret = test_shutdown(sk, SHUT_WR);
+ test_shutdown(sk, SHUT_WR);
flag = MSG_NOSIGNAL;
/*recvmsg () TEST6:reading on a socket that received SHUTDOWN */
count = recvmsg(acpt_sk, &inmessage, flag);
if (count < 0)
- tst_brkm(TBROK, NULL, "recvmsg on a socket that has "
+ tst_brkm(TBROK, tst_exit, "recvmsg on a socket that has "
"received shutdown count:%d, errno:%d", count, errno);
tst_resm(TPASS, "recvmsg() on a socket that has received shutdown - "
@@ -180,7 +179,7 @@ int main(int argc, char *argv[])
SHUTDOWN */
count = recvmsg(sk, &inmessage, flag);
if (count < 0)
- tst_brkm(TBROK, NULL, "recvmsg on a socket with pending "
+ tst_brkm(TBROK, tst_exit, "recvmsg on a socket with pending "
"message that has sent shutdown count:%d, errno:%d",
count, errno);
@@ -191,7 +190,7 @@ int main(int argc, char *argv[])
ENOTCONN Expected error */
count = recvmsg(sk, &inmessage, flag);
if (count != -1 || errno != ENOTCONN)
- tst_brkm(TBROK, NULL, "recvmsg on a socket with no "
+ tst_brkm(TBROK, tst_exit, "recvmsg on a socket with no "
"pending messages and has sent shutdown count:%d, "
"errno:%d", count, errno);
@@ -201,5 +200,5 @@ int main(int argc, char *argv[])
close(sk);
close(lstn_sk);
close(acpt_sk);
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_rtoinfo.c b/testcases/network/sctp/func_tests/test_1_to_1_rtoinfo.c
index c31bdd9..85293e8 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_rtoinfo.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_rtoinfo.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P
* (C) Copyright IBM Corp. 2004
*
@@ -9,13 +9,13 @@
* the value using setsockopt() and gets the set value using getsockopt().
* A comparison between set values and get values are performed.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -72,7 +72,7 @@ int main(void)
/*TEST1 Getting the default values using getsockopt() */
ret = getsockopt(sd, IPPROTO_SCTP, SCTP_RTOINFO, &grtoinfo, &len);
if (ret < 0)
- tst_brkm(TBROK, NULL, "getsockopt SCTP_RTOINFO "
+ tst_brkm(TBROK, tst_exit, "getsockopt SCTP_RTOINFO "
"ret:%d, errno:%d", ret, errno);
tst_resm(TPASS, "getsockopt() SCTP_RTOINFO - SUCCESS");
@@ -86,7 +86,7 @@ int main(void)
ret = setsockopt(sd, IPPROTO_SCTP, SCTP_RTOINFO, &srtoinfo,
sizeof(struct sctp_rtoinfo));
if (ret < 0)
- tst_brkm(TBROK, NULL, "setsockopt SCTP_RTOINFO "
+ tst_brkm(TBROK, tst_exit, "setsockopt SCTP_RTOINFO "
"ret:%d, errno:%d", ret, errno);
tst_resm(TPASS, "setsockopt() SCTP_RTOINFO - SUCCESS");
@@ -94,14 +94,14 @@ int main(void)
/*Getting the values which are set using setsockopt() */
ret = getsockopt(sd, IPPROTO_SCTP, SCTP_RTOINFO, &grtoinfo, &len);
if (ret < 0)
- tst_brkm(TBROK, NULL, "getsockopt SCTP_RTOINFO "
+ tst_brkm(TBROK, tst_exit, "getsockopt SCTP_RTOINFO "
"ret:%d, errno:%d", ret, errno);
/* TEST3 Compare the get values with the set values. */
if (srtoinfo.srto_initial != grtoinfo.srto_initial &&
srtoinfo.srto_max != grtoinfo.srto_max &&
srtoinfo.srto_min != grtoinfo.srto_min)
- tst_brkm(TBROK, NULL, "setsockopt/getsockopt SCTP_RTOINFO "
+ tst_brkm(TBROK, tst_exit, "setsockopt/getsockopt SCTP_RTOINFO "
"compare failed");
tst_resm(TPASS, "setsockopt()/getsockopt SCTP_RTOINFO compare - "
@@ -109,5 +109,5 @@ int main(void)
close(sd);
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_send.c b/testcases/network/sctp/func_tests/test_1_to_1_send.c
index a8dc8f5..5b47e74 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_send.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_send.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P
* (C) Copyright IBM Corp. 2004
*
@@ -13,13 +13,13 @@
* TEST7: send from server to client
* TEST8: sending partial data from a buffer
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -111,7 +111,7 @@ int main(int argc, char *argv[])
/*send () TEST1: Bad socket descriptor, EBADF Expected error */
count = send(-1, message, len_snd, flag);
if (count != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "send with a bad socket "
+ tst_brkm(TBROK, tst_exit, "send with a bad socket "
"descriptor count:%d, errno:%d", count, errno);
tst_resm(TPASS, "send() with a bad socket descriptor - EBADF");
@@ -119,7 +119,7 @@ int main(int argc, char *argv[])
/*send () TEST2: Invalid socket, ENOTSOCK Expected error */
count = send(0, message, len_snd, flag);
if (count != -1 || errno != ENOTSOCK)
- tst_brkm(TBROK, NULL, "send with invalid socket "
+ tst_brkm(TBROK, tst_exit, "send with invalid socket "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "send() with invalid socket - ENOTSOCK");
@@ -127,7 +127,7 @@ int main(int argc, char *argv[])
/*send () TEST3: send on listening socket, EPIPE Expected error */
count = send(lstn_sk, message, len_snd, flag);
if (count != -1 || errno != EPIPE)
- tst_brkm(TBROK, NULL, "send on a listening socket "
+ tst_brkm(TBROK, tst_exit, "send on a listening socket "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "send() on a listening socket - EPIPE");
@@ -136,7 +136,7 @@ int main(int argc, char *argv[])
/* FIXME this test should pass. Don't catch why... */
count = send(sk, (char *)0x1, len_snd, flag);
if (count != -1 || errno != EFAULT)
- tst_brkm(TBROK, NULL, "send with invalid message "
+ tst_brkm(TBROK, tst_exit, "send with invalid message "
"pointer count:%d, errno:%d", count, errno);
tst_resm(TPASS, "send() with invalid message ptr - EFAULT");
@@ -153,11 +153,12 @@ int main(int argc, char *argv[])
/*send () TEST5: send on closed association, EPIPE Expected error */
count = send(acpt1_sk, message, len_snd, flag);
if (count != -1 || errno != EPIPE)
- tst_brkm(TBROK, NULL, "send on a closed association "
+ tst_brkm(TBROK, tst_exit, "send on a closed association "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "send() on a closed association - EPIPE");
+ close(acpt1_sk);
close(sk);
close(lstn_sk);
close(acpt_sk);
@@ -189,7 +190,7 @@ int main(int argc, char *argv[])
/*send() TEST6: Sending data from client socket to server socket */
count = send(sk, message, msg_count, flag);
if (count != msg_count)
- tst_brkm(TBROK, NULL, "send from client to server "
+ tst_brkm(TBROK, tst_exit, "send from client to server "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "send() from client to server - SUCCESS");
@@ -201,7 +202,7 @@ int main(int argc, char *argv[])
/*send() TEST7: Sending data from accept socket to client socket */
count = send(acpt_sk, message, msg_count, flag);
if (count != msg_count)
- tst_brkm(TBROK, NULL, "send from accept socket to client "
+ tst_brkm(TBROK, tst_exit, "send from accept socket to client "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "send() from accept socket to client - SUCCESS");
@@ -224,5 +225,5 @@ int main(int argc, char *argv[])
close(lstn_sk);
close(acpt_sk);
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_sendmsg.c b/testcases/network/sctp/func_tests/test_1_to_1_sendmsg.c
index dffdde5..4053cca 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_sendmsg.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_sendmsg.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P
* (C) Copyright IBM Corp. 2004
*
@@ -20,13 +20,13 @@
* TEST13: Sending data from unconnected client to server
* TEST14: Sending a message on SHUT_RD socket
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -75,15 +75,12 @@ int main(int argc, char *argv[])
int sk, sk1, pf_class, lstn_sk, acpt_sk, acpt1_sk, flag;
struct msghdr outmessage;
char *message = "hello, world!\n";
- struct iovec iov;
struct sctp_sndrcvinfo *sinfo;
int count;
char outcmsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))];
struct cmsghdr *cmsg;
struct iovec out_iov;
- char *buffer;
struct msghdr inmessage;
- char *buffer_snd;
char *buffer_rcv;
struct sockaddr_in conn_addr, lstn_addr, svr_addr;
struct iovec iov_rcv;
@@ -124,8 +121,6 @@ int main(int argc, char *argv[])
acpt_sk = test_accept(lstn_sk, (struct sockaddr *)&svr_addr, &len);
memset(&outmessage, 0, sizeof(outmessage));
- buffer = malloc(REALLY_BIG);
-
outmessage.msg_name = &conn_addr;
outmessage.msg_namelen = sizeof(conn_addr);
outmessage.msg_iov = &out_iov;
@@ -142,17 +137,14 @@ int main(int argc, char *argv[])
sinfo = (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg);
memset(sinfo, 0x00, sizeof(struct sctp_sndrcvinfo));
- iov.iov_base = buffer;
- iov.iov_len = REALLY_BIG;
outmessage.msg_iov->iov_base = message;
-
outmessage.msg_iov->iov_len = strlen(message) + 1;
flag = MSG_NOSIGNAL;
/*sendmsg () TEST1: Bad socket descriptor, EBADF Expected error */
count = sendmsg(-1, &outmessage, flag);
if (count != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "sendmsg with a bad socket "
+ tst_brkm(TBROK, tst_exit, "sendmsg with a bad socket "
"descriptor count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendmsg() with a bad socket descriptor - EBADF");
@@ -160,7 +152,7 @@ int main(int argc, char *argv[])
/*sendmsg () TEST2: Invalid socket, ENOTSOCK Expected error */
count = sendmsg(0, &outmessage, flag);
if (count != -1 || errno != ENOTSOCK)
- tst_brkm(TBROK, NULL, "sendmsg with invalid socket "
+ tst_brkm(TBROK, tst_exit, "sendmsg with invalid socket "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendmsg() with invalid socket - ENOTSOCK");
@@ -168,7 +160,7 @@ int main(int argc, char *argv[])
/*sendmsg () TEST3: sendmsg on listening socket, EPIPE Expected error */
count = sendmsg(lstn_sk, &outmessage, flag);
if (count != -1 || errno != EPIPE)
- tst_brkm(TBROK, NULL, "sendmsg on a listening socket "
+ tst_brkm(TBROK, tst_exit, "sendmsg on a listening socket "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendmsg() on a listening socket - EPIPE");
@@ -177,7 +169,7 @@ int main(int argc, char *argv[])
outmessage.msg_iov = (struct iovec *)-1;
count = sendmsg(sk, &outmessage, flag);
if (count != -1 || errno != EFAULT)
- tst_brkm(TBROK, NULL, "sendmsg with invalid iovec "
+ tst_brkm(TBROK, tst_exit, "sendmsg with invalid iovec "
"pointer count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendmsg() with invalid iovec ptr - EFAULT");
@@ -188,7 +180,7 @@ int main(int argc, char *argv[])
outmessage.msg_iovlen = 0;
count = sendmsg(sk, &outmessage, flag);
if (count != -1 || errno != EINVAL)
- tst_brkm(TBROK, NULL, "sendmsg with invalid iovec "
+ tst_brkm(TBROK, tst_exit, "sendmsg with invalid iovec "
"length count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendmsg() with invalid iovec length - EINVAL");
@@ -198,7 +190,7 @@ int main(int argc, char *argv[])
/*sendmsg () TEST6: Invalid msghdr pointer EFAULT, Expected error */
count = sendmsg(sk, (struct msghdr *)-1, flag);
if (count != -1 || errno != EFAULT)
- tst_brkm(TBROK, NULL, "sendmsg with invalid msghdr "
+ tst_brkm(TBROK, tst_exit, "sendmsg with invalid msghdr "
"pointer count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendmsg() with invalid msghdr ptr - EFAULT");
@@ -207,7 +199,7 @@ int main(int argc, char *argv[])
sinfo->sinfo_flags = 999;
count = sendmsg(sk, &outmessage, -1);
if (count != -1 || errno != EINVAL)
- tst_brkm(TBROK, NULL, "sendmsg with invalid sinfo "
+ tst_brkm(TBROK, tst_exit, "sendmsg with invalid sinfo "
"flags count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendmsg() with invalid sinfo flags - EINVAL");
@@ -216,7 +208,7 @@ int main(int argc, char *argv[])
sinfo->sinfo_flags = SCTP_EOF;
count = sendmsg(sk, &outmessage, flag);
if (count != -1 || errno != EINVAL)
- tst_brkm(TBROK, NULL, "sendmsg with SCTP_EOF flag "
+ tst_brkm(TBROK, tst_exit, "sendmsg with SCTP_EOF flag "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendmsg() with SCTP_EOF flag - EINVAL");
@@ -225,7 +217,7 @@ int main(int argc, char *argv[])
sinfo->sinfo_flags = SCTP_ABORT;
count = sendmsg(sk, &outmessage, flag);
if (count != -1 || errno != EINVAL)
- tst_brkm(TBROK, NULL, "sendmsg with SCTP_ABORT flag "
+ tst_brkm(TBROK, tst_exit, "sendmsg with SCTP_ABORT flag "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendmsg() with SCTP_ABORT flag - EINVAL");
@@ -242,11 +234,12 @@ int main(int argc, char *argv[])
/*sendmsg () TEST10:sendmsg on closed association, EPIPE Expected error */
count = sendmsg(acpt1_sk, &outmessage, flag);
if (count != -1 || errno != EPIPE)
- tst_brkm(TBROK, NULL, "sendmsg on a closed association "
+ tst_brkm(TBROK, tst_exit, "sendmsg on a closed association "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendmsg() on a closed association - EPIPE");
+ close(acpt1_sk);
close(sk);
close(lstn_sk);
close(acpt_sk);
@@ -277,8 +270,6 @@ int main(int argc, char *argv[])
acpt_sk = test_accept(lstn_sk, (struct sockaddr *)&svr_addr, &len);
memset(&outmessage, 0, sizeof(outmessage));
- buffer_snd = malloc(REALLY_BIG);
-
outmessage.msg_name = &svr_addr;
outmessage.msg_namelen = sizeof(svr_addr);
outmessage.msg_iov = &out_iov;
@@ -295,10 +286,7 @@ int main(int argc, char *argv[])
sinfo = (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg);
memset(sinfo, 0x00, sizeof(struct sctp_sndrcvinfo));
- iov.iov_base = buffer_snd;
- iov.iov_len = REALLY_BIG;
outmessage.msg_iov->iov_base = message;
-
outmessage.msg_iov->iov_len = strlen(message) + 1;
memset(&inmessage, 0, sizeof(inmessage));
@@ -316,7 +304,7 @@ int main(int argc, char *argv[])
/*sendmsg() TEST11: Sending data from server socket to client socket */
count = sendmsg(acpt_sk, &outmessage, flag);
if (count != msg_count)
- tst_brkm(TBROK, NULL, "sendmsg from accept socket to "
+ tst_brkm(TBROK, tst_exit, "sendmsg from accept socket to "
"client count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendmsg() from accept socket to client - SUCCESS");
@@ -329,7 +317,7 @@ int main(int argc, char *argv[])
/*sendmsg() TEST12: Sending data from client socket to server socket */
count = sendmsg(sk, &outmessage, flag);
if (count != msg_count)
- tst_brkm(TBROK, NULL, "sendmsg from client to server "
+ tst_brkm(TBROK, tst_exit, "sendmsg from client to server "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendmsg() from client to server - SUCCESS");
@@ -347,7 +335,7 @@ int main(int argc, char *argv[])
server socket */
count = sendmsg(sk1, &outmessage, flag);
if (count != msg_count)
- tst_brkm(TBROK, NULL, "sendmsg from unconnected client to "
+ tst_brkm(TBROK, tst_exit, "sendmsg from unconnected client to "
"server count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendmsg() from unconnected clt to server - SUCCESS");
@@ -362,7 +350,7 @@ int main(int argc, char *argv[])
/*sendmsg() TEST14: Sending a message on SHUT_RD socket */
count = sendmsg(sk1, &outmessage, flag);
if (count != msg_count)
- tst_brkm(TBROK, NULL, "sendmsg on a SHUT_RD socket "
+ tst_brkm(TBROK, tst_exit, "sendmsg on a SHUT_RD socket "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendmsg() on a SHUT_RD socket - SUCCESS");
@@ -373,5 +361,5 @@ int main(int argc, char *argv[])
close(sk1);
close(lstn_sk);
close(acpt_sk);
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_sendto.c b/testcases/network/sctp/func_tests/test_1_to_1_sendto.c
index d576d77..1b88d88 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_sendto.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_sendto.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P
* (C) Copyright IBM Corp. 2004
*
@@ -10,13 +10,13 @@
* TEST3: Sending data from unconnected client socket to server
* TEST4: sending partial data from a buffer
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -108,7 +108,7 @@ int main(int argc, char *argv[])
count = sendto(sk, message, msg_count, flag,
(const struct sockaddr *)&conn_addr, len);
if (count != msg_count)
- tst_brkm(TBROK, NULL, "sendto from client to server "
+ tst_brkm(TBROK, tst_exit, "sendto from client to server "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendto() from client to server - SUCCESS");
@@ -121,7 +121,7 @@ int main(int argc, char *argv[])
count = sendto(acpt_sk, message, msg_count, flag,
(const struct sockaddr *)&svr_addr, len);
if (count != msg_count)
- tst_brkm(TBROK, NULL, "sendto from accept socket to client "
+ tst_brkm(TBROK, tst_exit, "sendto from accept socket to client "
"count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendto() from accept socket to client - SUCCESS");
@@ -138,7 +138,7 @@ int main(int argc, char *argv[])
count = sendto(sk1, message, msg_count, flag,
(const struct sockaddr *)&conn_addr, len);
if (count != msg_count)
- tst_brkm(TBROK, NULL, "sendto from unconnected client to "
+ tst_brkm(TBROK, tst_exit, "sendto from unconnected client to "
"server count:%d, errno:%d", count, errno);
tst_resm(TPASS, "sendto() from unconnected client to server - SUCCESS");
@@ -158,6 +158,6 @@ int main(int argc, char *argv[])
close(sk1);
close(lstn_sk);
close(acpt_sk);
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_shutdown.c b/testcases/network/sctp/func_tests/test_1_to_1_shutdown.c
index 02c8bf8..a9d1e9b 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_shutdown.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_shutdown.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P
* (C) Copyright IBM Corp. 2004
*
@@ -11,13 +11,13 @@
* TEST5: shutdown with SHUT_RDWR flag to disable new receive/send
* TEST6: Unconnected socket
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -105,7 +105,7 @@ int main(int argc, char *argv[])
/*shutdown() TEST1: Bad socket descriptor, EBADF Expected error */
error = shutdown(-1, SHUT_WR);
if (error != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "shutdown with a bad socket "
+ tst_brkm(TBROK, tst_exit, "shutdown with a bad socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "shutdown() with a bad socket descriptor - EBADF");
@@ -113,7 +113,7 @@ int main(int argc, char *argv[])
/*shutdown() TEST2: Invalid socket, ENOTSOCK Expected error */
error = shutdown(0, SHUT_WR);
if (error != -1 || errno != ENOTSOCK)
- tst_brkm(TBROK, NULL, "shutdown with an invalid socket "
+ tst_brkm(TBROK, tst_exit, "shutdown with an invalid socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "shutdown() with an invalid socket - ENOTSOCK");
@@ -125,7 +125,7 @@ int main(int argc, char *argv[])
/*shutdown() TEST3: shutdown with SHUT_WR flag to disable new send */
error = shutdown(clnt_sk[0], SHUT_WR);
if (error < 0)
- tst_brkm(TBROK, NULL, "shutdown with SHUT_WR flag "
+ tst_brkm(TBROK, tst_exit, "shutdown with SHUT_WR flag "
"error:%d, errno:%d", error, errno);
/* Reading on a socket that has received SHUTDOWN should return 0
@@ -133,7 +133,7 @@ int main(int argc, char *argv[])
*/
error = recv(acpt_sk[0], msgbuf, 100, 0);
if ((error != 0) || (errno != 0))
- tst_brkm(TBROK, NULL, "recv on a SHUTDOWN received socket "
+ tst_brkm(TBROK, tst_exit, "recv on a SHUTDOWN received socket "
"error:%d, errno:%d", error, errno);
/* Read the pending message on clnt_sk[0] that was received before
@@ -144,7 +144,7 @@ int main(int argc, char *argv[])
/* No more messages and the association is SHUTDOWN, should fail. */
error = recv(clnt_sk[0], msgbuf, 100, 0);
if ((error != -1) || (errno != ENOTCONN))
- tst_brkm(TBROK, NULL, "recv on a SHUT_WR socket with no "
+ tst_brkm(TBROK, tst_exit, "recv on a SHUT_WR socket with no "
"messages error:%d, errno:%d", error, errno);
tst_resm(TPASS, "shutdown() with SHUT_WR flag - SUCCESS");
@@ -156,13 +156,13 @@ int main(int argc, char *argv[])
error = recv(clnt_sk[1], msgbuf, 100, 0);
if ((error != 0) || (errno != 0))
- tst_brkm(TBROK, NULL, "recv on a SHUT_RD socket "
+ tst_brkm(TBROK, tst_exit, "recv on a SHUT_RD socket "
"error:%d, errno:%d", error, errno);
/* Sending a message on SHUT_RD socket. */
error = test_send(clnt_sk[1], message, strlen(message), 0);
if (error < 0)
- tst_brkm(TBROK, NULL, "send on a SHUT_RD socket "
+ tst_brkm(TBROK, tst_exit, "send on a SHUT_RD socket "
"error:%d, errno:%d", error, errno);
/* Receive the message sent on SHUT_RD socket. */
@@ -174,7 +174,7 @@ int main(int argc, char *argv[])
/* We should not receive the message as the socket is SHUT_RD */
error = recv(clnt_sk[1], msgbuf, 100, 0);
if ((error != 0) || (errno != 0))
- tst_brkm(TBROK, NULL, "recv on a SHUT_RD socket "
+ tst_brkm(TBROK, tst_exit, "recv on a SHUT_RD socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "shutdown() with SHUT_RD flag - SUCCESS");
@@ -185,12 +185,12 @@ int main(int argc, char *argv[])
error = recv(acpt_sk[2], msgbuf, 100, 0);
if ((error != 0) || (errno != 0))
- tst_brkm(TBROK, NULL, "recv on a SHUTDOWN received socket "
+ tst_brkm(TBROK, tst_exit, "recv on a SHUTDOWN received socket "
"error:%d, errno:%d", error, errno);
error = recv(clnt_sk[2], msgbuf, 100, 0);
if ((error != 0) || (errno != 0))
- tst_brkm(TBROK, NULL, "recv on a SHUT_RDWR socket "
+ tst_brkm(TBROK, tst_exit, "recv on a SHUT_RDWR socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "shutdown() with SHUT_RDWR flag - SUCCESS");
@@ -198,7 +198,7 @@ int main(int argc, char *argv[])
/*shutdown() TEST6: Unconnected socket, ENOTCONN Expected error */
error = shutdown(sk, SHUT_RD);
if ((error != -1) || (errno != ENOTCONN))
- tst_brkm(TBROK, NULL, "shutdown on an unconnected socket "
+ tst_brkm(TBROK, tst_exit, "shutdown on an unconnected socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "shutdown() on an unconnected socket - SUCCESS");
@@ -211,5 +211,5 @@ int main(int argc, char *argv[])
close(lstn_sk);
close(sk);
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_socket_bind_listen.c b/testcases/network/sctp/func_tests/test_1_to_1_socket_bind_listen.c
index 086ce0b..a201117 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_socket_bind_listen.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_socket_bind_listen.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P
* (C) Copyright IBM Corp. 2004
*
@@ -29,13 +29,13 @@
* TEST14: Invalid socket
* TEST15: Listening a bound socket
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -98,7 +98,7 @@ int main(int argc, char *argv[])
/* socket() TEST1: Invalid domain, EAFNOSUPPORT Expected error */
sk = socket(-1, SOCK_STREAM, IPPROTO_SCTP);
if (sk != -1 || errno != EAFNOSUPPORT)
- tst_brkm(TBROK, NULL, "socket() with invalid domain "
+ tst_brkm(TBROK, tst_exit, "socket() with invalid domain "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "socket() with invalid domain - EAFNOSUPPORT");
@@ -106,7 +106,7 @@ int main(int argc, char *argv[])
/*socket() TEST2 : Invalid type, EINVAL Expected error */
sk = socket(pf_class, -1, IPPROTO_SCTP);
if (sk != -1 || errno != EINVAL)
- tst_brkm(TBROK, NULL, "socket() with invalid type "
+ tst_brkm(TBROK, tst_exit, "socket() with invalid type "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "socket() with invalid type - EINVAL");
@@ -114,7 +114,7 @@ int main(int argc, char *argv[])
/*socket() TEST3: opening a socket */
sk = socket(pf_class, SOCK_STREAM, IPPROTO_SCTP);
if (sk < 0)
- tst_brkm(TBROK, NULL, "valid socket() call "
+ tst_brkm(TBROK, tst_exit, "valid socket() call "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "socket() - SUCCESS");
@@ -122,7 +122,7 @@ int main(int argc, char *argv[])
/*bind() TEST4: Invalid structure, EFAULT Expected error */
error = bind(sk, (struct sockaddr *)-1, sizeof(struct sockaddr_in));
if (error != -1 || errno != EFAULT)
- tst_brkm(TBROK, NULL, "bind() with invalid address ptr "
+ tst_brkm(TBROK, tst_exit, "bind() with invalid address ptr "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "bind() with invalid address ptr - EFAULT");
@@ -134,7 +134,7 @@ int main(int argc, char *argv[])
error = bind(sk, (struct sockaddr *)&bind_addr, sizeof(bind_addr) - 2);
if (error != -1 || errno != EINVAL)
- tst_brkm(TBROK, NULL, "bind() with invalid address length "
+ tst_brkm(TBROK, tst_exit, "bind() with invalid address length "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "bind() with invalid address length - EINVAL");
@@ -142,7 +142,7 @@ int main(int argc, char *argv[])
/*bind() TEST6: Invalid socket descriptor, ENOTSOCK Expect Error */
error = bind(0, (struct sockaddr *)&bind_addr, sizeof(bind_addr));
if (error != -1 || errno != ENOTSOCK)
- tst_brkm(TBROK, NULL, "bind() with invalid socket "
+ tst_brkm(TBROK, tst_exit, "bind() with invalid socket "
"descriptor error:%d, errno:%d", error, errno);
tst_resm(TPASS, "bind() with invalid socket descriptor - ENOTSOCK");
@@ -152,7 +152,7 @@ int main(int argc, char *argv[])
bind_addr.sin_addr.s_addr = inet_addr(SCTP_INV_LOOPBACK);
error = bind(sk, (struct sockaddr *)&bind_addr, sizeof(bind_addr));
if (error != -1 || errno != EADDRNOTAVAIL)
- tst_brkm(TBROK, NULL, "bind() with invalid local "
+ tst_brkm(TBROK, tst_exit, "bind() with invalid local "
"address error:%d, errno:%d", error, errno);
tst_resm(TPASS, "bind() with invalid local address - EADDRNOTAVAIL");
@@ -165,7 +165,7 @@ int main(int argc, char *argv[])
error = bind(sk, (struct sockaddr *)&bind_addr, sizeof(bind_addr));
if (error != -1 || errno != EINVAL)
- tst_brkm(TBROK, NULL, "bind() on an already bound socket "
+ tst_brkm(TBROK, tst_exit, "bind() on an already bound socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "bind() on an already bound socket - EINVAL");
@@ -184,7 +184,7 @@ int main(int argc, char *argv[])
error = bind(sk, (struct sockaddr *)&bind_addr,
sizeof(bind_addr));
if (error != -1 || errno != EACCES)
- tst_brkm(TBROK, NULL, "bind() on reserverd port "
+ tst_brkm(TBROK, tst_exit, "bind() on reserverd port "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "bind() on reserved port - EACCESS");
@@ -196,7 +196,7 @@ int main(int argc, char *argv[])
bind_addr.sin_port = htons(SCTP_TESTPORT_1);
error = bind(sk, (struct sockaddr *)&bind_addr, sizeof(bind_addr));
if (error < 0)
- tst_brkm(TBROK, NULL, "bind() with INADDR_ANY address and "
+ tst_brkm(TBROK, tst_exit, "bind() with INADDR_ANY address and "
"non-zero port error:%d, errno:%d", error, errno);
tst_resm(TPASS, "bind() with INADDR_ANY address and non-zero port - "
@@ -213,7 +213,7 @@ int main(int argc, char *argv[])
bind_addr.sin_port = 0;
error = bind(sk, (struct sockaddr *)&bind_addr, sizeof(bind_addr));
if (error < 0)
- tst_brkm(TBROK, NULL, "bind() with INADDR_ANY address and "
+ tst_brkm(TBROK, tst_exit, "bind() with INADDR_ANY address and "
"zero port error:%d, errno:%d", error, errno);
tst_resm(TPASS, "bind() with INADDR_ANY address and zero port - "
@@ -231,7 +231,7 @@ int main(int argc, char *argv[])
bind_addr.sin_port = 0;
error = bind(sk, (struct sockaddr *)&bind_addr, sizeof(bind_addr));
if (error < 0)
- tst_brkm(TBROK, NULL, "bind() with local address and "
+ tst_brkm(TBROK, tst_exit, "bind() with local address and "
"zero port error:%d, errno:%d", error, errno);
tst_resm(TPASS, "bind() with local address and zero port - " "SUCCESS");
@@ -239,7 +239,7 @@ int main(int argc, char *argv[])
/*listen() TEST13: Bad socket descriptor EBADF, Expected error */
error = listen(-1, 3);
if (error != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "listen() with bad socket descriptor "
+ tst_brkm(TBROK, tst_exit, "listen() with bad socket descriptor "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "listen() with bad socket descriptor - EBADF");
@@ -247,7 +247,7 @@ int main(int argc, char *argv[])
/*listen() TEST14: Invalid socket ENOTSOCK, Expected error */
error = listen(0, 3);
if (error != -1 || errno != ENOTSOCK)
- tst_brkm(TBROK, NULL, "listen() with invalid socket "
+ tst_brkm(TBROK, tst_exit, "listen() with invalid socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "listen() with invalid socket - ENOTSOCK");
@@ -255,12 +255,12 @@ int main(int argc, char *argv[])
/*listen() TEST15:listen on a bound socket, should succeed */
error = listen(sk, 3);
if (error < 0)
- tst_brkm(TBROK, NULL, "listen() on a bound socket "
+ tst_brkm(TBROK, tst_exit, "listen() on a bound socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "listen() on a bound socket - SUCCESS");
close(sk);
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_sockopt.c b/testcases/network/sctp/func_tests/test_1_to_1_sockopt.c
index b12313b..5c7eca9 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_sockopt.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_sockopt.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P
* (C) Copyright IBM Corp. 2004
*
@@ -31,13 +31,13 @@
* TEST21: getsockopt: SCTP_ASSOCINFO
* TEST22: setsockopt: SCTP_ASSOCINFO
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -111,7 +111,7 @@ int main(void)
/*setsockopt() TEST1: Bad socket descriptor EBADF, Expected error */
error = setsockopt(-1, IPPROTO_SCTP, 0, 0, 0);
if (error != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "setsockopt with a bad socket "
+ tst_brkm(TBROK, tst_exit, "setsockopt with a bad socket "
"descriptor error:%d, errno:%d", error, errno);
tst_resm(TPASS, "setsockopt() with a bad socket descriptor - EBADF");
@@ -119,7 +119,7 @@ int main(void)
/*setsockopt() TEST2: Invalid socket ENOTSOCK, Expected error */
error = setsockopt(0, IPPROTO_SCTP, 0, 0, 0);
if (error != -1 || errno != ENOTSOCK)
- tst_brkm(TBROK, NULL, "setsockopt with an invalid socket "
+ tst_brkm(TBROK, tst_exit, "setsockopt with an invalid socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "setsockopt() with an invalid socket - ENOTSOCK");
@@ -127,7 +127,7 @@ int main(void)
/*setsockopt() TEST3: Invalid level ENOPROTOOPT, Expected error */
error = setsockopt(sk, -1, SCTP_RTOINFO, 0, 0);
if (error != -1 || errno != ENOPROTOOPT)
- tst_brkm(TBROK, NULL, "setsockopt with invalid level "
+ tst_brkm(TBROK, tst_exit, "setsockopt with invalid level "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "setsockopt() with an invalid level - ENOPROTOOPT");
@@ -137,7 +137,7 @@ int main(void)
(const struct sctp_rtoinfo *)-1,
sizeof(struct sctp_rtoinfo));
if (error != -1 || errno != EFAULT)
- tst_brkm(TBROK, NULL, "setsockopt with invalid option "
+ tst_brkm(TBROK, tst_exit, "setsockopt with invalid option "
"buffer error:%d, errno:%d", error, errno);
tst_resm(TPASS, "setsockopt() with invalid option buffer - EFAULT");
@@ -145,7 +145,7 @@ int main(void)
/*setsockopt() TEST5: Invalid option Name EOPNOTSUPP, Expected error */
error = setsockopt(sk, IPPROTO_SCTP, SCTP_AUTOCLOSE, 0, 0);
if (error != -1 || errno != EOPNOTSUPP)
- tst_brkm(TBROK, NULL, "setsockopt with invalid option "
+ tst_brkm(TBROK, tst_exit, "setsockopt with invalid option "
"name error:%d, errno:%d", error, errno);
tst_resm(TPASS, "setsockopt() with invalid option name - EOPNOTSUPP");
@@ -153,7 +153,7 @@ int main(void)
/*getsockopt() TEST6: Bad socket descriptor EBADF, Expected error */
error = getsockopt(-1, IPPROTO_SCTP, 0, 0, 0);
if (error != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "getsockopt with a bad socket "
+ tst_brkm(TBROK, tst_exit, "getsockopt with a bad socket "
"descriptor error:%d, errno:%d", error, errno);
tst_resm(TPASS, "getsockopt() with a bad socket descriptor - EBADF");
@@ -161,7 +161,7 @@ int main(void)
/*getsockopt() TEST7: Invalid socket ENOTSOCK, Expected error */
error = getsockopt(0, IPPROTO_SCTP, 0, 0, 0);
if (error != -1 || errno != ENOTSOCK)
- tst_brkm(TBROK, NULL, "getsockopt with an invalid socket "
+ tst_brkm(TBROK, tst_exit, "getsockopt with an invalid socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "getsockopt() with an invalid socket - ENOTSOCK");
@@ -173,7 +173,7 @@ int main(void)
error = getsockopt(sk, -1, SCTP_RTOINFO, 0, 0);
if (error != -1 || errno != ENOPROTOOPT)
- tst_brkm(TBROK, NULL, "getsockopt with invalid level "
+ tst_brkm(TBROK, tst_exit, "getsockopt with invalid level "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "getsockopt() with an invalid level - ENOPROTOOPT");
@@ -184,7 +184,7 @@ int main(void)
error = getsockopt(sk, IPPROTO_SCTP, SCTP_RTOINFO,
(struct sctp_rtoinfo *)-1, &len);
if (error != -1 || errno != EFAULT)
- tst_brkm(TBROK, NULL, "getsockopt with invalid option "
+ tst_brkm(TBROK, tst_exit, "getsockopt with invalid option "
"buffer error:%d, errno:%d", error, errno);
tst_resm(TPASS, "getsockopt() with invalid option buffer - EFAULT");
@@ -192,7 +192,7 @@ int main(void)
/*getsockopt() TEST9: Invalid option Name EOPNOTSUPP, Expected error */
error = getsockopt(sk, IPPROTO_SCTP, SCTP_AUTOCLOSE, &grtinfo, &len);
if (error != -1 || errno != EOPNOTSUPP)
- tst_brkm(TBROK, NULL, "getsockopt with invalid option "
+ tst_brkm(TBROK, tst_exit, "getsockopt with invalid option "
"name error:%d, errno:%d", error, errno);
tst_resm(TPASS, "getsockopt() with invalid option name - EOPNOTSUPP");
@@ -230,7 +230,7 @@ int main(void)
sinmsg.sinit_max_instreams != ginmsg.sinit_max_instreams &&
sinmsg.sinit_max_attempts != ginmsg.sinit_max_attempts &&
sinmsg.sinit_max_init_timeo != ginmsg.sinit_max_init_timeo)
- tst_brkm(TBROK, NULL, "setsockopt/getsockopt SCTP_INITMSG "
+ tst_brkm(TBROK, tst_exit, "setsockopt/getsockopt SCTP_INITMSG "
"compare failed");
tst_resm(TPASS, "setsockopt() SCTP_INITMSG - SUCCESS");
@@ -243,7 +243,7 @@ int main(void)
sinmsg.sinit_max_instreams == ginmsg.sinit_max_instreams &&
sinmsg.sinit_max_attempts == ginmsg.sinit_max_attempts &&
sinmsg.sinit_max_init_timeo == ginmsg.sinit_max_init_timeo)
- tst_brkm(TBROK, NULL, "setsockopt/getsockopt SCTP_INITMSG "
+ tst_brkm(TBROK, tst_exit, "setsockopt/getsockopt SCTP_INITMSG "
"unexpected compare success");
/* SO_LINGER Test with l_onff = 0 and l_linger = 0 */
@@ -260,7 +260,7 @@ int main(void)
/* TEST12: Test case for setsockopt SO_LINGER */
error = setsockopt(sk2, SOL_SOCKET, SO_LINGER, &slinger, len);
if (error < 0)
- tst_brkm(TBROK, NULL, "setsockopt SO_LINGER "
+ tst_brkm(TBROK, tst_exit, "setsockopt SO_LINGER "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "setsockopt() SO_LINGER - SUCCESS");
@@ -268,14 +268,14 @@ int main(void)
/* TEST13: Test case for getsockopt SO_LINGER */
error = getsockopt(sk2, SOL_SOCKET, SO_LINGER, &glinger, &len);
if (error < 0)
- tst_brkm(TBROK, NULL, "getsockopt SO_LINGER "
+ tst_brkm(TBROK, tst_exit, "getsockopt SO_LINGER "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "getsockopt() SO_LINGER - SUCCESS");
if (slinger.l_onoff != glinger.l_onoff ||
slinger.l_linger != glinger.l_linger)
- tst_brkm(TBROK, NULL, "setsockopt/getsockopt SO_LINGER "
+ tst_brkm(TBROK, tst_exit, "setsockopt/getsockopt SO_LINGER "
"compare failed");
/*First gets the default SO_RCVBUF value and comapres with the
@@ -284,7 +284,7 @@ int main(void)
/* TEST14: Test case for getsockopt SO_RCVBUF */
error = getsockopt(sk2, SOL_SOCKET, SO_RCVBUF, &rcvbuf_val_get, &len);
if (error < 0)
- tst_brkm(TBROK, NULL, "getsockopt SO_RCVBUF "
+ tst_brkm(TBROK, tst_exit, "getsockopt SO_RCVBUF "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "getsockopt() SO_RCVBUF - SUCCESS");
@@ -293,7 +293,7 @@ int main(void)
/* TEST15: Test case for getsockopt SCTP_STATUS */
error = getsockopt(sk2, IPPROTO_SCTP, SCTP_STATUS, &gstatus, &len);
if (error < 0)
- tst_brkm(TBROK, NULL, "getsockopt SCTP_STATUS "
+ tst_brkm(TBROK, tst_exit, "getsockopt SCTP_STATUS "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "getsockopt() SCTP_STATUS - SUCCESS");
@@ -301,30 +301,30 @@ int main(void)
/* Reducing the SO_RCVBUF value using setsockopt() */
/*Minimum value is 128 and hence I am using it */
len = sizeof(int);
- rcvbuf_val_set = 128;
+ rcvbuf_val_set = 2048;
/* TEST16: Test case for setsockopt SO_RCVBUF */
error = setsockopt(sk2, SOL_SOCKET, SO_RCVBUF, &rcvbuf_val_set, len);
if (error < 0)
- tst_brkm(TBROK, NULL, "setsockopt SO_RCVBUF "
+ tst_brkm(TBROK, tst_exit, "setsockopt SO_RCVBUF "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "setsockopt() SO_RCVBUF - SUCCESS");
error = getsockopt(sk2, SOL_SOCKET, SO_RCVBUF, &rcvbuf_val_get, &len);
if (error < 0)
- tst_brkm(TBROK, NULL, "getsockopt SO_RCVBUF "
+ tst_brkm(TBROK, tst_exit, "getsockopt SO_RCVBUF "
"error:%d, errno:%d", error, errno);
if ((2 * rcvbuf_val_set) != rcvbuf_val_get)
- tst_brkm(TBROK, NULL, "Comparison failed:Set value and "
+ tst_brkm(TBROK, tst_exit, "Comparison failed:Set value and "
"got value differs Set Value=%d Get Value=%d",
(2 * rcvbuf_val_set), rcvbuf_val_get);
- sndbuf_val_set = 1024;
+ sndbuf_val_set = 2048;
/* TEST17: Test case for setsockopt SO_SNDBUF */
error = setsockopt(sk2, SOL_SOCKET, SO_SNDBUF, &sndbuf_val_set, len);
if (error < 0)
- tst_brkm(TBROK, NULL, "setsockopt SO_SNDBUF "
+ tst_brkm(TBROK, tst_exit, "setsockopt SO_SNDBUF "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "setsockopt() SO_SNDBUF - SUCCESS");
@@ -332,13 +332,13 @@ int main(void)
/* TEST18: Test case for getsockopt SO_SNDBUF */
error = getsockopt(sk2, SOL_SOCKET, SO_SNDBUF, &sndbuf_val_get, &len);
if (error < 0)
- tst_brkm(TBROK, NULL, "getsockopt SO_SNDBUF "
+ tst_brkm(TBROK, tst_exit, "getsockopt SO_SNDBUF "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "getsockopt() SO_SNDBUF - SUCCESS");
if ((2 * sndbuf_val_set) != sndbuf_val_get)
- tst_brkm(TBROK, NULL, "Comparison failed:Set value and "
+ tst_brkm(TBROK, tst_exit, "Comparison failed:Set value and "
"got value differs Set Value=%d Get Value=%d\n",
(2 * sndbuf_val_set), sndbuf_val_get);
@@ -348,7 +348,7 @@ int main(void)
error = getsockopt(sk2, IPPROTO_SCTP, SCTP_PRIMARY_ADDR, &gprimaddr,
&len);
if (error < 0)
- tst_brkm(TBROK, NULL, "getsockopt SCTP_PRIMARY_ADDR "
+ tst_brkm(TBROK, tst_exit, "getsockopt SCTP_PRIMARY_ADDR "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "getsockopt() SCTP_PRIMARY_ADDR - SUCCESS");
@@ -357,7 +357,7 @@ int main(void)
if (htons(gaddr->sin_port) != lstn_addr.sin_port &&
gaddr->sin_family != lstn_addr.sin_family &&
gaddr->sin_addr.s_addr != lstn_addr.sin_addr.s_addr)
- tst_brkm(TBROK, NULL, "getsockopt SCTP_PRIMARY_ADDR value "
+ tst_brkm(TBROK, tst_exit, "getsockopt SCTP_PRIMARY_ADDR value "
"mismatch");
memcpy(&sprimaddr, &gprimaddr, sizeof(struct sctp_prim));
@@ -366,7 +366,7 @@ int main(void)
error = setsockopt(sk2, IPPROTO_SCTP, SCTP_PRIMARY_ADDR, &sprimaddr,
len);
if (error < 0)
- tst_brkm(TBROK, NULL, "setsockopt SCTP_PRIMARY_ADDR "
+ tst_brkm(TBROK, tst_exit, "setsockopt SCTP_PRIMARY_ADDR "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "setsockopt() SCTP_PRIMARY_ADDR - SUCCESS");
@@ -377,7 +377,7 @@ int main(void)
error = getsockopt(sk2, IPPROTO_SCTP, SCTP_ASSOCINFO, &gassocparams,
&len);
if (error < 0)
- tst_brkm(TBROK, NULL, "getsockopt SCTP_ASSOCINFO "
+ tst_brkm(TBROK, tst_exit, "getsockopt SCTP_ASSOCINFO "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "getsockopt() SCTP_ASSOCINFO - SUCCESS");
@@ -390,18 +390,18 @@ int main(void)
error = setsockopt(sk2, IPPROTO_SCTP, SCTP_ASSOCINFO, &sassocparams,
len);
if (error < 0)
- tst_brkm(TBROK, NULL, "setsockopt SCTP_ASSOCINFO "
+ tst_brkm(TBROK, tst_exit, "setsockopt SCTP_ASSOCINFO "
"error:%d, errno:%d", error, errno);
error = getsockopt(sk2, IPPROTO_SCTP, SCTP_ASSOCINFO, &gassocparams,
&len);
if (error < 0)
- tst_brkm(TBROK, NULL, "getsockopt SCTP_ASSOCINFO "
+ tst_brkm(TBROK, tst_exit, "getsockopt SCTP_ASSOCINFO "
"error:%d, errno:%d", error, errno);
if (sassocparams.sasoc_asocmaxrxt != gassocparams.sasoc_asocmaxrxt ||
sassocparams.sasoc_cookie_life != gassocparams.sasoc_cookie_life)
- tst_brkm(TBROK, NULL, "getsockopt SCTP_ASSOCINFO value "
+ tst_brkm(TBROK, tst_exit, "getsockopt SCTP_ASSOCINFO value "
"mismatch");
tst_resm(TPASS, "setsockopt() SCTP_ASSOCINFO - SUCCESS");
@@ -409,5 +409,5 @@ int main(void)
close(sk1);
close(acpt_sk);
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_1_to_1_threads.c b/testcases/network/sctp/func_tests/test_1_to_1_threads.c
index d09ec09..ac2b1a2 100644
--- a/testcases/network/sctp/func_tests/test_1_to_1_threads.c
+++ b/testcases/network/sctp/func_tests/test_1_to_1_threads.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* Copyright (c) 2003 Hewlett-Packard Development Company, L.P
* (C) Copyright IBM Corp. 2004
*
@@ -6,13 +6,13 @@
* THREAD_SND_RCV_LOOPS = 10 many times. To change the number of threads
* change the THREADS valuen and loop change the THREAD_SND_RCV_LOOPS.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -47,7 +47,6 @@
#include <errno.h>
#include <netinet/sctp.h>
#include <sys/uio.h>
-#include <stdint.h>
#include <linux/socket.h>
#include <sctputil.h>
@@ -64,7 +63,7 @@ int acpt_sk;
struct sockaddr_in conn_addr;
char *message = "hello, world!\n";
-void t_recv(int id)
+void t_recv(void)
{
int cnt;
struct msghdr inmessage;
@@ -87,18 +86,15 @@ void t_recv(int id)
0, 0);
}
-void t_send(int id)
+void t_send(void)
{
struct msghdr outmessage;
struct sctp_sndrcvinfo *sinfo;
- char *buffer_snd;
struct cmsghdr *cmsg;
struct iovec out_iov;
char outcmsg[CMSG_SPACE(sizeof(sctp_cmsg_data_t))];
memset(&outmessage, 0, sizeof(outmessage));
- buffer_snd = malloc(100);
-
outmessage.msg_name = &conn_addr;
outmessage.msg_namelen = sizeof(conn_addr);
outmessage.msg_iov = &out_iov;
@@ -121,25 +117,25 @@ void t_send(int id)
test_sendmsg(client_sk, &outmessage, 0, strlen(message) + 1);
}
-void *relay(void *id_)
+void *relay(void *arg)
{
- int id = (uintptr_t) id_;
+ int id = *(int *)arg;
+
if (id == 0) {
- t_send(id);
- } else if (id == THREADS - 1) {
- t_send(id);
+ t_send();
} else {
- t_recv(id);
- t_send(id);
+ t_recv();
+ t_send();
}
- return 0;
+ pthread_exit(NULL);
}
int main(void)
{
int cnt, i;
+ int pth[THREADS];
pthread_t thread[THREADS];
int status;
int exit_status;
@@ -173,20 +169,22 @@ int main(void)
acpt_sk = test_accept(server_sk, (struct sockaddr *)&svr_addr, &len);
for (i = 0; i < THREAD_SND_RCV_LOOPS; i++) {
- for (cnt = 1; cnt < THREADS; cnt++) {
- status = pthread_create(&thread[cnt], &attr,
- relay, (void *)(uintptr_t) cnt);
+ for (cnt = 0; cnt < THREADS; cnt++) {
+ pth[cnt] = cnt;
+ status =
+ pthread_create(&thread[cnt], &attr, relay,
+ &pth[cnt]);
if (status)
- tst_brkm(TBROK, NULL, "pthread_create "
+ tst_brkm(TBROK, tst_exit, "pthread_create "
"failed status:%d, errno:%d", status,
errno);
}
pthread_attr_destroy(&attr);
- for (cnt = 1; cnt < THREADS; cnt++) {
+ for (cnt = 0; cnt < THREADS; cnt++) {
exit_status = pthread_join(thread[cnt], &result);
if (exit_status == -1)
- tst_brkm(TBROK, NULL, "pthread_join "
+ tst_brkm(TBROK, tst_exit, "pthread_join "
"Thread #%d exited with status:%d",
cnt, exit_status);
}
@@ -195,5 +193,5 @@ int main(void)
tst_resm(TPASS, "send and receive data across multiple threads - "
"SUCCESS");
- pthread_exit(NULL);
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_assoc_abort.c b/testcases/network/sctp/func_tests/test_assoc_abort.c
index 52d5ebd..9c68b61 100644
--- a/testcases/network/sctp/func_tests/test_assoc_abort.c
+++ b/testcases/network/sctp/func_tests/test_assoc_abort.c
@@ -1,17 +1,17 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2001, 2003
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
* Copyright (c) 2001 Intel Corp.
* Copyright (c) 2001 Nokia, Inc.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -203,7 +203,7 @@ int main(int argc, char *argv[])
error = getsockopt(svr_sk, SOL_SCTP, SCTP_STATUS,
&status, &status_len);
if (error)
- tst_brkm(TBROK, NULL,
+ tst_brkm(TBROK, tst_exit,
"getsockopt(SCTP_STATUS): %s",
strerror(errno));
@@ -217,7 +217,7 @@ int main(int argc, char *argv[])
error = getsockopt(svr_sk, SOL_SCTP, SCTP_STATUS,
&status, &status_len);
if ((error != -1) && (errno != EINVAL))
- tst_brkm(TBROK, NULL,
+ tst_brkm(TBROK, tst_exit,
"getsockopt(SCTP_STATUS) "
"error:%d errno:%d", error, errno);
}
@@ -229,8 +229,9 @@ int main(int argc, char *argv[])
inmessage.msg_controllen = sizeof(incmsg);
error = test_recvmsg(clt_sk[i], &inmessage, MSG_WAITALL);
test_check_msg_notification(&inmessage, error,
- sizeof(struct sctp_assoc_change),
- SCTP_ASSOC_CHANGE, SCTP_COMM_LOST);
+ sizeof(struct sctp_assoc_change) +
+ 4, SCTP_ASSOC_CHANGE,
+ SCTP_COMM_LOST);
close(clt_sk[i]);
}
@@ -238,5 +239,5 @@ int main(int argc, char *argv[])
tst_resm(TPASS, "ABORT an association using SCTP_ABORT");
/* Indicate successful completion. */
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_assoc_shutdown.c b/testcases/network/sctp/func_tests/test_assoc_shutdown.c
index a78e955..b5f1696 100644
--- a/testcases/network/sctp/func_tests/test_assoc_shutdown.c
+++ b/testcases/network/sctp/func_tests/test_assoc_shutdown.c
@@ -1,17 +1,17 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2001, 2003
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
* Copyright (c) 2001 Intel Corp.
* Copyright (c) 2001 Nokia, Inc.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -204,7 +204,7 @@ int main(int argc, char *argv[])
error = getsockopt(svr_sk, SOL_SCTP, SCTP_STATUS,
&status, &status_len);
if (error)
- tst_brkm(TBROK, NULL,
+ tst_brkm(TBROK, tst_exit,
"getsockopt(SCTP_STATUS): %s",
strerror(errno));
@@ -218,7 +218,7 @@ int main(int argc, char *argv[])
error = getsockopt(svr_sk, SOL_SCTP, SCTP_STATUS,
&status, &status_len);
if ((error != -1) && (errno != EINVAL))
- tst_brkm(TBROK, NULL,
+ tst_brkm(TBROK, tst_exit,
"getsockopt(SCTP_STATUS) "
"error:%d errno:%d", error, errno);
}
@@ -240,5 +240,5 @@ int main(int argc, char *argv[])
tst_resm(TPASS, "Graceful shutdown of associations using SCTP_EOF");
/* Indicate successful completion. */
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_autoclose.c b/testcases/network/sctp/func_tests/test_autoclose.c
index ef42fdc..e32efd1 100644
--- a/testcases/network/sctp/func_tests/test_autoclose.c
+++ b/testcases/network/sctp/func_tests/test_autoclose.c
@@ -1,17 +1,17 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2001, 2003
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
* Copyright (c) 2001 Intel Corp.
* Copyright (c) 2001 Nokia, Inc.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -63,7 +63,7 @@ int main(int argc, char *argv[])
sockaddr_storage_t loop1, loop2;
struct msghdr inmessage, outmessage;
struct iovec iov, out_iov;
- int error, bytes_sent;
+ int error;
char *big_buffer;
char *message = "hello, world!\n";
uint32_t autoclose;
@@ -111,7 +111,8 @@ int main(int argc, char *argv[])
outmessage.msg_iovlen = 1;
outmessage.msg_iov->iov_base = message;
outmessage.msg_iov->iov_len = strlen(message) + 1;
- bytes_sent = test_sendmsg(sk1, &outmessage, 0, strlen(message) + 1);
+
+ test_sendmsg(sk1, &outmessage, 0, strlen(message) + 1);
/* Initialize inmessage for all receives. */
big_buffer = test_malloc(REALLY_BIG);
@@ -161,5 +162,5 @@ int main(int argc, char *argv[])
close(sk2);
/* Indicate successful completion. */
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_basic.c b/testcases/network/sctp/func_tests/test_basic.c
index a5f60e2..0c3c16c 100644
--- a/testcases/network/sctp/func_tests/test_basic.c
+++ b/testcases/network/sctp/func_tests/test_basic.c
@@ -1,17 +1,17 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2001, 2003
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
* Copyright (c) 2001 Intel Corp.
* Copyright (c) 2001 Nokia, Inc.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -40,7 +40,7 @@
* Sridhar Samudrala <samudrala@us.ibm.com>
*/
-/* This is a basic functional test for the SCTP kernel reference
+/* This is a basic functional test for the SCTP kernel
* implementation state machine.
*/
@@ -151,7 +151,7 @@ int main(void)
inmessage.msg_controllen = sizeof(incmsg);
error = recvmsg(sk2, &inmessage, MSG_WAITALL);
if (error > 0)
- tst_brkm(TBROK, NULL, "recvmsg on a socket neither"
+ tst_brkm(TBROK, tst_exit, "recvmsg on a socket neither"
"listening nor established error: %d", error);
tst_resm(TPASS, "recvmsg on a socket neither listening nor "
@@ -302,7 +302,7 @@ int main(void)
outmessage.msg_namelen = 0;
bytes_sent = sendmsg(sk1, &outmessage, MSG_NOSIGNAL);
if ((bytes_sent > 0) || (EPIPE != errno))
- tst_brkm(TBROK, NULL, "sendmsg with NULL associd and "
+ tst_brkm(TBROK, tst_exit, "sendmsg with NULL associd and "
"NULL msg_name error:%d errno:%d", error, errno);
tst_resm(TPASS, "sendmsg with NULL associd and NULL msg_name");
@@ -311,7 +311,7 @@ int main(void)
sinfo->sinfo_assoc_id = associd2;
bytes_sent = sendmsg(sk1, &outmessage, MSG_NOSIGNAL);
if ((bytes_sent > 0) || (EPIPE != errno))
- tst_brkm(TBROK, NULL, "sendmsg with incorrect associd "
+ tst_brkm(TBROK, tst_exit, "sendmsg with incorrect associd "
"error:%d errno:%d", error, errno);
tst_resm(TPASS, "sendmsg with incorrect associd");
@@ -344,7 +344,8 @@ int main(void)
n_laddrs = sctp_getladdrs(sk1, associd1, &laddrs);
if (n_laddrs <= 0)
- tst_brkm(TBROK, NULL, "sctp_getladdrs: %s", strerror(errno));
+ tst_brkm(TBROK, tst_exit, "sctp_getladdrs: %s",
+ strerror(errno));
tst_resm(TPASS, "sctp_getladdrs");
@@ -373,7 +374,8 @@ int main(void)
n_paddrs = sctp_getpaddrs(sk1, associd1, &paddrs);
if (n_paddrs <= 0)
- tst_brkm(TBROK, NULL, "sctp_getpaddrs: %s", strerror(errno));
+ tst_brkm(TBROK, tst_exit, "sctp_getpaddrs: %s",
+ strerror(errno));
tst_resm(TPASS, "sctp_getpaddrs");
@@ -449,5 +451,5 @@ int main(void)
close(sk2);
/* Indicate successful completion. */
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_connect.c b/testcases/network/sctp/func_tests/test_connect.c
index 6fc788a..3cf5fb9 100644
--- a/testcases/network/sctp/func_tests/test_connect.c
+++ b/testcases/network/sctp/func_tests/test_connect.c
@@ -1,14 +1,14 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2002, 2003
* Copyright (c) 1999-2001 Motorola, Inc.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -57,12 +57,12 @@ int TST_CNT = 0;
int main(int argc, char *argv[])
{
int svr_sk, clt_sk1, clt_sk2, peeloff_sk;
- sctp_assoc_t svr_associd1, svr_associd2, clt_associd1, clt_associd2;
+ sctp_assoc_t svr_associd1;
sockaddr_storage_t svr_loop, clt_loop1, clt_loop2, clt_loop3;
+ struct sctp_assoc_change *sac;
struct iovec iov;
struct msghdr inmessage;
int error;
- struct sctp_assoc_change *sac;
char *big_buffer;
int flags;
@@ -106,15 +106,15 @@ int main(int argc, char *argv[])
/* Set clt_sk1 as non-blocking. */
flags = fcntl(clt_sk1, F_GETFL, 0);
if (flags < 0)
- tst_brkm(TBROK, NULL, "fcntl F_GETFL: %s", strerror(errno));
+ tst_brkm(TBROK, tst_exit, "fcntl F_GETFL: %s", strerror(errno));
if (fcntl(clt_sk1, F_SETFL, flags | O_NONBLOCK) < 0)
- tst_brkm(TBROK, NULL, "fcntl F_SETFL: %s", strerror(errno));
+ tst_brkm(TBROK, tst_exit, "fcntl F_SETFL: %s", strerror(errno));
/* Do a non-blocking connect from clt_sk1 to svr_sk */
error = connect(clt_sk1, &svr_loop.sa, sizeof(svr_loop));
/* Non-blocking connect should return immediately with EINPROGRESS. */
if ((error != -1) || (EINPROGRESS != errno))
- tst_brkm(TBROK, NULL, "non-blocking connect error: %d"
+ tst_brkm(TBROK, tst_exit, "non-blocking connect error: %d"
"errno:%d", error, errno);
tst_resm(TPASS, "non-blocking connect");
@@ -124,7 +124,7 @@ int main(int argc, char *argv[])
*/
error = connect(clt_sk1, &svr_loop.sa, sizeof(svr_loop));
if ((error != -1) || (EISCONN != errno))
- tst_brkm(TBROK, NULL, "connect on a socket to create an "
+ tst_brkm(TBROK, tst_exit, "connect on a socket to create an "
"assoc that is already established error:%d errno:%d",
error, errno);
@@ -145,8 +145,10 @@ int main(int argc, char *argv[])
test_check_msg_notification(&inmessage, error,
sizeof(struct sctp_assoc_change),
SCTP_ASSOC_CHANGE, SCTP_COMM_UP);
+#if 0
sac = (struct sctp_assoc_change *)iov.iov_base;
clt_associd1 = sac->sac_assoc_id;
+#endif
/* Get COMM_UP on svr_sk */
error = test_recvmsg(svr_sk, &inmessage, MSG_WAITALL);
@@ -167,16 +169,20 @@ int main(int argc, char *argv[])
test_check_msg_notification(&inmessage, error,
sizeof(struct sctp_assoc_change),
SCTP_ASSOC_CHANGE, SCTP_COMM_UP);
+#if 0
sac = (struct sctp_assoc_change *)iov.iov_base;
clt_associd2 = sac->sac_assoc_id;
+#endif
/* Get COMM_UP on svr_sk */
error = test_recvmsg(svr_sk, &inmessage, MSG_WAITALL);
test_check_msg_notification(&inmessage, error,
sizeof(struct sctp_assoc_change),
SCTP_ASSOC_CHANGE, SCTP_COMM_UP);
+#if 0
sac = (struct sctp_assoc_change *)iov.iov_base;
svr_associd2 = sac->sac_assoc_id;
+#endif
tst_resm(TPASS, "blocking connect");
@@ -185,7 +191,7 @@ int main(int argc, char *argv[])
/* Doing a connect on a peeled off socket should fail. */
error = connect(peeloff_sk, &clt_loop3.sa, sizeof(clt_loop3));
if ((error != -1) || (EISCONN != errno))
- tst_brkm(TBROK, NULL, "connect on a peeled off socket "
+ tst_brkm(TBROK, tst_exit, "connect on a peeled off socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "connect on a peeled off socket");
@@ -195,7 +201,7 @@ int main(int argc, char *argv[])
*/
error = connect(svr_sk, &clt_loop1.sa, sizeof(clt_loop1));
if ((error != -1) || (EADDRNOTAVAIL != errno))
- tst_brkm(TBROK, NULL, "connect to create an assoc that "
+ tst_brkm(TBROK, tst_exit, "connect to create an assoc that "
"matches a peeled off assoc error:%d errno:%d",
error, errno);
@@ -208,5 +214,5 @@ int main(int argc, char *argv[])
close(peeloff_sk);
/* Indicate successful completion. */
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_connectx.c b/testcases/network/sctp/func_tests/test_connectx.c
index 8f08025..372fe7c 100644
--- a/testcases/network/sctp/func_tests/test_connectx.c
+++ b/testcases/network/sctp/func_tests/test_connectx.c
@@ -1,14 +1,14 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2002, 2003
* Copyright (c) 1999-2001 Motorola, Inc.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -66,7 +66,8 @@ int TST_CNT = 0;
int main(int argc, char *argv[])
{
int svr_sk, clt_sk1, clt_sk2, peeloff_sk;
- sctp_assoc_t svr_associd1, svr_associd2, clt_associd1, clt_associd2;
+ sctp_assoc_t associd, svr_associd1, svr_associd2, clt_associd1,
+ clt_associd2;
struct iovec iov;
struct msghdr inmessage;
int error, i;
@@ -144,15 +145,16 @@ int main(int argc, char *argv[])
/* Set clt_sk1 as non-blocking. */
flags = fcntl(clt_sk1, F_GETFL, 0);
if (flags < 0)
- tst_brkm(TBROK, NULL, "fcntl F_GETFL: %s", strerror(errno));
+ tst_brkm(TBROK, tst_exit, "fcntl F_GETFL: %s", strerror(errno));
if (fcntl(clt_sk1, F_SETFL, flags | O_NONBLOCK) < 0)
- tst_brkm(TBROK, NULL, "fcntl F_SETFL: %s", strerror(errno));
+ tst_brkm(TBROK, tst_exit, "fcntl F_SETFL: %s", strerror(errno));
/* Do a non-blocking connectx from clt_sk1 to svr_sk */
- error = sctp_connectx(clt_sk1, (struct sockaddr *)svr_try, NUMADDR);
+ error = sctp_connectx(clt_sk1, (struct sockaddr *)svr_try, NUMADDR,
+ &associd);
/* Non-blocking connectx should return immediately with EINPROGRESS. */
if ((error != -1) || (EINPROGRESS != errno))
- tst_brkm(TBROK, NULL, "non-blocking connectx error: %d"
+ tst_brkm(TBROK, tst_exit, "non-blocking connectx error: %d"
"errno:%d", error, errno);
tst_resm(TPASS, "non-blocking connectx");
@@ -160,9 +162,10 @@ int main(int argc, char *argv[])
/* Doing a connectx on a socket to create an association that is
* is already established should return EISCONN.
*/
- error = sctp_connectx(clt_sk1, (struct sockaddr *)svr_try, NUMADDR);
+ error = sctp_connectx(clt_sk1, (struct sockaddr *)svr_try, NUMADDR,
+ NULL);
if ((error != -1) || (EISCONN != errno))
- tst_brkm(TBROK, NULL, "connectx on a socket to create an "
+ tst_brkm(TBROK, tst_exit, "connectx on a socket to create an "
"assoc that is already established error:%d errno:%d",
error, errno);
@@ -186,6 +189,15 @@ int main(int argc, char *argv[])
sac = (struct sctp_assoc_change *)iov.iov_base;
clt_associd1 = sac->sac_assoc_id;
+ if (associd) {
+ if (associd != clt_associd1)
+ tst_brkm(TBROK, tst_exit, "Association id mismatch: "
+ "connectx returned %d, notification returned:%d",
+ associd, clt_associd1);
+ tst_resm(TPASS, "Association id match between sctp_connectx()"
+ " and notification.");
+ }
+
/* Get COMM_UP on svr_sk */
error = test_recvmsg(svr_sk, &inmessage, MSG_WAITALL);
test_check_msg_notification(&inmessage, error,
@@ -221,10 +233,10 @@ int main(int argc, char *argv[])
peeloff_sk = test_sctp_peeloff(svr_sk, svr_associd1);
/* Doing a connectx on a peeled off socket should fail. */
- error =
- sctp_connectx(peeloff_sk, (struct sockaddr *)clt_loop3, NUMADDR);
+ error = sctp_connectx(peeloff_sk, (struct sockaddr *)clt_loop3, NUMADDR,
+ NULL);
if ((error != -1) || (EISCONN != errno))
- tst_brkm(TBROK, NULL, "connectx on a peeled off socket "
+ tst_brkm(TBROK, tst_exit, "connectx on a peeled off socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "connectx on a peeled off socket");
@@ -232,9 +244,10 @@ int main(int argc, char *argv[])
/* Trying to create an association on a socket that matches an
* existing peeled-off association should fail.
*/
- error = sctp_connectx(svr_sk, (struct sockaddr *)clt_loop1, NUMADDR);
+ error = sctp_connectx(svr_sk, (struct sockaddr *)clt_loop1, NUMADDR,
+ NULL);
if ((error != -1) || (EADDRNOTAVAIL != errno))
- tst_brkm(TBROK, NULL, "connectx to create an assoc that "
+ tst_brkm(TBROK, tst_exit, "connectx to create an assoc that "
"matches a peeled off assoc error:%d errno:%d",
error, errno);
@@ -255,5 +268,5 @@ int main(int argc, char *argv[])
close(peeloff_sk);
/* Indicate successful completion. */
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_fragments.c b/testcases/network/sctp/func_tests/test_fragments.c
index 4e92ac3..bea93c2 100644
--- a/testcases/network/sctp/func_tests/test_fragments.c
+++ b/testcases/network/sctp/func_tests/test_fragments.c
@@ -1,17 +1,17 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2001, 2003
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
* Copyright (c) 2001 Intel Corp.
* Copyright (c) 2001 Nokia, Inc.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -84,11 +84,9 @@ int main(int argc, char *argv[])
struct sctp_sndrcvinfo *sinfo;
struct iovec out_iov;
int error, bytes_sent;
- int pf_class, af_family;
+ int pf_class;
uint32_t ppid;
uint32_t stream;
- sctp_assoc_t associd1, associd2;
- struct sctp_assoc_change *sac;
char *big_buffer;
int msg_len, msg_cnt, i;
void *msg_buf;
@@ -103,7 +101,6 @@ int main(int argc, char *argv[])
/* Set some basic values which depend on the address family. */
#if TEST_V6
pf_class = PF_INET6;
- af_family = AF_INET6;
loop1.v6.sin6_family = AF_INET6;
loop1.v6.sin6_addr = in6addr_loopback;
@@ -114,7 +111,6 @@ int main(int argc, char *argv[])
loop2.v6.sin6_port = htons(SCTP_TESTPORT_2);
#else
pf_class = PF_INET;
- af_family = AF_INET;
loop1.v4.sin_family = AF_INET;
loop1.v4.sin_addr.s_addr = SCTP_IP_LOOPBACK;
@@ -180,18 +176,20 @@ int main(int argc, char *argv[])
test_check_msg_notification(&inmessage, error,
sizeof(struct sctp_assoc_change),
SCTP_ASSOC_CHANGE, SCTP_COMM_UP);
+#if 0
sac = (struct sctp_assoc_change *)iov.iov_base;
associd2 = sac->sac_assoc_id;
-
+#endif
/* Get the communication up message on sk1. */
inmessage.msg_controllen = sizeof(incmsg);
error = test_recvmsg(sk1, &inmessage, MSG_WAITALL);
test_check_msg_notification(&inmessage, error,
sizeof(struct sctp_assoc_change),
SCTP_ASSOC_CHANGE, SCTP_COMM_UP);
+#if 0
sac = (struct sctp_assoc_change *)iov.iov_base;
associd1 = sac->sac_assoc_id;
-
+#endif
/* Get the first message which was sent. */
inmessage.msg_controllen = sizeof(incmsg);
error = test_recvmsg(sk2, &inmessage, MSG_WAITALL);
@@ -212,7 +210,7 @@ int main(int argc, char *argv[])
error = test_getsockopt(sk1, SCTP_DISABLE_FRAGMENTS, &disable_frag,
&optlen);
if ((error != 0) && (disable_frag != 1))
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_DISABLE_FRAGMENTS) "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_DISABLE_FRAGMENTS) "
"error:%d errno:%d disable_frag:%d",
error, errno, disable_frag);
@@ -221,13 +219,13 @@ int main(int argc, char *argv[])
/* Try to send a messsage that exceeds association fragmentation point
* and verify that it fails.
*/
- msg_len = 30000;
+ msg_len = 100000;
msg_buf = test_build_msg(msg_len);
outmessage.msg_iov->iov_base = msg_buf;
outmessage.msg_iov->iov_len = msg_len;
error = sendmsg(sk1, &outmessage, 0);
if ((error != -1) || (errno != EMSGSIZE))
- tst_brkm(TBROK, NULL, "Send a message that exceeds "
+ tst_brkm(TBROK, tst_exit, "Send a message that exceeds "
"assoc frag point error:%d errno:%d", error, errno);
tst_resm(TPASS, "Send a message that exceeds assoc frag point");
@@ -293,5 +291,5 @@ int main(int argc, char *argv[])
close(sk2);
/* Indicate successful completion. */
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_getname.c b/testcases/network/sctp/func_tests/test_getname.c
index f300368..bb455e1 100644
--- a/testcases/network/sctp/func_tests/test_getname.c
+++ b/testcases/network/sctp/func_tests/test_getname.c
@@ -1,14 +1,14 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2004
* Copyright (c) 1999-2001 Motorola, Inc.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -93,7 +93,7 @@ int main(int argc, char *argv[])
/* Verify that getsockname() on an unconnected socket works fine. */
error = getsockname(svr_sk, (struct sockaddr *)&svr_local_addr, &len);
if (0 != error)
- tst_brkm(TBROK, NULL, "getsockname: %s", strerror(errno));
+ tst_brkm(TBROK, tst_exit, "getsockname: %s", strerror(errno));
tst_resm(TPASS, "getsockname on an unconnected socket");
@@ -102,7 +102,7 @@ int main(int argc, char *argv[])
/* Verify that getpeername() on an unconnected socket fails. */
error = getpeername(svr_sk, (struct sockaddr *)&svr_peer_addr, &len);
if ((-1 != error) || (ENOTCONN != errno))
- tst_brkm(TBROK, NULL, "getpeername on an unconnected "
+ tst_brkm(TBROK, tst_exit, "getpeername on an unconnected "
"socket error:%d, errno:%d", error, errno);
tst_resm(TPASS, "getpeername on an unconnected socket");
@@ -126,7 +126,7 @@ int main(int argc, char *argv[])
/* Get the client's local address. */
error = getsockname(clt_sk, (struct sockaddr *)&clt_local_addr, &len);
if (0 != error)
- tst_brkm(TBROK, NULL, "getsockname on a connected client "
+ tst_brkm(TBROK, tst_exit, "getsockname on a connected client "
"socket: %s", strerror(errno));
tst_resm(TPASS, "getsockname on a connected client socket");
@@ -136,7 +136,7 @@ int main(int argc, char *argv[])
/* Get the client's peer address. */
error = getpeername(clt_sk, (struct sockaddr *)&clt_peer_addr, &len);
if (0 != error)
- tst_brkm(TBROK, NULL, "getpeername on a connected client "
+ tst_brkm(TBROK, tst_exit, "getpeername on a connected client "
"socket: %s", strerror(errno));
tst_resm(TPASS, "getpeername on a connected client socket");
@@ -151,7 +151,7 @@ int main(int argc, char *argv[])
error = getsockname(accept_sk, (struct sockaddr *)&svr_local_addr,
&len);
if (0 != error)
- tst_brkm(TBROK, NULL, "getsockname on a connected server "
+ tst_brkm(TBROK, tst_exit, "getsockname on a connected server "
"socket: %s", strerror(errno));
tst_resm(TPASS, "getsockname on a connected server socket");
@@ -161,36 +161,36 @@ int main(int argc, char *argv[])
/* Get the server's peer address. */
error = getpeername(accept_sk, (struct sockaddr *)&svr_peer_addr, &len);
if (0 != error)
- tst_brkm(TBROK, NULL, "getpeername on a connected server "
+ tst_brkm(TBROK, tst_exit, "getpeername on a connected server "
"socket: %s", strerror(errno));
tst_resm(TPASS, "getpeername on a connected server socket");
if (svr_local_addr.v4.sin_port != clt_peer_addr.v4.sin_port)
- tst_brkm(TBROK, NULL, "Server's local port(%d) doesn't "
+ tst_brkm(TBROK, tst_exit, "Server's local port(%d) doesn't "
"match Client's peer port(%d)\n",
svr_local_addr.v4.sin_port, clt_peer_addr.v4.sin_port);
if (svr_peer_addr.v4.sin_port != clt_local_addr.v4.sin_port)
- tst_brkm(TBROK, NULL, "Server's peer port(%d) doesn't "
+ tst_brkm(TBROK, tst_exit, "Server's peer port(%d) doesn't "
"match Client's local port(%d)\n",
svr_peer_addr.v4.sin_port, clt_local_addr.v4.sin_port);
#if TEST_V6
if (memcmp(&svr_local_addr, &clt_peer_addr, len) != 0)
- tst_brkm(TBROK, NULL, "Server's local address and client's "
+ tst_brkm(TBROK, tst_exit, "Server's local address and client's "
"peer addresses do not match\n");
if (memcmp(&svr_peer_addr, &clt_local_addr, len) != 0)
- tst_brkm(TBROK, NULL, "Server's peer address and client's "
+ tst_brkm(TBROK, tst_exit, "Server's peer address and client's "
"local addresses do not match\n");
#else
if (svr_local_addr.v4.sin_addr.s_addr !=
clt_peer_addr.v4.sin_addr.s_addr)
- tst_brkm(TBROK, NULL, "Server's local address and client's "
+ tst_brkm(TBROK, tst_exit, "Server's local address and client's "
"peer addresses do not match\n");
if (svr_peer_addr.v4.sin_addr.s_addr !=
clt_local_addr.v4.sin_addr.s_addr)
- tst_brkm(TBROK, NULL, "Server's peer address and client's "
+ tst_brkm(TBROK, tst_exit, "Server's peer address and client's "
"local addresses do not match\n");
#endif
tst_resm(TPASS, "getsockname/getpeername server/client match");
@@ -200,7 +200,7 @@ int main(int argc, char *argv[])
/*getsockname(): Bad socket descriptor, EBADF expected error */
error = getsockname(-1, (struct sockaddr *)&clt_local_addr, &len);
if (error != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "getsockname on a bad socket "
+ tst_brkm(TBROK, tst_exit, "getsockname on a bad socket "
"descriptor. error:%d errno:%d", error, errno);
tst_resm(TPASS, "getsockname on a bad socket descriptor - EBADF");
@@ -208,7 +208,7 @@ int main(int argc, char *argv[])
/*getsockname(): Invalid socket, ENOTSOCK expected error */
error = getsockname(0, (struct sockaddr *)&clt_local_addr, &len);
if (error != -1 || errno != ENOTSOCK)
- tst_brkm(TBROK, NULL, "getsockname on an invalid socket "
+ tst_brkm(TBROK, tst_exit, "getsockname on an invalid socket "
"error:%d errno:%d", error, errno);
tst_resm(TPASS, "getsockname on an invalid socket - ENOTSOCK");
@@ -216,7 +216,7 @@ int main(int argc, char *argv[])
/*getsockname(): Invalid structure, EFAULT expected error */
error = getsockname(clt_sk, (struct sockaddr *)-1, &len);
if (error != -1 || errno != EFAULT)
- tst_brkm(TBROK, NULL, "getsockname with invalid buffer "
+ tst_brkm(TBROK, tst_exit, "getsockname with invalid buffer "
"error:%d errno:%d", error, errno);
tst_resm(TPASS, "getsockname with invalid buffer - EFAULT");
@@ -226,7 +226,7 @@ int main(int argc, char *argv[])
/*getpeername(): Bad socket descriptor, EBADF expected error */
error = getpeername(-1, (struct sockaddr *)&clt_local_addr, &len);
if (error != -1 || errno != EBADF)
- tst_brkm(TBROK, NULL, "getpeername on a bad socket "
+ tst_brkm(TBROK, tst_exit, "getpeername on a bad socket "
"descriptor. error:%d errno:%d", error, errno);
tst_resm(TPASS, "getpeername on a bad socket descriptor - EBADF");
@@ -234,7 +234,7 @@ int main(int argc, char *argv[])
/*getpeername(): Invalid socket, ENOTSOCK expected error */
error = getpeername(0, (struct sockaddr *)&clt_local_addr, &len);
if (error != -1 || errno != ENOTSOCK)
- tst_brkm(TBROK, NULL, "getpeername on an invalid socket "
+ tst_brkm(TBROK, tst_exit, "getpeername on an invalid socket "
"error:%d errno:%d", error, errno);
tst_resm(TPASS, "getpeername on an invalid socket - ENOTSOCK");
@@ -242,7 +242,7 @@ int main(int argc, char *argv[])
/*getpeername(): Invalid structure, EFAULT expected error */
error = getpeername(clt_sk, (struct sockaddr *)-1, &len);
if (error != -1 || errno != EFAULT)
- tst_brkm(TBROK, NULL, "getpeername with invalid buffer "
+ tst_brkm(TBROK, tst_exit, "getpeername with invalid buffer "
"error:%d errno:%d", error, errno);
tst_resm(TPASS, "getpeername with invalid buffer - EFAULT");
@@ -252,5 +252,5 @@ int main(int argc, char *argv[])
close(accept_sk);
/* Indicate successful completion. */
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_inaddr_any.c b/testcases/network/sctp/func_tests/test_inaddr_any.c
index ac8a638..5ca458b 100644
--- a/testcases/network/sctp/func_tests/test_inaddr_any.c
+++ b/testcases/network/sctp/func_tests/test_inaddr_any.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2002, 2003
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
@@ -6,13 +6,13 @@
* Copyright (c) 2001 Nokia, Inc.
* Copyright (c) 2001 La Monte H.P. Yarroll
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -78,7 +78,7 @@ int main(void)
char *telephone = "Watson, come here! I need you!\n";
char *telephone_resp = "I already brought your coffee...\n";
int error;
- int pf_class, af_family;
+ int pf_class;
uint32_t ppid;
uint32_t stream;
socklen_t namelen;
@@ -91,7 +91,6 @@ int main(void)
/* Set some basic values which depend on the address family. */
#if TEST_V6
pf_class = PF_INET6;
- af_family = AF_INET6;
loop.v6.sin6_family = AF_INET6;
loop.v6.sin6_addr = (struct in6_addr)SCTP_IN6ADDR_LOOPBACK_INIT;
@@ -102,7 +101,6 @@ int main(void)
anyaddr.v6.sin6_port = 0;
#else
pf_class = PF_INET;
- af_family = AF_INET;
loop.v4.sin_family = AF_INET;
loop.v4.sin_addr.s_addr = SCTP_IP_LOOPBACK;
@@ -134,12 +132,12 @@ int main(void)
namelen = sizeof(loop);
error = getsockname(sk1, &loop.sa, &namelen);
if (error != 0)
- tst_brkm(TBROK, NULL, "getsockname: %s", strerror(errno));
+ tst_brkm(TBROK, tst_exit, "getsockname: %s", strerror(errno));
namelen = sizeof(anyaddr);
error = getsockname(sk2, &anyaddr.sa, &namelen);
if (error != 0)
- tst_brkm(TBROK, NULL, "getsockname: %s", strerror(errno));
+ tst_brkm(TBROK, tst_exit, "getsockname: %s", strerror(errno));
#if TEST_V6
loop.v6.sin6_port = anyaddr.v6.sin6_port;
@@ -248,5 +246,5 @@ int main(void)
tst_resm(TPASS, "send msgs from a socket with INADDR_ANY bind address");
/* Indicate successful completion. */
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_peeloff.c b/testcases/network/sctp/func_tests/test_peeloff.c
index 08db125..8eb3529 100644
--- a/testcases/network/sctp/func_tests/test_peeloff.c
+++ b/testcases/network/sctp/func_tests/test_peeloff.c
@@ -1,17 +1,17 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2001, 2003
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
* Copyright (c) 2001 Intel Corp.
* Copyright (c) 2001 Nokia, Inc.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -61,7 +61,7 @@ int TST_CNT = 0;
int main(int argc, char *argv[])
{
int svr_sk, clt_sk[MAX_CLIENTS], peeloff_sk[MAX_CLIENTS];
- sctp_assoc_t svr_associd[MAX_CLIENTS], clt_associd[MAX_CLIENTS];
+ sctp_assoc_t svr_associd[MAX_CLIENTS];
sockaddr_storage_t svr_loop, clt_loop[MAX_CLIENTS];
struct iovec iov;
struct msghdr inmessage;
@@ -166,8 +166,10 @@ int main(int argc, char *argv[])
test_check_msg_notification(&inmessage, error,
sizeof(struct sctp_assoc_change),
SCTP_ASSOC_CHANGE, SCTP_COMM_UP);
+#if 0
sac = (struct sctp_assoc_change *)iov.iov_base;
clt_associd[i] = sac->sac_assoc_id;
+#endif
}
/* Get the communication up message and the data message on the
@@ -200,7 +202,7 @@ int main(int argc, char *argv[])
/* Verify that a peeled off socket is not allowed to do a listen(). */
error = listen(peeloff_sk[0], 1);
if (error != -1)
- tst_brkm(TBROK, NULL, "listen on a peeled off socket "
+ tst_brkm(TBROK, tst_exit, "listen on a peeled off socket "
"error: %d, errno: %d", error, errno);
tst_resm(TPASS, "listen on a peeled off socket");
@@ -211,7 +213,7 @@ int main(int argc, char *argv[])
*/
if ((-1 != sctp_peeloff(peeloff_sk[0], svr_associd[0])) ||
(EINVAL != errno))
- tst_brkm(TBROK, NULL, "sctp_peeloff on a peeled off "
+ tst_brkm(TBROK, tst_exit, "sctp_peeloff on a peeled off "
"socket error:%d, errno:%d", error, errno);
tst_resm(TPASS, "sctp_peeloff on a peeled off socket");
@@ -291,5 +293,5 @@ int main(int argc, char *argv[])
}
/* Indicate successful completion. */
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_recvmsg.c b/testcases/network/sctp/func_tests/test_recvmsg.c
index b6314d8..9cd030b 100644
--- a/testcases/network/sctp/func_tests/test_recvmsg.c
+++ b/testcases/network/sctp/func_tests/test_recvmsg.c
@@ -1,16 +1,16 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2002, 2003
* Copyright (c) 1999-2001 Motorola, Inc.
*
- * This file is part of the SCTP kernel reference Implementation
+ * This file is part of the SCTP kernel Implementation
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
diff --git a/testcases/network/sctp/func_tests/test_sctp_sendrecvmsg.c b/testcases/network/sctp/func_tests/test_sctp_sendrecvmsg.c
index ed41829..4754c3c 100644
--- a/testcases/network/sctp/func_tests/test_sctp_sendrecvmsg.c
+++ b/testcases/network/sctp/func_tests/test_sctp_sendrecvmsg.c
@@ -1,14 +1,14 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2003
* Copyright (c) 2003 Intel Corp.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -34,7 +34,7 @@
*
* Written or modified by:
* Ardelle Fan <ardelle.fan@intel.com>
- * Sridhar Samudrala <sri@us.ibm.com>
+ * Sridhar Samudrala <sri@us.ibm.com>
*/
/* This is a basic functional test for the SCTP new library APIs
@@ -77,19 +77,19 @@ int main(int argc, char *argv[])
sockaddr_storage_t loop2;
sockaddr_storage_t msgname;
int error;
- int pf_class, af_family;
+ int pf_class;
uint32_t ppid;
uint32_t stream;
struct sctp_event_subscribe subscribe;
char *big_buffer;
int offset, msg_flags;
- socklen_t msgname_len, len;
+ socklen_t msgname_len;
size_t buflen;
struct sctp_send_failed *ssf;
struct sctp_sndrcvinfo sinfo;
struct sctp_sndrcvinfo snd_sinfo;
- sctp_assoc_t associd1, associd2;
- int oldlen;
+ sctp_assoc_t associd1;
+ socklen_t len, oldlen;
struct sctp_status gstatus;
/* Rather than fflush() throughout the code, set stdout to
@@ -100,7 +100,6 @@ int main(int argc, char *argv[])
/* Set some basic values which depend on the address family. */
#if TEST_V6
pf_class = PF_INET6;
- af_family = AF_INET6;
loop1.v6.sin6_family = AF_INET6;
loop1.v6.sin6_addr = in6addr_loopback;
@@ -111,7 +110,6 @@ int main(int argc, char *argv[])
loop2.v6.sin6_port = htons(SCTP_TESTPORT_2);
#else
pf_class = PF_INET;
- af_family = AF_INET;
loop1.v4.sin_family = AF_INET;
loop1.v4.sin_addr.s_addr = SCTP_IP_LOOPBACK;
@@ -151,14 +149,14 @@ int main(int argc, char *argv[])
error = getsockopt(sk2, SOL_SOCKET, SO_RCVBUF, &oldlen, &len);
if (error)
- tst_brkm(TBROK, NULL, "can't get rcvbuf size: %s",
+ tst_brkm(TBROK, tst_exit, "can't get rcvbuf size: %s",
strerror(errno));
len = SMALL_RCVBUF; /* Really becomes 2xlen when set. */
error = setsockopt(sk2, SOL_SOCKET, SO_RCVBUF, &len, sizeof(len));
if (error)
- tst_brkm(TBROK, NULL, "setsockopt(SO_RCVBUF): %s",
+ tst_brkm(TBROK, tst_exit, "setsockopt(SO_RCVBUF): %s",
strerror(errno));
/* Mark sk2 as being able to accept new associations. */
@@ -177,10 +175,13 @@ int main(int argc, char *argv[])
buflen = REALLY_BIG;
big_buffer = test_malloc(buflen);
msgname_len = sizeof(msgname);
+ msg_flags = 0;
error = test_sctp_recvmsg(sk2, big_buffer, buflen,
(struct sockaddr *)&msgname, &msgname_len,
&sinfo, &msg_flags);
+#if 0
associd2 = ((struct sctp_assoc_change *)big_buffer)->sac_assoc_id;
+#endif
test_check_buf_notification(big_buffer, error, msg_flags,
sizeof(struct sctp_assoc_change),
SCTP_ASSOC_CHANGE, SCTP_COMM_UP);
@@ -189,12 +190,13 @@ int main(int argc, char *argv[])
error = setsockopt(sk2, SOL_SOCKET, SO_RCVBUF, &oldlen, sizeof(oldlen));
if (error)
- tst_brkm(TBROK, NULL, "setsockopt(SO_RCVBUF): %s",
+ tst_brkm(TBROK, tst_exit, "setsockopt(SO_RCVBUF): %s",
strerror(errno));
/* Get the communication up message on sk1. */
buflen = REALLY_BIG;
msgname_len = sizeof(msgname);
+ msg_flags = 0;
error = test_sctp_recvmsg(sk1, big_buffer, buflen,
(struct sockaddr *)&msgname, &msgname_len,
&sinfo, &msg_flags);
@@ -208,6 +210,7 @@ int main(int argc, char *argv[])
/* Get the first message which was sent. */
buflen = REALLY_BIG;
msgname_len = sizeof(msgname);
+ msg_flags = 0;
error = test_sctp_recvmsg(sk2, big_buffer, buflen,
(struct sockaddr *)&msgname, &msgname_len,
&sinfo, &msg_flags);
@@ -223,7 +226,7 @@ int main(int argc, char *argv[])
error = getsockopt(sk1, IPPROTO_SCTP, SCTP_STATUS, &gstatus, &len);
if (error)
- tst_brkm(TBROK, NULL, "can't get rwnd size: %s",
+ tst_brkm(TBROK, tst_exit, "can't get rwnd size: %s",
strerror(errno));
tst_resm(TINFO, "creating a fillmsg of size %d",
gstatus.sstat_rwnd + RWND_SLOP);
@@ -269,6 +272,7 @@ int main(int argc, char *argv[])
do {
buflen = REALLY_BIG;
msgname_len = sizeof(msgname);
+ msg_flags = 0;
test_sctp_recvmsg(sk2, big_buffer, buflen,
(struct sockaddr *)&msgname, &msgname_len,
&sinfo, &msg_flags);
@@ -277,13 +281,14 @@ int main(int argc, char *argv[])
/* Get the message that did NOT time out. */
buflen = REALLY_BIG;
msgname_len = sizeof(msgname);
+ msg_flags = 0;
error = test_sctp_recvmsg(sk2, big_buffer, buflen,
(struct sockaddr *)&msgname, &msgname_len,
&sinfo, &msg_flags);
test_check_buf_data(big_buffer, error, msg_flags, &sinfo,
strlen(nottlmsg) + 1, MSG_EOR, stream, ppid);
if (0 != strncmp(big_buffer, nottlmsg, strlen(nottlmsg)))
- tst_brkm(TBROK, NULL, "sctp_recvmsg: Wrong Message !!!");
+ tst_brkm(TBROK, tst_exit, "sctp_recvmsg: Wrong Message !!!");
tst_resm(TPASS, "sctp_recvmsg msg with zero ttl");
@@ -292,6 +297,7 @@ int main(int argc, char *argv[])
*/
buflen = REALLY_BIG;
msgname_len = sizeof(msgname);
+ msg_flags = 0;
error = test_sctp_recvmsg(sk1, big_buffer, buflen,
(struct sockaddr *)&msgname, &msgname_len,
&sinfo, &msg_flags);
@@ -300,7 +306,7 @@ int main(int argc, char *argv[])
strlen(ttlmsg) + 1, SCTP_SEND_FAILED, 0);
ssf = (struct sctp_send_failed *)big_buffer;
if (0 != strncmp(ttlmsg, (char *)ssf->ssf_data, strlen(ttlmsg) + 1))
- tst_brkm(TBROK, NULL, "SEND_FAILED data mismatch");
+ tst_brkm(TBROK, tst_exit, "SEND_FAILED data mismatch");
tst_resm(TPASS, "sctp_recvmsg SEND_FAILED for message with ttl");
@@ -312,6 +318,7 @@ int main(int argc, char *argv[])
do {
buflen = REALLY_BIG;
msgname_len = sizeof(msgname);
+ msg_flags = 0;
error = test_sctp_recvmsg(sk1, big_buffer, buflen,
(struct sockaddr *)&msgname,
&msgname_len, &sinfo, &msg_flags);
@@ -321,7 +328,7 @@ int main(int argc, char *argv[])
ssf = (struct sctp_send_failed *)big_buffer;
if (0 != strncmp(&ttlfrag[offset], (char *)ssf->ssf_data,
SMALL_MAXSEG))
- tst_brkm(TBROK, NULL, "SEND_FAILED data mismatch");
+ tst_brkm(TBROK, tst_exit, "SEND_FAILED data mismatch");
offset += SMALL_MAXSEG;
} while (!(ssf->ssf_info.sinfo_flags & 0x01)); /* LAST FRAG */
@@ -338,6 +345,7 @@ int main(int argc, char *argv[])
buflen = REALLY_BIG;
msgname_len = sizeof(msgname);
+ msg_flags = 0;
error = test_sctp_recvmsg(sk2, big_buffer, buflen,
(struct sockaddr *)&msgname, &msgname_len,
&sinfo, &msg_flags);
@@ -353,6 +361,7 @@ int main(int argc, char *argv[])
/* Get the shutdown complete notification. */
buflen = REALLY_BIG;
msgname_len = sizeof(msgname);
+ msg_flags = 0;
error = test_sctp_recvmsg(sk2, big_buffer, buflen,
(struct sockaddr *)&msgname, &msgname_len,
&sinfo, &msg_flags);
@@ -363,5 +372,5 @@ int main(int argc, char *argv[])
close(sk2);
/* Indicate successful completion. */
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_sockopt.c b/testcases/network/sctp/func_tests/test_sockopt.c
index 0dc3324..96becf0 100644
--- a/testcases/network/sctp/func_tests/test_sockopt.c
+++ b/testcases/network/sctp/func_tests/test_sockopt.c
@@ -1,17 +1,17 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2001, 2004
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
* Copyright (c) 2001 Intel Corp.
* Copyright (c) 2001 Nokia, Inc.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -77,7 +77,7 @@ int main(void)
struct iovec out_iov;
char *message = "hello, world!\n";
int error;
- int pf_class, af_family;
+ int pf_class;
uint32_t ppid;
uint32_t stream;
sctp_assoc_t udp_svr_associd, udp_clt_associd;
@@ -85,6 +85,7 @@ int main(void)
char *big_buffer;
struct sctp_event_subscribe subscribe;
struct sctp_initmsg initmsg;
+ struct sctp_paddrparams paddrparams;
struct sctp_sndrcvinfo set_udp_sk_dflt_param, get_udp_sk_dflt_param;
struct sctp_sndrcvinfo set_tcp_sk_dflt_param, get_tcp_sk_dflt_param;
struct sctp_sndrcvinfo set_udp_assoc_dflt_param;
@@ -94,8 +95,10 @@ int main(void)
struct sctp_sndrcvinfo get_peeloff_assoc_dflt_param;
struct sctp_sndrcvinfo get_accept_assoc_dflt_param;
struct sctp_paddrinfo pinfo;
+ int dflt_pathmaxrxt;
socklen_t optlen, addrlen;
struct sctp_status status;
+ struct sctp_assoc_value value;
/* Rather than fflush() throughout the code, set stdout to
* be unbuffered.
@@ -105,7 +108,6 @@ int main(void)
/* Set some basic values which depend on the address family. */
#if TEST_V6
pf_class = PF_INET6;
- af_family = AF_INET6;
udp_svr_loop.v6.sin6_family = AF_INET6;
udp_svr_loop.v6.sin6_addr = in6addr_loopback;
@@ -124,7 +126,6 @@ int main(void)
tcp_clt_loop.v6.sin6_port = htons(SCTP_TESTPORT_1 + 3);
#else
pf_class = PF_INET;
- af_family = AF_INET;
udp_svr_loop.v4.sin_family = AF_INET;
udp_svr_loop.v4.sin_addr.s_addr = SCTP_IP_LOOPBACK;
@@ -166,7 +167,7 @@ int main(void)
memset(&status, 0, optlen);
error = getsockopt(udp_svr_sk, SOL_SCTP, SCTP_STATUS, &status, &optlen);
if ((error != -1) && (errno != EINVAL))
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_STATUS) on a "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_STATUS) on a "
"socket with no assoc error:%d errno:%d",
error, errno);
@@ -242,7 +243,7 @@ int main(void)
status.sstat_assoc_id = udp_svr_associd;
error = getsockopt(udp_clt_sk, SOL_SCTP, SCTP_STATUS, &status, &optlen);
if ((error != -1) && (errno != EINVAL))
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_STATUS) with "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_STATUS) with "
"associd error: %d errno:%d", error, errno);
tst_resm(TPASS, "getsockopt(SCTP_STATUS) with invalid associd");
@@ -253,7 +254,7 @@ int main(void)
status.sstat_assoc_id = 0;
error = getsockopt(udp_svr_sk, SOL_SCTP, SCTP_STATUS, &status, &optlen);
if ((error != -1) && (errno != EINVAL))
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_STATUS) with "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_STATUS) with "
"NULL associd error: %d errno:%d", error, errno);
tst_resm(TPASS, "getsockopt(SCTP_STATUS) with NULL associd");
@@ -326,7 +327,8 @@ int main(void)
MSG_EOR, 0, 0);
/* Verify that we received the msg without any ancillary data. */
if (inmessage.msg_controllen != 0)
- tst_brkm(TBROK, NULL, "Receive unexpected ancillary" "data");
+ tst_brkm(TBROK, tst_exit, "Receive unexpected ancillary"
+ "data");
/* Enable SCTP_SHUTDOWN_EVENTs on udp_svr_sk. */
memset(&subscribe, 0, sizeof(struct sctp_event_subscribe));
@@ -410,7 +412,7 @@ int main(void)
error = sctp_opt_info(udp_clt_sk, udp_clt_associd, SCTP_STATUS,
(char *)&status1, &optlen);
if (error != 0)
- tst_brkm(TBROK, NULL,
+ tst_brkm(TBROK, tst_exit,
"sctp_opt_info(SCTP_STATUS): %s",
strerror(errno));
@@ -418,11 +420,11 @@ int main(void)
error = getsockopt(udp_clt_sk, IPPROTO_SCTP, SCTP_STATUS,
(char *)&status2, &optlen);
if (error != 0)
- tst_brkm(TBROK, NULL,
+ tst_brkm(TBROK, tst_exit,
"getsockopt(SCTP_STATUS): %s",
strerror(errno));
if (strncmp((char *)&status1, (char *)&status2, optlen))
- tst_brkm(TBROK, NULL, "sctp_opt_info(SCTP_STAUS)"
+ tst_brkm(TBROK, tst_exit, "sctp_opt_info(SCTP_STAUS)"
"doesn't match getsockopt(SCTP_STATUS)");
tst_resm(TPASS, "sctp_opt_info(SCTP_STATUS)");
@@ -463,7 +465,253 @@ int main(void)
close(udp_svr_sk);
- /* TEST #5: SCTP_DEFAULT_SEND_PARAM socket option. */
+ /* TEST #5: SCTP_PEER_ADDR_PARAMS socket option. */
+ /* Create a socket. */
+ udp_svr_sk = test_socket(pf_class, SOCK_SEQPACKET, IPPROTO_SCTP);
+
+ /* Get the default parameters for this endpoint */
+ optlen = sizeof(paddrparams);
+ memset(&paddrparams, 0, sizeof(paddrparams));
+ paddrparams.spp_address.ss_family = AF_INET;
+ test_getsockopt(udp_svr_sk, SCTP_PEER_ADDR_PARAMS, &paddrparams,
+ &optlen);
+
+ dflt_pathmaxrxt = paddrparams.spp_pathmaxrxt;
+ tst_resm(TPASS, "getsockopt(SCTP_PEER_ADDR_PARAMS)");
+
+ /* Change the default parameters for this endpoint (socket) */
+ paddrparams.spp_hbinterval = 1000;
+ paddrparams.spp_pathmaxrxt = dflt_pathmaxrxt + 1;
+ paddrparams.spp_sackdelay = 100;
+ test_setsockopt(udp_svr_sk, SCTP_PEER_ADDR_PARAMS, &paddrparams,
+ sizeof(paddrparams));
+
+ paddrparams.spp_pathmaxrxt = 0;
+
+ /* Get the updated default parameters for this endpoint. */
+ optlen = sizeof(paddrparams);
+ test_getsockopt(udp_svr_sk, SCTP_PEER_ADDR_PARAMS, &paddrparams,
+ &optlen);
+ if (paddrparams.spp_pathmaxrxt != dflt_pathmaxrxt + 1)
+ tst_brkm(TBROK, tst_exit, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "mismatch");
+
+ value.assoc_id = 0;
+ optlen = sizeof(value);
+ test_getsockopt(udp_svr_sk, SCTP_DELAYED_ACK_TIME, &value, &optlen);
+ if (value.assoc_value != 100)
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_DELAYED_ACK_TIME) "
+ "mismatch");
+
+ value.assoc_id = 0;
+ value.assoc_value = 250;
+ test_setsockopt(udp_svr_sk, SCTP_DELAYED_ACK_TIME, &value,
+ sizeof(value));
+ optlen = sizeof(paddrparams);
+ test_getsockopt(udp_svr_sk, SCTP_PEER_ADDR_PARAMS, &paddrparams,
+ &optlen);
+ if (paddrparams.spp_sackdelay != 250)
+ tst_brkm(TBROK, tst_exit, "setsockopt(SCTP_DELAYED_ACK_TIME) "
+ "mismatch");
+
+ tst_resm(TPASS, "setsockopt(SCTP_DELAYED_ACK_TIME)");
+
+ /* Ensure that prior defaults are preserved for a new endpoint */
+ udp_clt_sk = test_socket(pf_class, SOCK_SEQPACKET, IPPROTO_SCTP);
+ optlen = sizeof(paddrparams);
+ memset(&paddrparams, 0, sizeof(paddrparams));
+ paddrparams.spp_address.ss_family = AF_INET;
+ test_getsockopt(udp_clt_sk, SCTP_PEER_ADDR_PARAMS, &paddrparams,
+ &optlen);
+ if (paddrparams.spp_pathmaxrxt != dflt_pathmaxrxt)
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "mismatch");
+
+ tst_resm(TPASS, "setsockopt(SCTP_PEER_ADDR_PARAMS)");
+
+ /* Invalid assoc id */
+ paddrparams.spp_assoc_id = 1234;
+ error = setsockopt(udp_clt_sk, SOL_SCTP, SCTP_PEER_ADDR_PARAMS,
+ &paddrparams, sizeof(paddrparams));
+ if ((-1 != error) || (EINVAL != errno))
+ tst_brkm(TBROK, tst_exit, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "invalid associd error:%d, errno:%d\n", error, errno);
+
+ tst_resm(TPASS, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "- one-to-many style invalid associd");
+
+ test_bind(udp_svr_sk, &udp_svr_loop.sa, sizeof(udp_svr_loop));
+ test_bind(udp_clt_sk, &udp_clt_loop.sa, sizeof(udp_clt_loop));
+
+ test_listen(udp_svr_sk, 5);
+
+ test_enable_assoc_change(udp_svr_sk);
+ test_enable_assoc_change(udp_clt_sk);
+
+ /* Do a connect on a UDP-style socket and establish an association. */
+ test_connect(udp_clt_sk, &udp_svr_loop.sa, sizeof(udp_svr_loop));
+
+ /* Receive the COMM_UP notifications and get the associd's */
+ inmessage.msg_controllen = sizeof(incmsg);
+ error = test_recvmsg(udp_svr_sk, &inmessage, MSG_WAITALL);
+ test_check_msg_notification(&inmessage, error,
+ sizeof(struct sctp_assoc_change),
+ SCTP_ASSOC_CHANGE, SCTP_COMM_UP);
+ sac = (struct sctp_assoc_change *)iov.iov_base;
+
+ paddrparams.spp_assoc_id = sac->sac_assoc_id;
+ memcpy(&paddrparams.spp_address, &udp_clt_loop, sizeof(udp_clt_loop));
+ paddrparams.spp_hbinterval = 1000;
+ paddrparams.spp_pathmaxrxt = dflt_pathmaxrxt + 1;
+ test_setsockopt(udp_svr_sk, SCTP_PEER_ADDR_PARAMS, &paddrparams,
+ sizeof(paddrparams));
+ tst_resm(TPASS, "setsockopt(SCTP_PEER_ADDR_PARAMS) - "
+ "one-to-many style valid associd valid address");
+
+ paddrparams.spp_assoc_id = sac->sac_assoc_id;
+ memcpy(&paddrparams.spp_address, &udp_svr_loop, sizeof(udp_svr_loop));
+ paddrparams.spp_hbinterval = 1000;
+ paddrparams.spp_pathmaxrxt = dflt_pathmaxrxt + 1;
+
+ error = setsockopt(udp_clt_sk, SOL_SCTP, SCTP_PEER_ADDR_PARAMS,
+ &paddrparams, sizeof(paddrparams));
+ if ((-1 != error) || (EINVAL != errno))
+ tst_brkm(TBROK, tst_exit, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "invalid transport error:%d, errno:%d\n",
+ error, errno);
+
+ tst_resm(TPASS, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "- one-to-many style invalid transport");
+
+ paddrparams.spp_assoc_id = sac->sac_assoc_id;
+ memcpy(&paddrparams.spp_address, &udp_clt_loop, sizeof(udp_clt_loop));
+ paddrparams.spp_hbinterval = 1000;
+ paddrparams.spp_pathmaxrxt = dflt_pathmaxrxt + 1;
+
+ error = setsockopt(udp_clt_sk, SOL_SCTP, SCTP_PEER_ADDR_PARAMS,
+ &paddrparams, sizeof(paddrparams) - 1);
+ if ((-1 != error) || (EINVAL != errno))
+ tst_brkm(TBROK, tst_exit, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "invalid parameter length error:%d, errno:%d\n",
+ error, errno);
+
+ tst_resm(TPASS, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "- one-to-many style invalid parameter length");
+
+ error = setsockopt(udp_clt_sk, SOL_SCTP, SCTP_DELAYED_ACK_TIME,
+ &value, sizeof(value) - 1);
+ if ((-1 != error) || (EINVAL != errno))
+ tst_brkm(TBROK, tst_exit, "setsockopt(SCTP_DELAYED_ACK_TIME) "
+ "invalid parameter length error:%d, errno:%d\n",
+ error, errno);
+
+ tst_resm(TPASS, "setsockopt(SCTP_DELAYED_ACK_TIME) "
+ "- one-to-many style invalid parameter length");
+
+ memset(&paddrparams, 0, sizeof(paddrparams));
+ paddrparams.spp_assoc_id = sac->sac_assoc_id;
+ memcpy(&paddrparams.spp_address, &udp_clt_loop, sizeof(udp_clt_loop));
+ paddrparams.spp_sackdelay = 501;
+
+ error = setsockopt(udp_clt_sk, SOL_SCTP, SCTP_PEER_ADDR_PARAMS,
+ &paddrparams, sizeof(paddrparams));
+ if ((-1 != error) || (EINVAL != errno))
+ tst_brkm(TBROK, tst_exit, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "invalid sack delay error:%d, errno:%d\n",
+ error, errno);
+
+ tst_resm(TPASS, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "- one-to-many style invalid sack delay");
+
+ value.assoc_id = sac->sac_assoc_id;
+ value.assoc_value = 501;
+
+ error = setsockopt(udp_clt_sk, SOL_SCTP, SCTP_DELAYED_ACK_TIME,
+ &value, sizeof(value));
+ if ((-1 != error) || (EINVAL != errno))
+ tst_brkm(TBROK, tst_exit, "setsockopt(SCTP_DELAYED_ACK_TIME) "
+ "invalid sack delay error:%d, errno:%d\n",
+ error, errno);
+
+ tst_resm(TPASS, "setsockopt(SCTP_DELAYED_ACK_TIME) "
+ "- one-to-many style invalid sack delay");
+
+ memset(&paddrparams, 0, sizeof(paddrparams));
+ paddrparams.spp_assoc_id = sac->sac_assoc_id;
+ memcpy(&paddrparams.spp_address, &udp_clt_loop, sizeof(udp_clt_loop));
+ paddrparams.spp_pathmtu = 511;
+
+ error = setsockopt(udp_clt_sk, SOL_SCTP, SCTP_PEER_ADDR_PARAMS,
+ &paddrparams, sizeof(paddrparams));
+ if ((-1 != error) || (EINVAL != errno))
+ tst_brkm(TBROK, tst_exit, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "invalid path MTU error:%d, errno:%d\n", error, errno);
+
+ tst_resm(TPASS, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "- one-to-many style invalid path MTU");
+
+ memset(&paddrparams, 0, sizeof(paddrparams));
+ paddrparams.spp_assoc_id = sac->sac_assoc_id;
+ memcpy(&paddrparams.spp_address, &udp_clt_loop, sizeof(udp_clt_loop));
+ paddrparams.spp_flags = SPP_HB_ENABLE | SPP_HB_DISABLE;
+
+ error = setsockopt(udp_clt_sk, SOL_SCTP, SCTP_PEER_ADDR_PARAMS,
+ &paddrparams, sizeof(paddrparams));
+ if ((-1 != error) || (EINVAL != errno))
+ tst_brkm(TBROK, tst_exit, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "invalid hb enable flags error:%d, errno:%d\n",
+ error, errno);
+
+ tst_resm(TPASS, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "- one-to-many style invalid hb enable flags");
+
+ memset(&paddrparams, 0, sizeof(paddrparams));
+ paddrparams.spp_assoc_id = sac->sac_assoc_id;
+ memcpy(&paddrparams.spp_address, &udp_clt_loop, sizeof(udp_clt_loop));
+ paddrparams.spp_flags = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE;
+
+ error = setsockopt(udp_clt_sk, SOL_SCTP, SCTP_PEER_ADDR_PARAMS,
+ &paddrparams, sizeof(paddrparams));
+ if ((-1 != error) || (EINVAL != errno))
+ tst_brkm(TBROK, tst_exit, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "invalid PMTU discovery enable flags error:%d, errno:%d\n",
+ error, errno);
+
+ tst_resm(TPASS, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "- one-to-many style invalid PMTU discovery enable flags");
+
+ memset(&paddrparams, 0, sizeof(paddrparams));
+ paddrparams.spp_assoc_id = sac->sac_assoc_id;
+ memcpy(&paddrparams.spp_address, &udp_clt_loop, sizeof(udp_clt_loop));
+ paddrparams.spp_flags = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE;
+
+ error = setsockopt(udp_clt_sk, SOL_SCTP, SCTP_PEER_ADDR_PARAMS,
+ &paddrparams, sizeof(paddrparams));
+ if ((-1 != error) || (EINVAL != errno))
+ tst_brkm(TBROK, tst_exit, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "invalid sack delay enable flags error:%d, errno:%d\n",
+ error, errno);
+
+ tst_resm(TPASS, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "- one-to-many style invalid sack delay enable flags");
+
+ memset(&paddrparams, 0, sizeof(paddrparams));
+ paddrparams.spp_flags = SPP_HB_DEMAND;
+
+ error = setsockopt(udp_clt_sk, SOL_SCTP, SCTP_PEER_ADDR_PARAMS,
+ &paddrparams, sizeof(paddrparams));
+ if ((-1 != error) || (EINVAL != errno))
+ tst_brkm(TBROK, tst_exit, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "invalid hb demand error:%d, errno:%d\n",
+ error, errno);
+
+ tst_resm(TPASS, "setsockopt(SCTP_PEER_ADDR_PARAMS) "
+ "- one-to-many style invalid hb demand");
+
+ close(udp_svr_sk);
+ close(udp_clt_sk);
+
+ /* TEST #6: SCTP_DEFAULT_SEND_PARAM socket option. */
/* Create and bind 2 UDP-style sockets(udp_svr_sk, udp_clt_sk) and
* 2 TCP-style sockets. (tcp_svr_sk, tcp_clt_sk)
*/
@@ -511,7 +759,7 @@ int main(void)
/* Verify that the get param matches set param. */
if (set_udp_sk_dflt_param.sinfo_ppid !=
get_udp_sk_dflt_param.sinfo_ppid)
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
"mismatch.");
/* Get default send parameters on the unconnected UDP-style socket. */
@@ -523,7 +771,7 @@ int main(void)
/* Verify that the get param matches set param. */
if (set_udp_sk_dflt_param.sinfo_ppid !=
get_udp_sk_dflt_param.sinfo_ppid)
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
"mismatch.");
tst_resm(TPASS, "getsockopt(SCTP_DEFAULT_SEND_PARAM) - "
@@ -540,7 +788,7 @@ int main(void)
&set_udp_sk_dflt_param,
sizeof(set_udp_sk_dflt_param));
if ((-1 != error) || (EINVAL != errno))
- tst_brkm(TBROK, NULL, "setsockopt(SCTP_DEFAULT_SEND_PARAM) "
+ tst_brkm(TBROK, tst_exit, "setsockopt(SCTP_DEFAULT_SEND_PARAM) "
"invalid associd error:%d, errno:%d\n", error, errno);
tst_resm(TPASS, "setsockopt(SCTP_DEFAULT_SEND_PARAM) "
@@ -576,7 +824,7 @@ int main(void)
&set_udp_assoc_dflt_param,
sizeof(set_udp_assoc_dflt_param));
if ((-1 != error) || (EINVAL != errno))
- tst_brkm(TBROK, NULL, "setsockopt(SCTP_DEFAULT_SEND_PARAM) "
+ tst_brkm(TBROK, tst_exit, "setsockopt(SCTP_DEFAULT_SEND_PARAM) "
"associd belonging to another socket "
"error:%d, errno:%d", error, errno);
@@ -608,7 +856,7 @@ int main(void)
/* Verify that the get param matches the set param. */
if (get_udp_assoc_dflt_param.sinfo_ppid !=
set_udp_assoc_dflt_param.sinfo_ppid)
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
"mismatch.");
tst_resm(TPASS, "getsockopt(SCTP_DEFAULT_SEND_PARAM) - "
@@ -627,7 +875,7 @@ int main(void)
/* Verify that the get param matches the socket-wide set param. */
if (get_udp_sk_dflt_param.sinfo_ppid !=
set_udp_sk_dflt_param.sinfo_ppid)
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
"mismatch.");
tst_resm(TPASS, "getsockopt(SCTP_DEFAULT_SEND_PARAM) - "
@@ -649,7 +897,7 @@ int main(void)
/* Verify that the get param matches the association's set param. */
if (get_peeloff_assoc_dflt_param.sinfo_ppid !=
set_udp_assoc_dflt_param.sinfo_ppid)
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
"mismatch.");
tst_resm(TPASS, "getsockopt(SCTP_DEFAULT_SEND_PARAM) - "
@@ -683,7 +931,7 @@ int main(void)
/* Verify that the get param matches set param. */
if (set_tcp_sk_dflt_param.sinfo_ppid !=
get_tcp_sk_dflt_param.sinfo_ppid)
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
"mismatch.");
/* Get default send parameters on the unconnected TCP-style socket. */
@@ -695,7 +943,7 @@ int main(void)
/* Verify that the get param matches set param. */
if (set_tcp_sk_dflt_param.sinfo_ppid !=
get_tcp_sk_dflt_param.sinfo_ppid)
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
"mismatch.");
tst_resm(TPASS, "getsockopt(SCTP_DEFAULT_SEND_PARAM) - "
@@ -727,7 +975,7 @@ int main(void)
if (set_tcp_assoc_dflt_param.sinfo_ppid !=
get_tcp_assoc_dflt_param.sinfo_ppid)
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
"mismatch.");
/* Get default send parameters on the connected TCP-style socket. */
@@ -743,7 +991,7 @@ int main(void)
set_tcp_sk_dflt_param.sinfo_ppid) ||
(get_tcp_sk_dflt_param.sinfo_ppid !=
set_tcp_assoc_dflt_param.sinfo_ppid))
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
"mismatch.");
/* Get default send parameters on the listening TCP-style socket. */
@@ -757,7 +1005,7 @@ int main(void)
*/
if (get_tcp_sk_dflt_param.sinfo_ppid !=
set_tcp_sk_dflt_param.sinfo_ppid)
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
"mismatch.");
tst_resm(TPASS, "getsockopt(SCTP_DEFAULT_SEND_PARAM) - "
@@ -780,20 +1028,20 @@ int main(void)
*/
if (get_tcp_sk_dflt_param.sinfo_ppid !=
set_tcp_sk_dflt_param.sinfo_ppid)
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_DEFAULT_SEND_PARAM) "
"mismatch.");
tst_resm(TPASS, "getsockopt(SCTP_DEFAULT_SEND_PARAM) - "
"one-to-one style accepted socket");
- /* TEST #6: SCTP_GET_PEER_ADDR_INFO socket option. */
+ /* TEST #7: SCTP_GET_PEER_ADDR_INFO socket option. */
/* Try 0 associd and 0 addr */
memset(&pinfo, 0, sizeof(pinfo));
optlen = sizeof(pinfo);
error = getsockopt(udp_clt_sk, SOL_SCTP, SCTP_GET_PEER_ADDR_INFO,
&pinfo, &optlen);
if ((-1 != error) || (EINVAL != errno))
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_GET_PEER_ADDR_INFO) "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_GET_PEER_ADDR_INFO) "
"null associd, null addr error:%d, errno:%d\n",
error, errno);
@@ -807,7 +1055,7 @@ int main(void)
error = getsockopt(udp_clt_sk, SOL_SCTP, SCTP_GET_PEER_ADDR_INFO,
&pinfo, &optlen);
if ((-1 != error) || (EINVAL != errno))
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_GET_PEER_ADDR_INFO) "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_GET_PEER_ADDR_INFO) "
"valid associd, null addr error:%d, errno:%d\n",
error, errno);
@@ -822,7 +1070,7 @@ int main(void)
error = getsockopt(udp_clt_sk, SOL_SCTP, SCTP_GET_PEER_ADDR_INFO,
&pinfo, &optlen);
if ((-1 != error) || (EINVAL != errno))
- tst_brkm(TBROK, NULL, "getsockopt(SCTP_GET_PEER_ADDR_INFO) "
+ tst_brkm(TBROK, tst_exit, "getsockopt(SCTP_GET_PEER_ADDR_INFO) "
"valid associd, invalid addr error:%d, errno:%d\n",
error, errno);
@@ -868,5 +1116,5 @@ int main(void)
close(peeloff_sk);
/* Indicate successful completion. */
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_tcp_style.c b/testcases/network/sctp/func_tests/test_tcp_style.c
index da0a5c6..60de8d3 100644
--- a/testcases/network/sctp/func_tests/test_tcp_style.c
+++ b/testcases/network/sctp/func_tests/test_tcp_style.c
@@ -1,16 +1,16 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2003
* Copyright (c) 1999-2001 Motorola, Inc.
*
- * This file is part of the SCTP kernel reference Implementation
+ * This file is part of the SCTP kernel Implementation
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -133,7 +133,7 @@ int main(int argc, char *argv[])
/* Try to do accept on a non-listening socket. It should fail. */
error = accept(clt_sk[0], &accept_loop.sa, &addrlen);
if ((-1 != error) && (EINVAL != errno))
- tst_brkm(TBROK, NULL, "accept on non-listening socket "
+ tst_brkm(TBROK, tst_exit, "accept on non-listening socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "accept on non-listening socket");
@@ -142,7 +142,7 @@ int main(int argc, char *argv[])
error = connect(listen_sk, (struct sockaddr *)&clt_loop[0],
sizeof(clt_loop[0]));
if ((-1 != error) && (EISCONN != errno))
- tst_brkm(TBROK, NULL, "connect to non-listening socket "
+ tst_brkm(TBROK, tst_exit, "connect to non-listening socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "connect to non-listening socket");
@@ -158,7 +158,7 @@ int main(int argc, char *argv[])
*/
error = connect(clt2_sk, &svr_loop.sa, sizeof(svr_loop));
if ((-1 != error) && (ECONNREFUSED != errno))
- tst_brkm(TBROK, NULL, "connect after max backlog "
+ tst_brkm(TBROK, tst_exit, "connect after max backlog "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "connect after max backlog");
@@ -170,7 +170,7 @@ int main(int argc, char *argv[])
poll_fd.revents = 0;
error = poll(&poll_fd, 1, -1);
if ((1 != error) && (1 != poll_fd.revents))
- tst_brkm(TBROK, NULL, "Unexpected return value "
+ tst_brkm(TBROK, tst_exit, "Unexpected return value "
"with poll, error:%d errno:%d, revents:%d",
error, errno, poll_fd.revents);
@@ -184,7 +184,7 @@ int main(int argc, char *argv[])
/* Try to do a connect on an established socket. It should fail. */
error = connect(accept_sk[0], &clt_loop[0].sa, sizeof(clt_loop[0]));
if ((-1 != error) || (EISCONN != errno))
- tst_brkm(TBROK, NULL, "connect on an established socket "
+ tst_brkm(TBROK, tst_exit, "connect on an established socket "
"error:%d errno:%d", error, errno);
tst_resm(TPASS, "connect on an established socket");
@@ -192,12 +192,12 @@ int main(int argc, char *argv[])
/* Try to do accept on an established socket. It should fail. */
error = accept(accept_sk[0], &accept_loop.sa, &addrlen);
if ((-1 != error) && (EINVAL != errno))
- tst_brkm(TBROK, NULL, "accept on an established socket "
+ tst_brkm(TBROK, tst_exit, "accept on an established socket "
"error:%d errno:%d", error, errno);
error = accept(clt_sk[0], &accept_loop.sa, &addrlen);
if ((-1 != error) && (EINVAL != errno))
- tst_brkm(TBROK, NULL, "accept on an established socket "
+ tst_brkm(TBROK, tst_exit, "accept on an established socket "
"failure: error:%d errno:%d", error, errno);
tst_resm(TPASS, "accept on an established socket");
@@ -225,7 +225,7 @@ int main(int argc, char *argv[])
/* Sending a message on a listening socket should fail. */
error = send(listen_sk, message, strlen(message), MSG_NOSIGNAL);
if ((-1 != error) || (EPIPE != errno))
- tst_brkm(TBROK, NULL, "send on a listening socket "
+ tst_brkm(TBROK, tst_exit, "send on a listening socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "send on a listening socket");
@@ -233,7 +233,7 @@ int main(int argc, char *argv[])
/* Trying to receive a message on a listening socket should fail. */
error = recv(listen_sk, msgbuf, 100, 0);
if ((-1 != error) || (ENOTCONN != errno))
- tst_brkm(TBROK, NULL, "recv on a listening socket "
+ tst_brkm(TBROK, tst_exit, "recv on a listening socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "recv on a listening socket");
@@ -253,7 +253,7 @@ int main(int argc, char *argv[])
*/
error = recv(accept_sk[0], msgbuf, 100, 0);
if ((0 != error) || (0 != errno))
- tst_brkm(TBROK, NULL, "recv on a SHUTDOWN received socket "
+ tst_brkm(TBROK, tst_exit, "recv on a SHUTDOWN received socket "
"error:%d errno:%d", error, errno);
tst_resm(TPASS, "recv on a SHUTDOWN received socket");
@@ -284,7 +284,7 @@ int main(int argc, char *argv[])
/* No more messages and the association is SHUTDOWN, should fail. */
error = recv(clt_sk[0], msgbuf, 100, 0);
if ((-1 != error) || (ENOTCONN != errno))
- tst_brkm(TBROK, NULL, "recv on a SHUTDOWN sent socket "
+ tst_brkm(TBROK, tst_exit, "recv on a SHUTDOWN sent socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "recv on a SHUTDOWN sent socket");
@@ -296,7 +296,7 @@ int main(int argc, char *argv[])
error = recv(clt_sk[1], msgbuf, 100, 0);
if ((0 != error) || (0 != errno))
- tst_brkm(TBROK, NULL, "recv on a SHUT_RD socket "
+ tst_brkm(TBROK, tst_exit, "recv on a SHUT_RD socket "
"error:%d, errno:%d", error, errno);
/* Sending a message on SHUT_RD socket. */
@@ -311,7 +311,7 @@ int main(int argc, char *argv[])
/* We should not receive the message as the socket is SHUT_RD */
error = recv(clt_sk[1], msgbuf, 100, 0);
if ((0 != error) || (0 != errno))
- tst_brkm(TBROK, NULL, "recv on a SHUT_RD socket "
+ tst_brkm(TBROK, tst_exit, "recv on a SHUT_RD socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "recv on a SHUT_RD socket");
@@ -321,12 +321,12 @@ int main(int argc, char *argv[])
error = recv(accept_sk[2], msgbuf, 100, 0);
if ((0 != error) || (0 != errno))
- tst_brkm(TBROK, NULL, "recv on a SHUT_RDWR socket "
+ tst_brkm(TBROK, tst_exit, "recv on a SHUT_RDWR socket "
"error:%d, errno:%d", error, errno);
error = recv(clt_sk[2], msgbuf, 100, 0);
if ((0 != error) || (0 != errno))
- tst_brkm(TBROK, NULL, "recv on a SHUT_RDWR socket "
+ tst_brkm(TBROK, tst_exit, "recv on a SHUT_RDWR socket "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "recv on a SHUT_RDWR socket");
@@ -353,7 +353,7 @@ int main(int argc, char *argv[])
error = select(listen_sk + 1, &set, NULL, NULL, NULL);
if (1 != error)
- tst_brkm(TBROK, NULL, "select error:%d, "
+ tst_brkm(TBROK, tst_exit, "select error:%d, "
"errno: %d", error, errno);
/* Now accept the CLOSED association waiting on the listening
@@ -369,7 +369,7 @@ int main(int argc, char *argv[])
*/
error = recv(accept2_sk, msgbuf, 100, 0);
if ((0 != error) || (0 != errno))
- tst_brkm(TBROK, NULL, "Unexpected error return on "
+ tst_brkm(TBROK, tst_exit, "Unexpected error return on "
"recv(error:%d, errno:%d)", error, errno);
tst_resm(TPASS, "accept of a CLOSED association");
@@ -379,7 +379,7 @@ int main(int argc, char *argv[])
*/
error = send(accept2_sk, message, strlen(message), MSG_NOSIGNAL);
if ((-1 != error) || (EPIPE != errno))
- tst_brkm(TBROK, NULL, "send to a CLOSED association "
+ tst_brkm(TBROK, tst_exit, "send to a CLOSED association "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "send to a CLOSED association");
@@ -425,7 +425,7 @@ int main(int argc, char *argv[])
sinfo->sinfo_flags |= SCTP_EOF;
error = sendmsg(clt2_sk, &outmessage, 0);
if ((-1 != error) || (EINVAL != errno))
- tst_brkm(TBROK, NULL, "sendmsg with SCTP_EOF flag "
+ tst_brkm(TBROK, tst_exit, "sendmsg with SCTP_EOF flag "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "sendmsg with SCTP_EOF flag");
@@ -436,7 +436,7 @@ int main(int argc, char *argv[])
sinfo->sinfo_flags |= SCTP_ABORT;
error = sendmsg(clt2_sk, &outmessage, 0);
if ((-1 != error) || (EINVAL != errno))
- tst_brkm(TBROK, NULL, "sendmsg with SCTP_ABORT flag "
+ tst_brkm(TBROK, tst_exit, "sendmsg with SCTP_ABORT flag "
"error:%d, errno:%d", error, errno);
tst_resm(TPASS, "sendmsg with SCTP_ABORT flag");
@@ -458,5 +458,5 @@ int main(int argc, char *argv[])
close(listen_sk);
/* Indicate successful completion. */
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/func_tests/test_timetolive.c b/testcases/network/sctp/func_tests/test_timetolive.c
index 05f5bb6..e0c68fb 100644
--- a/testcases/network/sctp/func_tests/test_timetolive.c
+++ b/testcases/network/sctp/func_tests/test_timetolive.c
@@ -1,17 +1,17 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2001, 2003
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
* Copyright (c) 2001 Intel Corp.
* Copyright (c) 2001 Nokia, Inc.
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -38,7 +38,7 @@
*/
/*
- * This is a basic functional test for the SCTP kernel reference
+ * This is a basic functional test for the SCTP kernel
* implementation of sndrcvinfo.sinfo_timetolive.
*
* 1) Create two sockets, the listening socket sets its RECVBUF small
@@ -101,10 +101,10 @@ int main(int argc, char *argv[])
struct sctp_sndrcvinfo *sinfo;
struct iovec out_iov;
int error;
- int pf_class, af_family;
+ int pf_class;
uint32_t ppid;
uint32_t stream;
- sctp_assoc_t associd1, associd2;
+ sctp_assoc_t associd1;
struct sctp_assoc_change *sac;
struct sctp_event_subscribe subscribe;
char *big_buffer;
@@ -122,7 +122,6 @@ int main(int argc, char *argv[])
/* Set some basic values which depend on the address family. */
#if TEST_V6
pf_class = PF_INET6;
- af_family = AF_INET6;
loop1.v6.sin6_family = AF_INET6;
loop1.v6.sin6_addr = in6addr_loopback;
@@ -133,7 +132,6 @@ int main(int argc, char *argv[])
loop2.v6.sin6_port = htons(SCTP_TESTPORT_2);
#else
pf_class = PF_INET;
- af_family = AF_INET;
loop1.v4.sin_family = AF_INET;
loop1.v4.sin_addr.s_addr = SCTP_IP_LOOPBACK;
@@ -151,7 +149,7 @@ int main(int argc, char *argv[])
len = sizeof(int);
error = getsockopt(sk2, SOL_SOCKET, SO_RCVBUF, &orig_len, &len);
if (error)
- tst_brkm(TBROK, NULL, "can't get rcvbuf size: %s",
+ tst_brkm(TBROK, tst_exit, "can't get rcvbuf size: %s",
strerror(errno));
/* Set the MAXSEG to something smallish. */
{
@@ -182,7 +180,7 @@ int main(int argc, char *argv[])
len = SMALL_RCVBUF;
error = setsockopt(sk2, SOL_SOCKET, SO_RCVBUF, &len, sizeof(len));
if (error)
- tst_brkm(TBROK, NULL, "setsockopt(SO_RCVBUF): %s",
+ tst_brkm(TBROK, tst_exit, "setsockopt(SO_RCVBUF): %s",
strerror(errno));
/* Mark sk2 as being able to accept new associations. */
@@ -226,8 +224,10 @@ int main(int argc, char *argv[])
test_check_msg_notification(&inmessage, error,
sizeof(struct sctp_assoc_change),
SCTP_ASSOC_CHANGE, SCTP_COMM_UP);
+#if 0
sac = (struct sctp_assoc_change *)iov.iov_base;
associd2 = sac->sac_assoc_id;
+#endif
/* Get the communication up message on sk1. */
inmessage.msg_controllen = sizeof(incmsg);
@@ -243,7 +243,7 @@ int main(int argc, char *argv[])
sizeof(orig_len));
if (error)
- tst_brkm(TBROK, NULL, "setsockopt(SO_RCVBUF): %s",
+ tst_brkm(TBROK, tst_exit, "setsockopt(SO_RCVBUF): %s",
strerror(errno));
/* Get the first data message which was sent. */
@@ -259,7 +259,7 @@ int main(int argc, char *argv[])
error = getsockopt(sk1, IPPROTO_SCTP, SCTP_STATUS, &gstatus, &len);
if (error)
- tst_brkm(TBROK, NULL, "can't get rwnd size: %s",
+ tst_brkm(TBROK, tst_exit, "can't get rwnd size: %s",
strerror(errno));
tst_resm(TINFO, "Creating fillmsg of size %d",
gstatus.sstat_rwnd + RWND_SLOP);
@@ -347,7 +347,7 @@ int main(int argc, char *argv[])
test_check_msg_data(&inmessage, error, strlen(nottlmsg) + 1,
MSG_EOR, stream, ppid);
if (0 != strncmp(iov.iov_base, nottlmsg, strlen(nottlmsg) + 1))
- tst_brkm(TBROK, NULL, "Received Wrong Message !!!");
+ tst_brkm(TBROK, tst_exit, "Received Wrong Message !!!");
tst_resm(TPASS, "Receive message with no timeout");
@@ -361,7 +361,7 @@ int main(int argc, char *argv[])
strlen(ttlmsg) + 1, SCTP_SEND_FAILED, 0);
ssf = (struct sctp_send_failed *)iov.iov_base;
if (0 != strncmp(ttlmsg, (char *)ssf->ssf_data, strlen(ttlmsg) + 1))
- tst_brkm(TBROK, NULL, "SEND_FAILED data mismatch");
+ tst_brkm(TBROK, tst_exit, "SEND_FAILED data mismatch");
tst_resm(TPASS, "Receive SEND_FAILED for message with timeout");
@@ -378,7 +378,7 @@ int main(int argc, char *argv[])
ssf = (struct sctp_send_failed *)iov.iov_base;
if (0 != strncmp(&ttlfrag[offset], (char *)ssf->ssf_data,
SMALL_MAXSEG))
- tst_brkm(TBROK, NULL, "SEND_FAILED data mismatch");
+ tst_brkm(TBROK, tst_exit, "SEND_FAILED data mismatch");
offset += SMALL_MAXSEG;
} while (!(ssf->ssf_info.sinfo_flags & 0x01)); /* LAST_FRAG */
@@ -398,5 +398,5 @@ int main(int argc, char *argv[])
close(sk2);
/* Indicate successful completion. */
- tst_exit();
+ return 0;
}
diff --git a/testcases/network/sctp/include/netinet/sctp.h b/testcases/network/sctp/include/netinet/sctp.h
index e30bfdf..9756247 100644
--- a/testcases/network/sctp/include/netinet/sctp.h
+++ b/testcases/network/sctp/include/netinet/sctp.h
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation: User API extensions.
+/* SCTP kernel Implementation: User API extensions.
*
* sctp.h
*
@@ -6,7 +6,7 @@
* http://www.gnu.org/copyleft/lesser.txt
*
* This file is part of the user library that offers support for the
- * SCTP kernel reference Implementation. The main purpose of this
+ * Linux Kernel SCTP Implementation. The main purpose of this
* code is to provide the SCTP Socket API mappings for user
* application to interface with SCTP in kernel.
*
@@ -27,6 +27,7 @@
* Daisy Chang <daisyc@us.ibm.com>
* Inaky Perez-Gonzalez <inaky.gonzalez@intel.com>
* Sridhar Samudrala <sri@us.ibm.com>
+ * Vlad Yasevich <vladislav.yasevich@hp.com>
*/
#ifndef __linux_sctp_h__
@@ -36,9 +37,7 @@
#include <linux/types.h>
#include <sys/socket.h>
-__BEGIN_DECLS
-
-typedef __s32 sctp_assoc_t;
+__BEGIN_DECLS typedef __s32 sctp_assoc_t;
/* Socket option layer for SCTP */
#ifndef SOL_SCTP
@@ -61,64 +60,53 @@ typedef __s32 sctp_assoc_t;
/* The following symbols come from the Sockets API Extensions for
* SCTP <draft-ietf-tsvwg-sctpsocket-07.txt>.
*/
-enum sctp_optname {
- SCTP_RTOINFO,
-#define SCTP_RTOINFO SCTP_RTOINFO
- SCTP_ASSOCINFO,
-#define SCTP_ASSOCINFO SCTP_ASSOCINFO
- SCTP_INITMSG,
-#define SCTP_INITMSG SCTP_INITMSG
- SCTP_NODELAY, /* Get/set nodelay option. */
-#define SCTP_NODELAY SCTP_NODELAY
- SCTP_AUTOCLOSE,
-#define SCTP_AUTOCLOSE SCTP_AUTOCLOSE
- SCTP_SET_PEER_PRIMARY_ADDR,
-#define SCTP_SET_PEER_PRIMARY_ADDR SCTP_SET_PEER_PRIMARY_ADDR
- SCTP_PRIMARY_ADDR,
-#define SCTP_PRIMARY_ADDR SCTP_PRIMARY_ADDR
- SCTP_ADAPTION_LAYER,
-#define SCTP_ADAPTION_LAYER SCTP_ADAPTION_LAYER
- SCTP_DISABLE_FRAGMENTS,
-#define SCTP_DISABLE_FRAGMENTS SCTP_DISABLE_FRAGMENTS
- SCTP_PEER_ADDR_PARAMS,
-#define SCTP_PEER_ADDR_PARAMS SCTP_PEER_ADDR_PARAMS
- SCTP_DEFAULT_SEND_PARAM,
-#define SCTP_DEFAULT_SEND_PARAM SCTP_DEFAULT_SEND_PARAM
- SCTP_EVENTS,
-#define SCTP_EVENTS SCTP_EVENTS
- SCTP_I_WANT_MAPPED_V4_ADDR, /* Turn on/off mapped v4 addresses */
-#define SCTP_I_WANT_MAPPED_V4_ADDR SCTP_I_WANT_MAPPED_V4_ADDR
- SCTP_MAXSEG, /* Get/set maximum fragment. */
-#define SCTP_MAXSEG SCTP_MAXSEG
- SCTP_STATUS,
-#define SCTP_STATUS SCTP_STATUS
- SCTP_GET_PEER_ADDR_INFO,
-#define SCTP_GET_PEER_ADDR_INFO SCTP_GET_PEER_ADDR_INFO
-
- /* Internal Socket Options. Some of the sctp library functions are
- * implemented using these socket options.
- */
- SCTP_SOCKOPT_BINDX_ADD = 100,/* BINDX requests for adding addresses. */
-#define SCTP_SOCKOPT_BINDX_ADD SCTP_SOCKOPT_BINDX_ADD
- SCTP_SOCKOPT_BINDX_REM, /* BINDX requests for removing addresses. */
-#define SCTP_SOCKOPT_BINDX_REM SCTP_SOCKOPT_BINDX_REM
- SCTP_SOCKOPT_PEELOFF, /* peel off association. */
-#define SCTP_SOCKOPT_PEELOFF SCTP_SOCKOPT_PEELOFF
- SCTP_GET_PEER_ADDRS_NUM_OLD, /* Get number of peer addresss. */
-#define SCTP_GET_PEER_ADDRS_NUM_OLD SCTP_GET_PEER_ADDRS_NUM_OLD
- SCTP_GET_PEER_ADDRS_OLD, /* Get all peer addresss. */
-#define SCTP_GET_PEER_ADDRS_OLD SCTP_GET_PEER_ADDRS_OLD
- SCTP_GET_LOCAL_ADDRS_NUM_OLD, /* Get number of local addresss. */
-#define SCTP_GET_LOCAL_ADDRS_NUM_OLD SCTP_GET_LOCAL_ADDRS_NUM_OLD
- SCTP_GET_LOCAL_ADDRS_OLD, /* Get all local addresss. */
-#define SCTP_GET_LOCAL_ADDRS_OLD SCTP_GET_LOCAL_ADDRS_OLD
- SCTP_SOCKOPT_CONNECTX, /* CONNECTX requests. */
-#define SCTP_SOCKOPT_CONNECTX SCTP_SOCKOPT_CONNECTX
- SCTP_GET_PEER_ADDRS, /* Get all peer addresss. */
-#define SCTP_GET_PEER_ADDRS SCTP_GET_PEER_ADDRS
- SCTP_GET_LOCAL_ADDRS, /* Get all local addresss. */
-#define SCTP_GET_LOCAL_ADDRS SCTP_GET_LOCAL_ADDRS
-};
+#define SCTP_RTOINFO 0
+#define SCTP_ASSOCINFO 1
+#define SCTP_INITMSG 2
+#define SCTP_NODELAY 3 /* Get/set nodelay option. */
+#define SCTP_AUTOCLOSE 4
+#define SCTP_SET_PEER_PRIMARY_ADDR 5
+#define SCTP_PRIMARY_ADDR 6
+#define SCTP_ADAPTATION_LAYER 7
+#define SCTP_DISABLE_FRAGMENTS 8
+#define SCTP_PEER_ADDR_PARAMS 9
+#define SCTP_DEFAULT_SEND_PARAM 10
+#define SCTP_EVENTS 11
+#define SCTP_I_WANT_MAPPED_V4_ADDR 12 /* Turn on/off mapped v4 addresses */
+#define SCTP_MAXSEG 13 /* Get/set maximum fragment. */
+#define SCTP_STATUS 14
+#define SCTP_GET_PEER_ADDR_INFO 15
+#define SCTP_DELAYED_ACK_TIME 16
+#define SCTP_DELAYED_ACK SCTP_DELAYED_ACK_TIME
+#define SCTP_DELAYED_SACK SCTP_DELAYED_ACK_TIME
+#define SCTP_CONTEXT 17
+#define SCTP_FRAGMENT_INTERLEAVE 18
+#define SCTP_PARTIAL_DELIVERY_POINT 19 /* Set/Get partial delivery point */
+#define SCTP_MAX_BURST 20 /* Set/Get max burst */
+#define SCTP_AUTH_CHUNK 21 /* Set only: add a chunk type to authenticate */
+#define SCTP_HMAC_IDENT 22
+#define SCTP_AUTH_KEY 23
+#define SCTP_AUTH_ACTIVE_KEY 24
+#define SCTP_AUTH_DELETE_KEY 25
+#define SCTP_PEER_AUTH_CHUNKS 26 /* Read only */
+#define SCTP_LOCAL_AUTH_CHUNKS 27 /* Read only */
+#define SCTP_GET_ASSOC_NUMBER 28 /* Read only */
+
+/* Internal Socket Options. Some of the sctp library functions are
+ * implemented using these socket options.
+ */
+#define SCTP_SOCKOPT_BINDX_ADD 100 /* BINDX requests for adding addrs */
+#define SCTP_SOCKOPT_BINDX_REM 101 /* BINDX requests for removing addrs. */
+#define SCTP_SOCKOPT_PEELOFF 102 /* peel off association. */
+/* Options 104-106 are deprecated and removed. Do not use this space */
+#define SCTP_SOCKOPT_CONNECTX_OLD 107 /* CONNECTX old requests. */
+#define SCTP_GET_PEER_ADDRS 108 /* Get all peer addresss. */
+#define SCTP_GET_LOCAL_ADDRS 109 /* Get all local addresss. */
+#define SCTP_SOCKOPT_CONNECTX 110 /* CONNECTX requests. */
+#define SCTP_SOCKOPT_CONNECTX3 111 /* CONNECTX requests (updated) */
+
+/* SCTP socket option used to read per endpoint association statistics. */
+#define SCTP_GET_ASSOC_STATS 112 /* Read only */
/*
* 5.2.1 SCTP Initiation Structure (SCTP_INIT)
@@ -172,26 +160,27 @@ struct sctp_sndrcvinfo {
*/
enum sctp_sinfo_flags {
- SCTP_UNORDERED = 1, /* Send/receive message unordered. */
- SCTP_ADDR_OVER = 2, /* Override the primary destination. */
- SCTP_ABORT=4, /* Send an ABORT message to the peer. */
- SCTP_EOF=MSG_FIN, /* Initiate graceful shutdown process. */
+ SCTP_UNORDERED = 1, /* Send/receive message unordered. */
+ SCTP_ADDR_OVER = 2, /* Override the primary destination. */
+ SCTP_ABORT = 4, /* Send an ABORT message to the peer. */
+ SCTP_SACK_IMMEDIATELY = 8, /* SACK should be sent without delay */
+ SCTP_EOF = MSG_FIN, /* Initiate graceful shutdown process. */
};
-
typedef union {
- __u8 raw;
- struct sctp_initmsg init;
- struct sctp_sndrcvinfo sndrcv;
+ __u8 raw;
+ struct sctp_initmsg init;
+ struct sctp_sndrcvinfo sndrcv;
} sctp_cmsg_data_t;
/* These are cmsg_types. */
typedef enum sctp_cmsg_type {
- SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */
- SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */
+ SCTP_INIT, /* 5.2.1 SCTP Initiation Structure */
+#define SCTP_INIT SCTP_INIT
+ SCTP_SNDRCV, /* 5.2.2 SCTP Header Information Structure */
+#define SCTP_SNDRCV SCTP_SNDRCV
} sctp_cmsg_t;
-
/*
* 5.3.1.1 SCTP_ASSOC_CHANGE
*
@@ -210,6 +199,7 @@ struct sctp_assoc_change {
__u16 sac_outbound_streams;
__u16 sac_inbound_streams;
sctp_assoc_t sac_assoc_id;
+ __u8 sac_info[0];
};
/*
@@ -244,7 +234,7 @@ struct sctp_paddr_change {
int spc_state;
int spc_error;
sctp_assoc_t spc_assoc_id;
-} __attribute__((packed, aligned(4)));
+} __attribute__ ((packed, aligned(4)));
/*
* spc_state: 32 bits (signed integer)
@@ -258,9 +248,9 @@ enum sctp_spc_state {
SCTP_ADDR_REMOVED,
SCTP_ADDR_ADDED,
SCTP_ADDR_MADE_PRIM,
+ SCTP_ADDR_CONFIRMED,
};
-
/*
* 5.3.1.3 SCTP_REMOTE_ERROR
*
@@ -280,7 +270,6 @@ struct sctp_remote_error {
__u8 sre_data[0];
};
-
/*
* 5.3.1.4 SCTP_SEND_FAILED
*
@@ -328,25 +317,25 @@ struct sctp_shutdown_event {
};
/*
- * 5.3.1.6 SCTP_ADAPTION_INDICATION
+ * 5.3.1.6 SCTP_ADAPTATION_INDICATION
*
- * When a peer sends a Adaption Layer Indication parameter , SCTP
+ * When a peer sends a Adaptation Layer Indication parameter , SCTP
* delivers this notification to inform the application
- * that of the peers requested adaption layer.
+ * that of the peers requested adaptation layer.
*/
-struct sctp_adaption_event {
+struct sctp_adaptation_event {
__u16 sai_type;
__u16 sai_flags;
__u32 sai_length;
- __u32 sai_adaption_ind;
+ __u32 sai_adaptation_ind;
sctp_assoc_t sai_assoc_id;
};
/*
* 5.3.1.7 SCTP_PARTIAL_DELIVERY_EVENT
*
- * When a reciever is engaged in a partial delivery of a
- * message this notification will be used to inidicate
+ * When a receiver is engaged in a partial delivery of a
+ * message this notification will be used to indicate
* various events.
*/
struct sctp_pdapi_event {
@@ -357,7 +346,33 @@ struct sctp_pdapi_event {
sctp_assoc_t pdapi_assoc_id;
};
-enum { SCTP_PARTIAL_DELIVERY_ABORTED=0, };
+enum { SCTP_PARTIAL_DELIVERY_ABORTED = 0, };
+
+/*
+* 5.3.1.8. SCTP_AUTHENTICATION_EVENT
+*
+* When a receiver is using authentication this message will provide
+* notifications regarding new keys being made active as well as errors.
+*/
+
+struct sctp_authkey_event {
+ __u16 auth_type;
+ __u16 auth_flags;
+ __u32 auth_length;
+ __u16 auth_keynumber;
+ __u16 auth_altkeynumber;
+ __u32 auth_indication;
+ sctp_assoc_t auth_assoc_id;
+};
+
+enum { SCTP_AUTH_NEWKEY = 0, };
+
+struct sctp_sender_dry_event {
+ __u16 sender_dry_type;
+ __u16 sender_dry_flags;
+ __u32 sender_dry_length;
+ sctp_assoc_t sender_dry_assoc_id;
+};
/*
* Described in Section 7.3
@@ -371,7 +386,9 @@ struct sctp_event_subscribe {
__u8 sctp_peer_error_event;
__u8 sctp_shutdown_event;
__u8 sctp_partial_delivery_event;
- __u8 sctp_adaption_layer_event;
+ __u8 sctp_adaptation_layer_event;
+ __u8 sctp_authentication_event;
+ __u8 sctp_sender_dry_event;
};
/*
@@ -383,7 +400,7 @@ struct sctp_event_subscribe {
*/
union sctp_notification {
struct {
- __u16 sn_type; /* Notification type. */
+ __u16 sn_type; /* Notification type. */
__u16 sn_flags;
__u32 sn_length;
} sn_header;
@@ -392,8 +409,10 @@ union sctp_notification {
struct sctp_remote_error sn_remote_error;
struct sctp_send_failed sn_send_failed;
struct sctp_shutdown_event sn_shutdown_event;
- struct sctp_adaption_event sn_adaption_event;
+ struct sctp_adaptation_event sn_adaptation_event;
struct sctp_pdapi_event sn_pdapi_event;
+ struct sctp_authkey_event sn_authkey_event;
+ struct sctp_sender_dry_event sn_sender_dry_event;
};
/* Section 5.3.1
@@ -402,19 +421,30 @@ union sctp_notification {
*/
enum sctp_sn_type {
- SCTP_SN_TYPE_BASE = (1<<15),
+ SCTP_SN_TYPE_BASE = (1 << 15),
SCTP_ASSOC_CHANGE,
+#define SCTP_ASSOC_CHANGE SCTP_ASSOC_CHANGE
SCTP_PEER_ADDR_CHANGE,
+#define SCTP_PEER_ADDR_CHANGE SCTP_PEER_ADDR_CHANGE
SCTP_SEND_FAILED,
+#define SCTP_SEND_FAILED SCTP_SEND_FAILED
SCTP_REMOTE_ERROR,
+#define SCTP_REMOTE_ERROR SCTP_REMOTE_ERROR
SCTP_SHUTDOWN_EVENT,
+#define SCTP_SHUTDOWN_EVENT SCTP_SHUTDOWN_EVENT
SCTP_PARTIAL_DELIVERY_EVENT,
- SCTP_ADAPTION_INDICATION,
+#define SCTP_PARTIAL_DELIVERY_EVENT SCTP_PARTIAL_DELIVERY_EVENT
+ SCTP_ADAPTATION_INDICATION,
+#define SCTP_ADAPTATION_INDICATION SCTP_ADAPTATION_INDICATION
+ SCTP_AUTHENTICATION_INDICATION,
+#define SCTP_AUTHENTICATION_INDICATION SCTP_AUTHENTICATION_INDICATION
+ SCTP_SENDER_DRY_EVENT,
+#define SCTP_SENDER_DRY_EVENT SCTP_SENDER_DRY_EVENT
};
/* Notification error codes used to fill up the error fields in some
* notifications.
- * SCTP_PEER_ADDRESS_CHAGE : spc_error
+ * SCTP_PEER_ADDRESS_CHAGE : spc_error
* SCTP_ASSOC_CHANGE : sac_error
* These names should be potentially included in the draft 04 of the SCTP
* sockets API specification.
@@ -437,10 +467,10 @@ typedef enum sctp_sn_error {
* these parameters are used in RTO calculation.
*/
struct sctp_rtoinfo {
- sctp_assoc_t srto_assoc_id;
- __u32 srto_initial;
- __u32 srto_max;
- __u32 srto_min;
+ sctp_assoc_t srto_assoc_id;
+ __u32 srto_initial;
+ __u32 srto_max;
+ __u32 srto_min;
};
/*
@@ -450,12 +480,12 @@ struct sctp_rtoinfo {
* endpoint parameters.
*/
struct sctp_assocparams {
- sctp_assoc_t sasoc_assoc_id;
- __u16 sasoc_asocmaxrxt;
- __u16 sasoc_number_peer_destinations;
- __u32 sasoc_peer_rwnd;
- __u32 sasoc_local_rwnd;
- __u32 sasoc_cookie_life;
+ sctp_assoc_t sasoc_assoc_id;
+ __u16 sasoc_asocmaxrxt;
+ __u16 sasoc_number_peer_destinations;
+ __u32 sasoc_peer_rwnd;
+ __u32 sasoc_local_rwnd;
+ __u32 sasoc_cookie_life;
};
/*
@@ -467,9 +497,9 @@ struct sctp_assocparams {
* set primary request:
*/
struct sctp_setpeerprim {
- sctp_assoc_t sspp_assoc_id;
+ sctp_assoc_t sspp_assoc_id;
struct sockaddr_storage sspp_addr;
-} __attribute__((packed, aligned(4)));
+} __attribute__ ((packed, aligned(4)));
/*
* 7.1.10 Set Primary Address (SCTP_PRIMARY_ADDR)
@@ -479,19 +509,22 @@ struct sctp_setpeerprim {
* association peer's addresses. The following structure is used to
* make a set peer primary request:
*/
-struct sctp_prim {
- sctp_assoc_t ssp_assoc_id;
+struct sctp_setprim {
+ sctp_assoc_t ssp_assoc_id;
struct sockaddr_storage ssp_addr;
-} __attribute__((packed, aligned(4)));
+} __attribute__ ((packed, aligned(4)));
+
+/* For backward compatibility use, define the old name too */
+#define sctp_prim sctp_setprim
/*
- * 7.1.11 Set Adaption Layer Indicator (SCTP_ADAPTION_LAYER)
+ * 7.1.11 Set Adaptation Layer Indicator (SCTP_ADAPTATION_LAYER)
*
- * Requests that the local endpoint set the specified Adaption Layer
+ * Requests that the local endpoint set the specified Adaptation Layer
* Indication parameter for all future INIT and INIT-ACK exchanges.
*/
-struct sctp_setadaption {
- __u32 ssb_adaption_ind;
+struct sctp_setadaptation {
+ __u32 ssb_adaptation_ind;
};
/*
@@ -504,12 +537,107 @@ struct sctp_setadaption {
* unreachable. The following structure is used to access and modify an
* address's parameters:
*/
+enum sctp_spp_flags {
+ SPP_HB_ENABLE = 1 << 0, /*Enable heartbeats */
+ SPP_HB_DISABLE = 1 << 1, /*Disable heartbeats */
+ SPP_HB = SPP_HB_ENABLE | SPP_HB_DISABLE,
+ SPP_HB_DEMAND = 1 << 2, /*Send heartbeat immediately */
+ SPP_PMTUD_ENABLE = 1 << 3, /*Enable PMTU discovery */
+ SPP_PMTUD_DISABLE = 1 << 4, /*Disable PMTU discovery */
+ SPP_PMTUD = SPP_PMTUD_ENABLE | SPP_PMTUD_DISABLE,
+ SPP_SACKDELAY_ENABLE = 1 << 5, /*Enable SACK */
+ SPP_SACKDELAY_DISABLE = 1 << 6, /*Disable SACK */
+ SPP_SACKDELAY = SPP_SACKDELAY_ENABLE | SPP_SACKDELAY_DISABLE,
+ SPP_HB_TIME_IS_ZERO = 1 << 7, /* Set HB delay to 0 */
+};
+
struct sctp_paddrparams {
- sctp_assoc_t spp_assoc_id;
- struct sockaddr_storage spp_address;
- __u32 spp_hbinterval;
- __u16 spp_pathmaxrxt;
-} __attribute__((packed, aligned(4)));
+ sctp_assoc_t spp_assoc_id;
+ struct sockaddr_storage spp_address;
+ __u32 spp_hbinterval;
+ __u16 spp_pathmaxrxt;
+ __u32 spp_pathmtu;
+ __u32 spp_sackdelay;
+ __u32 spp_flags;
+} __attribute__ ((packed, aligned(4)));
+
+/*
+ * 7.1.18. Add a chunk that must be authenticated (SCTP_AUTH_CHUNK)
+ *
+ * This set option adds a chunk type that the user is requesting to be
+ * received only in an authenticated way. Changes to the list of chunks
+ * will only effect future associations on the socket.
+ */
+struct sctp_authchunk {
+ __u8 sauth_chunk;
+};
+
+/*
+ * 7.1.19. Get or set the list of supported HMAC Identifiers (SCTP_HMAC_IDENT)
+ *
+ * This option gets or sets the list of HMAC algorithms that the local
+ * endpoint requires the peer to use.
+*/
+
+enum {
+ SCTP_AUTH_HMAC_ID_SHA1 = 1,
+ SCTP_AUTH_HMAC_ID_SHA256 = 3,
+};
+
+struct sctp_hmacalgo {
+ __u32 shmac_number_of_idents;
+ __u16 shmac_idents[];
+};
+
+/*
+ * 7.1.20. Set a shared key (SCTP_AUTH_KEY)
+ *
+ * This option will set a shared secret key which is used to build an
+ * association shared key.
+ */
+struct sctp_authkey {
+ sctp_assoc_t sca_assoc_id;
+ __u16 sca_keynumber;
+ __u16 sca_keylength;
+ __u8 sca_key[];
+};
+
+/*
+ * 7.1.21. Get or set the active shared key (SCTP_AUTH_ACTIVE_KEY)
+ *
+ * This option will get or set the active shared key to be used to build
+ * the association shared key.
+ */
+
+struct sctp_authkeyid {
+ sctp_assoc_t scact_assoc_id;
+ __u16 scact_keynumber;
+};
+
+/*
+ * 7.1.23. Get or set delayed ack timer (SCTP_DELAYED_SACK)
+ *
+ * This option will effect the way delayed acks are performed. This
+ * option allows you to get or set the delayed ack time, in
+ * milliseconds. It also allows changing the delayed ack frequency.
+ * Changing the frequency to 1 disables the delayed sack algorithm. If
+ * the assoc_id is 0, then this sets or gets the endpoints default
+ * values. If the assoc_id field is non-zero, then the set or get
+ * effects the specified association for the one to many model (the
+ * assoc_id field is ignored by the one to one model). Note that if
+ * sack_delay or sack_freq are 0 when setting this option, then the
+ * current values will remain unchanged.
+ */
+struct sctp_sack_info {
+ sctp_assoc_t sack_assoc_id;
+ uint32_t sack_delay;
+ uint32_t sack_freq;
+};
+
+struct sctp_assoc_value {
+ sctp_assoc_t assoc_id;
+ uint32_t assoc_value;
+};
/*
* 7.2.2 Peer Address Information
@@ -521,19 +649,30 @@ struct sctp_paddrparams {
* information:
*/
struct sctp_paddrinfo {
- sctp_assoc_t spinfo_assoc_id;
- struct sockaddr_storage spinfo_address;
- __s32 spinfo_state;
- __u32 spinfo_cwnd;
- __u32 spinfo_srtt;
- __u32 spinfo_rto;
- __u32 spinfo_mtu;
-} __attribute__((packed, aligned(4)));
+ sctp_assoc_t spinfo_assoc_id;
+ struct sockaddr_storage spinfo_address;
+ __s32 spinfo_state;
+ __u32 spinfo_cwnd;
+ __u32 spinfo_srtt;
+ __u32 spinfo_rto;
+ __u32 spinfo_mtu;
+} __attribute__ ((packed, aligned(4)));
/* Peer addresses's state. */
+/* UNKNOWN: Peer address passed by the upper layer in sendmsg or connect[x]
+ * calls.
+ * UNCONFIRMED: Peer address received in INIT/INIT-ACK address parameters.
+ * Not yet confirmed by a heartbeat and not available for data
+ * transfers.
+ * ACTIVE : Peer address confirmed, active and available for data transfers.
+ * INACTIVE: Peer address inactive and not available for data transfers.
+ */
enum sctp_spinfo_state {
SCTP_INACTIVE,
+ SCTP_PF,
SCTP_ACTIVE,
+ SCTP_UNCONFIRMED,
+ SCTP_UNKNOWN = 0xffff
};
/*
@@ -546,28 +685,45 @@ enum sctp_spinfo_state {
* used to access this information:
*/
struct sctp_status {
- sctp_assoc_t sstat_assoc_id;
- __s32 sstat_state;
- __u32 sstat_rwnd;
- __u16 sstat_unackdata;
- __u16 sstat_penddata;
- __u16 sstat_instrms;
- __u16 sstat_outstrms;
- __u32 sstat_fragmentation_point;
- struct sctp_paddrinfo sstat_primary;
+ sctp_assoc_t sstat_assoc_id;
+ __s32 sstat_state;
+ __u32 sstat_rwnd;
+ __u16 sstat_unackdata;
+ __u16 sstat_penddata;
+ __u16 sstat_instrms;
+ __u16 sstat_outstrms;
+ __u32 sstat_fragmentation_point;
+ struct sctp_paddrinfo sstat_primary;
};
+/*
+ * 7.2.3. Get the list of chunks the peer requires to be authenticated
+ * (SCTP_PEER_AUTH_CHUNKS)
+ *
+ * This option gets a list of chunks for a specified association that
+ * the peer requires to be received authenticated only.
+ */
+struct sctp_authchunks {
+ sctp_assoc_t gauth_assoc_id;
+ __u32 gauth_number_of_chunks;
+ uint8_t gauth_chunks[];
+};
+/* The broken spelling has been released already,
+ * so don't break anyone, now that it's fixed.
+ */
+#define guth_number_of_chunks gauth_number_of_chunks
+
/* Association states. */
enum sctp_sstat_state {
- SCTP_EMPTY = 0,
- SCTP_CLOSED = 1,
- SCTP_COOKIE_WAIT = 2,
- SCTP_COOKIE_ECHOED = 3,
- SCTP_ESTABLISHED = 4,
- SCTP_SHUTDOWN_PENDING = 5,
- SCTP_SHUTDOWN_SENT = 6,
- SCTP_SHUTDOWN_RECEIVED = 7,
- SCTP_SHUTDOWN_ACK_SENT = 8,
+ SCTP_EMPTY = 0,
+ SCTP_CLOSED = 1,
+ SCTP_COOKIE_WAIT = 2,
+ SCTP_COOKIE_ECHOED = 3,
+ SCTP_ESTABLISHED = 4,
+ SCTP_SHUTDOWN_PENDING = 5,
+ SCTP_SHUTDOWN_SENT = 6,
+ SCTP_SHUTDOWN_RECEIVED = 7,
+ SCTP_SHUTDOWN_ACK_SENT = 8,
};
/*
@@ -577,14 +733,40 @@ enum sctp_sstat_state {
* sctp_getpaddrs() and sctp_getladdrs() API.
*/
struct sctp_getaddrs_old {
- sctp_assoc_t assoc_id;
- int addr_num;
- struct sockaddr *addrs;
+ sctp_assoc_t assoc_id;
+ int addr_num;
+ struct sockaddr *addrs;
};
struct sctp_getaddrs {
- sctp_assoc_t assoc_id; /*input*/
- __u32 addr_num; /*output*/
- __u8 addrs[0]; /*output, variable size*/
+ sctp_assoc_t assoc_id; /*input */
+ __u32 addr_num; /*output */
+ __u8 addrs[0]; /*output, variable size */
+};
+
+/* A socket user request obtained via SCTP_GET_ASSOC_STATS that retrieves
+ * association stats. All stats are counts except sas_maxrto and
+ * sas_obs_rto_ipaddr. maxrto is the max observed rto + transport since
+ * the last call. Will return 0 when did not change since last call
+ */
+struct sctp_assoc_stats {
+ sctp_assoc_t sas_assoc_id; /* Input */
+ /* Transport of the observed max RTO spike */
+ struct sockaddr_storage sas_obs_rto_ipaddr;
+ __u64 sas_maxrto; /* Maximum Observed RTO for period */
+ __u64 sas_isacks; /* SACKs received */
+ __u64 sas_osacks; /* SACKs sent */
+ __u64 sas_opackets; /* Packets sent */
+ __u64 sas_ipackets; /* Packets received */
+ __u64 sas_rtxchunks; /* Retransmitted Chunks */
+ __u64 sas_outofseqtsns; /* TSN received > next expected */
+ __u64 sas_idupchunks; /* Dups received (ordered+unordered) */
+ __u64 sas_gapcnt; /* Gap Acknowledgements Received */
+ __u64 sas_ouodchunks; /* Unordered data chunks sent */
+ __u64 sas_iuodchunks; /* Unordered data chunks received */
+ __u64 sas_oodchunks; /* Ordered data chunks sent */
+ __u64 sas_iodchunks; /* Ordered data chunks received */
+ __u64 sas_octrlchunks; /* Control chunks sent */
+ __u64 sas_ictrlchunks; /* Control chunks received */
};
/* These are bit fields for msghdr->msg_flags. See section 5.1. */
@@ -611,17 +793,18 @@ typedef struct {
int sd;
} sctp_peeloff_arg_t;
-
int sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt, int flags);
-int sctp_connectx(int sd, struct sockaddr *addrs, int addrcnt);
+int sctp_connectx(int sd, struct sockaddr *addrs, int addrcnt,
+ sctp_assoc_t * id);
int sctp_peeloff(int sd, sctp_assoc_t assoc_id);
/* Prototype for the library function sctp_opt_info defined in
* API 7. Socket Options.
*/
-int sctp_opt_info(int sd, sctp_assoc_t id, int opt, void *arg, socklen_t *size);
+int sctp_opt_info(int sd, sctp_assoc_t id, int opt, void *arg,
+ socklen_t * size);
/* Get all peer address on a socket. This is a new SCTP API
* described in the section 8.3 of the Sockets API Extensions for SCTP.
@@ -658,7 +841,7 @@ int sctp_sendmsg(int s, const void *msg, size_t len, struct sockaddr *to,
* dealing directly with the CMSG header.
*/
int sctp_send(int s, const void *msg, size_t len,
- const struct sctp_sndrcvinfo *sinfo, int flags);
+ const struct sctp_sndrcvinfo *sinfo, int flags);
/* This library function assists the user with the advanced features
* of SCTP. This is a new SCTP API described in the section 8.8 of the
@@ -666,9 +849,11 @@ int sctp_send(int s, const void *msg, size_t len,
* recvmsg() interface.
*/
int sctp_recvmsg(int s, void *msg, size_t len, struct sockaddr *from,
- socklen_t *fromlen, struct sctp_sndrcvinfo *sinfo,
+ socklen_t * fromlen, struct sctp_sndrcvinfo *sinfo,
int *msg_flags);
-__END_DECLS
+/* Return the address length for an address family. */
+int sctp_getaddrlen(sa_family_t family);
+__END_DECLS
#endif /* __linux_sctp_h__ */
diff --git a/testcases/network/sctp/lib/addrs.c b/testcases/network/sctp/lib/addrs.c
index 184335c..2ce3677 100644
--- a/testcases/network/sctp/lib/addrs.c
+++ b/testcases/network/sctp/lib/addrs.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation: User API extensions.
+/* SCTP kernel Implementation: User API extensions.
*
* addrs.c
*
@@ -6,7 +6,7 @@
* http://www.gnu.org/copyleft/lesser.txt
*
* This file is part of the user library that offers support for the
- * SCTP kernel reference Implementation. The main purpose of this
+ * SCTP kernel Implementation. The main purpose of this
* code is to provide the SCTP Socket API mappings for user
* application to interface with the SCTP in kernel.
*
@@ -19,66 +19,22 @@
* Written or modified by:
* Ardelle Fan <ardelle.fan@intel.com>
* Sridhar Samudrala <sri@us.ibm.com>
+ * Ivan Skytte Jørgensen <isj-sctp@i1.dk>
*/
-#include <string.h>
-#include <stdlib.h>
+#include <malloc.h>
#include <netinet/in.h>
#include <netinet/sctp.h>
+#include <string.h>
#include <errno.h>
/*
- * Get local/peer addresses using the old API
- * Old kernels (2.6.13 and earlier) only support this API but it breaks 32-bit
- * programs on 64-bit kernels.
- */
-static int
-sctp_getaddrs_old(int sd, sctp_assoc_t id, int optname_num, int optname_old,
- struct sockaddr **addrs)
-{
- socklen_t len = sizeof(sctp_assoc_t);
- int cnt, err;
- struct sctp_getaddrs_old getaddrs;
-
- cnt = getsockopt(sd, SOL_SCTP, optname_num, &id, &len);
- if (cnt < 0)
- return -1;
-
- if (0 == cnt) {
- *addrs = NULL;
- return 0;
- }
-
- len = cnt * sizeof(struct sockaddr_in6);
-
- getaddrs.assoc_id = id;
- getaddrs.addr_num = cnt;
- getaddrs.addrs = (struct sockaddr *)malloc(len);
- if (NULL == getaddrs.addrs)
- return -1;
-
- len = sizeof(getaddrs);
- err = getsockopt(sd, SOL_SCTP, optname_old, &getaddrs, &len);
- if (err < 0) {
- free(getaddrs.addrs);
- return -1;
- }
-
- *addrs = getaddrs.addrs;
-
- return getaddrs.addr_num;
-
-} /* sctp_getaddrs_old() */
-
-/*
* Common getsockopt() layer
* If the NEW getsockopt() API fails this function will fall back to using
* the old API
*/
static int
-sctp_getaddrs(int sd, sctp_assoc_t id,
- int optname_new, int optname_num_old, int optname_old,
- struct sockaddr **addrs)
+sctp_getaddrs(int sd, sctp_assoc_t id, int optname_new, struct sockaddr **addrs)
{
int cnt, err;
socklen_t len;
@@ -99,15 +55,9 @@ sctp_getaddrs(int sd, sctp_assoc_t id,
/*got it */
break;
}
- if (errno == ENOPROTOOPT) {
- /*Kernel does not support new API */
- free(getaddrs);
- return sctp_getaddrs_old(sd, id,
- optname_num_old, optname_old,
- addrs);
- }
if (errno != ENOMEM) {
/*unknown error */
+ free(getaddrs);
return -1;
}
/*expand buffer */
@@ -129,7 +79,7 @@ sctp_getaddrs(int sd, sctp_assoc_t id,
/* we skip traversing the list, allocating a new buffer etc. and enjoy
* a simple hack*/
cnt = getaddrs->addr_num;
- memmove(getaddrs, getaddrs + 1, len - sizeof(struct sctp_getaddrs));
+ memmove(getaddrs, getaddrs + 1, len);
*addrs = (struct sockaddr *)getaddrs;
return cnt;
@@ -141,10 +91,7 @@ sctp_getaddrs(int sd, sctp_assoc_t id,
*/
int sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **addrs)
{
- return sctp_getaddrs(sd, id,
- SCTP_GET_PEER_ADDRS,
- SCTP_GET_PEER_ADDRS_NUM_OLD,
- SCTP_GET_PEER_ADDRS_OLD, addrs);
+ return sctp_getaddrs(sd, id, SCTP_GET_PEER_ADDRS, addrs);
} /* sctp_getpaddrs() */
/* Frees all resources allocated by sctp_getpaddrs(). This is a new SCTP API
@@ -163,10 +110,7 @@ int sctp_freepaddrs(struct sockaddr *addrs)
*/
int sctp_getladdrs(int sd, sctp_assoc_t id, struct sockaddr **addrs)
{
- return sctp_getaddrs(sd, id,
- SCTP_GET_LOCAL_ADDRS,
- SCTP_GET_LOCAL_ADDRS_NUM_OLD,
- SCTP_GET_LOCAL_ADDRS_OLD, addrs);
+ return sctp_getaddrs(sd, id, SCTP_GET_LOCAL_ADDRS, addrs);
} /* sctp_getladdrs() */
/* Frees all resources allocated by sctp_getladdrs(). This is a new SCTP API
@@ -178,3 +122,25 @@ int sctp_freeladdrs(struct sockaddr *addrs)
return 0;
} /* sctp_freeladdrs() */
+
+int sctp_getaddrlen(sa_family_t family)
+{
+ /* We could call into the kernel to see what it thinks the size should
+ * be, but hardcoding the address families here is: (a) faster,
+ * (b) easier, and (c) probably good enough for forseeable future.
+ */
+ switch (family) {
+ case AF_INET:
+ return sizeof(struct sockaddr_in);
+ case AF_INET6:
+ return sizeof(struct sockaddr_in6);
+ default:
+ /* Currently there is no defined error handling in
+ * draft-ietf-tsvwg-sctpsocket-13.txt.
+ * -1 might cause the application to overwrite buffer
+ * or misinterpret data. 0 is more likely to cause
+ * an endless loop.
+ */
+ return 0;
+ }
+}
diff --git a/testcases/network/sctp/lib/bindx.c b/testcases/network/sctp/lib/bindx.c
index b89b31e..af3a68c 100644
--- a/testcases/network/sctp/lib/bindx.c
+++ b/testcases/network/sctp/lib/bindx.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation: User API extensions.
+/* SCTP kernel Implementation: User API extensions.
*
* bindx.c
*
@@ -6,7 +6,7 @@
* http://www.gnu.org/copyleft/lesser.txt
*
* This file is part of the user library that offers support for the
- * SCTP kernel reference Implementation. The main purpose of this
+ * SCTP kernel Implementation. The main purpose of this
* code is to provide the SCTP Socket API mappings for user
* application to interface with the SCTP in kernel.
*
diff --git a/testcases/network/sctp/lib/connectx.c b/testcases/network/sctp/lib/connectx.c
index 5a56623..7f79f0a 100644
--- a/testcases/network/sctp/lib/connectx.c
+++ b/testcases/network/sctp/lib/connectx.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation: User API extensions.
+/* SCTP kernel Implementation: User API extensions.
*
* connectx.c
*
@@ -6,7 +6,7 @@
* http://www.gnu.org/copyleft/lesser.txt.
*
* This file is part of the user library that offers support for the
- * SCTP kernel reference Implementation. The main purpose of this
+ * SCTP kernel Implementation. The main purpose of this
* code is to provide the SCTP Socket API mappings for user
* application to interface with the SCTP in kernel.
*
@@ -23,6 +23,9 @@
#include <netinet/in.h>
#include <netinet/sctp.h> /* SCTP_SOCKOPT_CONNECTX_* */
#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#include <fcntl.h>
/* Support the sctp_connectx() interface.
*
@@ -31,16 +34,16 @@
* Instead of implementing through a socket call in sys_socketcall(),
* tunnel the request through setsockopt().
*/
-int sctp_connectx(int fd, struct sockaddr *addrs, int addrcnt)
+static int __connectx_addrsize(const struct sockaddr *addrs, const int addrcnt)
{
- void *addrbuf;
- struct sockaddr *sa_addr;
- socklen_t addrs_size = 0;
+ const void *addrbuf;
+ const struct sockaddr *sa_addr;
+ int addrs_size = 0;
int i;
addrbuf = addrs;
for (i = 0; i < addrcnt; i++) {
- sa_addr = (struct sockaddr *)addrbuf;
+ sa_addr = (const struct sockaddr *)addrbuf;
switch (sa_addr->sa_family) {
case AF_INET:
addrs_size += sizeof(struct sockaddr_in);
@@ -56,6 +59,123 @@ int sctp_connectx(int fd, struct sockaddr *addrs, int addrcnt)
}
}
- return setsockopt(fd, SOL_SCTP, SCTP_SOCKOPT_CONNECTX, addrs,
+ return addrs_size;
+}
+
+int __sctp_connectx(int fd, struct sockaddr *addrs, int addrcnt)
+{
+ socklen_t addrs_size = __connectx_addrsize(addrs, addrcnt);
+
+ if (addrs_size < 0)
+ return addrs_size;
+
+ return setsockopt(fd, SOL_SCTP, SCTP_SOCKOPT_CONNECTX_OLD, addrs,
addrs_size);
}
+
+extern int sctp_connectx_orig(int) __attribute((alias("__sctp_connectx")));
+
+static int __connectx(int fd, struct sockaddr *addrs, socklen_t addrs_size,
+ sctp_assoc_t * id)
+{
+ int status;
+
+ if (id)
+ *id = 0;
+
+ status = setsockopt(fd, SOL_SCTP, SCTP_SOCKOPT_CONNECTX, addrs,
+ addrs_size);
+
+ /* Normalize status and set association id */
+ if (status > 0) {
+ if (id)
+ *id = status;
+ return 0;
+ }
+
+ /* The error is something other then "Option not supported" */
+ if (status < 0 && errno != ENOPROTOOPT)
+ return status;
+
+ /* At this point, if the application wanted the id, we can't
+ * really provide it, so we can return ENOPROTOOPT.
+ */
+ if (id) {
+ errno = ENOPROTOOPT;
+ return -1;
+ }
+
+ /* Finally, try the old API */
+ return setsockopt(fd, SOL_SCTP, SCTP_SOCKOPT_CONNECTX_OLD,
+ addrs, addrs_size);
+}
+
+int sctp_connectx2(int fd, struct sockaddr *addrs, int addrcnt,
+ sctp_assoc_t * id)
+{
+ socklen_t addrs_size = __connectx_addrsize(addrs, addrcnt);
+
+ if (addrs_size < 0)
+ return addrs_size;
+
+ return __connectx(fd, addrs, addrs_size, id);
+}
+
+int sctp_connectx3(int fd, struct sockaddr *addrs, int addrcnt,
+ sctp_assoc_t * id)
+{
+ socklen_t addrs_size = __connectx_addrsize(addrs, addrcnt);
+ int status;
+ struct sctp_getaddrs_old param;
+ socklen_t opt_len = sizeof(param);
+
+ if (addrs_size < 0)
+ return addrs_size;
+
+ /* First try the new socket api
+ * Because the id is returned in the option buffer we have prepend
+ * 32bit to it for the returned association id
+ */
+ param.assoc_id = 0;
+ param.addr_num = addrs_size;
+ param.addrs = addrs;
+ status = getsockopt(fd, SOL_SCTP, SCTP_SOCKOPT_CONNECTX3,
+ ¶m, &opt_len);
+ if (status == 0 || errno == EINPROGRESS) {
+ /* Succeeded immediately, or initiated on non-blocking
+ * socket.
+ */
+ if (id)
+ *id = param.assoc_id;
+ }
+
+ if (errno != ENOPROTOOPT) {
+ /* No point in trying the fallbacks */
+ return status;
+ }
+
+ /* The first incarnation of updated connectx api didn't work for
+ * non-blocking sockets. So if the application wants the association
+ * id and the socket is non-blocking, we can't really do anything.
+ */
+ if (id) {
+ /* Program wants the association-id returned. We can only do
+ * that if the socket is blocking */
+ status = fcntl(fd, F_GETFL);
+ if (status < 0)
+ return status;
+
+ if (status & O_NONBLOCK) {
+ /* Socket is non-blocking. Fail */
+ errno = ENOPROTOOPT;
+ return -1;
+ }
+ }
+
+ return __connectx(fd, addrs, addrs_size, id);
+}
+
+__asm__(".symver __sctp_connectx, sctp_connectx@");
+__asm__(".symver sctp_connectx_orig, sctp_connectx@VERS_1");
+__asm__(".symver sctp_connectx2, sctp_connectx@VERS_2");
+__asm__(".symver sctp_connectx3, sctp_connectx@@VERS_3");
diff --git a/testcases/network/sctp/lib/opt_info.c b/testcases/network/sctp/lib/opt_info.c
index ba765ce..c048ab0f 100644
--- a/testcases/network/sctp/lib/opt_info.c
+++ b/testcases/network/sctp/lib/opt_info.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation: User API extensions.
+/* SCTP kernel Implementation: User API extensions.
*
* opt_info.c
*
@@ -6,7 +6,7 @@
* http://www.gnu.org/copyleft/lesser.txt
*
* This file is part of the user library that offers support for the
- * SCTP kernel reference Implementation. The main purpose of this
+ * SCTP kernel Implementation. The main purpose of this
* code if to provide the SCTP Socket API mappings for user
* application to interface with the SCTP in kernel.
*
@@ -49,6 +49,9 @@ int sctp_opt_info(int sd, sctp_assoc_t id, int opt, void *arg, socklen_t * size)
case SCTP_MAXSEG:
case SCTP_STATUS:
case SCTP_GET_PEER_ADDR_INFO:
+ case SCTP_AUTH_ACTIVE_KEY:
+ case SCTP_PEER_AUTH_CHUNKS:
+ case SCTP_LOCAL_AUTH_CHUNKS:
*(sctp_assoc_t *) arg = id;
return getsockopt(sd, IPPROTO_SCTP, opt, arg, size);
default:
diff --git a/testcases/network/sctp/lib/peeloff.c b/testcases/network/sctp/lib/peeloff.c
index 04fe9bc..52ff534 100644
--- a/testcases/network/sctp/lib/peeloff.c
+++ b/testcases/network/sctp/lib/peeloff.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation: User API extensions.
+/* SCTP kernel Implementation: User API extensions.
*
* peeloff.c
*
@@ -6,7 +6,7 @@
* http://www.gnu.org/copyleft/lesser.txt
*
* This file is part of the user library that offers support for the
- * SCTP kernel reference Implementation. The main purpose of this
+ * SCTP kernel Implementation. The main purpose of this
* code is to provide the SCTP Socket API mappings for user
* application to interface with the SCTP in kernel.
*
diff --git a/testcases/network/sctp/lib/recvmsg.c b/testcases/network/sctp/lib/recvmsg.c
index 4efffae..c57de77 100644
--- a/testcases/network/sctp/lib/recvmsg.c
+++ b/testcases/network/sctp/lib/recvmsg.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation: User API extensions.
+/* SCTP kernel Implementation: User API extensions.
*
* sctp_recvmsg.c
*
@@ -6,7 +6,7 @@
* http://www.gnu.org/copyleft/lesser.txt
*
* This file is part of the user library that offers support for the
- * SCTP kernel reference Implementation. The main purpose of this
+ * SCTP kernel Implementation. The main purpose of this
* code is to provide the SCTP Socket API mappings for user
* application to interface with the SCTP in kernel.
*
@@ -74,7 +74,7 @@ int sctp_recvmsg(int s, void *msg, size_t len, struct sockaddr *from,
inmsg.msg_control = incmsg;
inmsg.msg_controllen = sizeof(incmsg);
- error = recvmsg(s, &inmsg, 0);
+ error = recvmsg(s, &inmsg, msg_flags ? *msg_flags : 0);
if (error < 0)
return error;
diff --git a/testcases/network/sctp/lib/sendmsg.c b/testcases/network/sctp/lib/sendmsg.c
index 82d98f5..bef2420 100644
--- a/testcases/network/sctp/lib/sendmsg.c
+++ b/testcases/network/sctp/lib/sendmsg.c
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation: User API extensions.
+/* SCTP kernel Implementation: User API extensions.
*
* sendmsg.c
*
@@ -6,7 +6,7 @@
* http://www.gnu.org/copyleft/lesser.txt
*
* This file is part of the user library that offers support for the
- * SCTP kernel reference Implementation. The main purpose of this
+ * SCTP kernel Implementation. The main purpose of this
* code is to provide the SCTP Socket API mappings for user
* application to interface with the SCTP in kernel.
*
@@ -76,6 +76,7 @@ sctp_send(int s, const void *msg, size_t len,
{
struct msghdr outmsg;
struct iovec iov;
+ char outcmsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))];
outmsg.msg_name = NULL;
outmsg.msg_namelen = 0;
@@ -86,7 +87,6 @@ sctp_send(int s, const void *msg, size_t len,
outmsg.msg_controllen = 0;
if (sinfo) {
- char outcmsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))];
struct cmsghdr *cmsg;
outmsg.msg_control = outcmsg;
diff --git a/testcases/network/sctp/testlib/sctputil.c b/testcases/network/sctp/testlib/sctputil.c
index 26c9203..13b5974 100644
--- a/testcases/network/sctp/testlib/sctputil.c
+++ b/testcases/network/sctp/testlib/sctputil.c
@@ -1,17 +1,17 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2001, 2003
* Copyright (C) 1999 Cisco
* Copyright (C) 1999-2000 Motorola
# Copyright (C) 2001 Nokia
* Copyright (C) 2001 La Monte H.P. Yarroll
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -42,15 +42,15 @@
*/
#include <stdio.h>
-#include <errno.h>
#include <ctype.h>
#include <string.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <netinet/in.h>
-#include <stdlib.h>
-#include "netinet/sctp.h"
+#include <errno.h>
+#include <malloc.h>
+#include <netinet/sctp.h>
#include "sctputil.h"
/* This function prints the cmsg data. */
@@ -109,7 +109,7 @@ void test_print_message(int sk, struct msghdr *msg, size_t msg_len)
/* Make sure that everything is printable and that we
* are NUL terminated...
*/
- printf("DATA(%zi): ", msg_len);
+ printf("DATA(%d): ", msg_len);
while (msg_len > 0) {
char *text;
int len;
@@ -185,26 +185,27 @@ test_check_buf_notification(void *buf, int datalen, int msg_flags,
union sctp_notification *sn;
if (!(msg_flags & MSG_NOTIFICATION))
- tst_brkm(TBROK, NULL, "Got a datamsg, expecting notification");
+ tst_brkm(TBROK, tst_exit, "Got a datamsg, expecting "
+ "notification");
if (expected_datalen <= 0)
return;
if (datalen != expected_datalen)
- tst_brkm(TBROK, NULL, "Got a notification of unexpected "
- "length (%d); expected length was %d", datalen,
+ tst_brkm(TBROK, tst_exit, "Got a notification of unexpected "
+ "length:%d, expected length:%d", datalen,
expected_datalen);
sn = (union sctp_notification *)buf;
if (sn->sn_header.sn_type != expected_sn_type)
- tst_brkm(TBROK, NULL, "Unexpected notification:%d "
+ tst_brkm(TBROK, tst_exit, "Unexpected notification:%d"
"expected:%d", sn->sn_header.sn_type,
expected_sn_type);
switch (sn->sn_header.sn_type) {
case SCTP_ASSOC_CHANGE:
if (sn->sn_assoc_change.sac_state != expected_additional)
- tst_brkm(TBROK, NULL, "Unexpected sac_state:%d "
+ tst_brkm(TBROK, tst_exit, "Unexpected sac_state:%d "
"expected:%d", sn->sn_assoc_change.sac_state,
expected_additional);
break;
@@ -236,34 +237,34 @@ test_check_buf_data(void *buf, int datalen, int msg_flags,
uint32_t expected_ppid)
{
if (msg_flags & MSG_NOTIFICATION)
- tst_brkm(TBROK, NULL, "Got a notification, expecting a"
+ tst_brkm(TBROK, tst_exit, "Got a notification, expecting a"
"datamsg");
if (expected_datalen <= 0)
return;
if (datalen != expected_datalen)
- tst_brkm(TBROK, NULL, "Got a datamsg of unexpected "
+ tst_brkm(TBROK, tst_exit, "Got a datamsg of unexpected "
"length:%d, expected length:%d", datalen,
expected_datalen);
if ((msg_flags & ~0x80000000) != expected_msg_flags)
- tst_brkm(TBROK, NULL, "Unexpected msg_flags:0x%x "
+ tst_brkm(TBROK, tst_exit, "Unexpected msg_flags:0x%x "
"expecting:0x%x", msg_flags, expected_msg_flags);
if ((0 == expected_stream) && (0 == expected_ppid))
return;
if (!sinfo)
- tst_brkm(TBROK, NULL, "Null sinfo, but expected "
+ tst_brkm(TBROK, tst_exit, "Null sinfo, but expected "
"stream:%d expected ppid:%d", expected_stream,
expected_ppid);
if (sinfo->sinfo_stream != expected_stream)
- tst_brkm(TBROK, NULL, "stream mismatch: expected:%x "
+ tst_brkm(TBROK, tst_exit, "stream mismatch: expected:%x "
"got:%x", expected_stream, sinfo->sinfo_stream);
if (sinfo->sinfo_ppid != expected_ppid)
- tst_brkm(TBROK, NULL, "ppid mismatch: expected:%x "
+ tst_brkm(TBROK, tst_exit, "ppid mismatch: expected:%x "
"got:%x\n", expected_ppid, sinfo->sinfo_ppid);
}
@@ -284,7 +285,7 @@ test_check_msg_data(struct msghdr *msg, int datalen, int expected_datalen,
if (IPPROTO_SCTP == cmsg->cmsg_level &&
SCTP_SNDRCV == cmsg->cmsg_type)
break;
- } /* for (all cmsgs) */
+ } /* for( all cmsgs) */
if ((!cmsg) ||
(cmsg->cmsg_len < CMSG_LEN(sizeof(struct sctp_sndrcvinfo))))
@@ -309,7 +310,7 @@ void *test_build_msg(int len)
msg_buf = (char *)malloc(len);
if (!msg_buf)
- tst_brkm(TBROK, NULL, "malloc failed");
+ tst_brkm(TBROK, tst_exit, "malloc failed");
p = msg_buf;
@@ -352,7 +353,7 @@ static int cmp_addr(sockaddr_storage_t * addr1, sockaddr_storage_t * addr2)
return memcmp(&addr1->v4.sin_addr, &addr2->v4.sin_addr,
sizeof(addr1->v4.sin_addr));
default:
- tst_brkm(TBROK, NULL, "invalid address type %d",
+ tst_brkm(TBROK, tst_exit, "invalid address type %d",
addr1->sa.sa_family);
return -1;
}
@@ -372,12 +373,13 @@ int test_peer_addr(int sk, sctp_assoc_t asoc, sockaddr_storage_t * peers,
error = sctp_getpaddrs(sk, asoc, &addrs);
if (-1 == error) {
- tst_brkm(TBROK, NULL, "sctp_getpaddrs: %s", strerror(errno));
+ tst_brkm(TBROK, tst_exit, "sctp_getpaddrs: %s",
+ strerror(errno));
return error;
}
if (error != count) {
sctp_freepaddrs(addrs);
- tst_brkm(TBROK, NULL, "peer count %d mismatch, expected %d",
+ tst_brkm(TBROK, tst_exit, "peer count %d mismatch, expected %d",
error, count);
}
addrbuf = addrs;
@@ -395,7 +397,7 @@ int test_peer_addr(int sk, sctp_assoc_t asoc, sockaddr_storage_t * peers,
default:
errno = EINVAL;
sctp_freepaddrs(addrs);
- tst_brkm(TBROK, NULL, "sctp_getpaddrs: %s",
+ tst_brkm(TBROK, tst_exit, "sctp_getpaddrs: %s",
strerror(errno));
return -1;
}
@@ -408,7 +410,8 @@ int test_peer_addr(int sk, sctp_assoc_t asoc, sockaddr_storage_t * peers,
}
for (j = 0; j < count; j++) {
if (found[j] == 0) {
- tst_brkm(TBROK, NULL, "peer address %d not found", j);
+ tst_brkm(TBROK, tst_exit, "peer address %d not found",
+ j);
}
}
sctp_freepaddrs(addrs);
diff --git a/testcases/network/sctp/testlib/sctputil.h b/testcases/network/sctp/testlib/sctputil.h
index 4178552..0ef8693 100644
--- a/testcases/network/sctp/testlib/sctputil.h
+++ b/testcases/network/sctp/testlib/sctputil.h
@@ -1,4 +1,4 @@
-/* SCTP kernel reference Implementation
+/* SCTP kernel Implementation
* (C) Copyright IBM Corp. 2001, 2003
* Copyright (c) 1999-2000 Cisco, Inc.
* Copyright (c) 1999-2001 Motorola, Inc.
@@ -6,13 +6,13 @@
* Copyright (c) 2001 Nokia, Inc.
* Copyright (c) 2001 La Monte H.P. Yarroll
*
- * The SCTP reference implementation is free software;
+ * 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 reference implementation is distributed in the hope that it
+ * 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.
@@ -61,7 +61,6 @@ typedef union {
struct sockaddr sa;
} sockaddr_storage_t;
-
#define REALLY_BIG 65536
/* Literal defines. */
@@ -72,7 +71,7 @@ typedef union {
#endif
#define SCTP_TESTPORT_2 (SCTP_TESTPORT_1+1)
-#define SCTP_IP_BCAST htonl(0xffffffff)
+#define SCTP_IP_BCAST htonl(0xffffffff)
#define SCTP_IP_LOOPBACK htonl(0x7f000001)
/* These are stolen from <netinet/in.h>. */
@@ -97,7 +96,7 @@ typedef union {
ntohs((addr).s6_addr16[6]), \
ntohs((addr).s6_addr16[7])
-#define DUMP_CORE { \
+#define DUMP_CORE { \
char *diediedie = 0; \
printf("DUMP_CORE %s: %d\n", __FILE__, __LINE__);\
*diediedie = 0; \
@@ -133,68 +132,65 @@ extern int TST_CNT;
static inline int test_socket(int domain, int type, int protocol)
{
int sk = socket(domain, type, protocol);
- if (-1 == sk)
- tst_brkm(TBROK, NULL, "socket: %s", strerror(errno));
+ if (-1 == sk)
+ tst_brkm(TBROK, tst_exit, "socket: %s", strerror(errno));
return sk;
}
static inline int test_bind(int sk, struct sockaddr *addr, socklen_t addrlen)
{
- int error;
- int true_const=1;
-
- setsockopt(sk, SOL_SOCKET, SO_REUSEADDR, &true_const, sizeof(int));
- error = bind(sk, addr, addrlen);
- if (-1 == error)
- tst_brkm(TBROK, NULL, "bind: %s", strerror(errno));
+ int error = bind(sk, addr, addrlen);
+ if (-1 == error)
+ tst_brkm(TBROK, tst_exit, "bind: %s", strerror(errno));
return error;
}
static inline int test_bindx_add(int sk, struct sockaddr *addr, int count)
{
int error = sctp_bindx(sk, addr, count, SCTP_BINDX_ADD_ADDR);
- if (-1 == error)
- tst_brkm(TBROK, NULL, "bindx (add): %s", strerror(errno));
+ if (-1 == error)
+ tst_brkm(TBROK, tst_exit, "bindx (add): %s", strerror(errno));
return error;
}
static inline int test_listen(int sk, int backlog)
{
int error = listen(sk, backlog);
- if (-1 == error)
- tst_brkm(TBROK, NULL, "listen: %s", strerror(errno));
+ if (-1 == error)
+ tst_brkm(TBROK, tst_exit, "listen: %s", strerror(errno));
return error;
}
static inline int test_connect(int sk, struct sockaddr *addr, socklen_t addrlen)
{
int error = connect(sk, addr, addrlen);
- if (-1 == error)
- tst_brkm(TBROK, NULL, "connect: %s", strerror(errno));
+ if (-1 == error)
+ tst_brkm(TBROK, tst_exit, "connect: %s", strerror(errno));
return error;
}
static inline int test_connectx(int sk, struct sockaddr *addr, int count)
{
- int error = sctp_connectx(sk, addr, count);
- if (-1 == error)
- tst_brkm(TBROK, NULL, "connectx: %s", strerror(errno));
+ int error = sctp_connectx(sk, addr, count, NULL);
+ if (-1 == error)
+ tst_brkm(TBROK, tst_exit, "connectx: %s", strerror(errno));
return error;
}
-static inline int test_accept(int sk, struct sockaddr *addr, socklen_t *addrlen)
+static inline int test_accept(int sk, struct sockaddr *addr,
+ socklen_t * addrlen)
{
int error = accept(sk, addr, addrlen);
- if (-1 == error)
- tst_brkm(TBROK, NULL, "accept: %s", strerror(errno));
+ if (-1 == error)
+ tst_brkm(TBROK, tst_exit, "accept: %s", strerror(errno));
return error;
}
static inline int test_send(int sk, const void *msg, size_t len, int flags)
{
int error = send(sk, msg, len, flags);
- if (len != error)
- tst_brkm(TBROK, NULL, "send: error:%d errno:%d",
+ if (len != error)
+ tst_brkm(TBROK, tst_exit, "send: error:%d errno:%d",
error, errno);
return error;
}
@@ -203,8 +199,8 @@ static inline int test_sendto(int sk, const void *msg, size_t len, int flags,
const struct sockaddr *to, socklen_t tolen)
{
int error = sendto(sk, msg, len, flags, to, tolen);
- if (len != error)
- tst_brkm(TBROK, NULL, "sendto: error:%d errno:%d",
+ if (len != error)
+ tst_brkm(TBROK, tst_exit, "sendto: error:%d errno:%d",
error, errno);
return error;
}
@@ -213,8 +209,8 @@ static inline int test_sendmsg(int sk, const struct msghdr *msg, int flags,
int msglen)
{
int error = sendmsg(sk, msg, flags);
- if (msglen != error)
- tst_brkm(TBROK, NULL, "sendmsg: error:%d errno:%d",
+ if (msglen != error)
+ tst_brkm(TBROK, tst_exit, "sendmsg: error:%d errno:%d",
error, errno);
return error;
}
@@ -222,33 +218,33 @@ static inline int test_sendmsg(int sk, const struct msghdr *msg, int flags,
static inline int test_recv(int sk, void *buf, size_t len, int flags)
{
int error = recv(sk, buf, len, flags);
- if (-1 == error)
- tst_brkm(TBROK, NULL, "recv: %s", strerror(errno));
+ if (-1 == error)
+ tst_brkm(TBROK, tst_exit, "recv: %s", strerror(errno));
return error;
}
static inline int test_recvmsg(int sk, struct msghdr *msg, int flags)
{
int error = recvmsg(sk, msg, flags);
- if (-1 == error)
- tst_brkm(TBROK, NULL, "recvmsg: %s", strerror(errno));
+ if (-1 == error)
+ tst_brkm(TBROK, tst_exit, "recvmsg: %s", strerror(errno));
return error;
}
static inline int test_shutdown(int sk, int how)
{
int error = shutdown(sk, how);
- if (-1 == error)
- tst_brkm(TBROK, NULL, "shutdown: %s", strerror(errno));
+ if (-1 == error)
+ tst_brkm(TBROK, tst_exit, "shutdown: %s", strerror(errno));
return error;
}
static inline int test_getsockopt(int sk, int optname, void *optval,
- socklen_t *optlen)
+ socklen_t * optlen)
{
int error = getsockopt(sk, SOL_SCTP, optname, optval, optlen);
if (error)
- tst_brkm(TBROK, NULL, "getsockopt(%d): %s", optname,
+ tst_brkm(TBROK, tst_exit, "getsockopt(%d): %s", optname,
strerror(errno));
return error;
}
@@ -258,7 +254,7 @@ static inline int test_setsockopt(int sk, int optname, const void *optval,
{
int error = setsockopt(sk, SOL_SCTP, optname, optval, optlen);
if (error)
- tst_brkm(TBROK, NULL, "setsockopt(%d): %s", optname,
+ tst_brkm(TBROK, tst_exit, "setsockopt(%d): %s", optname,
strerror(errno));
return error;
}
@@ -266,8 +262,8 @@ static inline int test_setsockopt(int sk, int optname, const void *optval,
static inline int test_sctp_peeloff(int sk, sctp_assoc_t assoc_id)
{
int error = sctp_peeloff(sk, assoc_id);
- if (-1 == error)
- tst_brkm(TBROK, NULL, "sctp_peeloff: %s", strerror(errno));
+ if (-1 == error)
+ tst_brkm(TBROK, tst_exit, "sctp_peeloff: %s", strerror(errno));
return error;
}
@@ -278,40 +274,39 @@ static inline int test_sctp_sendmsg(int s, const void *msg, size_t len,
uint32_t context)
{
int error = sctp_sendmsg(s, msg, len, to, tolen, ppid, flags, stream_no,
- timetolive, context);
+ timetolive, context);
if (len != error)
- tst_brkm(TBROK, NULL, "sctp_sendmsg: error:%d errno:%d",
+ tst_brkm(TBROK, tst_exit, "sctp_sendmsg: error:%d errno:%d",
error, errno);
return error;
}
static inline int test_sctp_send(int s, const void *msg, size_t len,
- const struct sctp_sndrcvinfo *sinfo,
- int flags)
+ const struct sctp_sndrcvinfo *sinfo, int flags)
{
int error = sctp_send(s, msg, len, sinfo, flags);
if (len != error)
- tst_brkm(TBROK, NULL, "sctp_send: error:%d errno:%d",
+ tst_brkm(TBROK, tst_exit, "sctp_send: error:%d errno:%d",
error, errno);
return error;
}
static inline int test_sctp_recvmsg(int sk, void *msg, size_t len,
- struct sockaddr *from, socklen_t *fromlen,
+ struct sockaddr *from, socklen_t * fromlen,
struct sctp_sndrcvinfo *sinfo,
int *msg_flags)
{
int error = sctp_recvmsg(sk, msg, len, from, fromlen, sinfo, msg_flags);
if (-1 == error)
- tst_brkm(TBROK, NULL, "sctp_recvmsg: %s", strerror(errno));
+ tst_brkm(TBROK, tst_exit, "sctp_recvmsg: %s", strerror(errno));
return error;
}
static inline void *test_malloc(size_t size)
{
void *buf = malloc(size);
- if (NULL == buf)
- tst_brkm(TBROK, NULL, "malloc failed");
+ if (NULL == buf)
+ tst_brkm(TBROK, tst_exit, "malloc failed");
return buf;
}
@@ -323,6 +318,7 @@ void test_check_buf_data(void *, int, int, struct sctp_sndrcvinfo *, int, int,
void *test_build_msg(int);
void test_enable_assoc_change(int);
void test_print_message(int sk, struct msghdr *msg, size_t msg_len);
-int test_peer_addr(int sk, sctp_assoc_t asoc, sockaddr_storage_t *peers, int count);
+int test_peer_addr(int sk, sctp_assoc_t asoc, sockaddr_storage_t * peers,
+ int count);
#endif /* __sctputil_h__ */
--
1.8.1.4
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
next reply other threads:[~2013-07-23 3:08 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-07-23 3:07 Hangbin Liu [this message]
2013-07-23 3:27 ` [LTP] [PATCH] testcases/network/sctp: update sctp test to upstream version 1.0.15 Hangbin Liu
2013-07-31 14:34 ` chrubis
[not found] ` <51F92131.7090406@redhat.com>
2013-08-01 13:33 ` chrubis
[not found] ` <20130802013524.GN14331@localhost.localdomain>
2013-08-05 12:11 ` chrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1374548876-24829-1-git-send-email-liuhangbin@gmail.com \
--to=liuhangbin@gmail.com \
--cc=dborkman@redhat.com \
--cc=lingyun.xie@bj.cs2c.com.cn \
--cc=ltp-list@lists.sourceforge.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).