SCTP

Mark Atkinson atkin901 at gmail.com
Thu May 19 20:18:25 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 05/14/2011 01:59, jyl_2006 wrote:
> I have download files from http://www.sctp.org/app.tar.bz2,and when I input
> gmake,
> It shows that:
> cc:../user/FreeBSD/libsctpuser.a:No such file or directory.
> I have tryed to search file named "libsctpuser.a",but nothing have found.
> Anyone who can help me?

SCTP on FreeBSD is easier than the ancient SCTP demo code.

1. Take any regular TCP app source and find the socket calls in it.
2. change netinet/in.h to netinet/sctp.h
3. change protocol IPPROTO_SCTP
4. compile and launch.

example change from port swww/bozohttpd.

- --- ./daemon-bozo.c     2010-09-20 15:49:42.000000000 -0700
+++ /usr/ports/www/bozohttpd-sctp/work/bozohttpd-20100920/daemon-bozo.c
 2011-04-28 08:03:22.000000000 -0700
@@ -36,7 +36,7 @@
 #include <sys/socket.h>
 #include <sys/wait.h>

- -#include <netinet/in.h>
+#include <netinet/sctp.h>

 #include <errno.h>
 #include <netdb.h>
@@ -98,7 +98,7 @@
        httpd->sock = bozomalloc(httpd, httpd->nsock *
sizeof(*httpd->sock));
        httpd->fds = bozomalloc(httpd, httpd->nsock * sizeof(*httpd->fds));
        for (i = 0, r = r0; r != NULL; r = r->ai_next) {
- -               httpd->sock[i] = socket(r->ai_family, SOCK_STREAM, 0);
+               httpd->sock[i] = socket(r->ai_family, SOCK_STREAM,
IPPROTO_SCTP);
                if (httpd->sock[i] == -1)
                        continue;
                if (setsockopt(httpd->sock[i], SOL_SOCKET, SO_REUSEADDR,
&on,


example change to wget:

- --- wget-svn/wget/src/connect.c 2007-07-23 14:31:01.000000000 -0700
+++ wget-sctp/wget/src/connect.c        2011-05-12 07:01:04.000000000 -0700
@@ -39,7 +39,7 @@
 #ifndef WINDOWS
 # include <sys/socket.h>
 # include <netdb.h>
- -# include <netinet/in.h>
+# include <netinet/sctp.h>
 # ifndef __BEOS__
 #  include <arpa/inet.h>
 # endif
@@ -275,7 +275,7 @@
   sockaddr_set_data (sa, ip, port);

   /* Create the socket of the family appropriate for the address.  */
- -  sock = socket (sa->sa_family, SOCK_STREAM, 0);
+  sock = socket (sa->sa_family, SOCK_STREAM, IPPROTO_SCTP);
   if (sock < 0)
     goto err;

@@ -423,7 +423,7 @@
   void *setopt_ptr = (void *)&setopt_val;
   socklen_t setopt_size = sizeof (setopt_val);

- -  sock = socket (bind_address->family, SOCK_STREAM, 0);
+  sock = socket (bind_address->family, SOCK_STREAM, IPPROTO_SCTP);
   if (sock < 0)
     return -1;

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (FreeBSD)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk3VdGkACgkQrDN5kXnx8ybfxQCfW53+CBn0L/V+MW3rRyxRx5hp
IZEAn0iRjxj2LH2atgIBjImWbSlDmt84
=6Aja
-----END PGP SIGNATURE-----


More information about the freebsd-net mailing list