diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/error.c socat-2.0.0-b1-sctp/error.c
--- socat-2.0.0-b1/error.c	2007-06-01 02:00:57.000000000 -0400
+++ socat-2.0.0-b1-sctp/error.c	2008-03-28 14:15:16.000000000 -0400
@@ -20,12 +20,14 @@
 #if HAVE_UNISTD_H
 #include <unistd.h>
 #endif
+#include <pthread.h>
 #include "mytypes.h"
 #include "compat.h"
 #include "utils.h"
 
 #include "error.h"
 
+
 /* translate MSG level to SYSLOG level */
 int syslevel[] = {
    LOG_DEBUG,
@@ -100,7 +102,7 @@
 		   sizeof(facilitynames)/sizeof(struct wordent))) == NULL) {
 	    Error1("unknown syslog facility \"%s\"", arg);
 	 } else {
-	    diagopts.logfacility = (int)keywd->desc;
+	    diagopts.logfacility = (long)(keywd->desc);
 	 }
       }
       openlog(diagopts.progname, LOG_PID, diagopts.logfacility);
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xio.h socat-2.0.0-b1-sctp/xio.h
--- socat-2.0.0-b1/xio.h	2007-05-20 15:51:36.000000000 -0400
+++ socat-2.0.0-b1-sctp/xio.h	2008-03-28 13:57:19.000000000 -0400
@@ -184,7 +184,7 @@
    const char *defname;	/* main (canonical) name of address */
    int numparams;	/* number of required parameters */
    int leftdirs;
-   unsigned groups;
+   unsigned long long groups;
    int howtoshut;
    int howtoclose;
    int (*func)(int argc, const char *argv[], struct opt *opts, int rw, union bipipe *fd, unsigned groups,
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xiohelp.c socat-2.0.0-b1-sctp/xiohelp.c
--- socat-2.0.0-b1/xiohelp.c	2007-05-28 15:29:15.000000000 -0400
+++ socat-2.0.0-b1-sctp/xiohelp.c	2008-03-28 12:56:04.000000000 -0400
@@ -41,7 +41,7 @@
 	"TERMIOS",	"RANGE",	"PTY",		"PARENT",
 	"UNIX",		"IP4",		"IP6",		"INTERFACE",
 	"UDP",		"TCP",		"SOCKS4",	"OPENSSL",
-	"PROCESS",	"APPL",		"HTTP",		"SOCKS5"
+	"PROCESS",	"APPL",		"HTTP",		"SOCKS5", "SCTP"
 } ;
 
 
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xio-ip.c socat-2.0.0-b1-sctp/xio-ip.c
--- socat-2.0.0-b1/xio-ip.c	2007-03-15 15:51:29.000000000 -0400
+++ socat-2.0.0-b1-sctp/xio-ip.c	2008-03-28 14:08:25.000000000 -0400
@@ -123,7 +123,9 @@
 #else /* HAVE_GETIPNODEBYNAME || nothing */
    struct hostent *host;
 #endif
+#if defined HAVE_GETIPNODEBYNAME || defined HAVE_GETADDRINFO
    int error_num;
