Update sctp testsuite
PATCH 1/1 Update sctp testsuite
The sctp library and testsuite in LTP are too old and do not work with recent kernels. This patch updates them to latest upstream
(https://github.com/borkmann/lksctp-tools/commit/630ce8e1b21c8fbc0dd191e130288ed233059507).
Tested with 2.6.39 kernel.
--- .../sctp/func_tests/test_1_to_1_accept_close.c | 162 ++--- .../network/sctp/func_tests/test_1_to_1_addrs.c | 199 +++--- .../network/sctp/func_tests/test_1_to_1_connect.c | 164 ++--- .../network/sctp/func_tests/test_1_to_1_connectx.c | 148 +++-- .../network/sctp/func_tests/test_1_to_1_events.c | 82 +-- .../sctp/func_tests/test_1_to_1_initmsg_connect.c | 47 +- .../network/sctp/func_tests/test_1_to_1_nonblock.c | 159 +++-- .../network/sctp/func_tests/test_1_to_1_recvfrom.c | 95 +-- .../network/sctp/func_tests/test_1_to_1_recvmsg.c | 114 ++-- .../network/sctp/func_tests/test_1_to_1_rtoinfo.c | 57 +- .../network/sctp/func_tests/test_1_to_1_send.c | 136 ++-- .../network/sctp/func_tests/test_1_to_1_sendmsg.c | 271 ++++---- .../network/sctp/func_tests/test_1_to_1_sendto.c | 111 ++-- .../network/sctp/func_tests/test_1_to_1_shutdown.c | 84 +-- .../func_tests/test_1_to_1_socket_bind_listen.c | 186 +++--- .../network/sctp/func_tests/test_1_to_1_sockopt.c | 241 +++---- .../network/sctp/func_tests/test_1_to_1_threads.c | 159 +++-- .../network/sctp/func_tests/test_assoc_abort.c | 65 +- .../network/sctp/func_tests/test_assoc_shutdown.c | 63 +- testcases/network/sctp/func_tests/test_autoclose.c | 46 +- testcases/network/sctp/func_tests/test_basic.c | 242 +++---- testcases/network/sctp/func_tests/test_connect.c | 61 +- testcases/network/sctp/func_tests/test_connectx.c | 93 +-- testcases/network/sctp/func_tests/test_fragments.c | 200 +++--- testcases/network/sctp/func_tests/test_getname.c | 98 +-- .../network/sctp/func_tests/test_inaddr_any.c | 199 +++--- testcases/network/sctp/func_tests/test_peeloff.c | 104 +-- testcases/network/sctp/func_tests/test_recvmsg.c | 48 +- .../sctp/func_tests/test_sctp_sendrecvmsg.c | 134 ++-- testcases/network/sctp/func_tests/test_sockopt.c | 707 ++++++++++++++------- testcases/network/sctp/func_tests/test_tcp_style.c | 113 ++-- .../network/sctp/func_tests/test_timetolive.c | 217 +++---- testcases/network/sctp/include/netinet/sctp.h | 357 ++++++++--- testcases/network/sctp/lib/addrs.c | 149 ++--- testcases/network/sctp/lib/bindx.c | 15 +- testcases/network/sctp/lib/connectx.c | 146 ++++- testcases/network/sctp/lib/opt_info.c | 20 +- testcases/network/sctp/lib/peeloff.c | 27 +- testcases/network/sctp/lib/recvmsg.c | 26 +- testcases/network/sctp/lib/sendmsg.c | 14 +- testcases/network/sctp/testlib/sctputil.c | 168 ++--- testcases/network/sctp/testlib/sctputil.h | 70 +- 42 files changed, 3200 insertions(+), 2597 deletions(-)
testcases/network/sctp/func_tests/test_1_to_1_accept_close.c +82 -80
@@ -1,8 +1,8 @@ -/* SCTP kernel reference Implementation +/* SCTP kernel Implementation * Copyright (c) 2003 Hewlett-Packard Development Company, L.P * (C) Copyright IBM Corp. 2004 * -* This file has test cases to test the accept () and close () call for +* This file has test cases to test the accept () and close () call for * 1-1 style sockets * * accept () Tests:
@@ -20,14 +20,14 @@* TEST8: Bad socket descriptor * 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.
@@ -57,7 +57,7 @@#include <string.h> #include <sys/types.h> #include <sys/socket.h> -#include <netinet/in.h> /* for sockaddr_in */ +#include <netinet/in.h> /* for sockaddr_in */ #include <arpa/inet.h> #include <errno.h> #include <netinet/sctp.h>
@@ -70,162 +70,164 @@ int TST_CNT = 0;#define SK_MAX 10 -int main (int argc,char *argv[]) +int +main (int argc,char *argv[]) { -socklen_t len; +socklen_t len;int i; -int sk, lstn_sk, clnt_sk[SK_MAX ], acpt_sk, pf_class; -int new_sk[SK_MAX ], clnt2_sk[SK_MAX ]; +int sk,lstn_sk,clnt_sk[SK_MAX ],acpt_sk,pf_class; +int new_sk[SK_MAX ],clnt2_sk[SK_MAX ];int error; -struct sockaddr_in conn_addr, lstn_addr, acpt_addr; +struct sockaddr_in conn_addr,lstn_addr,acpt_addr;/* Rather than fflush() throughout the code, set stdout to -* be unbuffered. -*/ -setvbuf (stdout,NULL , _IONBF,0 ); -setvbuf (stderr,NULL , _IONBF,0 ); +* be unbuffered. +*/ +setvbuf (stdout,NULL , _IONBF,0 ); +setvbuf (stderr,NULL , _IONBF,0 ); - pf_class =PF_INET ; + pf_class =PF_INET ; - sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); -for (i =0 ; i <SK_MAX ; i++) +for (i=0 ; i <SK_MAX ; i++) new_sk[i] =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP );/* Creating a regular socket */ -for (i =0 ; i <SK_MAX ; i++) +for (i =0 ; i <SK_MAX ; i++) clnt_sk[i] =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); -for (i =0 ; i <SK_MAX ; i++) +for (i =0 ; i <SK_MAX ; i++) clnt2_sk[i] =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP );/* Creating a listen socket */ - lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); conn_addr.sin_family =AF_INET ; - conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); lstn_addr.sin_family =AF_INET ; - lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + lstn_addr.sin_port =htons (SCTP_TESTPORT_1 );/* Binding the listen socket */ -test_bind (lstn_sk, (struct sockaddr *)&lstn_addr,sizeof (lstn_addr)); +test_bind (lstn_sk, (struct sockaddr *) &lstn_addr,sizeof (lstn_addr));/* Listening many sockets as we are calling too many connect here */ -test_listen (lstn_sk,SK_MAX ); +test_listen (lstn_sk,SK_MAX );/* connect() is called just to make sure accept() doesn't block the * program */ i =0 ; len =sizeof (struct sockaddr_in ); -test_connect (clnt_sk[i++], (struct sockaddr *)&conn_addr, len); +test_connect (clnt_sk[i++], (struct sockaddr *) &conn_addr, len);/* 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" -"error:%d, errno:%d" , error, errno); + error =accept (-1 , (struct sockaddr *) &acpt_addr, &len); +if (error !=-1 || errno !=EBADF ) +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" ); -/*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" -"error:%d, errno:%d" , error, errno); +/*accept() TEST2: Invalid socket ENOTSOCK, Expected error*/ + error =accept (0 , (struct sockaddr *) &acpt_addr, &len); +if (error !=-1 || errno !=ENOTSOCK ) +tst_brkm (TBROK , tst_exit,"accept with invalid socket" +"error:%d, errno:%d" , error, errno);tst_resm (TPASS ,"accept() with invalid socket - ENOTSOCK" ); -/*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" -"error:%d, errno:%d" , error, errno); +/*accept() TEST3: Invalid address EFAULT, Expected error*/ + error =accept (lstn_sk, (struct sockaddr *)-1 , &len); +if (error !=-1 || errno !=EFAULT ) +tst_brkm (TBROK , tst_exit,"accept with invalid address" +"error:%d, errno:%d" , error, errno);tst_resm (TPASS ,"accept() with invalid address - EFAULT" ); -test_connect (clnt_sk[i++], (struct sockaddr *)&conn_addr, len); +test_connect (clnt_sk[i++], (struct sockaddr *) &conn_addr, len); -/*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" -"error:%d, errno:%d" , error, errno); +/*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 , tst_exit,"accept on a non-listening socket" +"error:%d, errno:%d" , error, errno);tst_resm (TPASS ,"accept() on a non-listening socket - EINVAL" ); + +test_connect (clnt_sk[i++], (struct sockaddr *) &conn_addr, len); -test_connect (clnt_sk[i++], (struct sockaddr *)&conn_addr, len); +/*Calling accept to establish the connection*/ + acpt_sk =test_accept (lstn_sk, (struct sockaddr *) &acpt_addr, &len); -/*Calling accept to establish the connection */ - acpt_sk =test_accept (lstn_sk, (struct sockaddr *)&acpt_addr, &len); - -/*accept() TEST5: On a established socket EINVAL, Expected error */ - error =accept (acpt_sk, (struct sockaddr *)&acpt_addr, &len); +/*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" -"error:%d, errno:%d" , error, errno); +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" ); -/*Closing the previously established association */ +/*Closing the previously established association*/ close (acpt_sk); -test_connect (clnt_sk[i], (struct sockaddr *)&conn_addr, len); +test_connect (clnt_sk[i], (struct sockaddr *) &conn_addr, len); -/*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" -"error:%d, errno:%d" , error, errno); +/*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 , tst_exit,"accept a closed association" +"error:%d, errno:%d" , error, errno);tst_resm (TPASS ,"accept() a closed association - SUCCESS" );close (acpt_sk);/*accept() TEST7: Extracting the association on the listening socket -as new socket, new socket socket descriptor should return */ -for (i =0 ; i < (SK_MAX -1 ); i++) -test_connect (clnt2_sk[i], (struct sockaddr *)&conn_addr, len); +as new socket, new socket socket descriptor should return*/ +for (i =0 ; i < (SK_MAX -1 ); i++) +test_connect (clnt2_sk[i], (struct sockaddr *) &conn_addr, len); -for (i =0 ; i < (SK_MAX -1 ); i++) +for (i =0 ; i < (SK_MAX -1 ); i++) new_sk[i] =test_accept (lstn_sk, (struct sockaddr *)&acpt_addr, &len);tst_resm (TPASS ,"accept() on a listening socket - SUCCESS" ); -/*close() TEST8: Bad socket descriptor, EBADF Expected error */ + +/*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 " -"error:%d, errno:%d" , error, errno); +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" ); -/*close() TEST9: valid socket descriptor should succeed */ +/*close() TEST9: valid socket descriptor should succeed*/ error =close (sk);if (error <0 ) -tst_brkm (TBROK ,NULL ,"close with a valid socket descriptor" -" error:%d, errno:%d" , error, errno); +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" ); -/*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 " +/*close() TEST10: closed socket descriptor, EBADF Expected error*/ + error =close (sk); +if (error !=-1 || errno !=EBADF ) +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" ); - -for (i =0 ; i <SK_MAX ; i++) { + +for (i =0 ; i <SK_MAX ; i++) {close (clnt_sk[i]);close (new_sk[i]);close (clnt2_sk[i]); } -tst_exit (); +return 0 ; }
testcases/network/sctp/func_tests/test_1_to_1_addrs.c +96 -103
323 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_connect.c +83 -81
264 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_connectx.c +73 -75
250 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_events.c +42 -40
169 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_initmsg_connect.c +24 -23
105 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_nonblock.c +76 -83
264 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_recvfrom.c +48 -47
202 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_recvmsg.c +57 -57
222 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_rtoinfo.c +29 -28
110 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_send.c +69 -67
264 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_sendmsg.c +130 -141
466 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_sendto.c +56 -55
88 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_shutdown.c +43 -41
84 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_socket_bind_listen.c +94 -92
186 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_sockopt.c +121 -120
241 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_threads.c +78 -81
159 lines not on this page · raw message
testcases/network/sctp/func_tests/test_assoc_abort.c +33 -32
65 lines not on this page · raw message
testcases/network/sctp/func_tests/test_assoc_shutdown.c +32 -31
63 lines not on this page · raw message
testcases/network/sctp/func_tests/test_autoclose.c +24 -22
46 lines not on this page · raw message
testcases/network/sctp/func_tests/test_basic.c +122 -120
242 lines not on this page · raw message
testcases/network/sctp/func_tests/test_connect.c +34 -27
61 lines not on this page · raw message
testcases/network/sctp/func_tests/test_connectx.c +52 -41
93 lines not on this page · raw message
testcases/network/sctp/func_tests/test_fragments.c +100 -100
200 lines not on this page · raw message
testcases/network/sctp/func_tests/test_getname.c +50 -48
98 lines not on this page · raw message
testcases/network/sctp/func_tests/test_inaddr_any.c +99 -100
199 lines not on this page · raw message
testcases/network/sctp/func_tests/test_peeloff.c +54 -50
104 lines not on this page · raw message
testcases/network/sctp/func_tests/test_recvmsg.c +25 -23
48 lines not on this page · raw message
testcases/network/sctp/func_tests/test_sctp_sendrecvmsg.c +73 -61
134 lines not on this page · raw message
testcases/network/sctp/func_tests/test_sockopt.c +491 -216
707 lines not on this page · raw message
testcases/network/sctp/func_tests/test_tcp_style.c +57 -56
113 lines not on this page · raw message
testcases/network/sctp/func_tests/test_timetolive.c +110 -107
217 lines not on this page · raw message
testcases/network/sctp/include/netinet/sctp.h +275 -82
357 lines not on this page · raw message
testcases/network/sctp/lib/addrs.c +62 -87
149 lines not on this page · raw message
testcases/network/sctp/lib/connectx.c +135 -11
146 lines not on this page · raw message
testcases/network/sctp/testlib/sctputil.c +84 -84
168 lines not on this page · raw message
testcases/network/sctp/testlib/sctputil.h +33 -37
70 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 13 lines
1.8.4.2 ------------------------------------------------------------------------------ Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Part of the diff is not shown here. View the raw message.
Could anyone help to review?
Thanks
Simon
testcases/network/sctp/testlib/sctputil.h
Quoted 11,486 lines · Simon Xu
The sctp library and testsuite in LTP are too old and do not work with recent kernels. This patch updates them to latest upstream
(https://github.com/borkmann/lksctp-tools/commit/630ce8e1b21c8fbc0dd191e130288ed233059507).Tested with 2.6.39 kernel.
Signed-off-by Simon Xu <[email protected]>--- .../sctp/func_tests/test_1_to_1_accept_close.c | 162 ++--- .../network/sctp/func_tests/test_1_to_1_addrs.c | 199 +++--- .../network/sctp/func_tests/test_1_to_1_connect.c | 164 ++--- .../network/sctp/func_tests/test_1_to_1_connectx.c | 148 +++-- .../network/sctp/func_tests/test_1_to_1_events.c | 82 +-- .../sctp/func_tests/test_1_to_1_initmsg_connect.c | 47 +- .../network/sctp/func_tests/test_1_to_1_nonblock.c | 159 +++-- .../network/sctp/func_tests/test_1_to_1_recvfrom.c | 95 +-- .../network/sctp/func_tests/test_1_to_1_recvmsg.c | 114 ++-- .../network/sctp/func_tests/test_1_to_1_rtoinfo.c | 57 +- .../network/sctp/func_tests/test_1_to_1_send.c | 136 ++-- .../network/sctp/func_tests/test_1_to_1_sendmsg.c | 271 ++++---- .../network/sctp/func_tests/test_1_to_1_sendto.c | 111 ++-- .../network/sctp/func_tests/test_1_to_1_shutdown.c | 84 +-- .../func_tests/test_1_to_1_socket_bind_listen.c | 186 +++--- .../network/sctp/func_tests/test_1_to_1_sockopt.c | 241 +++---- .../network/sctp/func_tests/test_1_to_1_threads.c | 159 +++-- .../network/sctp/func_tests/test_assoc_abort.c | 65 +- .../network/sctp/func_tests/test_assoc_shutdown.c | 63 +- testcases/network/sctp/func_tests/test_autoclose.c | 46 +- testcases/network/sctp/func_tests/test_basic.c | 242 +++---- testcases/network/sctp/func_tests/test_connect.c | 61 +- testcases/network/sctp/func_tests/test_connectx.c | 93 +-- testcases/network/sctp/func_tests/test_fragments.c | 200 +++--- testcases/network/sctp/func_tests/test_getname.c | 98 +-- .../network/sctp/func_tests/test_inaddr_any.c | 199 +++--- testcases/network/sctp/func_tests/test_peeloff.c | 104 +-- testcases/network/sctp/func_tests/test_recvmsg.c | 48 +- .../sctp/func_tests/test_sctp_sendrecvmsg.c | 134 ++-- testcases/network/sctp/func_tests/test_sockopt.c | 707 ++++++++++++++------- testcases/network/sctp/func_tests/test_tcp_style.c | 113 ++-- .../network/sctp/func_tests/test_timetolive.c | 217 +++---- testcases/network/sctp/include/netinet/sctp.h | 357 ++++++++--- testcases/network/sctp/lib/addrs.c | 149 ++--- testcases/network/sctp/lib/bindx.c | 15 +- testcases/network/sctp/lib/connectx.c | 146 ++++- testcases/network/sctp/lib/opt_info.c | 20 +- testcases/network/sctp/lib/peeloff.c | 27 +- testcases/network/sctp/lib/recvmsg.c | 26 +- testcases/network/sctp/lib/sendmsg.c | 14 +- testcases/network/sctp/testlib/sctputil.c | 168 ++--- testcases/network/sctp/testlib/sctputil.h | 70 +- 42 files changed, 3200 insertions(+), 2597 deletions(-)testcases/network/sctp/func_tests/test_1_to_1_accept_close.c +82
-80@@ -1,8 +1,8 @@ -/* SCTP kernel reference Implementation +/* SCTP kernel Implementation * Copyright (c) 2003 Hewlett-Packard Development Company, L.P * (C) Copyright IBM Corp. 2004 * -* This file has test cases to test the accept () and close () call for +* This file has test cases to test the accept () and close () call for * 1-1 style sockets * * accept () Tests: @@ -20,14 +20,14 @@* TEST8: Bad socket descriptor * 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. @@ -57,7 +57,7 @@#include <string.h> #include <sys/types.h> #include <sys/socket.h> -#include <netinet/in.h> /* for sockaddr_in */ +#include <netinet/in.h> /* for sockaddr_in */ #include <arpa/inet.h> #include <errno.h> #include <netinet/sctp.h> @@ -70,162 +70,164 @@ int TST_CNT = 0;#define SK_MAX 10 -int main (int argc,char *argv[]) +int +main (int argc,char *argv[]) { -socklen_t len; +socklen_t len;int i; -int sk, lstn_sk, clnt_sk[SK_MAX ], acpt_sk, pf_class; -int new_sk[SK_MAX ], clnt2_sk[SK_MAX ]; +int sk,lstn_sk,clnt_sk[SK_MAX ],acpt_sk,pf_class; +int new_sk[SK_MAX ],clnt2_sk[SK_MAX ];int error; -struct sockaddr_in conn_addr, lstn_addr, acpt_addr; +struct sockaddr_in conn_addr,lstn_addr,acpt_addr;/* Rather than fflush() throughout the code, set stdout to -* be unbuffered. -*/ -setvbuf (stdout,NULL , _IONBF,0 ); -setvbuf (stderr,NULL , _IONBF,0 ); +* be unbuffered. +*/ +setvbuf (stdout,NULL , _IONBF,0 ); +setvbuf (stderr,NULL , _IONBF,0 ); - pf_class =PF_INET ; + pf_class =PF_INET ; - sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); -for (i =0 ; i <SK_MAX ; i++) +for (i=0 ; i <SK_MAX ; i++) new_sk[i] =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP );/* Creating a regular socket */ -for (i =0 ; i <SK_MAX ; i++) +for (i =0 ; i <SK_MAX ; i++) clnt_sk[i] =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); -for (i =0 ; i <SK_MAX ; i++) +for (i =0 ; i <SK_MAX ; i++) clnt2_sk[i] =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP );/* Creating a listen socket */ - lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); conn_addr.sin_family =AF_INET ; - conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); lstn_addr.sin_family =AF_INET ; - lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + lstn_addr.sin_port =htons (SCTP_TESTPORT_1 );/* Binding the listen socket */ -test_bind (lstn_sk, (struct sockaddr *)&lstn_addr,sizeof (lstn_addr)); +test_bind (lstn_sk, (struct sockaddr *) &lstn_addr,sizeof (lstn_addr));/* Listening many sockets as we are calling too many connect here */ -test_listen (lstn_sk,SK_MAX ); +test_listen (lstn_sk,SK_MAX );/* connect() is called just to make sure accept() doesn't block the * program */ i =0 ; len =sizeof (struct sockaddr_in ); -test_connect (clnt_sk[i++], (struct sockaddr *)&conn_addr, len); +test_connect (clnt_sk[i++], (struct sockaddr *) &conn_addr, len);/* 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" -"error:%d, errno:%d" , error, errno); + error =accept (-1 , (struct sockaddr *) &acpt_addr, &len); +if (error !=-1 || errno !=EBADF ) +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" ); -/*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" -"error:%d, errno:%d" , error, errno); +/*accept() TEST2: Invalid socket ENOTSOCK, Expected error*/ + error =accept (0 , (struct sockaddr *) &acpt_addr, &len); +if (error !=-1 || errno !=ENOTSOCK ) +tst_brkm (TBROK , tst_exit,"accept with invalid socket" +"error:%d, errno:%d" , error, errno);tst_resm (TPASS ,"accept() with invalid socket - ENOTSOCK" ); -/*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" -"error:%d, errno:%d" , error, errno); +/*accept() TEST3: Invalid address EFAULT, Expected error*/ + error =accept (lstn_sk, (struct sockaddr *)-1 , &len); +if (error !=-1 || errno !=EFAULT ) +tst_brkm (TBROK , tst_exit,"accept with invalid address" +"error:%d, errno:%d" , error, errno);tst_resm (TPASS ,"accept() with invalid address - EFAULT" ); -test_connect (clnt_sk[i++], (struct sockaddr *)&conn_addr, len); +test_connect (clnt_sk[i++], (struct sockaddr *) &conn_addr, len); -/*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" -"error:%d, errno:%d" , error, errno); +/*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 , tst_exit,"accept on a non-listening socket" +"error:%d, errno:%d" , error, errno);tst_resm (TPASS ,"accept() on a non-listening socket - EINVAL" ); + +test_connect (clnt_sk[i++], (struct sockaddr *) &conn_addr, len); -test_connect (clnt_sk[i++], (struct sockaddr *)&conn_addr, len); +/*Calling accept to establish the connection*/ + acpt_sk =test_accept (lstn_sk, (struct sockaddr *) &acpt_addr, &len); -/*Calling accept to establish the connection */ - acpt_sk =test_accept (lstn_sk, (struct sockaddr *)&acpt_addr, &len); - -/*accept() TEST5: On a established socket EINVAL, Expected error */ - error =accept (acpt_sk, (struct sockaddr *)&acpt_addr, &len); +/*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" -"error:%d, errno:%d" , error, errno); +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" ); -/*Closing the previously established association */ +/*Closing the previously established association*/ close (acpt_sk); -test_connect (clnt_sk[i], (struct sockaddr *)&conn_addr, len); +test_connect (clnt_sk[i], (struct sockaddr *) &conn_addr, len); -/*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" -"error:%d, errno:%d" , error, errno); +/*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 , tst_exit,"accept a closed association" +"error:%d, errno:%d" , error, errno);tst_resm (TPASS ,"accept() a closed association - SUCCESS" );close (acpt_sk);/*accept() TEST7: Extracting the association on the listening socket -as new socket, new socket socket descriptor should return */ -for (i =0 ; i < (SK_MAX -1 ); i++) -test_connect (clnt2_sk[i], (struct sockaddr *)&conn_addr, len); +as new socket, new socket socket descriptor should return*/ +for (i =0 ; i < (SK_MAX -1 ); i++) +test_connect (clnt2_sk[i], (struct sockaddr *) &conn_addr, len); -for (i =0 ; i < (SK_MAX -1 ); i++) +for (i =0 ; i < (SK_MAX -1 ); i++) new_sk[i] =test_accept (lstn_sk, (struct sockaddr *)&acpt_addr, &len);tst_resm (TPASS ,"accept() on a listening socket - SUCCESS" ); -/*close() TEST8: Bad socket descriptor, EBADF Expected error */ + +/*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 " -"error:%d, errno:%d" , error, errno); +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" ); -/*close() TEST9: valid socket descriptor should succeed */ +/*close() TEST9: valid socket descriptor should succeed*/ error =close (sk);if (error <0 ) -tst_brkm (TBROK ,NULL ,"close with a valid socket descriptor" -" error:%d, errno:%d" , error, errno); +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" ); -/*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 " +/*close() TEST10: closed socket descriptor, EBADF Expected error*/ + error =close (sk); +if (error !=-1 || errno !=EBADF ) +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" ); - -for (i =0 ; i <SK_MAX ; i++) { + +for (i =0 ; i <SK_MAX ; i++) {close (clnt_sk[i]);close (new_sk[i]);close (clnt2_sk[i]); } -tst_exit (); +return 0 ; }testcases/network/sctp/func_tests/test_1_to_1_addrs.c +96
-103@@ -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. @@ -63,7 +63,7 @@#include <string.h> #include <sys/types.h> #include <sys/socket.h> -#include <netinet/in.h> /* for sockaddr_in */ +#include <netinet/in.h> /* for sockaddr_in */ #include <arpa/inet.h> #include <errno.h> #include <netinet/sctp.h> @@ -74,203 +74,196 @@ char *TCID = __FILE__;int TST_TOTAL =10 ;int TST_CNT =0 ; -int main (int argc,char *argv[]) +int +main (int argc,char *argv[]) { -int error; +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; +struct msghdr inmessage; +char *message ="hello, world!\n" ; +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_rcv;char incmsg[CMSG_SPACE (sizeof (sctp_cmsg_data_t))];struct sockaddr *laddrs, *paddrs; -struct sockaddr_in conn_addr, lstn_addr, acpt_addr; +struct sockaddr_in conn_addr,lstn_addr,acpt_addr;struct sockaddr_in *addr;/* Rather than fflush() throughout the code, set stdout to -* be unbuffered. -*/ -setvbuf (stdout,NULL , _IONBF,0 ); -setvbuf (stderr,NULL , _IONBF,0 ); +* be unbuffered. +*/ +setvbuf (stdout,NULL , _IONBF,0 ); +setvbuf (stderr,NULL , _IONBF,0 ); - pf_class =PF_INET ; + pf_class =PF_INET ; - sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); - -/*Creating a regular socket */ +/*Creating a regular socket*/ clnt_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); -/*Creating a listen socket */ - lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); +/*Creating a listen socket*/ + lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); conn_addr.sin_family =AF_INET ; - conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); lstn_addr.sin_family =AF_INET ; - lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); -/*Binding the listen socket */ -test_bind (lstn_sk, (struct sockaddr *)&lstn_addr,sizeof (lstn_addr)); +/*Binding the listen socket*/ +test_bind (lstn_sk, (struct sockaddr *) &lstn_addr,sizeof (lstn_addr)); -/*Listening many sockets as we are calling too many connect here */ +/*Listening many sockets as we are calling too many connect here*/ test_listen (lstn_sk,1 ); len =sizeof (struct sockaddr_in ); + +test_connect (clnt_sk, (struct sockaddr *) &conn_addr, len); -test_connect (clnt_sk, (struct sockaddr *)&conn_addr, len); - - acpt_sk =test_accept (lstn_sk, (struct sockaddr *)&acpt_addr, &len); + acpt_sk =test_accept (lstn_sk, (struct sockaddr *) &acpt_addr, &len);memset (&inmessage,0 ,sizeof (inmessage)); - buffer_rcv =malloc (REALLY_BIG ); + buffer_rcv =malloc (REALLY_BIG ); - iov_rcv.iov_base = buffer_rcv; - iov_rcv.iov_len =REALLY_BIG ; - inmessage.msg_iov = &iov_rcv; - inmessage.msg_iovlen =1 ; - inmessage.msg_control = incmsg; - inmessage.msg_controllen =sizeof (incmsg); + iov_rcv.iov_base = buffer_rcv; + iov_rcv.iov_len =REALLY_BIG ; + inmessage.msg_iov = &iov_rcv; + inmessage.msg_iovlen =1 ; + inmessage.msg_control = incmsg; + inmessage.msg_controllen =sizeof (incmsg); - msg_count =strlen (message) +1 ; + 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; - outmessage.msg_iovlen =1 ; - outmessage.msg_control = outcmsg; - outmessage.msg_controllen =sizeof (outcmsg); - outmessage.msg_flags =0 ; - - cmsg =CMSG_FIRSTHDR (&outmessage); - cmsg->cmsg_level =IPPROTO_SCTP ; - cmsg->cmsg_type =SCTP_SNDRCV ; - cmsg->cmsg_len =CMSG_LEN (sizeof (struct sctp_sndrcvinfo )); - outmessage.msg_controllen = cmsg->cmsg_len; - 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; + outmessage.msg_name = &lstn_addr; + outmessage.msg_namelen =sizeof (lstn_addr); + outmessage.msg_iov = &out_iov; + outmessage.msg_iovlen =1 ; + outmessage.msg_control = outcmsg; + outmessage.msg_controllen =sizeof (outcmsg); + outmessage.msg_flags =0 ; + + cmsg =CMSG_FIRSTHDR (&outmessage); + cmsg->cmsg_level =IPPROTO_SCTP ; + cmsg->cmsg_type =SCTP_SNDRCV ; + cmsg->cmsg_len =CMSG_LEN (sizeof (struct sctp_sndrcvinfo )); + outmessage.msg_controllen = cmsg->cmsg_len; + sinfo = (struct sctp_sndrcvinfo *)CMSG_DATA (cmsg); +memset (sinfo,0x00 ,sizeof (struct sctp_sndrcvinfo )); + + 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 ); -/*sctp_getladdrs() TEST1: Bad socket descriptor, EBADF Expected error */ +/*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 - " "EBADF" ); -/*sctp_getladdrs() TEST2: Invalid socket, ENOTSOCK Expected error */ +/*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" );/*sctp_getladdrs() TEST3: socket of different protocol -EOPNOTSUPP Expected error */ - sk1 =socket (pf_class,SOCK_STREAM ,IPPROTO_IP ); +EOPNOTSUPP Expected error*/ + 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 - " "EOPNOTSUPP" ); -/*sctp_getladdrs() TEST4: Getting the local addresses */ +/*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 || +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 */ +/*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" ); -/*sctp_getpaddrs() TEST6: Bad socket descriptor, EBADF Expected error */ +/*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 - " "EBADF" ); -/*sctp_getpaddrs() TEST7: Invalid socket, ENOTSOCK Expected error */ +/*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" ); - +/*sctp_getpaddrs() TEST8: socket of different protocol -EOPNOTSUPP Expected error */ +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 - " "EOPNOTSUPP" ); - -/*sctp_getpaddrs() TEST9: Getting the peer addresses */ + +/*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" ); + addr->sin_family != acpt_addr.sin_family || + addr->sin_addr.s_addr != acpt_addr.sin_addr.s_addr) +tst_brkm (TBROK , tst_exit,"sctp_getpaddrs comparision failed" );tst_resm (TPASS ,"sctp_getpaddrs() - SUCCESS" ); -/*sctp_freeapddrs() TEST10: freeing the peer address */ +/*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 ; }testcases/network/sctp/func_tests/test_1_to_1_connect.c +83
-81@@ -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,15 +13,15 @@* TEST7: Connect when accept queue is full * TEST8: On a listening socket * TEST9: On established socket -* TEST10: Connect to re-establish a closed association. +* 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. @@ -52,7 +52,7 @@#include <sys/types.h> #include <sys/socket.h> #include <linux/socket.h> -#include <netinet/in.h> /* for sockaddr_in */ +#include <netinet/in.h> /* for sockaddr_in */ #include <arpa/inet.h> #include <errno.h> #include <sys/uio.h> @@ -65,150 +65,152 @@ int TST_CNT = 0;#define SK_MAX 10 -int main (int argc,char *argv[]) +int +main (int argc,char *argv[]) { -int error, i; +int error,i;socklen_t len; -int sk, lstn_sk, clnt_sk[SK_MAX ], acpt_sk[SK_MAX ], pf_class; -int sk1, clnt2_sk; +int sk,lstn_sk,clnt_sk[SK_MAX ],acpt_sk[SK_MAX ],pf_class; +int sk1,clnt2_sk; -struct sockaddr_in conn_addr, lstn_addr, acpt_addr; +struct sockaddr_in conn_addr,lstn_addr,acpt_addr;/* Rather than fflush() throughout the code, set stdout to -* be unbuffered. -*/ -setvbuf (stdout,NULL , _IONBF,0 ); -setvbuf (stderr,NULL , _IONBF,0 ); +* be unbuffered. +*/ +setvbuf (stdout,NULL , _IONBF,0 ); +setvbuf (stderr,NULL , _IONBF,0 ); - pf_class =PF_INET ; + pf_class =PF_INET ; - sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); - sk1 =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + sk1 =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); -/*Creating a listen socket */ - lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); +/*Creating a listen socket*/ + lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); -/*Creating a regular socket */ -for (i =0 ; i <SK_MAX ; i++) +/*Creating a regular socket*/ +for (i =0 ; i <SK_MAX ; i++) clnt_sk[i] =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); clnt2_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); conn_addr.sin_family =AF_INET ; - conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); lstn_addr.sin_family =AF_INET ; - lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + +/*Binding the listen socket*/ +test_bind (lstn_sk, (struct sockaddr *) &lstn_addr,sizeof (lstn_addr)); -/*Binding the listen socket */ -test_bind (lstn_sk, (struct sockaddr *)&lstn_addr,sizeof (lstn_addr)); +/*Listening the socket*/ +test_listen (lstn_sk,SK_MAX -1 ); -/*Listening the socket */ -test_listen (lstn_sk,SK_MAX -1 ); -/*connect () TEST1: Bad socket descriptor, EBADF Expected error */ +/*connect () TEST1: Bad socket descriptor, EBADF Expected error*/ len =sizeof (struct sockaddr_in ); - error =connect (-1 , (const struct sockaddr *)&conn_addr, len); + 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" ); - -/*connect () TEST2: Invalid socket, ENOTSOCK Expected error */ - error =connect (0 , (const struct sockaddr *)&conn_addr, len); + +/*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 " -"error:%d, errno:%d" , error, errno); +tst_brkm (TBROK , tst_exit,"connect with invalid socket " +"error:%d, errno:%d" , error, errno);tst_resm (TPASS ,"connect() with invalid socket - ENOTSOCK" ); -/*connect () TEST3: Invalid address, EFAULT Expected error */ - error =connect (sk, (const struct sockaddr *)-1 , len); +/*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 " -"error:%d, errno:%d" , error, errno); +tst_brkm (TBROK , tst_exit,"connect with invalid address " +"error:%d, errno:%d" , error, errno);tst_resm (TPASS ,"connect() with invalid address - EFAULT" ); -/*connect () TEST4: Invalid address length, EINVAL Expected error */ - error =connect (sk, (const struct sockaddr *)&conn_addr, (len -3 )); +/*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 " -"error:%d, errno:%d" , error, errno); +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" ); -/*connect () TEST5: Invalid address family, EINVAL Expect error */ - 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 " -"error:%d, errno:%d" , error, errno); +/*connect () TEST5: Invalid address family, EINVAL Expect error*/ + 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 , tst_exit,"connect with invalid address family " +"error:%d, errno:%d" , error, errno);tst_resm (TPASS ,"connect() with invalid address family - EINVAL" ); conn_addr.sin_family =AF_INET ; -/*connect () TEST6: Blocking connect, should pass */ -/*All the be below blocking connect should pass as socket will be -listening SK_MAX clients */ -for (i =0 ; i <SK_MAX ; i++) { +/*connect () TEST6: Blocking connect, should pass*/ +/*All the be below blocking connect should pass as socket will be +listening SK_MAX clients*/ +for (i =0 ; i <SK_MAX ; i++) { error =connect (clnt_sk[i], (const struct sockaddr *)&conn_addr, - len); + 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); }tst_resm (TPASS ,"valid blocking connect() - SUCCESS" );/*connect () TEST7: connect when accept queue is full, ECONNREFUSED -Expect error */ -/*Now that accept queue is full, the below connect should fail */ - error =connect (clnt2_sk, (const struct sockaddr *)&conn_addr, len); +Expect error*/ +/*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 " -"error:%d, errno:%d" , error, errno); +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" ); - -/*Calling a accept first to estblish the pending connections */ -for (i =0 ; i <SK_MAX ; i++) + +/*Calling a accept first to estblish the pending connections*/ +for (i=0 ; i <SK_MAX ; i++) acpt_sk[i] =test_accept (lstn_sk, - (struct sockaddr *)&acpt_addr, &len); + (struct sockaddr *) &acpt_addr, &len); -/*connect () TEST8: from a listening socket, EISCONN Expect error */ - error =connect (lstn_sk, (const struct sockaddr *)&lstn_addr, len); +/*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 " -"error:%d, errno:%d" , error, errno); +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" ); -/*connect() TEST9: On established socket, EISCONN Expect error */ - 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 " -"error:%d, errno:%d" , error, errno); +/*connect() TEST9: On established socket, EISCONN Expect error*/ + i=0 ; + error =connect (acpt_sk[i], (const struct sockaddr *) &lstn_addr, len); +if (error !=-1 || errno !=EISCONN ) +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" ); -for (i =0 ; i <4 ; i++) { +for (i =0 ; i <4 ; i++) {close (clnt_sk[i]);close (acpt_sk[i]); - } + }/* connect() TEST10: Re-establish an association that is closed. * should succeed. */ error =connect (sk1, (const struct sockaddr *)&conn_addr, len);if (error <0 ) -tst_brkm (TBROK ,NULL ,"Re-establish an association that " -"is closed error:%d, errno:%d" , error, errno); +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 - " "SUCCESS" );@@ -217,5 +219,5 @@ int main(int argc, char *argv[])close (sk1);close (lstn_sk); -tst_exit (); +return 0 ; }testcases/network/sctp/func_tests/test_1_to_1_connectx.c +73
-75@@ -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,15 +13,15 @@* TEST7: Connect when accept queue is full * TEST8: On a listening socket * TEST9: On established socket -* TEST10: Connect to re-establish a closed association. +* 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. @@ -52,7 +52,7 @@#include <sys/types.h> #include <sys/socket.h> #include <linux/socket.h> -#include <netinet/in.h> /* for sockaddr_in */ +#include <netinet/in.h> /* for sockaddr_in */ #include <arpa/inet.h> #include <errno.h> #include <sys/uio.h> @@ -65,14 +65,15 @@ int TST_CNT = 0;#define SK_MAX 10 -int main (int argc,char *argv[]) +int +main (int argc,char *argv[]) { -int error, i; +int error,i;socklen_t len; -int sk, lstn_sk, clnt_sk[SK_MAX ], acpt_sk[SK_MAX ], pf_class; -int sk1, clnt2_sk; +int sk,lstn_sk,clnt_sk[SK_MAX ],acpt_sk[SK_MAX ],pf_class; +int sk1,clnt2_sk; -struct sockaddr_in conn_addr, lstn_addr, acpt_addr; +struct sockaddr_in conn_addr,lstn_addr,acpt_addr;struct sockaddr *tmp_addr;/* Rather than fflush() throughout the code, set stdout to @@ -86,11 +87,11 @@ int main(int argc, char *argv[]) sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); sk1 =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); -/*Creating a listen socket */ +/*Creating a listen socket*/ lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); -/*Creating a regular socket */ -for (i =0 ; i <SK_MAX ; i++) +/*Creating a regular socket*/ +for (i =0 ; i <SK_MAX ; i++) clnt_sk[i] =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); clnt2_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP );@@ -103,126 +104,123 @@ int main(int argc, char *argv[]) lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); -/*Binding the listen socket */ -test_bind (lstn_sk, (struct sockaddr *)&lstn_addr,sizeof (lstn_addr)); +/*Binding the listen socket*/ +test_bind (lstn_sk, (struct sockaddr *) &lstn_addr,sizeof (lstn_addr)); -/*Listening the socket */ -test_listen (lstn_sk,SK_MAX -1 ); +/*Listening the socket*/ +test_listen (lstn_sk,SK_MAX -1 ); -/*sctp_connectx () TEST1: Bad socket descriptor, EBADF Expected error */ + +/*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 ); + +/*sctp_connectx () TEST2: Invalid socket, ENOTSOCK Expected error*/ + error =sctp_connectx (0 , (struct sockaddr *) &conn_addr,1 ,NULL );if (error !=-1 || errno !=ENOTSOCK ) -tst_brkm (TBROK ,NULL ,"sctp_connectx with invalid socket " -"error:%d, errno:%d" , error, errno); +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" ); -/*sctp_connectx () TEST3: Invalid address, EINVAL Expected error */ - tmp_addr = (struct sockaddr *)malloc (sizeof (struct sockaddr ) -1 ); +/*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 " -"error:%d, errno:%d" , error, errno); +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 ); +/*sctp_connectx () TEST4: Invalid address length, EINVAL Expected error*/ + error =sctp_connectx (sk, (struct sockaddr *) &conn_addr,0 ,NULL );if (error !=-1 || errno !=EINVAL ) -tst_brkm (TBROK ,NULL , -"sctp_connectx with invalid address length " -"error:%d, errno:%d" , error, errno); +tst_brkm (TBROK , tst_exit,"sctp_connectx with invalid address length " +"error:%d, errno:%d" , error, errno);tst_resm (TPASS ,"sctp_connectx() with invalid address length - EINVAL" ); -/*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 ); +/*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 ,NULL );if (error !=-1 || errno !=EINVAL ) -tst_brkm (TBROK ,NULL , -"sctp_connectx with invalid address family " -"error:%d, errno:%d" , error, errno); +tst_brkm (TBROK , tst_exit,"sctp_connectx with invalid address family " +"error:%d, errno:%d" , error, errno);tst_resm (TPASS ,"sctp_connectx() with invalid address family - EINVAL" ); conn_addr.sin_family =AF_INET ; -/*sctp_connectx () TEST6: Blocking sctp_connectx, should pass */ -/*All the be below blocking sctp_connectx should pass as socket will be -listening SK_MAX clients */ -for (i =0 ; i <SK_MAX ; i++) { +/*sctp_connectx () TEST6: Blocking sctp_connectx, should pass*/ +/*All the be below blocking sctp_connectx should pass as socket will be +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); }tst_resm (TPASS ,"valid blocking sctp_connectx() - SUCCESS" );/*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 ); +Expect error*/ +/*Now that accept queue is full, the below sctp_connectx should fail*/ + 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 " -"error:%d, errno:%d" , error, errno); +tst_brkm (TBROK , tst_exit,"sctp_connectx when accept queue is full " +"error:%d, errno:%d" , error, errno); -tst_resm (TPASS , -"sctp_connectx() when accept queue is full - ECONNREFUSED" ); - -/*Calling a accept first to estblish the pending sctp_connectxions */ -for (i =0 ; i <SK_MAX ; i++) +tst_resm (TPASS ,"sctp_connectx() when accept queue is full - ECONNREFUSED" ); + +/*Calling a accept first to estblish the pending sctp_connectxions*/ +for (i=0 ; i <SK_MAX ; i++) acpt_sk[i] =test_accept (lstn_sk, - (struct sockaddr *)&acpt_addr, &len); + (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 ); +/*sctp_connectx () TEST8: from a listening socket, EISCONN Expect error*/ + 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 " -"error:%d, errno:%d" , error, errno); +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 ); +/*sctp_connectx() TEST9: On established socket, EISCONN Expect error*/ + i=0 ; + 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 " -"error:%d, errno:%d" , error, errno); +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" ); -for (i =0 ; i <4 ; i++) { +for (i =0 ; i <4 ; i++) {close (clnt_sk[i]);close (acpt_sk[i]); - } + }/* 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 " -"is closed error:%d, errno:%d" , error, errno); +tst_brkm (TBROK , tst_exit,"Re-establish an association that " +"is closed error:%d, errno:%d" , error, errno); -tst_resm (TPASS , -"sctp_connectx() to re-establish a closed association - " +tst_resm (TPASS ,"sctp_connectx() to re-establish a closed association - " "SUCCESS" );close (sk);close (sk1);close (lstn_sk); -tst_exit (); +return 0 ; }testcases/network/sctp/func_tests/test_1_to_1_events.c +42
-40@@ -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. @@ -37,9 +37,9 @@#include <unistd.h> #include <stdlib.h> #include <sys/types.h> -#include <sys/socket.h> /* needed by linux/sctp.h */ +#include <sys/socket.h> /* needed by linux/sctp.h */ #include <sys/uio.h> -#include <netinet/in.h> /* for sockaddr_in */ +#include <netinet/in.h> /* for sockaddr_in */ #include <errno.h> #include <netinet/sctp.h> #include <sctputil.h> @@ -49,10 +49,11 @@ char *TCID = __FILE__;int TST_TOTAL =4 ;int TST_CNT =0 ; -int main (int argc,char *argv[]) +int +main (int argc,char *argv[]) { -int svr_sk, clt_sk, acpt_sk; -struct sockaddr_in svr_loop, clt_loop, acpt_loop; +int svr_sk, clt_sk,acpt_sk; +struct sockaddr_in svr_loop, clt_loop,acpt_loop;struct iovec iov, out_iov;struct msghdr inmessage, outmessage;char incmsg[CMSG_SPACE (sizeof (sctp_cmsg_data_t))];@@ -67,12 +68,12 @@ int main(int argc, char *argv[])uint32_t ppid;uint32_t stream; -/* Rather than fflush() throughout the code, set stdout to -* be unbuffered. -*/ -setvbuf (stdout,NULL , _IONBF,0 ); +/* Rather than fflush() throughout the code, set stdout to +* be unbuffered. +*/ +setvbuf (stdout,NULL , _IONBF,0 ); -/* Initialize the server and client addresses. */ +/* Initialize the server and client addresses. */ svr_loop.sin_family =AF_INET ; svr_loop.sin_addr.s_addr =SCTP_IP_LOOPBACK ; svr_loop.sin_port =htons (SCTP_TESTPORT_1 );@@ -82,8 +83,8 @@ int main(int argc, char *argv[]) clt_loop.sin_port =htons (SCTP_TESTPORT_1 );/* Create and bind the server socket. */ - svr_sk =test_socket (AF_INET ,SOCK_STREAM ,IPPROTO_SCTP ); -test_bind (svr_sk, (struct sockaddr *)&svr_loop,sizeof (svr_loop)); + svr_sk =test_socket (AF_INET ,SOCK_STREAM ,IPPROTO_SCTP ); +test_bind (svr_sk, (struct sockaddr *) &svr_loop,sizeof (svr_loop));/* Mark server socket as being able to accept new associations. */ test_listen (svr_sk,3 );@@ -99,12 +100,12 @@ int main(int argc, char *argv[])test_setsockopt (clt_sk,SCTP_EVENTS , &event, len); len =sizeof (struct sockaddr_in ); -test_connect (clt_sk, (struct sockaddr *)&clt_loop, len); - - acpt_sk =test_accept (svr_sk, (struct sockaddr *)&acpt_loop, &len); +test_connect (clt_sk, (struct sockaddr *) &clt_loop, len); + + acpt_sk =test_accept (svr_sk, (struct sockaddr *) &acpt_loop, &len);/* Build up a msghdr structure we can use for all sending. */ -memset (&outmessage,0 ,sizeof (outmessage)); +memset (&outmessage,0 ,sizeof (outmessage)); outmessage.msg_name = &svr_loop; outmessage.msg_namelen =sizeof (svr_loop); outmessage.msg_iov = &out_iov;@@ -120,7 +121,7 @@ int main(int argc, char *argv[]) outmessage.msg_controllen = cmsg->cmsg_len; sinfo = (struct sctp_sndrcvinfo *)CMSG_DATA (cmsg);memset (sinfo,0x00 ,sizeof (struct sctp_sndrcvinfo )); - ppid =rand ();/* Choose an arbitrary value. */ + ppid =rand ();/* Choose an arbitrary value. */ stream =1 ; sinfo->sinfo_ppid = ppid;@@ -129,15 +130,13 @@ int main(int argc, char *argv[]) outmessage.msg_iov->iov_base = message; outmessage.msg_iov->iov_len = (strlen (message) +1 ); -/* Send . This will create the association */ -test_sendmsg (clt_sk, &outmessage,0 ,strlen (message) +1 ); +/* Send . This will create the association*/ +test_sendmsg (clt_sk, &outmessage,0 ,strlen (message)+1 ); -memset (&inmessage,0 ,sizeof (inmessage)); +memset (&inmessage,0 ,sizeof (inmessage));/* NOW initialize inmessage with enough space for DATA... */ big_buffer =malloc (REALLY_BIG ); -if (!big_buffer) { -DUMP_CORE ; - } +if (!big_buffer) {DUMP_CORE ; }/* Let's do a test to do a recvmsg when we are not listening and * when we have no associations. @@ -151,38 +150,41 @@ int main(int argc, char *argv[]) error =test_recvmsg (clt_sk, &inmessage,MSG_WAITALL );test_check_msg_notification (&inmessage, - error, -sizeof (struct sctp_assoc_change ), -SCTP_ASSOC_CHANGE ,SCTP_COMM_UP ); - + error, +sizeof (struct sctp_assoc_change ), +SCTP_ASSOC_CHANGE , +SCTP_COMM_UP ); +tst_resm (TPASS ,"COMM_UP notification on client socket - SUCCESS" ); error =test_recvmsg (acpt_sk, &inmessage,MSG_WAITALL );test_check_msg_notification (&inmessage, - error, -sizeof (struct sctp_assoc_change ), -SCTP_ASSOC_CHANGE ,SCTP_COMM_UP ); - + error, +sizeof (struct sctp_assoc_change ), +SCTP_ASSOC_CHANGE , +SCTP_COMM_UP ); +tst_resm (TPASS ,"COMM_UP notification on server socket - SUCCESS" ); inmessage.msg_control = incmsg; inmessage.msg_controllen =sizeof (incmsg); error =test_recvmsg (acpt_sk, &inmessage,MSG_WAITALL ); -test_check_msg_data (&inmessage, error,strlen (message) +1 , -MSG_EOR , stream, ppid); +test_check_msg_data (&inmessage, error,strlen (message) +1 , +MSG_EOR , stream, ppid);tst_resm (TPASS ,"Data message on server socket - SUCCESS" );close (clt_sk); error =test_recvmsg (acpt_sk, &inmessage,MSG_WAITALL );test_check_msg_notification (&inmessage, - error, -sizeof (struct sctp_shutdown_event ), -SCTP_SHUTDOWN_EVENT ,0 ); + error, +sizeof (struct sctp_shutdown_event ), +SCTP_SHUTDOWN_EVENT , +0 );tst_resm (TPASS ,"SHUTDOWN notification on accepted socket - SUCCESS" );close (svr_sk);close (acpt_sk); -tst_exit (); +return 0 ; }testcases/network/sctp/func_tests/test_1_to_1_initmsg_connect.c +24
-23@@ -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. @@ -41,24 +41,25 @@#include <string.h> #include <sys/types.h> #include <sys/socket.h> -#include <netinet/in.h> /* for sockaddr_in */ +#include <netinet/in.h> /* for sockaddr_in */ #include <arpa/inet.h> #include <errno.h> #include <netinet/sctp.h> #include <sys/uio.h> -#include <sctputil.h> +#include <sctputil.h> char *TCID = __FILE__;int TST_TOTAL =1 ;int TST_CNT =0 ; -int main (int argc,char **argv) +int +main (int argc,char **argv) {int sk1, sk2, sk3, pf_class;socklen_t len;struct sockaddr_in lstn_addr, acpt_addr;struct sockaddr_in conn_addr; -char *buffer_rcv; +char * buffer_rcv;struct sctp_initmsg sinmsg;char *message ="Hello World!\n" ;@@ -68,22 +69,22 @@ int main(int argc, char **argv)setvbuf (stdout,NULL , _IONBF,0 );setvbuf (stderr,NULL , _IONBF,0 ); -/* Opening the socket */ - +/* Opening the socket*/ + pf_class =PF_INET ; sk1 =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); sk3 =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); - conn_addr.sin_family =AF_INET ; - conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + conn_addr.sin_family =AF_INET ; + conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); - lstn_addr.sin_family =AF_INET ; - lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + lstn_addr.sin_family =AF_INET ; + lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); -test_bind (sk3, (struct sockaddr *)&lstn_addr,sizeof (lstn_addr)); +test_bind (sk3, (struct sockaddr *) &lstn_addr,sizeof (lstn_addr)); len =sizeof (struct sctp_initmsg ); sinmsg.sinit_num_ostreams =65535 ;@@ -98,9 +99,9 @@ int main(int argc, char **argv)test_listen (sk3,1 ); len =sizeof (struct sockaddr_in ); -test_connect (sk1, (struct sockaddr *)&conn_addr, len); +test_connect (sk1, (struct sockaddr *) &conn_addr, len); - sk2 =test_accept (sk3, (struct sockaddr *)&acpt_addr, &len); + sk2 =test_accept (sk3, (struct sockaddr *) &acpt_addr, &len); test_sctp_sendmsg(sk1, message, strlen(message) + 1, (struct sockaddr *)&conn_addr, len,@@ -111,9 +112,9 @@ int main(int argc, char **argv)tst_resm (TPASS ,"connect() with init timeout set to 0 - SUCCESS" ); -close (sk1); -close (sk2); -close (sk3); - -return 0 ; +close (sk1); +close (sk2); +close (sk3); + +return 0 ; }testcases/network/sctp/func_tests/test_1_to_1_nonblock.c +76
-83@@ -1,24 +1,24 @@ -/* SCTP kernel reference Implementation +/* SCTP kernel Implementation * Copyright (c) 2003 Hewlett-Packard Development Company, L.P * (C) Copyright IBM Corp. 2004 * * This file has test cases to test the Non-Blocking mode of connect(), * accept() and recvmsg() calls. * -* TEST1: Non blocking accept return EAGAIN if connect is not called +* TEST1: Non blocking accept return EAGAIN if connect is not called * TEST2: Non blocking connect should return EINPROGRESS * TEST3: accept() passes when connect called in Non-blocking mode * TEST4: Non blocking recvmsg should return EAGAIN * 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. @@ -48,7 +48,7 @@#include <string.h> #include <sys/types.h> #include <sys/socket.h> -#include <netinet/in.h> /* for sockaddr_in */ +#include <netinet/in.h> /* for sockaddr_in */ #include <arpa/inet.h> #include <errno.h> #include <netinet/sctp.h> @@ -60,157 +60,150 @@ char *TCID = __FILE__;int TST_TOTAL =5 ;int TST_CNT =0 ; -int main (int argc,char *argv[]) +int +main (int argc,char *argv[]) { -int error, msg_count; +int error,msg_count;socklen_t len; -int sk, pf_class, lstn_sk, acpt_sk, flag, cflag, sflag; +int sk,pf_class,lstn_sk,acpt_sk,flag,cflag,sflag;struct msghdr outmessage;struct msghdr inmessage; -char *message ="hello, world!\n" ; -struct iovec iov; -struct iovec iov_rcv; +char *message ="hello, world!\n" ; +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; +struct iovec out_iov; +char * buffer_rcv;char incmsg[CMSG_SPACE (sizeof (sctp_cmsg_data_t))]; - -struct sockaddr_in conn_addr, lstn_addr, svr_addr; + +struct sockaddr_in conn_addr,lstn_addr,svr_addr;/* Rather than fflush() throughout the code, set stdout to -* be unbufferd -*/ -setvbuf (stdout,NULL , _IONBF,0 ); -setvbuf (stderr,NULL , _IONBF,0 ); +* be unbufferd +*/ +setvbuf (stdout,NULL , _IONBF,0 ); +setvbuf (stderr,NULL , _IONBF,0 ); - pf_class =PF_INET ; + pf_class =PF_INET ; - sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); - lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); conn_addr.sin_family =AF_INET ; - conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); lstn_addr.sin_family =AF_INET ; - lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); -/*Binding the listen socket */ -test_bind (lstn_sk, (struct sockaddr *)&lstn_addr,sizeof (lstn_addr)); +/*Binding the listen socket*/ +test_bind (lstn_sk, (struct sockaddr *) &lstn_addr,sizeof (lstn_addr)); -/*Listening the socket */ -test_listen (lstn_sk,10 ); +/*Listening the socket*/ +test_listen (lstn_sk,10 ); len =sizeof (struct sockaddr_in ); flag =MSG_NOSIGNAL ; - -/*Setting server socket non-blocking */ + +/*Setting server socket non-blocking*/ sflag =fcntl (lstn_sk,F_GETFL ,0 );if (sflag <0 ) -tst_brkm (TBROK ,NULL ,"fcnt F_GETFL failed " -"sflag:%d, errno:%d" , sflag, errno); +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 " -"error:%d, errno:%d" , error, errno); +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 " -"error:%d, errno:%d" , error, errno); +tst_brkm (TBROK , tst_exit,"non-blocking accept " +"error:%d, errno:%d" , error, errno);tst_resm (TPASS ,"non-blocking accept() - EAGAIN" );/* TEST2: Non Block connect should return EINPROGRESS */ -/*Set client socket as non-blocking */ +/*Set client socket as non-blocking*/ cflag =fcntl (sk,F_GETFL ,0 );if (cflag <0 ) -tst_brkm (TBROK ,NULL ,"fcnt F_GETFL failed " -"cflag:%d, errno:%d" , cflag, errno); +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 " -"error:%d, errno:%d" , error, errno); +tst_brkm (TBROK , tst_exit,"fcnt F_SETFL failed " +"error:%d, errno:%d" , error, errno); - error =connect (sk, (const struct sockaddr *)&conn_addr, len); + error =connect (sk, (const struct sockaddr *) &conn_addr, len);if (error !=-1 || errno !=EINPROGRESS ) -tst_brkm (TBROK ,NULL ,"non-blocking connect " -"error:%d, errno:%d" , error, errno); +tst_brkm (TBROK , tst_exit,"non-blocking connect " +"error:%d, errno:%d" , error, errno);tst_resm (TPASS ,"non-blocking connect() - EINPROGRESS" );/* 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 " -"error:%d, errno:%d" , error, errno); - +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; - outmessage.msg_iovlen =1 ; - outmessage.msg_control = outcmsg; - outmessage.msg_controllen =sizeof (outcmsg); - outmessage.msg_flags =0 ; + outmessage.msg_name = &svr_addr; + outmessage.msg_namelen =sizeof (svr_addr); + outmessage.msg_iov = &out_iov; + outmessage.msg_iovlen =1 ; + outmessage.msg_control = outcmsg; + outmessage.msg_controllen =sizeof (outcmsg); + outmessage.msg_flags =0 ; cmsg =CMSG_FIRSTHDR (&outmessage); - cmsg->cmsg_level =IPPROTO_SCTP ; - cmsg->cmsg_type =SCTP_SNDRCV ; - cmsg->cmsg_len =CMSG_LEN (sizeof (struct sctp_sndrcvinfo )); - outmessage.msg_controllen = cmsg->cmsg_len; + cmsg->cmsg_level =IPPROTO_SCTP ; + cmsg->cmsg_type =SCTP_SNDRCV ; + cmsg->cmsg_len =CMSG_LEN (sizeof (struct sctp_sndrcvinfo )); + outmessage.msg_controllen = cmsg->cmsg_len; 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; +memset (sinfo,0x00 ,sizeof (struct sctp_sndrcvinfo )); - outmessage.msg_iov->iov_len =strlen (message) +1 ; + outmessage.msg_iov->iov_base = message; + outmessage.msg_iov->iov_len =strlen (message) +1 ;memset (&inmessage,0 ,sizeof (inmessage)); - buffer_rcv =malloc (REALLY_BIG ); + buffer_rcv =malloc (REALLY_BIG ); - iov_rcv.iov_base = buffer_rcv; - iov_rcv.iov_len =REALLY_BIG ; - inmessage.msg_iov = &iov_rcv; - inmessage.msg_iovlen =1 ; - inmessage.msg_control = incmsg; - inmessage.msg_controllen =sizeof (incmsg); + iov_rcv.iov_base = buffer_rcv; + iov_rcv.iov_len =REALLY_BIG ; + inmessage.msg_iov = &iov_rcv; + inmessage.msg_iovlen =1 ; + inmessage.msg_control = incmsg; + inmessage.msg_controllen =sizeof (incmsg); msg_count =strlen (message) +1 ;/* 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 " -"error:%d, errno:%d" , error, errno); +if ( error !=-1 || errno !=EAGAIN ) +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); -test_check_msg_data (&inmessage, error, msg_count,MSG_EOR ,0 ,0 ); +test_check_msg_data (&inmessage, error, msg_count,MSG_EOR ,0 ,0 );tst_resm (TPASS ,"non-blocking recvmsg() when data is available - " "SUCCESS" );close (lstn_sk);close (acpt_sk); -tst_exit (); +return 0 ; }testcases/network/sctp/func_tests/test_1_to_1_recvfrom.c +48
-47@@ -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. @@ -48,7 +48,7 @@#include <string.h> #include <sys/types.h> #include <sys/socket.h> -#include <netinet/in.h> /* for sockaddr_in */ +#include <netinet/in.h> /* for sockaddr_in */ #include <arpa/inet.h> #include <errno.h> #include <netinet/sctp.h> @@ -60,113 +60,114 @@ char *TCID = __FILE__;int TST_TOTAL =7 ;int TST_CNT =0 ; -int main (int argc,char *argv[]) +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" ; +int sk,pf_class,lstn_sk,acpt_sk, flag; +char *message ="hello, world!\n" ;char *message_rcv; -int count; +int count; -struct sockaddr_in conn_addr, lstn_addr, svr_addr; +struct sockaddr_in conn_addr,lstn_addr,svr_addr;/* Rather than fflush() throughout the code, set stdout to -* be unbuffered. -*/ -setvbuf (stdout,NULL , _IONBF,0 ); -setvbuf (stderr,NULL , _IONBF,0 ); +* be unbuffered. +*/ +setvbuf (stdout,NULL , _IONBF,0 ); +setvbuf (stderr,NULL , _IONBF,0 ); message_rcv =malloc (512 ); - pf_class =PF_INET ; + pf_class =PF_INET ; - sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); - lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); conn_addr.sin_family =AF_INET ; - conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); lstn_addr.sin_family =AF_INET ; - lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); -/*Binding the listen socket */ -test_bind (lstn_sk, (struct sockaddr *)&lstn_addr,sizeof (lstn_addr)); +/*Binding the listen socket*/ +test_bind (lstn_sk, (struct sockaddr *) &lstn_addr,sizeof (lstn_addr)); -/*Listening the socket */ -test_listen (lstn_sk,10 ); +/*Listening the socket*/ +test_listen (lstn_sk,10 ); len =sizeof (struct sockaddr_in ); - -test_connect (sk, (struct sockaddr *)&conn_addr, len); + +test_connect (sk, (struct sockaddr *) &conn_addr, len); acpt_sk =test_accept (lstn_sk, (struct sockaddr *)&svr_addr, &len); - + msg_count = (strlen (message) +1 ); flag =MSG_NOSIGNAL ; -/*Sending the message */ +/*Sending the message*/ count =test_send (sk, message, msg_count, flag); -/*recvfrom () TEST1: Bad socket descriptor, EBADF Expected error */ +/*recvfrom () TEST1: Bad socket descriptor, EBADF Expected error*/ 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" ); -/*recvfrom () TEST2: Invalid socket , ENOTSOCK Expected error */ +/*recvfrom () TEST2: Invalid socket , ENOTSOCK Expected error*/ 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" ); -/*recvfrom () TEST3: Invalid message pointer EFAULT, Expected error */ +/*recvfrom () TEST3: Invalid message pointer EFAULT, Expected error*/ 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" ); -/*TEST4: recvfrom on listening socket,ENOTCONN Expected error */ +/*TEST4: recvfrom on listening socket,ENOTCONN Expected error*/ 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 */ +/*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 - " "EOF" ); -/*recvfrom () TEST6:reading the pending message on socket that sent -SHUTDOWN */ +/*recvfrom () TEST6:reading the pending message on socket that sent +SHUTDOWN*/ 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);@@ -174,11 +175,11 @@ int main(int argc, char *argv[]) "sent shutdown - SUCCESS");/*recvfrom () TEST7: No more message and association is shutdown, -ENOTCONN Expected error */ +ENOTCONN Expected error*/ 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 +189,6 @@ int main(int argc, char *argv[])close (sk);close (lstn_sk);close (acpt_sk); -tst_exit (); - +return 0 ; + }testcases/network/sctp/func_tests/test_1_to_1_recvmsg.c +57
-57@@ -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. @@ -49,7 +49,7 @@#include <string.h> #include <sys/types.h> #include <sys/socket.h> -#include <netinet/in.h> /* for sockaddr_in */ +#include <netinet/in.h> /* for sockaddr_in */ #include <arpa/inet.h> #include <errno.h> #include <netinet/sctp.h> @@ -61,126 +61,126 @@ char *TCID = __FILE__;int TST_TOTAL =8 ;int TST_CNT =0 ; -int main (int argc,char *argv[]) +int +main (int argc,char *argv[]) { -socklen_t len; -int ret; -int sk, pf_class, lstn_sk, acpt_sk; +socklen_t len; +int sk,pf_class,lstn_sk,acpt_sk;int flag =0 ;struct msghdr inmessage; -char *message ="hello, world!\n" ; +char *message ="hello, world!\n" ;struct iovec iov_rcv; -int count; -char *buffer_rcv; -char incmsg[CMSG_SPACE (sizeof (sctp_cmsg_data_t))]; +int count; +char * buffer_rcv; +char incmsg[CMSG_SPACE (sizeof (sctp_cmsg_data_t))];char *message1 ="hello, world!\n" ; -struct sockaddr_in conn_addr, lstn_addr, svr_addr; +struct sockaddr_in conn_addr,lstn_addr,svr_addr;/* Rather than fflush() throughout the code, set stdout to -* be unbuffered. -*/ -setvbuf (stdout,NULL , _IONBF,0 ); -setvbuf (stderr,NULL , _IONBF,0 ); +* be unbuffered. +*/ +setvbuf (stdout,NULL , _IONBF,0 ); +setvbuf (stderr,NULL , _IONBF,0 ); - pf_class =PF_INET ; + pf_class =PF_INET ; - sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); - lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); conn_addr.sin_family =AF_INET ; - conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); lstn_addr.sin_family =AF_INET ; - lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); -/*Binding the listen socket */ -test_bind (lstn_sk, (struct sockaddr *)&lstn_addr,sizeof (lstn_addr)); +/*Binding the listen socket*/ +test_bind (lstn_sk, (struct sockaddr *) &lstn_addr,sizeof (lstn_addr)); -/*Listening the socket */ -test_listen (lstn_sk,10 ); +/*Listening the socket*/ +test_listen (lstn_sk,10 ); len =sizeof (struct sockaddr_in ); - -test_connect (sk, (struct sockaddr *)&conn_addr, len); + +test_connect (sk, (struct sockaddr *) &conn_addr, len); acpt_sk =test_accept (lstn_sk, (struct sockaddr *)&svr_addr, &len);memset (&inmessage,0 ,sizeof (inmessage)); - buffer_rcv =malloc (REALLY_BIG ); + buffer_rcv =malloc (REALLY_BIG ); - iov_rcv.iov_base = buffer_rcv; - iov_rcv.iov_len =REALLY_BIG ; - inmessage.msg_iov = &iov_rcv; - inmessage.msg_iovlen =1 ; - inmessage.msg_control = incmsg; - inmessage.msg_controllen =sizeof (incmsg); + iov_rcv.iov_base = buffer_rcv; + iov_rcv.iov_len =REALLY_BIG ; + inmessage.msg_iov = &iov_rcv; + inmessage.msg_iovlen =1 ; + inmessage.msg_control = incmsg; + inmessage.msg_controllen =sizeof (incmsg); -/*recvmsg () TEST1: Bad socket descriptor, EBADF Expected error */ +/*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" ); -/*recvmsg () TEST2: Invalid socket , ENOTSOCK Expected error */ +/*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" ); -/*recvmsg () TEST3: Invalid iovec pointer EFAULT, Expected error */ +/*recvmsg () TEST3: Invalid iovec pointer EFAULT, Expected error*/ 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" ); - + inmessage.msg_iov = &iov_rcv; -/*recvmsg () TEST4: Invalid msghdr pointer EFAULT, Expected error */ +/*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" ); -/*recvmsg () TEST5:recvmsg on listening socket,ENOTCONN Expected error */ +/*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 */ +/*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 - " "EOF" ); -/*recvmsg () TEST7:reading the pending message socket that sent -SHUTDOWN */ +/*recvmsg () TEST7:reading the pending message socket that sent +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);@@ -188,10 +188,10 @@ int main(int argc, char *argv[]) "sent shutdown - SUCCESS");/*recvmsg () TEST8: No more message and association is shutdown, -ENOTCONN Expected error */ +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 +201,5 @@ int main(int argc, char *argv[])close (sk);close (lstn_sk);close (acpt_sk); -tst_exit (); +return 0 ; }testcases/network/sctp/func_tests/test_1_to_1_rtoinfo.c +29
-28@@ -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. @@ -46,8 +46,8 @@#include <sys/types.h> #include <sys/socket.h> #include <linux/socket.h> -#include <linux/in.h> /* for sockaddr_in */ -#include <linux/in6.h> /* for sockaddr_in6 */ +#include <linux/in.h> /* for sockaddr_in */ +#include <linux/in6.h> /* for sockaddr_in6 */ #include <errno.h> #include <sys/uio.h> #include <netinet/sctp.h> @@ -57,51 +57,52 @@ char *TCID = __FILE__;int TST_TOTAL =3 ;int TST_CNT =0 ; -int main (void ) +int +main (void ) { - +int sd, ret;socklen_t len; -struct sctp_rtoinfo srtoinfo;/*setting the variables */ -struct sctp_rtoinfo grtoinfo;/*Getting the variables */ +struct sctp_rtoinfo srtoinfo;/*setting the variables*/ +struct sctp_rtoinfo grtoinfo;/*Getting the variables*/ - sd =test_socket (PF_INET ,SOCK_STREAM ,IPPROTO_SCTP ); + sd =test_socket (PF_INET ,SOCK_STREAM ,IPPROTO_SCTP ); len =sizeof (struct sctp_rtoinfo ); - -/*TEST1 Getting the default values using getsockopt() */ + +/*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" ); -/*Assigning the values to RTO initial and max and min bounds */ - srtoinfo.srto_initial =60 ; - srtoinfo.srto_max =100 ; - srtoinfo.srto_min =40 ; +/*Assigning the values to RTO initial and max and min bounds*/ + srtoinfo.srto_initial=60 ; + srtoinfo.srto_max=100 ; + srtoinfo.srto_min=40 ; -/*TEST2 Setting the values using setsockopt() */ - ret =setsockopt (sd,IPPROTO_SCTP ,SCTP_RTOINFO , &srtoinfo, -sizeof (struct sctp_rtoinfo )); +/*TEST2 Setting the values using setsockopt()*/ + 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" ); -/*Getting the values which are set using setsockopt() */ +/*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. */ +/* 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 " + srtoinfo.srto_max != grtoinfo.srto_max && + srtoinfo.srto_min != grtoinfo.srto_min) +tst_brkm (TBROK , tst_exit,"setsockopt/getsockopt SCTP_RTOINFO " "compare failed" ); tst_resm(TPASS, "setsockopt()/getsockopt SCTP_RTOINFO compare - "@@ -109,5 +110,5 @@ int main(void)close (sd); -tst_exit (); +return 0 ; }testcases/network/sctp/func_tests/test_1_to_1_send.c +69
-67@@ -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,17 +9,17 @@* TEST3: On a listening socket * TEST4: On a closed association * TEST5: Invalid message address -* TEST6: send from client to server -* TEST7: send from server to client +* TEST6: send from client to server +* 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. @@ -49,7 +49,7 @@#include <string.h> #include <sys/types.h> #include <sys/socket.h> -#include <netinet/in.h> /* for sockaddr_in */ +#include <netinet/in.h> /* for sockaddr_in */ #include <arpa/inet.h> #include <errno.h> #include <netinet/sctp.h> @@ -61,162 +61,164 @@ char *TCID = __FILE__;int TST_TOTAL =8 ;int TST_CNT =0 ; -int main (int argc,char *argv[]) +int +main (int argc,char *argv[]) { -socklen_t len, len_snd; +socklen_t len,len_snd;int msg_count; -int sk, sk1, pf_class, lstn_sk, acpt_sk, acpt1_sk, flag, count; -char *message ="hello, world!\n" ; -char *message_rcv; +int sk,sk1,pf_class,lstn_sk,acpt_sk,acpt1_sk, flag, count; +char *message ="hello, world!\n" ; +char *message_rcv; -struct sockaddr_in conn_addr, lstn_addr, svr_addr; +struct sockaddr_in conn_addr,lstn_addr,svr_addr;/* Rather than fflush() throughout the code, set stdout to -* be unbuffered. -*/ -setvbuf (stdout,NULL , _IONBF,0 ); -setvbuf (stderr,NULL , _IONBF,0 ); +* be unbuffered. +*/ +setvbuf (stdout,NULL , _IONBF,0 ); +setvbuf (stderr,NULL , _IONBF,0 ); - pf_class =PF_INET ; + pf_class =PF_INET ; - sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); - sk1 =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + sk1 =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); - lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); conn_addr.sin_family =AF_INET ; - conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); lstn_addr.sin_family =AF_INET ; - lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); -/*Binding the listen socket */ -test_bind (lstn_sk, (struct sockaddr *)&lstn_addr,sizeof (lstn_addr)); +/*Binding the listen socket*/ +test_bind (lstn_sk, (struct sockaddr *) &lstn_addr,sizeof (lstn_addr)); -/*Listening the socket */ -test_listen (lstn_sk,10 ); +/*Listening the socket*/ +test_listen (lstn_sk,10 ); len =sizeof (struct sockaddr_in ); - -test_connect (sk, (struct sockaddr *)&conn_addr, len); + +test_connect (sk, (struct sockaddr *) &conn_addr, len); acpt_sk =test_accept (lstn_sk, (struct sockaddr *)&svr_addr, &len); len_snd = (strlen (message) +1 ); flag =MSG_NOSIGNAL ; -/*send () TEST1: Bad socket descriptor, EBADF Expected error */ +/*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" ); - -/*send () TEST2: Invalid socket, ENOTSOCK Expected error */ + +/*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" ); -/*send () TEST3: send on listening socket, EPIPE Expected error */ +/*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" );#if 0 -/*send () TEST4: Invalid message address, EFAULT Expected error */ -/* FIXME this test should pass. Don't catch why... */ +/*send () TEST4: Invalid message address, EFAULT Expected error*/ +/* 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" );#endif -test_connect (sk1, (struct sockaddr *)&lstn_addr, len); - +test_connect (sk1, (struct sockaddr *) &lstn_addr, len); + count =test_send (sk1, message, len_snd, flag);close (sk1); acpt1_sk =test_accept (lstn_sk, (struct sockaddr *)&conn_addr, &len); -/*send () TEST5: send on closed association, EPIPE Expected error */ +/*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); - sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); - lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); message_rcv =malloc (512 ); -/*Binding the listen socket */ -test_bind (lstn_sk, (struct sockaddr *)&lstn_addr,sizeof (lstn_addr)); +/*Binding the listen socket*/ +test_bind (lstn_sk, (struct sockaddr *) &lstn_addr,sizeof (lstn_addr)); -/*Listening the socket */ -test_listen (lstn_sk,10 ); +/*Listening the socket*/ +test_listen (lstn_sk,10 ); conn_addr.sin_family =AF_INET ; - conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); len =sizeof (struct sockaddr_in ); -test_connect (sk, (struct sockaddr *)&conn_addr, len); +test_connect (sk, (struct sockaddr *) &conn_addr, len); acpt_sk =test_accept (lstn_sk, (struct sockaddr *)&svr_addr, &len); - + msg_count =strlen (message) +1 ; -/*send() TEST6: Sending data from client socket to server socket */ +/*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 " -"count:%d, errno:%d" , count, errno); +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" );test_recv (acpt_sk, message_rcv, msg_count, flag); -strncpy (message_rcv,"\0" ,512 ); +strncpy (message_rcv,"\0" ,512 ); -/*send() TEST7: Sending data from accept socket to client socket */ +/*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 " -"count:%d, errno:%d" , count, errno); +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" );test_recv (sk, message_rcv, msg_count, flag); -/*send() TEST8: Sending less number of data from the buffer */ -/*Sending only 5 bytes so that only hello is received */ -test_send (sk, message,5 , flag); +/*send() TEST8: Sending less number of data from the buffer*/ +/*Sending only 5 bytes so that only hello is received*/ +test_send (sk, message,5 , flag);test_recv (acpt_sk, message_rcv,5 , flag); - +tst_resm (TPASS ,"send() partial data from a buffer - SUCCESS" );/* TEST9: sctp_send with no sinfo */ -test_sctp_send (sk, message,strlen (message) +1 ,NULL , flag); +test_sctp_send (sk, message,strlen (message) +1 ,NULL , flag);test_recv (acpt_sk, message_rcv,strlen (message) +1 , flag);tst_resm (TPASS ,"sctp_send() with no sinfo - SUCCESS" );@@ -224,5 +226,5 @@ int main(int argc, char *argv[])close (lstn_sk);close (acpt_sk); -tst_exit (); +return 0 ; }testcases/network/sctp/func_tests/test_1_to_1_sendmsg.c +130
-141@@ -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 * @@ -17,16 +17,16 @@* * TEST11: Sending data from server socket to client socket * TEST12: Sending data from client socket to server socket -* TEST13: Sending data from unconnected client to server +* 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. @@ -56,7 +56,7 @@#include <string.h> #include <sys/types.h> #include <sys/socket.h> -#include <netinet/in.h> /* for sockaddr_in */ +#include <netinet/in.h> /* for sockaddr_in */ #include <arpa/inet.h> #include <errno.h> #include <netinet/sctp.h> @@ -68,286 +68,275 @@ char *TCID = __FILE__;int TST_TOTAL =14 ;int TST_CNT =0 ; -int main (int argc,char *argv[]) +int +main (int argc,char *argv[]) { -socklen_t len; +socklen_t len;int msg_count; -int sk, sk1, pf_class, lstn_sk, acpt_sk, acpt1_sk, flag; +int sk,sk1,pf_class,lstn_sk,acpt_sk,acpt1_sk, flag;struct msghdr outmessage; -char *message ="hello, world!\n" ; -struct iovec iov; +char *message ="hello, world!\n" ;struct sctp_sndrcvinfo *sinfo; -int count; +int count;char outcmsg[CMSG_SPACE (sizeof (struct sctp_sndrcvinfo ))];struct cmsghdr *cmsg; -struct iovec out_iov; -char *buffer; +struct iovec out_iov;struct msghdr inmessage; -char *buffer_snd; -char *buffer_rcv; -struct sockaddr_in conn_addr, lstn_addr, svr_addr; -struct iovec iov_rcv; +char * buffer_rcv; +struct sockaddr_in conn_addr,lstn_addr,svr_addr; +struct iovec iov_rcv;char incmsg[CMSG_SPACE (sizeof (sctp_cmsg_data_t))];/* Rather than fflush() throughout the code, set stdout to -* be unbuffered. -*/ -setvbuf (stdout,NULL , _IONBF,0 ); -setvbuf (stderr,NULL , _IONBF,0 ); +* be unbuffered. +*/ +setvbuf (stdout,NULL , _IONBF,0 ); +setvbuf (stderr,NULL , _IONBF,0 ); - pf_class =PF_INET ; + pf_class =PF_INET ; - sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); - sk1 =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + sk1 =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); - lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); conn_addr.sin_family =AF_INET ; - conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); lstn_addr.sin_family =AF_INET ; - lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); -/*Binding the listen socket */ -test_bind (lstn_sk, (struct sockaddr *)&lstn_addr,sizeof (lstn_addr)); +/*Binding the listen socket*/ +test_bind (lstn_sk, (struct sockaddr *) &lstn_addr,sizeof (lstn_addr)); -/*Listening the socket */ -test_listen (lstn_sk,10 ); +/*Listening the socket*/ +test_listen (lstn_sk,10 ); len =sizeof (struct sockaddr_in ); - -test_connect (sk, (struct sockaddr *)&conn_addr, len); + +test_connect (sk, (struct sockaddr *) &conn_addr, len); 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; - outmessage.msg_iovlen =1 ; - outmessage.msg_control = outcmsg; - outmessage.msg_controllen =sizeof (outcmsg); - outmessage.msg_flags =0 ; + outmessage.msg_name = &conn_addr; + outmessage.msg_namelen =sizeof (conn_addr); + outmessage.msg_iov = &out_iov; + outmessage.msg_iovlen =1 ; + outmessage.msg_control = outcmsg; + outmessage.msg_controllen =sizeof (outcmsg); + outmessage.msg_flags =0 ; cmsg =CMSG_FIRSTHDR (&outmessage); - cmsg->cmsg_level =IPPROTO_SCTP ; - cmsg->cmsg_type =SCTP_SNDRCV ; - cmsg->cmsg_len =CMSG_LEN (sizeof (struct sctp_sndrcvinfo )); - outmessage.msg_controllen = cmsg->cmsg_len; + cmsg->cmsg_level =IPPROTO_SCTP ; + cmsg->cmsg_type =SCTP_SNDRCV ; + cmsg->cmsg_len =CMSG_LEN (sizeof (struct sctp_sndrcvinfo )); + outmessage.msg_controllen = cmsg->cmsg_len; sinfo = (struct sctp_sndrcvinfo *)CMSG_DATA (cmsg); -memset (sinfo,0x00 ,sizeof (struct sctp_sndrcvinfo )); +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 ; + 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 */ +/*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" ); - -/*sendmsg () TEST2: Invalid socket, ENOTSOCK Expected error */ + +/*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" ); -/*sendmsg () TEST3: sendmsg on listening socket, EPIPE Expected error */ +/*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" ); -/*sendmsg () TEST4: Invalid iovec pointer EFAULT, Expected error */ +/*sendmsg () TEST4: Invalid iovec pointer EFAULT, Expected error*/ 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" ); - + outmessage.msg_iov = &out_iov; -/*sendmsg () TEST5: Invalid iovec count EINVAL, Expected error */ - outmessage.msg_iovlen =0 ; +/*sendmsg () TEST5: Invalid iovec count EINVAL, Expected error*/ + 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" ); outmessage.msg_iovlen =1 ; - -/*sendmsg () TEST6: Invalid msghdr pointer EFAULT, Expected error */ + +/*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" ); -/*sendmsg () TEST7: Invalid sinfo flag EINVAL, Expected error */ +/*sendmsg () TEST7: Invalid sinfo flag EINVAL, Expected error*/ 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" ); -/*sendmsg () TEST8: SCTP_EOF flag EINVAL, Expected error */ +/*sendmsg () TEST8: SCTP_EOF flag EINVAL, Expected error*/ 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" ); -/*sendmsg () TEST9: SCTP_ABORT flag EINVAL, Expected error */ +/*sendmsg () TEST9: SCTP_ABORT flag EINVAL, Expected error*/ 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" ); - sinfo->sinfo_flags =0 ; - -test_connect (sk1, (struct sockaddr *)&lstn_addr, len); - -test_sendmsg (sk1, &outmessage, flag,strlen (message) +1 ); + sinfo->sinfo_flags =0 ; + +test_connect (sk1, (struct sockaddr *) &lstn_addr, len); + +test_sendmsg (sk1, &outmessage, flag,strlen (message)+1 );close (sk1); acpt1_sk =test_accept (lstn_sk, (struct sockaddr *)&conn_addr, &len); -/*sendmsg () TEST10:sendmsg on closed association, EPIPE Expected error */ +/*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); - sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); - lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); conn_addr.sin_family =AF_INET ; - conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); lstn_addr.sin_family =AF_INET ; - lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); -/*Binding the listen socket */ -test_bind (lstn_sk, (struct sockaddr *)&lstn_addr,sizeof (lstn_addr)); +/*Binding the listen socket*/ +test_bind (lstn_sk, (struct sockaddr *) &lstn_addr,sizeof (lstn_addr)); -/*Listening the socket */ -test_listen (lstn_sk,10 ); +/*Listening the socket*/ +test_listen (lstn_sk,10 ); len =sizeof (struct sockaddr_in ); flag =MSG_NOSIGNAL ; - -test_connect (sk, (struct sockaddr *)&conn_addr, len); + +test_connect (sk, (struct sockaddr *) &conn_addr, len); 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; - outmessage.msg_iovlen =1 ; - outmessage.msg_control = outcmsg; - outmessage.msg_controllen =sizeof (outcmsg); - outmessage.msg_flags =0 ; + outmessage.msg_name = &svr_addr; + outmessage.msg_namelen =sizeof (svr_addr); + outmessage.msg_iov = &out_iov; + outmessage.msg_iovlen =1 ; + outmessage.msg_control = outcmsg; + outmessage.msg_controllen =sizeof (outcmsg); + outmessage.msg_flags =0 ; cmsg =CMSG_FIRSTHDR (&outmessage); - cmsg->cmsg_level =IPPROTO_SCTP ; - cmsg->cmsg_type =SCTP_SNDRCV ; - cmsg->cmsg_len =CMSG_LEN (sizeof (struct sctp_sndrcvinfo )); - outmessage.msg_controllen = cmsg->cmsg_len; + cmsg->cmsg_level =IPPROTO_SCTP ; + cmsg->cmsg_type =SCTP_SNDRCV ; + cmsg->cmsg_len =CMSG_LEN (sizeof (struct sctp_sndrcvinfo )); + outmessage.msg_controllen = cmsg->cmsg_len; 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; +memset (sinfo,0x00 ,sizeof (struct sctp_sndrcvinfo )); - outmessage.msg_iov->iov_len =strlen (message) +1 ; + outmessage.msg_iov->iov_base = message; + outmessage.msg_iov->iov_len =strlen (message) +1 ;memset (&inmessage,0 ,sizeof (inmessage)); - buffer_rcv =malloc (REALLY_BIG ); + buffer_rcv =malloc (REALLY_BIG ); - iov_rcv.iov_base = buffer_rcv; - iov_rcv.iov_len =REALLY_BIG ; - inmessage.msg_iov = &iov_rcv; - inmessage.msg_iovlen =1 ; - inmessage.msg_control = incmsg; - inmessage.msg_controllen =sizeof (incmsg); + iov_rcv.iov_base = buffer_rcv; + iov_rcv.iov_len =REALLY_BIG ; + inmessage.msg_iov = &iov_rcv; + inmessage.msg_iovlen =1 ; + inmessage.msg_control = incmsg; + inmessage.msg_controllen =sizeof (incmsg); msg_count =strlen (message) +1 ; -/*sendmsg() TEST11: Sending data from server socket to client socket */ +/*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" ); count =test_recvmsg (sk, &inmessage, flag); -test_check_msg_data (&inmessage, count, msg_count,MSG_EOR ,0 ,0 ); +test_check_msg_data (&inmessage, count, msg_count,MSG_EOR ,0 ,0 ); - outmessage.msg_name = &conn_addr; - outmessage.msg_namelen =sizeof (conn_addr); -/*sendmsg() TEST12: Sending data from client socket to server socket */ + outmessage.msg_name = &conn_addr; + outmessage.msg_namelen =sizeof (conn_addr); +/*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 " -"count:%d, errno:%d" , count, errno); +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" ); count =test_recvmsg (acpt_sk, &inmessage, flag); -test_check_msg_data (&inmessage, count, msg_count,MSG_EOR ,0 ,0 ); +test_check_msg_data (&inmessage, count, msg_count,MSG_EOR ,0 ,0 ); - outmessage.msg_name = &conn_addr; - outmessage.msg_namelen =sizeof (conn_addr); + outmessage.msg_name = &conn_addr; + outmessage.msg_namelen =sizeof (conn_addr);close (sk);close (acpt_sk); sk1 =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); -/*sendmsg() TEST13: Sending data from unconnected client socket to -server socket */ +/*sendmsg() TEST13: Sending data from unconnected client socket to +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" );@@ -355,23 +344,23 @@ int main(int argc, char *argv[]) acpt_sk =test_accept (lstn_sk, (struct sockaddr *)&svr_addr, &len); count =test_recvmsg (acpt_sk, &inmessage, flag); -test_check_msg_data (&inmessage, count, msg_count,MSG_EOR ,0 ,0 ); +test_check_msg_data (&inmessage, count, msg_count,MSG_EOR ,0 ,0 );test_shutdown (sk1,SHUT_RD ); -/*sendmsg() TEST14: Sending a message on SHUT_RD socket */ +/*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 " -"count:%d, errno:%d" , count, errno); +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" ); count =test_recvmsg (acpt_sk, &inmessage, flag); -test_check_msg_data (&inmessage, count, msg_count,MSG_EOR ,0 ,0 ); +test_check_msg_data (&inmessage, count, msg_count,MSG_EOR ,0 ,0 );close (sk1);close (lstn_sk);close (acpt_sk); -tst_exit (); +return 0 ; }testcases/network/sctp/func_tests/test_1_to_1_sendto.c +56
-55@@ -1,8 +1,8 @@ -/* SCTP kernel reference Implementation +/* SCTP kernel Implementation * Copyright (c) 2003 Hewlett-Packard Development Company, L.P * (C) Copyright IBM Corp. 2004 * -* This file has test cases to test the sendto () call +* This file has test cases to test the sendto () call * for 1-1 style sockets * * TEST1: Sending data from client socket to server socket @@ -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. @@ -45,7 +45,7 @@#include <string.h> #include <sys/types.h> #include <sys/socket.h> -#include <netinet/in.h> /* for sockaddr_in */ +#include <netinet/in.h> /* for sockaddr_in */ #include <arpa/inet.h> #include <errno.h> #include <netinet/sctp.h> @@ -57,107 +57,108 @@ char *TCID = __FILE__;int TST_TOTAL =4 ;int TST_CNT =0 ; -int main (int argc,char *argv[]) +int +main (int argc,char *argv[]) { -int msg_count; +int msg_count;socklen_t len; -int sk, sk1, pf_class, lstn_sk, acpt_sk, flag; -char *message ="hello, world!\n" ; -char *message_rcv; -int count; - -struct sockaddr_in conn_addr, lstn_addr, svr_addr; +int sk,sk1,pf_class,lstn_sk,acpt_sk,flag; +char *message ="hello, world!\n" ; +char *message_rcv; +int count; + +struct sockaddr_in conn_addr,lstn_addr,svr_addr;/* Rather than fflush() throughout the code, set stdout to -* be unbufferd -*/ -setvbuf (stdout,NULL , _IONBF,0 ); -setvbuf (stderr,NULL , _IONBF,0 ); +* be unbufferd +*/ +setvbuf (stdout,NULL , _IONBF,0 ); +setvbuf (stderr,NULL , _IONBF,0 ); - pf_class =PF_INET ; + pf_class =PF_INET ; - sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); - lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); + lstn_sk =test_socket (pf_class,SOCK_STREAM ,IPPROTO_SCTP ); message_rcv =malloc (512 ); conn_addr.sin_family =AF_INET ; - conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + conn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + conn_addr.sin_port =htons (SCTP_TESTPORT_1 ); lstn_addr.sin_family =AF_INET ; - lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; - lstn_addr.sin_port =htons (SCTP_TESTPORT_1 ); + lstn_addr.sin_addr.s_addr =SCTP_IP_LOOPBACK ; + lstn_addr.sin_port =htons (SCTP_TESTPORT_1 );Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_1_to_1_shutdown.c +43
-41Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_1_to_1_socket_bind_listen.c +94
-92Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_1_to_1_sockopt.c +121
-120Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_1_to_1_threads.c +78
-81Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_assoc_abort.c +33
-32Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_assoc_shutdown.c +32
-31Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_autoclose.c +24
-22Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_basic.c +122
-120Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_connect.c +34
-27Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_connectx.c +52
-41Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_fragments.c +100
-100Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_getname.c +50
-48Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_inaddr_any.c +99
-100Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_peeloff.c +54
-50Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_recvmsg.c +25
-23Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_sctp_sendrecvmsg.c +73
-61Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_sockopt.c +491
-216Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_tcp_style.c +57
-56Lines of this file are not shown. View the raw message.
testcases/network/sctp/func_tests/test_timetolive.c +110
-107Lines of this file are not shown. View the raw message.
testcases/network/sctp/include/netinet/sctp.h +275
-82Lines of this file are not shown. View the raw message.
testcases/network/sctp/lib/connectx.c +135
-11Lines of this file are not shown. View the raw message.
testcases/network/sctp/testlib/sctputil.c +84
-84Lines of this file are not shown. View the raw message.
testcases/network/sctp/testlib/sctputil.h +33
-37Lines of this file are not shown. View the raw message.
The rest of this diff is not shown. View the raw message.
------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now.
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list
Part of the diff is not shown here. View the raw message.
Hi!
Quoted 1 line
Could anyone help to review?
Can we move it to the utils/ directory?
It's an externally developed testsuite so it shouldn't be placed randomly in the LTP tree.
And what version of the testsuite is this, latest release or latest git?
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
A message that is not in the archive (sent off-list or not yet received): [email protected]
Hi!
Quoted 11 lines
Quoted 2 lines
Quoted 1 line
Could anyone help to review?
Can we move it to the utils/ directory?
OK with me.
Quoted 4 lines
It's an externally developed testsuite so it shouldn't be placed randomly in the LTP tree.
And what version of the testsuite is this, latest release or latest git?
The latest git.
Wouldn't latest release suffice?
We will have to synchronize the sources in the future too and bumping it to latest release when available is one of the reasonable strategies.
Signature · 13 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
PATCH 1/1 Move sctp to utils and bump it to 1.0.15
--- testcases/network/sctp/Makefile | 53 - testcases/network/sctp/func_tests/Makefile | 73 -- .../sctp/func_tests/test_1_to_1_accept_close.c | 231 ---- .../network/sctp/func_tests/test_1_to_1_addrs.c | 276 ----- .../network/sctp/func_tests/test_1_to_1_connect.c | 221 ---- .../network/sctp/func_tests/test_1_to_1_connectx.c | 228 ---- .../network/sctp/func_tests/test_1_to_1_events.c | 188 ---- .../sctp/func_tests/test_1_to_1_initmsg_connect.c | 119 -- .../network/sctp/func_tests/test_1_to_1_nonblock.c | 216 ---- .../network/sctp/func_tests/test_1_to_1_recvfrom.c | 193 ---- .../network/sctp/func_tests/test_1_to_1_recvmsg.c | 205 ---- .../network/sctp/func_tests/test_1_to_1_rtoinfo.c | 113 -- .../network/sctp/func_tests/test_1_to_1_send.c | 228 ---- .../network/sctp/func_tests/test_1_to_1_sendmsg.c | 377 ------- .../network/sctp/func_tests/test_1_to_1_sendto.c | 163 --- .../network/sctp/func_tests/test_1_to_1_shutdown.c | 215 ---- .../func_tests/test_1_to_1_socket_bind_listen.c | 266 ----- .../network/sctp/func_tests/test_1_to_1_sockopt.c | 413 ------- .../network/sctp/func_tests/test_1_to_1_threads.c | 199 ---- .../network/sctp/func_tests/test_assoc_abort.c | 242 ----- .../network/sctp/func_tests/test_assoc_shutdown.c | 244 ----- testcases/network/sctp/func_tests/test_autoclose.c | 165 --- testcases/network/sctp/func_tests/test_basic.c | 453 -------- testcases/network/sctp/func_tests/test_connect.c | 212 ---- testcases/network/sctp/func_tests/test_connectx.c | 259 ----- testcases/network/sctp/func_tests/test_fragments.c | 297 ----- testcases/network/sctp/func_tests/test_getname.c | 256 ----- .../network/sctp/func_tests/test_inaddr_any.c | 252 ----- testcases/network/sctp/func_tests/test_peeloff.c | 295 ----- testcases/network/sctp/func_tests/test_recvmsg.c | 158 --- .../sctp/func_tests/test_sctp_sendrecvmsg.c | 367 ------- testcases/network/sctp/func_tests/test_sockopt.c | 872 --------------- testcases/network/sctp/func_tests/test_tcp_style.c | 462 -------- .../network/sctp/func_tests/test_timetolive.c | 402 ------- testcases/network/sctp/include/netinet/sctp.h | 674 ------------ testcases/network/sctp/lib/Makefile | 31 - testcases/network/sctp/lib/addrs.c | 180 --- testcases/network/sctp/lib/bindx.c | 77 -- testcases/network/sctp/lib/connectx.c | 61 -- testcases/network/sctp/lib/opt_info.c | 58 - testcases/network/sctp/lib/peeloff.c | 46 - testcases/network/sctp/lib/recvmsg.c | 101 -- testcases/network/sctp/lib/sendmsg.c | 106 -- testcases/network/sctp/testlib/Makefile | 41 - testcases/network/sctp/testlib/sctputil.c | 416 ------- testcases/network/sctp/testlib/sctputil.h | 328 ------ utils/sctp/Makefile | 53 + utils/sctp/func_tests/Makefile | 73 ++ utils/sctp/func_tests/test_1_to_1_accept_close.c | 233 ++++ utils/sctp/func_tests/test_1_to_1_addrs.c | 269 +++++ utils/sctp/func_tests/test_1_to_1_connect.c | 223 ++++ utils/sctp/func_tests/test_1_to_1_connectx.c | 226 ++++ utils/sctp/func_tests/test_1_to_1_events.c | 190 ++++ .../sctp/func_tests/test_1_to_1_initmsg_connect.c | 120 ++ utils/sctp/func_tests/test_1_to_1_nonblock.c | 209 ++++ utils/sctp/func_tests/test_1_to_1_recvfrom.c | 194 ++++ utils/sctp/func_tests/test_1_to_1_recvmsg.c | 205 ++++ utils/sctp/func_tests/test_1_to_1_rtoinfo.c | 114 ++ utils/sctp/func_tests/test_1_to_1_send.c | 230 ++++ utils/sctp/func_tests/test_1_to_1_sendmsg.c | 366 +++++++ utils/sctp/func_tests/test_1_to_1_sendto.c | 164 +++ utils/sctp/func_tests/test_1_to_1_shutdown.c | 217 ++++ .../func_tests/test_1_to_1_socket_bind_listen.c | 268 +++++ utils/sctp/func_tests/test_1_to_1_sockopt.c | 414 +++++++ utils/sctp/func_tests/test_1_to_1_threads.c | 196 ++++ utils/sctp/func_tests/test_assoc_abort.c | 244 +++++ utils/sctp/func_tests/test_assoc_shutdown.c | 246 +++++ utils/sctp/func_tests/test_autoclose.c | 168 +++ utils/sctp/func_tests/test_basic.c | 456 ++++++++ utils/sctp/func_tests/test_connect.c | 219 ++++ utils/sctp/func_tests/test_connectx.c | 270 +++++ utils/sctp/func_tests/test_fragments.c | 298 +++++ utils/sctp/func_tests/test_getname.c | 258 +++++ utils/sctp/func_tests/test_inaddr_any.c | 251 +++++ utils/sctp/func_tests/test_peeloff.c | 299 +++++ utils/sctp/func_tests/test_recvmsg.c | 160 +++ utils/sctp/func_tests/test_sctp_sendrecvmsg.c | 380 +++++++ utils/sctp/func_tests/test_sockopt.c | 1147 ++++++++++++++++++++ utils/sctp/func_tests/test_tcp_style.c | 463 ++++++++ utils/sctp/func_tests/test_timetolive.c | 406 +++++++ utils/sctp/include/netinet/sctp.h | 867 +++++++++++++++ utils/sctp/lib/Makefile | 31 + utils/sctp/lib/addrs.c | 155 +++ utils/sctp/lib/bindx.c | 78 ++ utils/sctp/lib/connectx.c | 185 ++++ utils/sctp/lib/opt_info.c | 62 ++ utils/sctp/lib/peeloff.c | 47 + utils/sctp/lib/recvmsg.c | 101 ++ utils/sctp/lib/sendmsg.c | 106 ++ utils/sctp/testlib/Makefile | 41 + utils/sctp/testlib/sctputil.c | 418 +++++++ utils/sctp/testlib/sctputil.h | 324 ++++++ 92 files changed, 11644 insertions(+), 11032 deletions(-) delete mode 100644 testcases/network/sctp/Makefile delete mode 100644 testcases/network/sctp/func_tests/Makefile delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_accept_close.c delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_addrs.c delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_connect.c delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_connectx.c delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_events.c delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_initmsg_connect.c delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_nonblock.c delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_recvfrom.c delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_recvmsg.c delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_rtoinfo.c delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_send.c delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_sendmsg.c delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_sendto.c delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_shutdown.c delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_socket_bind_listen.c delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_sockopt.c delete mode 100644 testcases/network/sctp/func_tests/test_1_to_1_threads.c delete mode 100644 testcases/network/sctp/func_tests/test_assoc_abort.c delete mode 100644 testcases/network/sctp/func_tests/test_assoc_shutdown.c delete mode 100644 testcases/network/sctp/func_tests/test_autoclose.c delete mode 100644 testcases/network/sctp/func_tests/test_basic.c delete mode 100644 testcases/network/sctp/func_tests/test_connect.c delete mode 100644 testcases/network/sctp/func_tests/test_connectx.c delete mode 100644 testcases/network/sctp/func_tests/test_fragments.c delete mode 100644 testcases/network/sctp/func_tests/test_getname.c delete mode 100644 testcases/network/sctp/func_tests/test_inaddr_any.c delete mode 100644 testcases/network/sctp/func_tests/test_peeloff.c delete mode 100644 testcases/network/sctp/func_tests/test_recvmsg.c delete mode 100644 testcases/network/sctp/func_tests/test_sctp_sendrecvmsg.c delete mode 100644 testcases/network/sctp/func_tests/test_sockopt.c delete mode 100644 testcases/network/sctp/func_tests/test_tcp_style.c delete mode 100644 testcases/network/sctp/func_tests/test_timetolive.c delete mode 100644 testcases/network/sctp/include/netinet/sctp.h delete mode 100644 testcases/network/sctp/lib/Makefile delete mode 100644 testcases/network/sctp/lib/addrs.c delete mode 100644 testcases/network/sctp/lib/bindx.c delete mode 100644 testcases/network/sctp/lib/connectx.c delete mode 100644 testcases/network/sctp/lib/opt_info.c delete mode 100644 testcases/network/sctp/lib/peeloff.c delete mode 100644 testcases/network/sctp/lib/recvmsg.c delete mode 100644 testcases/network/sctp/lib/sendmsg.c delete mode 100644 testcases/network/sctp/testlib/Makefile delete mode 100644 testcases/network/sctp/testlib/sctputil.c delete mode 100644 testcases/network/sctp/testlib/sctputil.h create mode 100644 utils/sctp/Makefile create mode 100644 utils/sctp/func_tests/Makefile create mode 100644 utils/sctp/func_tests/test_1_to_1_accept_close.c create mode 100644 utils/sctp/func_tests/test_1_to_1_addrs.c create mode 100644 utils/sctp/func_tests/test_1_to_1_connect.c create mode 100644 utils/sctp/func_tests/test_1_to_1_connectx.c create mode 100644 utils/sctp/func_tests/test_1_to_1_events.c create mode 100644 utils/sctp/func_tests/test_1_to_1_initmsg_connect.c create mode 100644 utils/sctp/func_tests/test_1_to_1_nonblock.c create mode 100644 utils/sctp/func_tests/test_1_to_1_recvfrom.c create mode 100644 utils/sctp/func_tests/test_1_to_1_recvmsg.c create mode 100644 utils/sctp/func_tests/test_1_to_1_rtoinfo.c create mode 100644 utils/sctp/func_tests/test_1_to_1_send.c create mode 100644 utils/sctp/func_tests/test_1_to_1_sendmsg.c create mode 100644 utils/sctp/func_tests/test_1_to_1_sendto.c create mode 100644 utils/sctp/func_tests/test_1_to_1_shutdown.c create mode 100644 utils/sctp/func_tests/test_1_to_1_socket_bind_listen.c create mode 100644 utils/sctp/func_tests/test_1_to_1_sockopt.c create mode 100644 utils/sctp/func_tests/test_1_to_1_threads.c create mode 100644 utils/sctp/func_tests/test_assoc_abort.c create mode 100644 utils/sctp/func_tests/test_assoc_shutdown.c create mode 100644 utils/sctp/func_tests/test_autoclose.c create mode 100644 utils/sctp/func_tests/test_basic.c create mode 100644 utils/sctp/func_tests/test_connect.c create mode 100644 utils/sctp/func_tests/test_connectx.c create mode 100644 utils/sctp/func_tests/test_fragments.c create mode 100644 utils/sctp/func_tests/test_getname.c create mode 100644 utils/sctp/func_tests/test_inaddr_any.c create mode 100644 utils/sctp/func_tests/test_peeloff.c create mode 100644 utils/sctp/func_tests/test_recvmsg.c create mode 100644 utils/sctp/func_tests/test_sctp_sendrecvmsg.c create mode 100644 utils/sctp/func_tests/test_sockopt.c create mode 100644 utils/sctp/func_tests/test_tcp_style.c create mode 100644 utils/sctp/func_tests/test_timetolive.c create mode 100644 utils/sctp/include/netinet/sctp.h create mode 100644 utils/sctp/lib/Makefile create mode 100644 utils/sctp/lib/addrs.c create mode 100644 utils/sctp/lib/bindx.c create mode 100644 utils/sctp/lib/connectx.c create mode 100644 utils/sctp/lib/opt_info.c create mode 100644 utils/sctp/lib/peeloff.c create mode 100644 utils/sctp/lib/recvmsg.c create mode 100644 utils/sctp/lib/sendmsg.c create mode 100644 utils/sctp/testlib/Makefile create mode 100644 utils/sctp/testlib/sctputil.c create mode 100644 utils/sctp/testlib/sctputil.h
testcases/network/sctp/Makefile deleted +0 -53
@@ -1,53 +0,0 @@ -# -# network/sctp test suite Makefile. -# -# Copyright (C) 2009, Cisco Systems Inc. -# -# This program 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 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -# -# Garrett Cooper, July 2009 -# - -top_srcdir ?= ../../.. - -include $(top_srcdir)/include/mk/env_pre.mk - -LIBSCTPDIR := lib -LIBSCTPUTILDIR := testlib -LIBSCTP := $(LIBSCTPDIR)/libsctp.a -LIBSCTPUTIL := $(LIBSCTPUTILDIR)/libsctputil.a - -FILTER_OUT_DIRS := $(LIBSCTPDIR) $(LIBSCTPUTILDIR) - -$(LIBSCTPDIR) $(LIBSCTPUTILDIR): - mkdir -p "$@" - -lib-clean:: $(LIBSCTPDIR) $(LIBSCTPUTILDIR) - for i in $^; do \ - $(MAKE) -C "$$i" -f "$(abs_srcdir)/$$i/Makefile" clean; \ - done - - -$(LIBSCTP): $(LIBSCTPDIR) - $(MAKE) -C "$^" -f "$(abs_srcdir)/$^/Makefile" all - -$(LIBSCTPUTIL): $(LIBSCTPUTILDIR) - $(MAKE) -C "$^" -f "$(abs_srcdir)/$^/Makefile" all - -trunk-all: $(LIBSCTP) $(LIBSCTPUTIL) - -trunk-clean:: | lib-clean - -include $(top_srcdir)/include/mk/generic_trunk_target.mk
testcases/network/sctp/func_tests/Makefile deleted +0 -73
73 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_accept_close.c deleted +0 -231
231 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_addrs.c deleted +0 -276
276 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_connect.c deleted +0 -221
221 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_connectx.c deleted +0 -228
228 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_events.c deleted +0 -188
188 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_initmsg_connect.c deleted +0 -119
119 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_nonblock.c deleted +0 -216
216 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_recvfrom.c deleted +0 -193
193 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_recvmsg.c deleted +0 -205
205 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_rtoinfo.c deleted +0 -113
113 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_send.c deleted +0 -228
228 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_sendmsg.c deleted +0 -377
377 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_sendto.c deleted +0 -163
163 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_shutdown.c deleted +0 -215
116 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_socket_bind_listen.c deleted +0 -266
266 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_sockopt.c deleted +0 -413
413 lines not on this page · raw message
testcases/network/sctp/func_tests/test_1_to_1_threads.c deleted +0 -199
199 lines not on this page · raw message
testcases/network/sctp/func_tests/test_assoc_abort.c deleted +0 -242
242 lines not on this page · raw message
testcases/network/sctp/func_tests/test_assoc_shutdown.c deleted +0 -244
244 lines not on this page · raw message
testcases/network/sctp/func_tests/test_autoclose.c deleted +0 -165
165 lines not on this page · raw message
testcases/network/sctp/func_tests/test_basic.c deleted +0 -453
453 lines not on this page · raw message
testcases/network/sctp/func_tests/test_connect.c deleted +0 -212
212 lines not on this page · raw message
testcases/network/sctp/func_tests/test_connectx.c deleted +0 -259
259 lines not on this page · raw message
testcases/network/sctp/func_tests/test_fragments.c deleted +0 -297
297 lines not on this page · raw message
testcases/network/sctp/func_tests/test_getname.c deleted +0 -256
256 lines not on this page · raw message
testcases/network/sctp/func_tests/test_inaddr_any.c deleted +0 -252
252 lines not on this page · raw message
testcases/network/sctp/func_tests/test_peeloff.c deleted +0 -295
295 lines not on this page · raw message
testcases/network/sctp/func_tests/test_recvmsg.c deleted +0 -158
158 lines not on this page · raw message
testcases/network/sctp/func_tests/test_sctp_sendrecvmsg.c deleted +0 -367
367 lines not on this page · raw message
testcases/network/sctp/func_tests/test_sockopt.c deleted +0 -872
872 lines not on this page · raw message
testcases/network/sctp/func_tests/test_tcp_style.c deleted +0 -462
462 lines not on this page · raw message
testcases/network/sctp/func_tests/test_timetolive.c deleted +0 -402
402 lines not on this page · raw message
testcases/network/sctp/include/netinet/sctp.h deleted +0 -674
674 lines not on this page · raw message
testcases/network/sctp/lib/Makefile deleted +0 -31
Lines of this file are not shown. View the raw message.
testcases/network/sctp/lib/addrs.c deleted +0 -180
180 lines not on this page · raw message
testcases/network/sctp/lib/bindx.c deleted +0 -77
77 lines not on this page · raw message
testcases/network/sctp/lib/connectx.c deleted +0 -61
61 lines not on this page · raw message
testcases/network/sctp/lib/opt_info.c deleted +0 -58
58 lines not on this page · raw message
testcases/network/sctp/lib/peeloff.c deleted +0 -46
46 lines not on this page · raw message
testcases/network/sctp/lib/recvmsg.c deleted +0 -101
101 lines not on this page · raw message
testcases/network/sctp/lib/sendmsg.c deleted +0 -106
106 lines not on this page · raw message
testcases/network/sctp/testlib/Makefile deleted +0 -41
41 lines not on this page · raw message
testcases/network/sctp/testlib/sctputil.c deleted +0 -416
416 lines not on this page · raw message
testcases/network/sctp/testlib/sctputil.h deleted +0 -328
328 lines not on this page · raw message
utils/sctp/Makefile new file +53 -0
53 lines not on this page · raw message
utils/sctp/func_tests/Makefile new file +73 -0
73 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_accept_close.c new file +233 -0
233 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_addrs.c new file +269 -0
269 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_connect.c new file +223 -0
223 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_connectx.c new file +226 -0
226 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_events.c new file +190 -0
190 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_initmsg_connect.c new file +120 -0
120 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_nonblock.c new file +209 -0
209 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_recvfrom.c new file +194 -0
194 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_recvmsg.c new file +205 -0
205 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_rtoinfo.c new file +114 -0
114 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_send.c new file +230 -0
230 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_sendmsg.c new file +366 -0
366 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_sendto.c new file +164 -0
164 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_shutdown.c new file +217 -0
217 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_socket_bind_listen.c new file +268 -0
268 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_sockopt.c new file +414 -0
414 lines not on this page · raw message
utils/sctp/func_tests/test_1_to_1_threads.c new file +196 -0
196 lines not on this page · raw message
utils/sctp/func_tests/test_assoc_abort.c new file +244 -0
244 lines not on this page · raw message
utils/sctp/func_tests/test_assoc_shutdown.c new file +246 -0
246 lines not on this page · raw message
utils/sctp/func_tests/test_autoclose.c new file +168 -0
168 lines not on this page · raw message
utils/sctp/func_tests/test_basic.c new file +456 -0
456 lines not on this page · raw message
utils/sctp/func_tests/test_connect.c new file +219 -0
219 lines not on this page · raw message
utils/sctp/func_tests/test_connectx.c new file +270 -0
270 lines not on this page · raw message
utils/sctp/func_tests/test_fragments.c new file +298 -0
298 lines not on this page · raw message
utils/sctp/func_tests/test_getname.c new file +258 -0
258 lines not on this page · raw message
utils/sctp/func_tests/test_inaddr_any.c new file +251 -0
251 lines not on this page · raw message
utils/sctp/func_tests/test_peeloff.c new file +299 -0
299 lines not on this page · raw message
utils/sctp/func_tests/test_recvmsg.c new file +160 -0
160 lines not on this page · raw message
utils/sctp/func_tests/test_sctp_sendrecvmsg.c new file +380 -0
380 lines not on this page · raw message
utils/sctp/func_tests/test_sockopt.c new file +1147 -0
1,147 lines not on this page · raw message
utils/sctp/func_tests/test_tcp_style.c new file +463 -0
463 lines not on this page · raw message
utils/sctp/func_tests/test_timetolive.c new file +406 -0
406 lines not on this page · raw message
utils/sctp/include/netinet/sctp.h new file +867 -0
867 lines not on this page · raw message
utils/sctp/lib/addrs.c new file +155 -0
155 lines not on this page · raw message
utils/sctp/lib/bindx.c new file +78 -0
78 lines not on this page · raw message
utils/sctp/lib/connectx.c new file +185 -0
185 lines not on this page · raw message
utils/sctp/lib/opt_info.c new file +62 -0
62 lines not on this page · raw message
utils/sctp/lib/peeloff.c new file +47 -0
47 lines not on this page · raw message
utils/sctp/lib/recvmsg.c new file +101 -0
101 lines not on this page · raw message
utils/sctp/lib/sendmsg.c new file +106 -0
106 lines not on this page · raw message
utils/sctp/testlib/Makefile new file +41 -0
41 lines not on this page · raw message
utils/sctp/testlib/sctputil.c new file +418 -0
418 lines not on this page · raw message
utils/sctp/testlib/sctputil.h new file +324 -0
324 lines not on this page · raw message
The rest of this diff is not shown. View the raw message.
Signature · 12 lines
1.8.4.2 ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
Part of the diff is not shown here. View the raw message.
Re: [LTP] [PATCH] Move sctp to utils and bump it to 1.0.15
Hi!
Quoted 1 line
Signed-off-by Simon Xu <[email protected]>
Pushed, thanks.
I still don't like that it installs binaries that are not clearly to be part of the sctp, i.e. test_1_to_1_addrs and so, but this patch is obvious improvement over the previous situation.
Signature · 12 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [LTP] [PATCH] Move sctp to utils and bump it to 1.0.15
Hi!
Quoted 10 lines
Quoted 5 lines
Pushed, thanks.
I still don't like that it installs binaries that are not clearly to be part of the sctp, i.e.
test_1_to_1_addrsand so, but this patch is obvious improvement over the previous situation.
test_1_to_1_addrsand the other binaries infunc_testsare part of lksctp-tools, see
https://github.com/borkmann/lksctp-tools/blob/master/src/func_tests/
<https://github.com/borkmann/lksctp-tools/blob/master/src/func_tests/test_1_to_1_addrs.c>
I know where they came from. But I would like to avoid collisions in the install phase by having resasonably unique name for each file we install. Or by grouping them in directories.
Signature · 12 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [LTP] [PATCH] Move sctp to utils and bump it to 1.0.15
Hi!
Quoted 9 lines
Quoted 9 lines
Quoted 9 lines
Quoted 5 lines
Pushed, thanks.
I still don't like that it installs binaries that are not clearly to be part of the sctp, i.e.
test_1_to_1_addrsand so, but this patch is obvious improvement over the previous situation.
test_1_to_1_addrsand the other binaries infunc_testsare part of lksctp-tools, see
https://github.com/borkmann/lksctp-tools/blob/master/src/func_tests/
<https://github.com/borkmann/lksctp-tools/blob/master/src/func_tests/test_1_to_1_addrs.c>
Quoted 5 lines
Quoted 3 lines
I know where they came from. But I would like to avoid collisions in the install phase by having resasonably unique name for each file we install. Or by grouping them in directories.
I see what you mean now. I think we can prefix them with '
sctp_'.
That would be great.
Signature · 12 lines
Cyril Hrubis [email protected] ------------------------------------------------------------------------------ Sponsored by Intel(R) XDK Develop, test and display web and hybrid apps with a single code base. Download it for free now! http://pubads.g.doubleclick.net/gampad/clk?id=111408631&iu=/4140/ostg.clktrk _______________________________________________ Ltp-list mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ltp-list