On 11/23/2012 11:55 PM, 小贺 wrote:
dear lksctp Project,
i met a problem about sending abort chunk. if you have time, please help me. i'm using the lksctp to develop my function, which is for sending Abort chunk. platform of my development : Redhat centos 5.5 and verion of linux kernel is 2.18. according to "man sctp_sendmsg", just set flags to SCTP_ABORT. my partial code.--------------------------------------------------------------------------------------------------------------------------struct msghdr msg;struct cmsghdr cmsg; struct iovec iov; static char error_code= 12; iov.iov_base = &error_code; iov.iov_len = 1;cmsg.cmsg_level = IPPROTO_SCTP;cmsg.cmsg_type = SCTP_SNDRV;cmsg.cmsg_len = sizeof(struct cmsghdr);msg.msg_name = (SOCKADDR*)&serAddr; msg.msg_namelen = sizeof(serAddr); msg.msg_iov = &iov; msg.msg_iovlen = 1; msg.msg_control = &cmsg; msg.msg_controllen = sizeof(cmsg); ret = sctp_sendmsg(sock_fd, (void*)&msg, sizeof(msg), (SOCKADDR*)&serAddr, sizeo
f(serAddr),sri.sinfo_ppid, (SCTP_ABORT), sri.sinfo_stream, sri.sinfo_timetolive,sri.sinfo_context);--------------------------------------------------------------------------------------------------------------------but the ret < 0 and the errno is 22 that is invalid agument.please tell which argument is error and how to set cause of abort chunk into "struct msghdr" best regardsthank you fangmin.cao
First, the msg argument is just a buffer to send, not a msghdr. Second
the SCTP_ABORT is set in the flags parameter of sctp_sendmsg(). Third,
SCTP_ABORT is not supported on a SOCK_STREAM socket.
That should get you what you want.
-vlad
--
To unsubscribe from this list: send the line "unsubscribe linux-sctp" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html