+#endif
 
 #if HAVE_RESOLV_H
    if (res_opts0 | res_opts1) {
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xiomodes.h socat-2.0.0-b1-sctp/xiomodes.h
--- socat-2.0.0-b1/xiomodes.h	2007-05-11 14:05:57.000000000 -0400
+++ socat-2.0.0-b1-sctp/xiomodes.h	2008-03-28 12:53:32.000000000 -0400
@@ -27,6 +27,7 @@
 #include "xio-ip6.h"
 #include "xio-ipapp.h"
 #include "xio-tcp.h"
+#include "xio-sctp.h"
 #include "xio-udp.h"
 #include "xio-socks.h"
 #include "xio-socks5.h"
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xioopen.c socat-2.0.0-b1-sctp/xioopen.c
--- socat-2.0.0-b1/xioopen.c	2007-06-01 01:57:42.000000000 -0400
+++ socat-2.0.0-b1-sctp/xioopen.c	2008-03-28 13:58:29.000000000 -0400
@@ -154,6 +154,22 @@
 #if WITH_READLINE
    { "readline",	xioaddrs_readline },
 #endif
+#if (WITH_IP4 || WITH_IP6) && WITH_SCTP
+  { "sctp",    xioaddrs_sctp_connect },
+  { "sctp-connect",  xioaddrs_sctp_connect },
+#endif
+#if (WITH_IP4 || WITH_IP6) && WITH_SCTP && WITH_LISTEN
+  { "sctp-l",    xioaddrs_sctp_listen },
+  { "sctp-listen",  xioaddrs_sctp_listen },
+#endif
+#if WITH_IP4 && WITH_SCTP
+  { "sctp4",    xioaddrs_sctp4_connect },
+  { "sctp4-connect",  xioaddrs_sctp4_connect },
+#endif
+#if WITH_IP4 && WITH_SCTP && WITH_LISTEN
+  { "sctp4-l",    xioaddrs_sctp4_listen },
+  { "sctp4-listen",  xioaddrs_sctp4_listen },
+#endif
 #if WITH_SOCKS4
    { "socks",		xioaddrs_socks4_connect },
    { "socks-client",	xioaddrs_socks4_connect },
@@ -366,7 +382,7 @@
    const char *addrs;
    xiosingle_t *sfdA;	/* what we just parse(d) */
    xiosingle_t *sfdB;	/* what we just parse(d) - second part of dual */
-   int newpipesep = 1;	/* dual address: 1%0 instead of 0!!1 */
+  //int newpipesep = 1;  /* dual address: 1%0 instead of 0!!1 */
    int reverseA, reverseB=0;
    bool currentisendpoint = false;
    int mayleftA, mayrightA,  mayleftB, mayrightB;
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xioopts.c socat-2.0.0-b1-sctp/xioopts.c
--- socat-2.0.0-b1/xioopts.c	2007-05-24 00:36:05.000000000 -0400
+++ socat-2.0.0-b1-sctp/xioopts.c	2008-03-28 14:28:37.000000000 -0400
@@ -12,6 +12,8 @@
 #include "xiolockfile.h"
 #include "nestlex.h"
 
+#include <stdlib.h>
+
 bool xioopts_ignoregroups;
 
 #define IF_ANY(a,b) {a,b},
@@ -2037,7 +2039,8 @@
 #if WITH_IP4
       case TYPE_IP4NAME:
 	 {
-	    struct sockaddr_in sa;  size_t salen = sizeof(sa);
+	    struct sockaddr_in sa;  
+      socklen_t salen = sizeof(sa);
 	    const char *ends[] = { NULL };
 	    const char *nests[] = { "[","]", NULL };
 	    char buff[512], *buffp=buff; size_t bufspc = sizeof(buff)-1;
@@ -3553,9 +3556,9 @@
 mc:addr
 */
 	       union sockaddr_union sockaddr1;
-	       size_t socklen1 = sizeof(sockaddr1.ip4);
+	       socklen_t socklen1 = sizeof(sockaddr1.ip4);
 	       union sockaddr_union sockaddr2;
-	       size_t socklen2 = sizeof(sockaddr2.ip4);
+	       socklen_t socklen2 = sizeof(sockaddr2.ip4);
 
 	       /* first parameter is alway multicast address */
 	       /*! result */
@@ -3651,7 +3654,7 @@
 	    {
 	       struct ipv6_mreq ip6_mreq = {{{{0}}}};
 	       union sockaddr_union sockaddr1;
-	       size_t socklen1 = sizeof(sockaddr1.ip6);
+	       socklen_t socklen1 = sizeof(sockaddr1.ip6);
 
 	       /* always two parameters */
 	       /* first parameter is multicast address */
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xioopts.h socat-2.0.0-b1-sctp/xioopts.h
--- socat-2.0.0-b1/xioopts.h	2007-05-04 15:55:03.000000000 -0400
+++ socat-2.0.0-b1-sctp/xioopts.h	2008-03-28 14:12:07.000000000 -0400
@@ -138,7 +138,8 @@
 
 #define GROUP_IP_UDP	0x01000000
 #define GROUP_IP_TCP	0x02000000
-#define GROUP_IPAPP	(GROUP_IP_UDP|GROUP_IP_TCP)	/* true: indicates one of UDP, TCP */
+#define GROUP_IP_SCTP	0x100000000
+#define GROUP_IPAPP	(GROUP_IP_UDP|GROUP_IP_TCP|GROUP_IP_SCTP)	/* true: indicates one of UDP, TCP */
 #define GROUP_IP_SOCKS4	0x04000000
 #define GROUP_OPENSSL	0x08000000
 
@@ -815,7 +816,7 @@
    const char *defname;		/* default name */
    const char *nickname;	/* usual name */
    enum e_optcode optcode;	/* short form of option name */
-   unsigned int group;
+   unsigned long long group;
    enum e_phase phase;		/* when this option is to be used */
    enum e_types type;	/* the data type as expected on input, and stored */
    enum e_func  func;	/* which function can apply this option, e.g. ioctl(),
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xio-process.c socat-2.0.0-b1-sctp/xio-process.c
--- socat-2.0.0-b1/xio-process.c	2003-05-21 01:16:38.000000000 -0400
+++ socat-2.0.0-b1-sctp/xio-process.c	2008-03-17 10:48:30.000000000 -0400
@@ -8,6 +8,7 @@
 #include "xioopen.h"
 
 #include "xio-process.h"
+#undef setenv
 
 /****** process related options ******/
 const struct optdesc opt_setgid_early= { "setgid-early",NULL,  OPT_SETGID_EARLY,GROUP_PROCESS, PH_EARLY,   TYPE_GIDT, OFUNC_SPEC };
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xio-progcall.c socat-2.0.0-b1-sctp/xio-progcall.c
--- socat-2.0.0-b1/xio-progcall.c	2007-05-20 14:09:55.000000000 -0400
+++ socat-2.0.0-b1-sctp/xio-progcall.c	2008-03-17 10:48:47.000000000 -0400
@@ -10,6 +10,7 @@
 
 #include "xio-process.h"
 #include "xio-progcall.h"
+#undef setenv
 
 /* these options are used by address pty too */
 #if HAVE_OPENPTY
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xio-readline.c socat-2.0.0-b1-sctp/xio-readline.c
--- socat-2.0.0-b1/xio-readline.c	2007-05-13 05:03:40.000000000 -0400
+++ socat-2.0.0-b1-sctp/xio-readline.c	2008-03-17 10:51:19.000000000 -0400
@@ -9,6 +9,8 @@
 
 #include "xio-termios.h"
 #include "xio-readline.h"
+       #include <sys/types.h>
+       #include <regex.h>
 
 
 #if WITH_READLINE
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xio-sctp.c socat-2.0.0-b1-sctp/xio-sctp.c
--- socat-2.0.0-b1/xio-sctp.c	1969-12-31 19:00:00.000000000 -0500
+++ socat-2.0.0-b1-sctp/xio-sctp.c	2008-03-28 13:53:38.000000000 -0400
@@ -0,0 +1,42 @@
+/* $Id: xio-tcp.c,v 1.24.2.1 2006/07/24 19:18:39 gerhard Exp $ */
+/* Copyright Gerhard Rieger 2001-2007 */
+/* Published under the GNU General Public License V.2, see file COPYING */
+
+/* this file contains the source for TCP related functions and options */
+
+#include "xiosysincludes.h"
+
+#if WITH_SCTP
+
+#include "xioopen.h"
+#include "xio-listen.h"
+#include "xio-ip4.h"
+#include "xio-ipapp.h"
+
+/****** TCP addresses ******/
+
+#if WITH_IP4 || WITH_IP6
+static const struct xioaddr_endpoint_desc xioendpoint_sctp_connect2 = { XIOADDR_SYS, "sctp-connect", 2, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_SCTP|GROUP_CHILD|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_ipapp_connect, SOCK_STREAM, IPPROTO_SCTP, PF_UNSPEC HELP(":<host>:<port>") };
+const union xioaddr_desc *xioaddrs_sctp_connect[] =  { (union xioaddr_desc *)&xioendpoint_sctp_connect2, NULL };
+#if WITH_LISTEN
+static const struct xioaddr_endpoint_desc xioendpoint_sctp_listen1  = { XIOADDR_SYS, "sctp-listen",  1, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_SOCK_IP6|GROUP_IP_SCTP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_ipapp_listen,  SOCK_STREAM, IPPROTO_SCTP, PF_UNSPEC HELP(":<port>") };
+const union xioaddr_desc *xioaddrs_sctp_listen[] =   { (union xioaddr_desc *)&xioendpoint_sctp_listen1, NULL };
+#endif
+#endif
+
+#if WITH_IP4
+static const struct xioaddr_endpoint_desc xioendpoint_sctp4_connect2 = { XIOADDR_SYS, "sctp4-connect", 2, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_SCTP|GROUP_CHILD|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_ipapp_connect, SOCK_STREAM, IPPROTO_SCTP, PF_INET HELP(":<host>:<port>") };
+const union xioaddr_desc *xioaddrs_sctp4_connect[] = { (union xioaddr_desc *)&xioendpoint_sctp4_connect2, NULL };
+#if WITH_LISTEN
+static const struct xioaddr_endpoint_desc xioendpoint_sctp4_listen1  = { XIOADDR_SYS, "sctp4-listen",  1, XIOBIT_ALL, GROUP_FD|GROUP_SOCKET|GROUP_SOCK_IP4|GROUP_IP_SCTP|GROUP_LISTEN|GROUP_CHILD|GROUP_RANGE|GROUP_RETRY, XIOSHUT_DOWN, XIOCLOSE_CLOSE, xioopen_ipapp_listen, SOCK_STREAM, IPPROTO_SCTP, PF_INET HELP(":<port>") };
+const union xioaddr_desc *xioaddrs_sctp4_listen[] =  { (union xioaddr_desc *)&xioendpoint_sctp4_listen1, NULL };
+#endif
+#endif /* WITH_IP4 */
+
+#if 0
+#ifdef TCP_NODELAY
+const struct optdesc opt_sctp_nodelay = { "sctp-nodelay",   "nodelay", OPT_SCTP_NODELAY, GROUP_IP_SCTP, PH_PASTSOCKET, TYPE_INT,	OFUNC_SOCKOPT, SOL_TCP, TCP_NODELAY };
+#endif
+#endif
+
+#endif /* WITH_TCP */
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xio-sctp.h socat-2.0.0-b1-sctp/xio-sctp.h
--- socat-2.0.0-b1/xio-sctp.h	1969-12-31 19:00:00.000000000 -0500
+++ socat-2.0.0-b1-sctp/xio-sctp.h	2008-03-28 12:53:03.000000000 -0400
@@ -0,0 +1,15 @@
+/* $Id: xio-tcp.h,v 1.12.2.1 2006/07/24 19:18:42 gerhard Exp $ */
+/* Copyright Gerhard Rieger 2001-2007 */
+/* Published under the GNU General Public License V.2, see file COPYING */
+
+#ifndef __xio_sctp_h_included
+#define __xio_sctp_h_included 1
+
+extern const union xioaddr_desc *xioaddrs_sctp_connect[];
+extern const union xioaddr_desc *xioaddrs_sctp_listen[];
+extern const union xioaddr_desc *xioaddrs_sctp4_connect[];
+extern const union xioaddr_desc *xioaddrs_sctp4_listen[];
+extern const union xioaddr_desc *xioaddrs_sctp6_connect[];
+extern const union xioaddr_desc *xioaddrs_sctp6_listen[];
+
+#endif /* !defined(__xio_tcp_h_included) */
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xioshutdown.c socat-2.0.0-b1-sctp/xioshutdown.c
--- socat-2.0.0-b1/xioshutdown.c	2007-05-13 05:04:04.000000000 -0400
+++ socat-2.0.0-b1-sctp/xioshutdown.c	2008-03-28 14:03:48.000000000 -0400
@@ -196,7 +196,6 @@
    shutting down the connection to give process some time to flush its output
    data */
 static int xioshut_sleep_kill(pid_t sub, unsigned long usec, int sig) {
-   struct sigaction act;
    int status = 0;
 
    /* we wait for the child process to die, but to prevent timeout
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xiosigchld.c socat-2.0.0-b1-sctp/xiosigchld.c
--- socat-2.0.0-b1/xiosigchld.c	2007-05-31 15:39:12.000000000 -0400
+++ socat-2.0.0-b1-sctp/xiosigchld.c	2008-03-28 14:03:25.000000000 -0400
@@ -94,7 +94,9 @@
    int _errno;
    int status = 0;
    bool wassig = false;
+#if 0
    int i;
+#endif
    struct _xiosigchld_child *entry;
 
    _errno = errno;	/* save current value; e.g., select() on Cygwin seems
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xio-socket.c socat-2.0.0-b1-sctp/xio-socket.c
--- socat-2.0.0-b1/xio-socket.c	2007-03-13 18:07:50.000000000 -0400
+++ socat-2.0.0-b1-sctp/xio-socket.c	2008-03-28 14:06:57.000000000 -0400
@@ -565,7 +565,7 @@
 	 |SA_NOMASK
 #endif
 	 ;
-      act.sa_handler = childdied;
+      act.sa_sigaction = childdied;
       if (Sigaction(SIGCHLD, &act, NULL) < 0) {
 	 /*! man does not say that errno is defined */
 	 Warn2("sigaction(SIGCHLD, %p, NULL): %s", childdied, strerror(errno));
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xiosocketpair.c socat-2.0.0-b1-sctp/xiosocketpair.c
--- socat-2.0.0-b1/xiosocketpair.c	2007-03-25 06:38:42.000000000 -0400
+++ socat-2.0.0-b1-sctp/xiosocketpair.c	2008-03-28 14:04:42.000000000 -0400
@@ -26,7 +26,6 @@
 int xiosocketpair(xiofile_t **xfd1p, xiofile_t **xfd2p, int how, ...) {
    va_list ap;
    xiofile_t *xfd1, *xfd2;
-   int result = 0;
 
    if ((xfd1 = xioallocfd()) == NULL) {
       return -1;
diff -Naurw --exclude='*.o' --exclude='*~' --exclude='config.*' --exclude=filan --exclude='*.a' --exclude=Makefile --exclude=procan --exclude=socat --exclude=user_keys.spec socat-2.0.0-b1/xio-socks5.c socat-2.0.0-b1-sctp/xio-socks5.c
--- socat-2.0.0-b1/xio-socks5.c	2007-05-12 15:43:00.000000000 -0400
+++ socat-2.0.0-b1-sctp/xio-socks5.c	2008-03-28 14:13:13.000000000 -0400
@@ -296,7 +296,7 @@
 		targetname);
       }
       sendrequest->destaddr[0] = strlen(targetname);
-      strncpy(sendrequest->destaddr+1, targetname, sizeof(sendbuff)-5);
+      strncpy((char *)sendrequest->destaddr+1, targetname, sizeof(sendbuff)-5);
       break;
    case SOCKS5_ADDRTYPE_IPV6:
       break;
@@ -431,10 +431,10 @@
    pos = sendbuff;
    *pos++ = SOCKS5_USERPASS_VERSION;
    *pos++ = strlen(username);
-   strncpy(pos, username, 255);
+   strncpy((char *)pos, username, 255);
    pos += strlen(username);
    *pos++ = strlen(password);
-   strncpy(pos, password, 255);
+   strncpy((char *)pos, password, 255);
    pos += strlen(password);
 
    result =
