FreeBSD SCTP support?
Michael Tuexen
Michael.Tuexen at lurchi.franken.de
Wed Aug 11 06:30:55 UTC 2010
On Aug 11, 2010, at 3:40 AM, Sebastien Decugis wrote:
> Hello,
>
> I am encountering a problem with SCTP stack in FreeBSD 8.1 release (on
> amd64); and I am looking for the correct place to report a bug. Would
> someone from this list be kind enough to give me direction where I
> should report the problem? I am totally new to FreeBSD and I was not
> able to find a better place than this mailing-list so far...
Reporting it here is the correct place.
>
> If by any change this list is the correct place, you can find the
> description of the problem and steps to reproduce here:
> http://www.freebsd.org/cgi/query-pr.cgi?pr=149488
It was reported here yesterday and I responded already...
>
> As I understand the answer in that bug report, SCTP is not part of
> FreeBSD? But I did not install anything special, nor could find a
> dedicated place on the Internet so far...
SCTP is part of FreeBSD. But the point is that your problem is not
related to a bug in FreeBSD but in your application. If you use
/* Send a message on a socket and a particular stream */
void send_on_stream(int sock, unsigned int strid, unsigned char * msg, size_t sz)
{
struct msghdr mhdr;
struct iovec iov;
struct cmsghdr *cmsg;
struct sctp_sndrcvinfo *info;
char buffer[CMSG_SPACE(sizeof(struct sctp_sndrcvinfo))];
ssize_t ret;
memset(&mhdr, 0, sizeof(mhdr));
memset(&iov, 0, sizeof(iov));
memset(buffer, 0, CMSG_SPACE(sizeof(struct sctp_sndrcvinfo)));
/* IO Vector: message data */
iov.iov_base = msg;
iov.iov_len = sz;
/* Anciliary data: specify SCTP stream */
cmsg = (struct cmsghdr *)buffer;
cmsg->cmsg_level = IPPROTO_SCTP;
cmsg->cmsg_type = SCTP_SNDRCV;
cmsg->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo));
info = (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg);
info->sinfo_stream = strid;
mhdr.msg_iov = &iov;
mhdr.msg_iovlen = 1;
mhdr.msg_control = buffer;
mhdr.msg_controllen = cmsg->cmsg_len;
if ( (ret = sendmsg(sock, &mhdr, 0)) < 0) {
perror("sendmsg");
exit (1);
}
ASSERT( ret == sz ); /* There should not be partial delivery with sendmsg... */
return;
}
the problem is solved. You were not using the CMSG stuff correctly, so on
64-bit platforms the problem showed up.
I hope this helps, if not, feel free to ask any question or contact me directly.
BTW: Do you have a running implementation of RFC 3436 which supports multiple
streams?
Best regards
Michael
>
> Thank you!
> Best regards,
> Sebastien.
>
> --
> Sebastien Decugis
> Research fellow
> Network Architecture Group
> NICT (nict.go.jp)
>
> _______________________________________________
> freebsd-net at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe at freebsd.org"
>
More information about the freebsd-net
mailing list