From: Song S. <son...@gm...> - 2010-09-01 18:28:04
|
Hello, I've come across a problem when use lksctp test-tools,after running the command "make v4test"in the terminal; In the terminal prints "test_assoc_abort.c 1 BROK : setsockopt(11): Invalid argument DUMP_CORE ./sctputil.h: 258" Details described below. I'm a novice, want your help,pls,thanks very much! *1)problem:* [root@localhost lksctp-tools-1.0.11]# */sbin/modprobe -a sctp* [root@localhost lksctp-tools-1.0.11]# *./configure* checking for a BSD-compatible install... /usr/bin/install -c checking whether build environment is sane... yes checking for gawk... gawk checking whether make sets $(MAKE)... yes checking for gawk... (cached) gawk checking for gcc... gcc ... ... ... ... [root@localhost lksctp-tools-1.0.11]# *make* [root@localhost func_tests]# *make v4test* ./test_assoc_abort *test_assoc_abort.c 1 BROK : setsockopt(11): Invalid argument* DUMP_CORE ./sctputil.h: 258 /bin/sh: line 1: 9968 Segment error ./$a test_assoc_abort fails make: *** [v4test] error 1 *2)configuration:* [root@localhost func_tests]# uname -a Linux localhost 2.6.9-42.ELsmp #1 SMP Sat Aug 12 09:39:11 CDT 2006 i686 i686 i386 GNU/Linux [root@localhost func_tests]# rpm -qli lksctp-tools Name : lksctp-tools Relocations: (not relocatable) Version : 1.0.2 Vendor: CentOS Release : 6.4E.1 Build Date: 2005.08.23 Tuesday 09:18:22 Install Date: 2010.03.05 Friday 00:06:56 Build Host: build1-i386 Group : System Environment/Libraries Source RPM: lksctp-tools-1.0.2-6.4E.1.src.rpm Size : 147707 License: LGPL Signature : DSA/SHA1, 2005.08.23 Tuesday 18:10:21, Key ID a53d0bab443e1821 Packager : Johnny Hughes <jo...@ce...> URL : http://lksctp.sourceforge.net Summary : User-space access to Linux Kernel SCTP Description : This is the lksctp-tools package for Linux Kernel SCTP Reference Implementation. This package is intended to supplement the Linux Kernel SCTP Reference Implementation now available in the Linux kernel source tree in versions 2.5.36 and following. For more information on LKSCTP see the package documentation README file, section titled "LKSCTP - Linux Kernel SCTP." This package contains the base run-time library & command-line tools. /usr/bin/checksctp /usr/bin/sctp_darn /usr/bin/sctp_test /usr/bin/withsctp /usr/lib/libsctp.so.1 /usr/lib/libsctp.so.1.0.2 /usr/lib/lksctp-tools/libwithsctp.a /usr/lib/lksctp-tools/libwithsctp.la /usr/lib/lksctp-tools/libwithsctp.so /usr/lib/lksctp-tools/libwithsctp.so.1 /usr/lib/lksctp-tools/libwithsctp.so.1.0.2 /usr/share/doc/lksctp-tools-1.0.2 /usr/share/doc/lksctp-tools-1.0.2/AUTHORS /usr/share/doc/lksctp-tools-1.0.2/COPYING /usr/share/doc/lksctp-tools-1.0.2/COPYING.lib /usr/share/doc/lksctp-tools-1.0.2/ChangeLog /usr/share/doc/lksctp-tools-1.0.2/README *3)code:* /********************sctputil.h:******************************/ #define tst_brkm(a1, a2, whatever...) \ { \ printf("%s %2d BROK : ", TCID, ++TST_CNT); \ printf(whatever); \ printf("\n"); \ DUMP_CORE \ } static inline int test_setsockopt(int sk, int optname, const void *optval, socklen_t optlen) { int error = *setsockopt*(sk, SOL_SCTP, optname, optval, optlen); if (error) tst_brkm(TBROK, tst_exit, "setsockopt(%d): %s", optname, strerror(errno)); return error; } /********************sctputil.c:******************************/ /* Enable ASSOC_CHANGE and SNDRCVINFO notifications. */ void test_enable_assoc_change(int fd) { struct sctp_event_subscribe subscribe; memset(&subscribe, 0, sizeof(subscribe)); subscribe.sctp_data_io_event = 1; subscribe.sctp_association_event = 1; *test_setsockopt*(fd, SCTP_EVENTS, (char *)&subscribe, sizeof(subscribe)); } /***********************test_assoc_abort.c*************************. #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/socket.h> #include <sys/uio.h> #include <netinet/in.h> #include <sys/errno.h> #include <errno.h> #include <netinet/sctp.h> #include <sctputil.h> char *TCID = __FILE__; int TST_TOTAL = 1; int TST_CNT = 0; #define MAX_CLIENTS 10 int main(int argc, char *argv[]) { int svr_sk, clt_sk[MAX_CLIENTS]; sockaddr_storage_t svr_loop, clt_loop[MAX_CLIENTS]; sctp_assoc_t svr_associd[MAX_CLIENTS]; struct iovec iov; struct msghdr inmessage; struct msghdr outmessage; char incmsg[CMSG_SPACE(sizeof(sctp_cmsg_data_t))]; char outcmsg[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))]; struct cmsghdr *cmsg; struct sctp_sndrcvinfo *sinfo; struct iovec out_iov; int error; uint32_t ppid; uint32_t stream; struct sctp_assoc_change *sac; char *big_buffer; int i; char *message = "hello, world!\n"; struct sctp_status status; socklen_t status_len; /* Rather than fflush() throughout the code, set stdout to * be unbuffered. */ setvbuf(stdout, NULL, _IONBF, 0); /* Create and bind the server socket. */ svr_sk = test_socket(AF_INET, SOCK_SEQPACKET, IPPROTO_SCTP); svr_loop.v4.sin_family = AF_INET; svr_loop.v4.sin_addr.s_addr = SCTP_IP_LOOPBACK; svr_loop.v4.sin_port = htons(SCTP_TESTPORT_1); test_bind(svr_sk, &svr_loop.sa, sizeof(svr_loop)); /* Enable ASSOC_CHANGE and SNDRCVINFO notifications. */ *test_enable_assoc_change(svr_sk);* .... .... } Tronix.Ruan yours, |