Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 11 Aug 2010 08:30:50 +0200
From:      Michael Tuexen <Michael.Tuexen@lurchi.franken.de>
To:        Sebastien Decugis <sdecugis@nict.go.jp>
Cc:        freebsd-net@freebsd.org
Subject:   Re: FreeBSD SCTP support?
Message-ID:  <7EBDF546-F92F-405A-BFEF-07A28EACA6DF@lurchi.franken.de>
In-Reply-To: <4C61FF94.2090801@nict.go.jp>
References:  <4C61FF94.2090801@nict.go.jp>

next in thread | previous in thread | raw e-mail | index | archive | help
On Aug 11, 2010, at 3:40 AM, Sebastien Decugis wrote:

> Hello,
>=20
> 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.
>=20
> 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=3D149488
It was reported here yesterday and I responded already...
>=20
> 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;
=09
	memset(&mhdr, 0, sizeof(mhdr));
	memset(&iov,  0, sizeof(iov));
	memset(buffer, 0, CMSG_SPACE(sizeof(struct sctp_sndrcvinfo)));
=09
	/* IO Vector: message data */
	iov.iov_base =3D msg;
	iov.iov_len  =3D sz;
=09
	/* Anciliary data: specify SCTP stream */
	cmsg =3D (struct cmsghdr *)buffer;
	cmsg->cmsg_level =3D IPPROTO_SCTP;
	cmsg->cmsg_type  =3D SCTP_SNDRCV;
	cmsg->cmsg_len   =3D CMSG_LEN(sizeof(struct sctp_sndrcvinfo));

	info =3D (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg);
	info->sinfo_stream =3D strid;

	mhdr.msg_iov    =3D &iov;
	mhdr.msg_iovlen =3D 1;

	mhdr.msg_control    =3D buffer;
	mhdr.msg_controllen =3D cmsg->cmsg_len;

	if ( (ret =3D sendmsg(sock, &mhdr, 0)) < 0) {
		perror("sendmsg");
		exit (1);
	}
	ASSERT( ret =3D=3D sz ); /* There should not be partial delivery =
with sendmsg... */
=09
	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
>=20
> Thank you!
> Best regards,
> Sebastien.
>=20
> --=20
> Sebastien Decugis
> Research fellow
> Network Architecture Group
> NICT (nict.go.jp)
>=20
> _______________________________________________
> freebsd-net@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-net
> To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
>=20




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?7EBDF546-F92F-405A-BFEF-07A28EACA6DF>