kernel: Remove our ancient SCTP support.
authorSascha Wildner <saw@online.de>
Wed, 7 Jan 2015 04:02:23 +0000 (05:02 +0100)
committerSascha Wildner <saw@online.de>
Wed, 7 Jan 2015 04:02:44 +0000 (05:02 +0100)
It was based on an early stage of FreeBSD's support and never got
beyond that point, due to lack of usage and lack of maintenance.

It is also kind of standing the the way of ongoing work in the
IPv6 stack by sephe.

If anyone ever wants to start again on upgrading and maintaining it,
they can decide then if reverting this commit again makes sense as a
base.

Requested-by: sephe
Approved-by: dillon
62 files changed:
Makefile_upgrade.inc
UPDATING
lib/Makefile
lib/libc/net/Symbol.map
lib/libsctp/Makefile [deleted file]
lib/libsctp/sctp_sys_calls.c [deleted file]
share/mk/bsd.libnames.mk
sys/conf/files
sys/conf/options
sys/config/LINT
sys/config/LINT64
sys/dev/netif/oce/oce_if.h
sys/dev/virtual/virtio/net/if_vtnet.c
sys/kern/init_sysent.c
sys/kern/syscalls.c
sys/kern/syscalls.master
sys/kern/uipc_socket.c
sys/kern/uipc_syscalls.c
sys/net/lagg/if_lagg.c
sys/net/rtsock.c
sys/netinet/in.h
sys/netinet/in_proto.c
sys/netinet/sctp.h [deleted file]
sys/netinet/sctp_asconf.c [deleted file]
sys/netinet/sctp_asconf.h [deleted file]
sys/netinet/sctp_callout.h [deleted file]
sys/netinet/sctp_constants.h [deleted file]
sys/netinet/sctp_crc32.c [deleted file]
sys/netinet/sctp_crc32.h [deleted file]
sys/netinet/sctp_hashdriver.c [deleted file]
sys/netinet/sctp_hashdriver.h [deleted file]
sys/netinet/sctp_header.h [deleted file]
sys/netinet/sctp_indata.c [deleted file]
sys/netinet/sctp_indata.h [deleted file]
sys/netinet/sctp_input.c [deleted file]
sys/netinet/sctp_input.h [deleted file]
sys/netinet/sctp_output.c [deleted file]
sys/netinet/sctp_output.h [deleted file]
sys/netinet/sctp_pcb.c [deleted file]
sys/netinet/sctp_pcb.h [deleted file]
sys/netinet/sctp_peeloff.c [deleted file]
sys/netinet/sctp_peeloff.h [deleted file]
sys/netinet/sctp_sha1.c [deleted file]
sys/netinet/sctp_sha1.h [deleted file]
sys/netinet/sctp_structs.h [deleted file]
sys/netinet/sctp_timer.c [deleted file]
sys/netinet/sctp_timer.h [deleted file]
sys/netinet/sctp_uio.h [deleted file]
sys/netinet/sctp_usrreq.c [deleted file]
sys/netinet/sctp_var.h [deleted file]
sys/netinet/sctputil.c [deleted file]
sys/netinet/sctputil.h [deleted file]
sys/netinet6/sctp6_usrreq.c [deleted file]
sys/netinet6/sctp6_var.h [deleted file]
sys/sys/mbuf.h
sys/sys/param.h
sys/sys/protosw.h
sys/sys/socket.h
sys/sys/syscall.h
sys/sys/syscall.mk
sys/sys/sysproto.h
sys/sys/sysunion.h

index 6e1bea0..768e086 100644 (file)
@@ -2747,6 +2747,29 @@ TO_REMOVE+=/usr/share/man/man4/uscanner.4.gz
 TO_REMOVE+=/usr/share/man/cat4/uticom.4.gz
 TO_REMOVE+=/usr/share/man/man4/uticom.4.gz
 TO_REMOVE+=/usr/include/netinet6/in6_prefix.h
+TO_REMOVE+=/usr/include/netinet/sctp.h
+TO_REMOVE+=/usr/include/netinet/sctp_asconf.h
+TO_REMOVE+=/usr/include/netinet/sctp_callout.h
+TO_REMOVE+=/usr/include/netinet/sctp_constants.h
+TO_REMOVE+=/usr/include/netinet/sctp_crc32.h
+TO_REMOVE+=/usr/include/netinet/sctp_hashdriver.h
+TO_REMOVE+=/usr/include/netinet/sctp_header.h
+TO_REMOVE+=/usr/include/netinet/sctp_indata.h
+TO_REMOVE+=/usr/include/netinet/sctp_input.h
+TO_REMOVE+=/usr/include/netinet/sctp_output.h
+TO_REMOVE+=/usr/include/netinet/sctp_pcb.h
+TO_REMOVE+=/usr/include/netinet/sctp_peeloff.h
+TO_REMOVE+=/usr/include/netinet/sctp_sha1.h
+TO_REMOVE+=/usr/include/netinet/sctp_structs.h
+TO_REMOVE+=/usr/include/netinet/sctp_timer.h
+TO_REMOVE+=/usr/include/netinet/sctp_uio.h
+TO_REMOVE+=/usr/include/netinet/sctp_var.h
+TO_REMOVE+=/usr/include/netinet/sctputil.h
+TO_REMOVE+=/usr/include/netinet6/sctp6_var.h
+TO_REMOVE+=/usr/lib/libsctp.a
+TO_REMOVE+=/usr/lib/libsctp.so
+TO_REMOVE+=/usr/lib/libsctp.so.3
+TO_REMOVE+=/usr/lib/profile/libsctp.a
 
 .if ${MACHINE_ARCH} == "x86_64"
 TO_REMOVE+=/usr/sbin/stlstats
index afc6e53..5948f36 100644 (file)
--- a/UPDATING
+++ b/UPDATING
 +         UPGRADING DRAGONFLY FROM 4.0 TO LATER VERSIONS                +
 +-----------------------------------------------------------------------+
 
+SCTP SUPPORT DROPPED
+--------------------
+
+Support for the SCTP protocol has been removed.
+
 OLD USB DRIVERS REMOVED
 -----------------------
 
index c1eb649..34e5bfe 100644 (file)
@@ -75,7 +75,6 @@ SUBDIR=       ${SUBDIR_ORDERED} \
        librefuse \
        librpcsvc \
        librt \
-       libsctp \
        libsdp \
        ${_libsm} \
        libsmb \
index 144c834..3a76b5f 100644 (file)
@@ -106,7 +106,6 @@ DF402.0 {
     rresvport;
     rresvport_af;
     ruserok;
-    sctp_peeloff;
     send;
     sethostent;
     setnetent;
diff --git a/lib/libsctp/Makefile b/lib/libsctp/Makefile
deleted file mode 100644 (file)
index 2bb5294..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-LIB=   sctp
-SRCS=  sctp_sys_calls.c
-WARNS?=        3
-
-.include <bsd.lib.mk>
diff --git a/lib/libsctp/sctp_sys_calls.c b/lib/libsctp/sctp_sys_calls.c
deleted file mode 100644 (file)
index eac6d3a..0000000
+++ /dev/null
@@ -1,658 +0,0 @@
-/*     $KAME: sctp_sys_calls.c,v 1.9 2004/08/17 06:08:53 itojun Exp $ */
-
-/*
- * Copyright (C) 2002, 2003, 2004 Cisco Systems Inc,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/errno.h>
-#include <sys/syscall.h>
-#include <sys/uio.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <netinet/sctp_uio.h>
-#include <netinet/sctp.h>
-#include <netinet/sctp_constants.h>
-
-#include <net/if_dl.h>
-
-#ifndef IN6_IS_ADDR_V4MAPPED
-#define IN6_IS_ADDR_V4MAPPED(a)                     \
-       ((*(const u_int32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
-        (*(const u_int32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
-        (*(const u_int32_t *)(const void *)(&(a)->s6_addr[8]) == ntohl(0x0000ffff)))
-#endif
-
-
-#ifdef SCTP_DEBUG_PRINT_ADDRESS
-static void
-SCTPPrintAnAddress(struct sockaddr *a)
-{
-       char stringToPrint[256];
-       u_short prt;
-       char *srcaddr, *txt;
-
-       if (a == NULL) {
-               printf("NULL\n");
-               return;
-       }
-       if (a->sa_family == AF_INET) {
-               srcaddr = (char *)&((struct sockaddr_in *)a)->sin_addr;
-               txt = "IPv4 Address: ";
-               prt = ntohs(((struct sockaddr_in *)a)->sin_port);
-       } else if (a->sa_family == AF_INET6) {
-               srcaddr = (char *)&((struct sockaddr_in6 *)a)->sin6_addr;
-               prt = ntohs(((struct sockaddr_in6 *)a)->sin6_port);
-               txt = "IPv6 Address: ";
-       } else if (a->sa_family == AF_LINK) {
-               int i;
-               char tbuf[200];
-               u_char adbuf[200];
-               struct sockaddr_dl *dl;
-
-               dl = (struct sockaddr_dl *)a;
-               strncpy(tbuf, dl->sdl_data, dl->sdl_nlen);
-               tbuf[dl->sdl_nlen] = 0;
-               printf("Intf:%s (len:%d)Interface index:%d type:%x(%d) ll-len:%d ",
-                   tbuf, dl->sdl_nlen, dl->sdl_index, dl->sdl_type,
-                   dl->sdl_type, dl->sdl_alen);
-               memcpy(adbuf, LLADDR(dl), dl->sdl_alen);
-               for (i = 0; i < dl->sdl_alen; i++){
-                       printf("%2.2x", adbuf[i]);
-                       if (i < (dl->sdl_alen - 1))
-                               printf(":");
-               }
-               printf("\n");
-       /*      u_short sdl_route[16];*/        /* source routing information */
-               return;
-       } else {
-               return;
-       }
-       if (inet_ntop(a->sa_family, srcaddr, stringToPrint,
-           sizeof(stringToPrint))) {
-               if (a->sa_family == AF_INET6) {
-                       printf("%s%s:%d scope:%d\n", txt, stringToPrint, prt,
-                           ((struct sockaddr_in6 *)a)->sin6_scope_id);
-               } else {
-                       printf("%s%s:%d\n", txt, stringToPrint, prt);
-               }
-
-       } else {
-               printf("%s unprintable?\n", txt);
-       }
-}
-#endif /* SCTP_DEBUG_PRINT_ADDRESS */
-
-static void
-in6_sin6_2_sin(struct sockaddr_in *sin, struct sockaddr_in6 *sin6)
-{
-       bzero(sin, sizeof(*sin));
-       sin->sin_len = sizeof(struct sockaddr_in);
-       sin->sin_family = AF_INET;
-       sin->sin_port = sin6->sin6_port;
-       sin->sin_addr.s_addr = sin6->sin6_addr.__u6_addr.__u6_addr32[3];
-}
-
-int
-sctp_connectx(int sd, struct sockaddr *addrs, int addrcnt)
-{
-       char buf[2048];
-       int i, ret, cnt, *aa;
-       char *cpto;
-       struct sockaddr *at;
-       size_t len = sizeof(int);
-       
-       at = addrs;
-       cnt = 0;
-       cpto = ((caddr_t)buf + sizeof(int));
-       /* validate all the addresses and get the size */
-       for (i = 0; i < addrcnt; i++) {
-               if (at->sa_family == AF_INET) {
-                       memcpy(cpto, at, at->sa_len);
-                       cpto = ((caddr_t)cpto + at->sa_len);
-                       len += at->sa_len;
-               } else if (at->sa_family == AF_INET6){
-                       if (IN6_IS_ADDR_V4MAPPED(&((struct sockaddr_in6 *)at)->sin6_addr)){
-                               len += sizeof(struct sockaddr_in);
-                               in6_sin6_2_sin((struct sockaddr_in *)cpto,
-                                   (struct sockaddr_in6 *)at);
-                               cpto = ((caddr_t)cpto + sizeof(struct sockaddr_in));
-                               len += sizeof(struct sockaddr_in);
-                       } else {
-                               memcpy(cpto, at, at->sa_len);
-                               cpto = ((caddr_t)cpto + at->sa_len);
-                               len += at->sa_len;
-                       }
-               } else {
-                       errno = EINVAL;
-                       return (-1);
-               }
-               if (len > (sizeof(buf)-sizeof(int))) {
-                       /* Never enough memory */
-                       return(E2BIG);
-               }
-               at = (struct sockaddr *)((caddr_t)at + at->sa_len);
-               cnt++;
-        }
-       /* do we have any? */
-       if (cnt == 0) {
-               errno = EINVAL;
-               return(-1);
-       }
-       aa = (int *)buf;
-       *aa = cnt;
-       ret = setsockopt(sd, IPPROTO_SCTP, SCTP_CONNECT_X, (void *)buf,
-           (unsigned int)len);
-       return (ret);
-}
-
-int
-sctp_bindx(int sd, struct sockaddr *addrs, int addrcnt, int flags)
-{
-       struct sctp_getaddresses *gaddrs;
-       struct sockaddr *sa;
-       int i, sz, fam, argsz;
-
-       if ((flags != SCTP_BINDX_ADD_ADDR) && 
-           (flags != SCTP_BINDX_REM_ADDR)) {
-               errno = EFAULT;
-               return(-1);
-       }
-       argsz = (sizeof(struct sockaddr_storage) +
-           sizeof(struct sctp_getaddresses));
-       gaddrs = (struct sctp_getaddresses *)calloc(1, argsz);
-       if (gaddrs == NULL) {
-               errno = ENOMEM;
-               return(-1);
-       }
-       gaddrs->sget_assoc_id = 0;
-       sa = addrs;
-       for (i = 0; i < addrcnt; i++) {
-               sz = sa->sa_len;
-               fam = sa->sa_family;
-               ((struct sockaddr_in *)&addrs[i])->sin_port = ((struct sockaddr_in *)sa)->sin_port;
-               if ((fam != AF_INET) && (fam != AF_INET6)) {
-                       errno = EINVAL;
-                       return(-1);
-               }
-               memcpy(gaddrs->addr, sa, sz);
-               if (setsockopt(sd, IPPROTO_SCTP, flags, gaddrs,
-                   (unsigned int)argsz) != 0) {
-                       free(gaddrs);
-                       return(-1);
-               }
-               memset(gaddrs, 0, argsz);
-               sa = (struct sockaddr *)((caddr_t)sa + sz);
-       }
-       free(gaddrs);
-       return(0);
-}
-
-
-int
-sctp_opt_info(int sd, sctp_assoc_t id, int opt, void *arg, size_t *size)
-{
-       if ((opt == SCTP_RTOINFO) || 
-           (opt == SCTP_ASSOCINFO) || 
-           (opt == SCTP_PRIMARY_ADDR) || 
-           (opt == SCTP_SET_PEER_PRIMARY_ADDR) || 
-           (opt == SCTP_PEER_ADDR_PARAMS) || 
-           (opt == SCTP_STATUS) || 
-           (opt == SCTP_GET_PEER_ADDR_INFO)) { 
-               *(sctp_assoc_t *)arg = id;
-               return(getsockopt(sd, IPPROTO_SCTP, opt, arg, (int *)size));
-       } else {
-               errno = EOPNOTSUPP;
-               return(-1);
-       }
-}
-
-int
-sctp_getpaddrs(int sd, sctp_assoc_t id, struct sockaddr **raddrs)
-{
-       struct sctp_getaddresses *addrs;
-       struct sockaddr *sa;
-       struct sockaddr *re;
-       sctp_assoc_t asoc;
-       caddr_t lim;
-       unsigned int siz;
-       int cnt;
-
-       if (raddrs == NULL) {
-               errno = EFAULT;
-               return(-1);
-       }
-       asoc = id;
-       siz = sizeof(sctp_assoc_t);  
-       if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_REMOTE_ADDR_SIZE,
-           &asoc, &siz) != 0) {
-               return(-1);
-       }
-       siz = (unsigned int)(uintptr_t)asoc;
-       siz += sizeof(struct sctp_getaddresses);
-       addrs = calloc((unsigned long)1, (unsigned long)siz);
-       if (addrs == NULL) {
-               errno = ENOMEM;
-               return(-1);
-       }
-       memset(addrs, 0, (size_t)siz);
-       addrs->sget_assoc_id = id;
-       /* Now lets get the array of addresses */
-       if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_PEER_ADDRESSES,
-           addrs, &siz) != 0) {
-               free(addrs);
-               return(-1);
-       }
-       re = (struct sockaddr *)&addrs->addr[0];
-       *raddrs = re;
-       cnt = 0;
-       sa = (struct sockaddr *)&addrs->addr[0];
-       lim = (caddr_t)addrs + siz;
-       while ((caddr_t)sa < lim) {
-               cnt++;
-               sa = (struct sockaddr *)((caddr_t)sa + sa->sa_len);
-               if (sa->sa_len == 0)
-                       break;
-       }
-       return(cnt);
-}
-
-void sctp_freepaddrs(struct sockaddr *addrs)
-{
-       /* Take away the hidden association id */
-       void *fr_addr;
-       fr_addr = (void *)((caddr_t)addrs - sizeof(sctp_assoc_t));
-       /* Now free it */
-       free(fr_addr);
-}
-
-int
-sctp_getladdrs (int sd, sctp_assoc_t id, struct sockaddr **raddrs)
-{
-       struct sctp_getaddresses *addrs;
-       struct sockaddr *re;
-       caddr_t lim;
-       struct sockaddr *sa;
-       int size_of_addresses;
-       unsigned int siz;
-       int cnt;
-
-       if (raddrs == NULL) {
-               errno = EFAULT;
-               return(-1);
-       }
-       size_of_addresses = 0;
-       siz = sizeof(int);  
-       if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_LOCAL_ADDR_SIZE,
-           &size_of_addresses, &siz) != 0) {
-               return(-1);
-       }
-       if (size_of_addresses == 0) {
-               errno = ENOTCONN;
-               return(-1);
-       }
-       siz = size_of_addresses + sizeof(struct sockaddr_storage);
-       siz += sizeof(struct sctp_getaddresses);
-       addrs = calloc((unsigned long)1, (unsigned long)siz);
-       if (addrs == NULL) {
-               errno = ENOMEM;
-               return(-1);
-       }
-       memset(addrs, 0, (size_t)siz);
-       addrs->sget_assoc_id = id;
-       /* Now lets get the array of addresses */
-       if (getsockopt(sd, IPPROTO_SCTP, SCTP_GET_LOCAL_ADDRESSES, addrs,
-           &siz) != 0) {
-               free(addrs);
-               return(-1);
-       }
-       re = (struct sockaddr *)&addrs->addr[0];
-       *raddrs = re;
-       cnt = 0;
-       sa = (struct sockaddr *)&addrs->addr[0];
-       lim = (caddr_t)addrs + siz;
-       while ((caddr_t)sa < lim) {
-               cnt++;
-               sa = (struct sockaddr *)((caddr_t)sa + sa->sa_len);
-               if (sa->sa_len == 0)
-                       break;
-       }
-       return(cnt);
-}
-
-void sctp_freeladdrs(struct sockaddr *addrs)
-{
-       /* Take away the hidden association id */
-       void *fr_addr;
-       fr_addr = (void *)((caddr_t)addrs - sizeof(sctp_assoc_t));
-       /* Now free it */
-       free(fr_addr);
-}
-
-
-ssize_t
-sctp_sendmsg(int s, 
-            const void *data, 
-            size_t len,
-            const struct sockaddr *to,
-            socklen_t tolen __attribute__((unused)),
-            u_int32_t ppid,
-            u_int32_t flags,
-            u_int16_t stream_no,
-            u_int32_t timetolive,
-            u_int32_t context)
-{
-       ssize_t sz;
-       struct msghdr msg;
-       struct iovec iov[2];
-       char controlVector[256];
-       struct sctp_sndrcvinfo *s_info;
-       struct cmsghdr *cmsg;
-       struct sockaddr *who=NULL;
-       union {
-               struct sockaddr_in in;
-               struct sockaddr_in6 in6;
-       } addr;
-
-#if 0
-       fprintf(io, "sctp_sendmsg(sd:%d, data:%x, len:%d, to:%x, tolen:%d, ppid:%x, flags:%x str:%d ttl:%d ctx:%x\n",
-           s, (u_int)data, (int)len, (u_int)to, (int)tolen, ppid, flags,
-           (int)stream_no, (int)timetolive, (u_int)context);
-       fflush(io);
-#endif
-       if (to) {
-               if (to->sa_len == 0) {
-                       /*
-                        * For the lazy app, that did not
-                        * set sa_len, we attempt to set for them.
-                        */
-                       if (to->sa_family == AF_INET){
-                               memcpy(&addr, to, sizeof(struct sockaddr_in));
-                               addr.in.sin_len = sizeof(struct sockaddr_in);
-                       } else if (to->sa_family == AF_INET6){
-                               memcpy(&addr, to, sizeof(struct sockaddr_in6));
-                               addr.in6.sin6_len = sizeof(struct sockaddr_in6);
-                       }
-               } else {
-                       memcpy (&addr, to, to->sa_len);
-               }
-               who = (struct sockaddr *)&addr;
-       }
-       iov[0].iov_base = (char *)data;
-       iov[0].iov_len = len;
-       iov[1].iov_base = NULL;
-       iov[1].iov_len = 0;
-
-       if (to) {
-               msg.msg_name = (caddr_t)who;
-               msg.msg_namelen = who->sa_len;
-       } else {
-               msg.msg_name = NULL;
-               msg.msg_namelen = 0;
-       }
-       msg.msg_iov = iov;
-       msg.msg_iovlen = 1;
-       msg.msg_control = (caddr_t)controlVector;
-
-       cmsg = (struct cmsghdr *)controlVector;
-
-       cmsg->cmsg_level = IPPROTO_SCTP;
-       cmsg->cmsg_type = SCTP_SNDRCV;
-       cmsg->cmsg_len = CMSG_LEN (sizeof(struct sctp_sndrcvinfo) );
-       s_info = (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg);
-
-       s_info->sinfo_stream = stream_no;
-       s_info->sinfo_ssn = 0;
-       s_info->sinfo_flags = flags;
-       s_info->sinfo_ppid = ppid;
-       s_info->sinfo_context = context;
-       s_info->sinfo_assoc_id = 0;
-       s_info->sinfo_timetolive = timetolive;
-       errno = 0;
-       msg.msg_controllen = cmsg->cmsg_len;
-       sz = sendmsg(s, &msg, 0);
-       return(sz);
-}
-
-sctp_assoc_t
-sctp_getassocid(int sd, struct sockaddr *sa)
-{
-       struct sctp_paddrparams sp;
-       int siz;
-
-       /* First get the assoc id */
-       siz = sizeof(struct sctp_paddrparams);
-       memset(&sp, 0, sizeof(sp));
-       memcpy((caddr_t)&sp.spp_address, sa, sa->sa_len);
-       errno = 0;
-       if (getsockopt(sd, IPPROTO_SCTP, SCTP_PEER_ADDR_PARAMS, &sp, &siz) != 0)
-               return((sctp_assoc_t)0);
-       /* We depend on the fact that 0 can never be returned */
-       return(sp.spp_assoc_id);
-}
-
-
-
-ssize_t
-sctp_send(int sd, const void *data, size_t len,
-         const struct sctp_sndrcvinfo *sinfo,
-         int flags)
-{
-       ssize_t sz;
-       struct msghdr msg;
-       struct iovec iov[2];
-       struct sctp_sndrcvinfo *s_info;
-       char controlVector[256];
-       struct cmsghdr *cmsg;
-
-       iov[0].iov_base = (char *)data;
-       iov[0].iov_len = len;
-       iov[1].iov_base = NULL;
-       iov[1].iov_len = 0;
-
-       msg.msg_name = 0;
-       msg.msg_namelen = 0;
-       msg.msg_iov = iov;
-       msg.msg_iovlen = 1;
-       msg.msg_control = (caddr_t)controlVector;
-  
-       cmsg = (struct cmsghdr *)controlVector;
-
-       cmsg->cmsg_level = IPPROTO_SCTP;
-       cmsg->cmsg_type = SCTP_SNDRCV;
-       cmsg->cmsg_len = CMSG_LEN (sizeof(struct sctp_sndrcvinfo) );
-       s_info = (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg);
-       /* copy in the data */
-       *s_info = *sinfo;
-       errno = 0;
-       msg.msg_controllen = cmsg->cmsg_len;
-       sz = sendmsg(sd, &msg, flags);
-       return(sz);
-}
-
-
-ssize_t
-sctp_sendx(int sd, const void *msg, size_t len, 
-          struct sockaddr *addrs, int addrcnt,
-          struct sctp_sndrcvinfo *sinfo,
-          int flags)
-{
-       int i, cnt, *aa, saved_errno;
-       ssize_t ret;
-       char *buf;
-       int add_len;
-       struct sockaddr *at;
-       len = sizeof(int);
-       at = addrs;
-       cnt = 0;
-       /* validate all the addresses and get the size */
-       for (i = 0; i < addrcnt; i++) {
-               if (at->sa_family == AF_INET) {
-                       add_len = sizeof(struct sockaddr_in);
-               } else if (at->sa_family == AF_INET6) {
-                       add_len = sizeof(struct sockaddr_in6);
-               } else {
-                       errno = EINVAL;
-                       return (-1);
-               }
-               len += add_len;
-               at = (struct sockaddr *)((caddr_t)at + add_len);
-               cnt++;
-       }
-       /* do we have any? */
-       if (cnt == 0) {
-               errno = EINVAL;
-               return(-1);
-       }
-       if (len > 2048) {
-               /* Never enough memory */
-               errno = E2BIG;
-               return(-1);
-       }
-       buf = malloc(len);
-       if (buf == NULL) {
-               errno = ENOMEM;
-               return(-1);
-       }
-       aa = (int *)buf;
-       *aa = cnt;
-       aa++;
-       memcpy((caddr_t)aa, addrs, (len - sizeof(int)));
-       ret = setsockopt(sd, IPPROTO_SCTP, SCTP_CONNECT_X_DELAYED, (void *)buf,
-           (unsigned int)len);
-
-       free(buf);
-       if (ret != 0) {
-               return(ret);
-       }
-       sinfo->sinfo_assoc_id = sctp_getassocid(sd, addrs);
-       if (sinfo->sinfo_assoc_id == 0) {
-               printf("Huh, can't get associd? TSNH!\n");
-               (void)setsockopt(sd, IPPROTO_SCTP, SCTP_CONNECT_X_COMPLETE, (void *)addrs,
-                                (unsigned int)addrs->sa_len);
-               errno = ENOENT;
-               return (-1);
-       }
-       ret = sctp_send(sd, msg, len, sinfo, flags);
-       saved_errno = errno;
-       (void)setsockopt(sd, IPPROTO_SCTP, SCTP_CONNECT_X_COMPLETE, (void *)addrs,
-                        (unsigned int)addrs->sa_len);
-
-       errno = saved_errno;
-       return (ret);
-}
-
-ssize_t
-sctp_sendmsgx(int sd, 
-             const void *msg, 
-             size_t len,
-             struct sockaddr *addrs,
-             int addrcnt,
-             u_int32_t ppid,
-             u_int32_t flags,
-             u_int16_t stream_no,
-             u_int32_t timetolive,
-             u_int32_t context)
-{
-       struct sctp_sndrcvinfo sinfo;
-    
-       memset((void *) &sinfo, 0, sizeof(struct sctp_sndrcvinfo));
-       sinfo.sinfo_ppid       = ppid;
-       sinfo.sinfo_flags      = flags;
-       sinfo.sinfo_ssn        = stream_no;
-       sinfo.sinfo_timetolive = timetolive;
-       sinfo.sinfo_context    = context;
-       return sctp_sendx(sd, msg, len, addrs, addrcnt, &sinfo, 0);
-}
-
-ssize_t
-sctp_recvmsg (int s, 
-             void *dbuf, 
-             size_t len,
-             struct sockaddr *from,
-             socklen_t *fromlen,
-             struct sctp_sndrcvinfo *sinfo,
-             int *msg_flags)
-{
-       struct sctp_sndrcvinfo *s_info;
-       ssize_t sz;
-       struct msghdr msg;
-       struct iovec iov[2];
-       char controlVector[2048];
-       struct cmsghdr *cmsg;
-       iov[0].iov_base = dbuf;
-       iov[0].iov_len = len;
-       iov[1].iov_base = NULL;
-       iov[1].iov_len = 0;
-       msg.msg_name = (caddr_t)from;
-       msg.msg_namelen = *fromlen;
-       msg.msg_iov = iov;
-       msg.msg_iovlen = 1;
-       msg.msg_control = (caddr_t)controlVector;
-       msg.msg_controllen = sizeof(controlVector);
-       errno = 0;
-       sz = recvmsg(s, &msg, 0);
-
-       s_info = NULL;
-       len = sz;
-       *msg_flags = msg.msg_flags;
-       *fromlen = msg.msg_namelen;
-       if ((msg.msg_controllen) && sinfo) {
-               /* parse through and see if we find
-                * the sctp_sndrcvinfo (if the user wants it).
-                */
-               cmsg = (struct cmsghdr *)controlVector;
-               while (cmsg) {
-                       if (cmsg->cmsg_level == IPPROTO_SCTP) {
-                               if (cmsg->cmsg_type == SCTP_SNDRCV) {
-                                       /* Got it */
-                                       s_info = (struct sctp_sndrcvinfo *)CMSG_DATA(cmsg);
-                                       /* Copy it to the user */
-                                       *sinfo = *s_info;
-                                       break;
-                               }
-                       }
-                       cmsg = CMSG_NXTHDR(&msg, cmsg);
-               }
-       }
-       return(sz);
-}
-
-#ifdef SYS_sctp_peeloff
-int
-sctp_peeloff(int sd, sctp_assoc_t assoc_id)
-{
-       return (syscall(SYS_sctp_peeloff, sd, assoc_id));
-}
-#endif
index efed774..ff6dc11 100644 (file)
@@ -84,7 +84,6 @@ LIBREFUSE?=   ${DESTDIR}${LIBDIR}/librefuse.a
 LIBRPCSVC?=    ${DESTDIR}${LIBDIR}/librpcsvc.a
 LIBRT?=                ${DESTDIR}${LIBDIR}/librt.a
 LIBSBUF?=      ${DESTDIR}${LIBDIR}/libsbuf.a
-LIBSCTP?=      ${DESTDIR}${LIBDIR}/libsctp.a
 LIBSDP?=       ${DESTDIR}${LIBDIR}/libsdp.a
 LIBSMB?=       ${DESTDIR}${LIBDIR}/libsmb.a
 LIBSSH?=       ${DESTDIR}${LIBDIR}/libssh.a    # XXX in secure dist, not base
index 329cce4..8f7ed63 100644 (file)
@@ -1424,19 +1424,6 @@ netinet6/in6.c                   optional inet6
 netinet6/in6_cksum.c           optional inet6
 netinet6/in6_gif.c             optional gif inet6
 netinet6/ip6_forward.c         optional inet6
-netinet/sctp_asconf.c          optional inet sctp
-netinet/sctp_crc32.c           optional inet sctp
-netinet/sctp_hashdriver.c      optional inet sctp
-netinet/sctp_indata.c          optional inet sctp
-netinet/sctp_input.c           optional inet sctp
-netinet/sctp_output.c          optional inet sctp
-netinet/sctp_pcb.c             optional inet sctp
-netinet/sctp_peeloff.c         optional inet sctp
-netinet/sctp_sha1.c            optional inet sctp
-netinet/sctp_timer.c           optional inet sctp
-netinet/sctp_usrreq.c          optional inet sctp
-netinet/sctputil.c             optional inet sctp
-netinet6/sctp6_usrreq.c                optional inet6 sctp
 net/ip6fw/ip6_fw.c             optional inet6 ipv6firewall
 netinet6/in6_ifattach.c                optional inet6
 netinet6/ip6_demux.c           optional inet6
index 011abcc..07bdf53 100644 (file)
@@ -663,18 +663,6 @@ DCONS_FORCE_GDB            opt_dcons.h
 # deprecated drivers and options
 I_WANT_DEPRECATED_STUFF        opt_deprecated.h
 
-# SCTP
-SCTP                   opt_sctp.h
-SCTP_DEBUG             opt_sctp.h
-SCTP_USE_ADLER32       opt_sctp.h
-SCTP_HIGH_SPEED                opt_sctp.h
-SCTP_STAT_LOGGING      opt_sctp.h
-SCTP_CWND_LOGGING      opt_sctp.h
-SCTP_BLK_LOGGING       opt_sctp.h
-SCTP_STR_LOGGING       opt_sctp.h
-SCTP_FR_LOGGING                opt_sctp.h
-SCTP_MAP_LOGGING       opt_sctp.h
-
 # DSCHED stuff
 DSCHED_AS              opt_dsched.h
 DSCHED_BFQ             opt_dsched.h
index 6a2d47c..3c34e4d 100644 (file)
@@ -2472,18 +2472,6 @@ options  ALTQ_DEBUG      #for debugging
 # especially with 100baseT
 #options       HZ=1000
 
-# SCTP
-options                SCTP
-options                SCTP_DEBUG
-options                SCTP_USE_ADLER32
-options                SCTP_HIGH_SPEED
-options                SCTP_STAT_LOGGING
-options                SCTP_CWND_LOGGING
-options                SCTP_BLK_LOGGING
-options                SCTP_STR_LOGGING
-options                SCTP_FR_LOGGING
-options                SCTP_MAP_LOGGING
-
 # DSCHED stuff
 options                DSCHED_AS
 options                DSCHED_BFQ
index 8df428c..845fd0c 100644 (file)
@@ -2303,18 +2303,6 @@ options  ALTQ_DEBUG      #for debugging
 # especially with 100baseT
 #options       HZ=1000
 
-# SCTP
-options                SCTP
-options                SCTP_DEBUG
-options                SCTP_USE_ADLER32
-options                SCTP_HIGH_SPEED
-options                SCTP_STAT_LOGGING
-options                SCTP_CWND_LOGGING
-options                SCTP_BLK_LOGGING
-options                SCTP_STR_LOGGING
-options                SCTP_FR_LOGGING
-options                SCTP_MAP_LOGGING
-
 # DSCHED stuff
 options                DSCHED_AS
 options                DSCHED_BFQ
index af663eb..add5eb6 100644 (file)
@@ -81,7 +81,6 @@
 
 #include <netinet/udp.h>
 #include <netinet/tcp.h>
-#include <netinet/sctp.h>
 #if 0 /* XXX swildner: LRO */
 #include <netinet/tcp_lro.h>
 #endif
index 7277c1d..7311314 100644 (file)
@@ -62,7 +62,6 @@
 #include <netinet/ip6.h>
 #include <netinet/udp.h>
 #include <netinet/tcp.h>
-#include <netinet/sctp.h>
 
 #include <dev/virtual/virtio/virtio/virtio.h>
 #include <dev/virtual/virtio/virtio/virtqueue.h>
@@ -204,7 +203,7 @@ struct vtnet_mac_filter {
 };
 
 #define VTNET_WATCHDOG_TIMEOUT 5
-#define VTNET_CSUM_OFFLOAD     (CSUM_TCP | CSUM_UDP)// | CSUM_SCTP)
+#define VTNET_CSUM_OFFLOAD     (CSUM_TCP | CSUM_UDP)
 
 /* Features desired/implemented by this driver. */
 #define VTNET_FEATURES                 \
@@ -1464,10 +1463,6 @@ vtnet_rx_csum(struct vtnet_softc *sc, struct mbuf *m,
                m->m_pkthdr.csum_data = 0xFFFF;
                break;
 
-       case offsetof(struct sctphdr, checksum):
-               //m->m_pkthdr.csum_flags |= CSUM_SCTP_VALID;
-               break;
-
        default:
                sc->vtnet_stats.rx_csum_bad_offset++;
                return (1);
index cddb67c..904512c 100644 (file)
@@ -400,7 +400,7 @@ struct sysent sysent[] = {
        { AS(getresgid_args), (sy_call_t *)sys_getresgid },     /* 361 = getresgid */
        { 0, (sy_call_t *)sys_kqueue },                 /* 362 = kqueue */
        { AS(kevent_args), (sy_call_t *)sys_kevent },   /* 363 = kevent */
-       { AS(sctp_peeloff_args), (sy_call_t *)sys_sctp_peeloff },       /* 364 = sctp_peeloff */
+       { 0, (sy_call_t *)sys_nosys },                  /* 364 = sctp_peeloff */
        { 0, (sy_call_t *)sys_nosys },                  /* 365 = nosys */
        { 0, (sy_call_t *)sys_nosys },                  /* 366 = nosys */
        { 0, (sy_call_t *)sys_nosys },                  /* 367 = nosys */
index f1c005b..2434385 100644 (file)
@@ -372,7 +372,7 @@ const char *syscallnames[] = {
        "getresgid",                    /* 361 = getresgid */
        "kqueue",                       /* 362 = kqueue */
        "kevent",                       /* 363 = kevent */
-       "sctp_peeloff",                 /* 364 = sctp_peeloff */
+       "#364",                 /* 364 = sctp_peeloff */
        "#365",                 /* 365 = nosys */
        "#366",                 /* 366 = nosys */
        "#367",                 /* 367 = nosys */
index b2dc995..717ef33 100644 (file)
                            const struct kevent *changelist, int nchanges, \
                            struct kevent *eventlist, int nevents, \
                            const struct timespec *timeout); }
-364    STD     { int sctp_peeloff(int sd, caddr_t name ); }
+364    UNIMPL  sctp_peeloff
 ; 365-392 used by FreeBSD-current
 365    UNIMPL  nosys
 366    UNIMPL  nosys
index 9e33a1a..8f8ef41 100644 (file)
@@ -64,7 +64,6 @@
  */
 
 #include "opt_inet.h"
-#include "opt_sctp.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -307,19 +306,9 @@ sodealloc(struct socket *so)
 int
 solisten(struct socket *so, int backlog, struct thread *td)
 {
-       int error;
-#ifdef SCTP
-       short oldopt, oldqlimit;
-#endif /* SCTP */
-
        if (so->so_state & (SS_ISCONNECTED | SS_ISCONNECTING))
                return (EINVAL);
 
-#ifdef SCTP
-       oldopt = so->so_options;
-       oldqlimit = so->so_qlimit;
-#endif /* SCTP */
-
        lwkt_gettoken(&so->so_rcv.ssb_token);
        if (TAILQ_EMPTY(&so->so_comp))
                so->so_options |= SO_ACCEPTCONN;
@@ -327,20 +316,7 @@ solisten(struct socket *so, int backlog, struct thread *td)
        if (backlog < 0 || backlog > somaxconn)
                backlog = somaxconn;
        so->so_qlimit = backlog;
-       /* SCTP needs to look at tweak both the inbound backlog parameter AND
-        * the so_options (UDP model both connect's and gets inbound
-        * connections .. implicitly).
-        */
-       error = so_pru_listen(so, td);
-       if (error) {
-#ifdef SCTP
-               /* Restore the params */
-               so->so_options = oldopt;
-               so->so_qlimit = oldqlimit;
-#endif /* SCTP */
-               return (error);
-       }
-       return (0);
+       return so_pru_listen(so, td);
 }
 
 /*
@@ -1456,23 +1432,6 @@ dontblock:
        /*
         * Skip any control mbufs prepending the record.
         */
-#ifdef SCTP
-       if (pr->pr_flags & PR_ADDR_OPT) {
-               /*
-                * For SCTP we may be getting a
-                * whole message OR a partial delivery.
-                */
-               if (m && m->m_type == MT_SONAME) {
-                       orig_resid = 0;
-                       if (psa)
-                               *psa = dup_sockaddr(mtod(m, struct sockaddr *));
-                       if (flags & MSG_PEEK)
-                               m = m->m_next;
-                       else
-                               m = sbunlinkmbuf(&so->so_rcv.sb, m, &free_chain);
-               }
-       }
-#endif /* SCTP */
        while (m && m->m_type == MT_CONTROL && error == 0) {
                if (flags & MSG_PEEK) {
                        if (controlp)
@@ -1548,10 +1507,6 @@ dontblock:
                if (len == m->m_len - moff) {
                        if (m->m_flags & M_EOR)
                                flags |= MSG_EOR;
-#ifdef SCTP
-                       if (m->m_flags & M_NOTIFICATION)
-                               flags |= MSG_NOTIFICATION;
-#endif /* SCTP */
                        if (flags & MSG_PEEK) {
                                m = m->m_next;
                                moff = 0;
index 962859c..294565d 100644 (file)
@@ -34,7 +34,6 @@
  */
 
 #include "opt_ktrace.h"
-#include "opt_sctp.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <net/netmsg2.h>
 #include <vm/vm_page2.h>
 
-#ifdef SCTP
-#include <netinet/sctp_peeloff.h>
-#endif /* SCTP */
-
 extern int use_soaccept_pred_fast;
 extern int use_sendfile_async;
 extern int use_soconnect_async;
@@ -1894,94 +1889,3 @@ done0:
                m_freem(mheader);
        return (error);
 }
-
-/*
- * MPALMOSTSAFE
- */
-int
-sys_sctp_peeloff(struct sctp_peeloff_args *uap)
-{
-#ifdef SCTP
-       struct thread *td = curthread;
-       struct filedesc *fdp = td->td_proc->p_fd;
-       struct file *lfp = NULL;
-       struct file *nfp = NULL;
-       int error;
-       struct socket *head, *so;
-       caddr_t assoc_id;
-       int fd;
-       short fflag;            /* type must match fp->f_flag */
-
-       assoc_id = uap->name;
-       error = holdsock(td->td_proc->p_fd, uap->sd, &lfp);
-       if (error)
-               return (error);
-
-       crit_enter();
-       head = (struct socket *)lfp->f_data;
-       error = sctp_can_peel_off(head, assoc_id);
-       if (error) {
-               crit_exit();
-               goto done;
-       }
-       /*
-        * At this point we know we do have a assoc to pull
-        * we proceed to get the fd setup. This may block
-        * but that is ok.
-        */
-
-       fflag = lfp->f_flag;
-       error = falloc(td->td_lwp, &nfp, &fd);
-       if (error) {
-               /*
-                * Probably ran out of file descriptors. Put the
-                * unaccepted connection back onto the queue and
-                * do another wakeup so some other process might
-                * have a chance at it.
-                */
-               crit_exit();
-               goto done;
-       }
-       uap->sysmsg_iresult = fd;
-
-       so = sctp_get_peeloff(head, assoc_id, &error);
-       if (so == NULL) {
-               /*
-                * Either someone else peeled it off OR
-                * we can't get a socket.
-                */
-               goto noconnection;
-       }
-       soreference(so);                        /* reference needed */
-       soclrstate(so, SS_NOFDREF | SS_COMP);   /* when clearing NOFDREF */
-       so->so_head = NULL;
-       if (head->so_sigio != NULL)
-               fsetown(fgetown(&head->so_sigio), &so->so_sigio);
-
-       nfp->f_type = DTYPE_SOCKET;
-       nfp->f_flag = fflag;
-       nfp->f_ops = &socketops;
-       nfp->f_data = so;
-
-noconnection:
-       /*
-        * Assign the file pointer to the reserved descriptor, or clear
-        * the reserved descriptor if an error occured.
-        */
-       if (error)
-               fsetfd(fdp, NULL, fd);
-       else
-               fsetfd(fdp, nfp, fd);
-       crit_exit();
-       /*
-        * Release explicitly held references before returning.
-        */
-done:
-       if (nfp != NULL)
-               fdrop(nfp);
-       fdrop(lfp);
-       return (error);
-#else /* SCTP */
-       return(EOPNOTSUPP);
-#endif /* SCTP */
-}
index 05437ba..c7f20c5 100644 (file)
@@ -1664,7 +1664,6 @@ lagg_hashmbuf(struct lagg_softc *sc, struct mbuf *m, uint32_t key)
                switch (ip->ip_p) {
                        case IPPROTO_TCP:
                        case IPPROTO_UDP:
-                       case IPPROTO_SCTP:
                                iphlen = ip->ip_hl << 2;
                                if (iphlen < sizeof(*ip))
                                        break;
index 68bf4d7..3b925be 100644 (file)
@@ -62,8 +62,6 @@
  * $FreeBSD: src/sys/net/rtsock.c,v 1.44.2.11 2002/12/04 14:05:41 ru Exp $
  */
 
-#include "opt_sctp.h"
-
 #include <sys/param.h>
 #include <sys/systm.h>
 #include <sys/kernel.h>
 #include <net/netmsg2.h>
 #include <net/netisr2.h>
 
-#ifdef SCTP
-extern void sctp_add_ip_address(struct ifaddr *ifa);
-extern void sctp_delete_ip_address(struct ifaddr *ifa);
-#endif /* SCTP */
-
 MALLOC_DEFINE(M_RTABLE, "routetbl", "routing tables");
 
 static struct route_cb {
@@ -1093,18 +1086,6 @@ rt_rtmsg(int cmd, struct rtentry *rt, struct ifnet *ifp, int error)
 void
 rt_newaddrmsg(int cmd, struct ifaddr *ifa, int error, struct rtentry *rt)
 {
-#ifdef SCTP
-       /*
-        * notify the SCTP stack
-        * this will only get called when an address is added/deleted
-        * XXX pass the ifaddr struct instead if ifa->ifa_addr...
-        */
-       if (cmd == RTM_ADD)
-               sctp_add_ip_address(ifa);
-       else if (cmd == RTM_DELETE)
-               sctp_delete_ip_address(ifa);
-#endif /* SCTP */
-
        if (route_cb.any_count == 0)
                return;
 
index 37b293a..37a9cc9 100644 (file)
@@ -32,7 +32,6 @@
  *
  *     @(#)in.h        8.3 (Berkeley) 1/3/94
  * $FreeBSD: src/sys/netinet/in.h,v 1.48.2.10 2003/08/24 08:24:38 hsu Exp $
- * $DragonFly: src/sys/netinet/in.h,v 1.16 2007/08/16 20:03:57 dillon Exp $
  */
 
 #ifndef _NETINET_IN_H_
 #define        IPPROTO_PIM             103             /* Protocol Independent Mcast */
 #define        IPPROTO_CARP            112             /* CARP */
 #define        IPPROTO_PGM             113             /* PGM */
-#define        IPPROTO_SCTP            132             /* SCTP */
 #define        IPPROTO_PFSYNC          240             /* PFSYNC */
 /* 255: Reserved */
 /* BSD Private, local use, namespace incursion */
index e7c0725..63c8a83 100644 (file)
@@ -34,7 +34,6 @@
 #include "opt_mrouting.h"
 #include "opt_ipsec.h"
 #include "opt_inet6.h"
-#include "opt_sctp.h"
 #include "opt_carp.h"
 
 #include <sys/param.h>
 #include <netproto/ipsec/ipsec.h>
 #endif /* FAST_IPSEC */
 
-#ifdef SCTP
-#include <netinet/sctp_pcb.h>
-#include <netinet/sctp.h>
-#include <netinet/sctp_var.h>
-#endif /* SCTP */
-
 #include <net/netisr.h>                /* for cpu0_soport */
 
 #ifdef CARP
@@ -152,61 +145,6 @@ struct protosw inetsw[] = {
        .pr_drain = tcp_drain,
        .pr_usrreqs = &tcp_usrreqs
     },
-#ifdef SCTP
-    /*
-     * Order is very important here, we add the good one in
-     * in this postion so it maps to the right ip_protox[]
-     * postion for SCTP. Don't move the one above below
-     * this one or IPv6/4 compatability will break
-     */
-    {
-       .pr_type = SOCK_DGRAM,
-       .pr_domain = &inetdomain,
-       .pr_protocol = IPPROTO_SCTP,
-       .pr_flags = PR_ADDR_OPT|PR_WANTRCVD,
-
-       .pr_input = sctp_input,
-       .pr_output = NULL,
-       .pr_ctlinput = sctp_ctlinput,
-       .pr_ctloutput = sctp_ctloutput,
-
-       .pr_ctlport = cpu0_ctlport,
-       .pr_init = sctp_init,
-       .pr_drain = sctp_drain,
-       .pr_usrreqs = &sctp_usrreqs
-    },
-    {
-       .pr_type = SOCK_SEQPACKET,
-       .pr_domain = &inetdomain,
-       .pr_protocol = IPPROTO_SCTP,
-       .pr_flags = PR_ADDR_OPT|PR_WANTRCVD,
-
-       .pr_input = sctp_input,
-       .pr_output = NULL,
-       .pr_ctlinput = sctp_ctlinput,
-       .pr_ctloutput = sctp_ctloutput,
-
-       .pr_ctlport = cpu0_ctlport,
-       .pr_drain = sctp_drain,
-       .pr_usrreqs = &sctp_usrreqs
-    },
-
-    {
-       .pr_type = SOCK_STREAM,
-       .pr_domain = &inetdomain,
-       .pr_protocol = IPPROTO_SCTP,
-       .pr_flags = PR_CONNREQUIRED|PR_ADDR_OPT|PR_WANTRCVD,
-
-       .pr_input = sctp_input,
-       .pr_output = NULL,
-       .pr_ctlinput = sctp_ctlinput,
-       .pr_ctloutput = sctp_ctloutput,
-
-       .pr_ctlport = cpu0_ctlport,
-       .pr_drain = sctp_drain,
-       .pr_usrreqs = &sctp_usrreqs
-    },
-#endif /* SCTP */
     {
        .pr_type = SOCK_RAW,
        .pr_domain = &inetdomain,
diff --git a/sys/netinet/sctp.h b/sys/netinet/sctp.h
deleted file mode 100644 (file)
index 2aad239..0000000
+++ /dev/null
@@ -1,308 +0,0 @@
-/*     $KAME: sctp.h,v 1.17 2004/08/17 04:06:15 itojun Exp $   */
-/*     $DragonFly: src/sys/netinet/sctp.h,v 1.3 2006/06/13 08:12:03 dillon Exp $       */
-
-#ifndef _NETINET_SCTP_H_
-#define _NETINET_SCTP_H_
-
-/*
- * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Cisco Systems, Inc.
- * 4. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifndef _SYS_TYPES_H_
-#include <sys/types.h>
-#endif
-
-/*
- * SCTP protocol - RFC2960.
- */
-
-struct sctphdr {
-       u_int16_t src_port;             /* source port */
-       u_int16_t dest_port;            /* destination port */
-       u_int32_t v_tag;                /* verification tag of packet */
-       u_int32_t checksum;             /* Adler32 C-Sum */
-       /* chunks follow... */
-};
-
-/*
- * SCTP Chunks
- */
-struct sctp_chunkhdr {
-       u_int8_t  chunk_type;           /* chunk type */
-       u_int8_t  chunk_flags;          /* chunk flags */
-       u_int16_t chunk_length;         /* chunk length */
-       /* optional params follow */
-};
-
-/*
- * SCTP chunk parameters
- */
-struct sctp_paramhdr {
-       u_int16_t param_type;           /* parameter type */
-       u_int16_t param_length;         /* parameter length */
-};
-
-/*
- * user socket options
- */
-/* read-write options */
-#define SCTP_NODELAY                   0x00000001
-#define SCTP_MAXSEG                    0x00000002
-#define SCTP_ASSOCINFO                 0x00000003
-
-#define SCTP_INITMSG                   0x00000004
-#define SCTP_AUTOCLOSE                 0x00000005
-#define SCTP_SET_PEER_PRIMARY_ADDR     0x00000006
-#define SCTP_PRIMARY_ADDR              0x00000007
-
-/* read-only options */
-#define SCTP_STATUS                    0x00000008
-#define SCTP_PCB_STATUS                        0x00000009
-
-/* ancillary data/notification interest options */
-#define SCTP_EVENTS                    0x0000000a
-/* sctp_opt_info params */
-#define SCTP_PEER_ADDR_PARAMS          0x0000000b
-#define SCTP_GET_PEER_ADDR_INFO                0x0000000c
-/* Hidden socket option that gets the addresses */
-#define SCTP_GET_PEER_ADDRESSES                0x0000000d
-#define SCTP_GET_LOCAL_ADDRESSES       0x0000000e
-/*
- * Blocking I/O is enabled on any TCP type socket by default.
- * For the UDP model if this is turned on then the socket buffer is
- * shared for send resources amongst all associations. The default
- * for the UDP model is that is SS_NBIO is set. Which means all associations
- * have a seperate send limit BUT they will NOT ever BLOCK instead
- * you will get an error back EAGAIN if you try to send to much. If
- * you want the blocking symantics you set this option at the cost
- * of sharing one socket send buffer size amongst all associations.
- * Peeled off sockets turn this option off and block... but since both TCP and
- * peeled off sockets have only one assoc per socket this is fine.
- * It probably does NOT make sense to set this  on SS_NBIO on a TCP model OR
- * peeled off UDP model, but we do allow you to do so. You just use
- * the normal syscall to toggle SS_NBIO the way you want.
- */
-/* Blocking I/O is controled by the SS_NBIO flag on the
- * socket state so_state field.
- *
- * XXX SS_NBIO no longer exists on DragonFly.  Why is SCTP trying to set
- * the blocking/non-blocking default state?  We really need to present a
- * uniform interface to the user program, so we do not actually try to
- * do this any more.
- */
-#define SCTP_GET_SNDBUF_USE            0x0000000f
-/* latter added read/write */
-#define SCTP_ADAPTION_LAYER            0x00000010
-#define SCTP_DISABLE_FRAGMENTS         0x00000011
-/* sctp_bindx() flags as socket options */
-#define SCTP_BINDX_ADD_ADDR            0x00000012
-#define SCTP_BINDX_REM_ADDR            0x00000013
-/* return the total count in bytes needed to hold all local addresses bound */
-#define SCTP_GET_LOCAL_ADDR_SIZE       0x00000014
-/* Without this applied we will give V4 and V6 addresses on a V6 socket */
-#define SCTP_I_WANT_MAPPED_V4_ADDR     0x00000015
-/* Return the total count in bytes needed to hold the remote address */
-#define SCTP_GET_REMOTE_ADDR_SIZE      0x00000016
-#define SCTP_GET_PEGS                  0x00000017
-#define SCTP_DEFAULT_SEND_PARAM                0x00000018
-#define SCTP_SET_DEBUG_LEVEL           0x00000019
-#define SCTP_RTOINFO                   0x0000001a
-#define SCTP_AUTO_ASCONF               0x0000001b
-#define SCTP_MAXBURST                  0x0000001c
-#define SCTP_GET_STAT_LOG              0x0000001d
-#define SCTP_CONNECT_X                 0x0000001e      /* hidden opt for connectx */
-#define SCTP_RESET_STREAMS             0x0000001f
-#define SCTP_CONNECT_X_DELAYED         0x00000020      /* hidden opt for connectx_delayed
-                                                        * part of sctp_sendx()
-                                                        */
-#define SCTP_CONNECT_X_COMPLETE         0x00000021
-#define SCTP_GET_ASOC_ID_LIST           0x00000022
-
-/* Other BSD items */
-#define SCTP_GET_NONCE_VALUES           0x00000023
-#define SCTP_DELAYED_ACK_TIME           0x00000024
-
-/* Things for the AUTH draft possibly */
-#define SCTP_PEER_PUBLIC_KEY            0x00000100 /* get the peers public key */
-#define SCTP_MY_PUBLIC_KEY              0x00000101 /* get/set my endpoints public key */
-#define SCTP_SET_AUTH_SECRET            0x00000102 /* get/set my shared secret */
-#define SCTP_SET_AUTH_CHUNKS            0x00000103/* specify what chunks you want
-                                                   * the system may have additional requirments
-                                                    * as well. I.e. probably ASCONF/ASCONF-ACK no matter
-                                                    * if you want it or not.
-                                                    */
-/* Debug things that need to be purged */
-#define SCTP_SET_INITIAL_DBG_SEQ       0x00001f00
-#define SCTP_RESET_PEGS                 0x00002000
-#define SCTP_CLR_STAT_LOG               0x00002100
-
-/*
- * user state values
- */
-#define SCTP_CLOSED                    0x0000
-#define SCTP_BOUND                     0x1000
-#define SCTP_LISTEN                    0x2000
-#define SCTP_COOKIE_WAIT               0x0002
-#define SCTP_COOKIE_ECHOED             0x0004
-#define SCTP_ESTABLISHED               0x0008
-#define SCTP_SHUTDOWN_SENT             0x0010
-#define SCTP_SHUTDOWN_RECEIVED         0x0020
-#define SCTP_SHUTDOWN_ACK_SENT         0x0040
-#define SCTP_SHUTDOWN_PENDING          0x0080
-
-/*
- * SCTP operational error codes (user visible)
- */
-#define SCTP_ERROR_NO_ERROR            0x0000
-#define SCTP_ERROR_INVALID_STREAM      0x0001
-#define SCTP_ERROR_MISSING_PARAM       0x0002
-#define SCTP_ERROR_STALE_COOKIE                0x0003
-#define SCTP_ERROR_OUT_OF_RESOURCES    0x0004
-#define SCTP_ERROR_UNRESOLVABLE_ADDR   0x0005
-#define SCTP_ERROR_UNRECOG_CHUNK       0x0006
-#define SCTP_ERROR_INVALID_PARAM       0x0007
-#define SCTP_ERROR_UNRECOG_PARAM       0x0008
-#define SCTP_ERROR_NO_USER_DATA                0x0009
-#define SCTP_ERROR_COOKIE_IN_SHUTDOWN  0x000a
-/* draft-ietf-tsvwg-sctpimpguide */
-#define SCTP_ERROR_RESTART_NEWADDRS    0x000b
-/* draft-ietf-tsvwg-addip-sctp */
-#define SCTP_ERROR_DELETE_LAST_ADDR    0x0100
-#define SCTP_ERROR_RESOURCE_SHORTAGE   0x0101
-#define SCTP_ERROR_DELETE_SOURCE_ADDR  0x0102
-#define SCTP_ERROR_ILLEGAL_ASCONF_ACK  0x0103
-
-/*
- * error cause parameters (user visisble)
- */
-struct sctp_error_cause {
-       u_int16_t code;
-       u_int16_t length;
-       /* optional cause-specific info may follow */
-};
-
-struct sctp_error_invalid_stream {
-       struct sctp_error_cause cause;  /* code=SCTP_ERROR_INVALID_STREAM */
-       u_int16_t stream_id;            /* stream id of the DATA in error */
-       u_int16_t reserved;
-};
-
-struct sctp_error_missing_param {
-       struct sctp_error_cause cause;  /* code=SCTP_ERROR_MISSING_PARAM */
-       u_int32_t num_missing_params;   /* number of missing parameters */
-       /* u_int16_t param_type's follow */
-};
-
-struct sctp_error_stale_cookie {
-       struct sctp_error_cause cause;  /* code=SCTP_ERROR_STALE_COOKIE */
-       u_int32_t stale_time;           /* time in usec of staleness */
-};
-
-struct sctp_error_out_of_resource {
-       struct sctp_error_cause cause;  /* code=SCTP_ERROR_OUT_OF_RESOURCES */
-};
-
-struct sctp_error_unresolv_addr {
-       struct sctp_error_cause cause;  /* code=SCTP_ERROR_UNRESOLVABLE_ADDR */
-
-};
-
-struct sctp_error_unrecognized_chunk {
-       struct sctp_error_cause cause;  /* code=SCTP_ERROR_UNRECOG_CHUNK */
-       struct sctp_chunkhdr ch;        /* header from chunk in error */
-};
-
-#define HAVE_SCTP                      1
-#define HAVE_KERNEL_SCTP               1
-#define HAVE_SCTP_PRSCTP               1
-#define HAVE_SCTP_ADDIP                        1
-#define HAVE_SCTP_CANSET_PRIMARY       1
-#define HAVE_SCTP_SAT_NETWORK_CAPABILITY1
-#define HAVE_SCTP_MULTIBUF              1
-#define HAVE_SCTP_NOCONNECT             0
-#define HAVE_SCTP_ECN_NONCE             1  /* ECN Nonce option */
-
-/* Main SCTP chunk types, we place
- * these here since that way natd and f/w's
- * in user land can find them.
- */
-#define SCTP_DATA              0x00
-#define SCTP_INITIATION                0x01
-#define SCTP_INITIATION_ACK    0x02
-#define SCTP_SELECTIVE_ACK     0x03
-#define SCTP_HEARTBEAT_REQUEST 0x04
-#define SCTP_HEARTBEAT_ACK     0x05
-#define SCTP_ABORT_ASSOCIATION 0x06
-#define SCTP_SHUTDOWN          0x07
-#define SCTP_SHUTDOWN_ACK      0x08
-#define SCTP_OPERATION_ERROR   0x09
-#define SCTP_COOKIE_ECHO       0x0a
-#define SCTP_COOKIE_ACK                0x0b
-#define SCTP_ECN_ECHO          0x0c
-#define SCTP_ECN_CWR           0x0d
-#define SCTP_SHUTDOWN_COMPLETE 0x0e
-
-/* draft-ietf-tsvwg-addip-sctp */
-#define SCTP_ASCONF            0xc1
-#define        SCTP_ASCONF_ACK         0x80
-
-/* draft-ietf-stewart-prsctp */
-#define SCTP_FORWARD_CUM_TSN   0xc0
-
-/* draft-ietf-stewart-pktdrpsctp */
-#define SCTP_PACKET_DROPPED    0x81
-
-/* draft-ietf-stewart-strreset-xxx */
-#define SCTP_STREAM_RESET       0x82
-
-/* ABORT and SHUTDOWN COMPLETE FLAG */
-#define SCTP_HAD_NO_TCB                0x01
-
-/* Packet dropped flags */
-#define SCTP_FROM_MIDDLE_BOX   SCTP_HAD_NO_TCB
-#define SCTP_BADCRC            0x02
-#define SCTP_PACKET_TRUNCATED  0x04
-
-#define SCTP_SAT_NETWORK_MIN        400        /* min ms for RTT to set satellite time */
-#define SCTP_SAT_NETWORK_BURST_INCR  2         /* how many times to multiply maxburst in sat */
-/* Data Chuck Specific Flags */
-#define SCTP_DATA_FRAG_MASK    0x03
-#define SCTP_DATA_MIDDLE_FRAG  0x00
-#define SCTP_DATA_LAST_FRAG    0x01
-#define SCTP_DATA_FIRST_FRAG   0x02
-#define SCTP_DATA_NOT_FRAG     0x03
-#define SCTP_DATA_UNORDERED    0x04
-
-/* ECN Nonce: SACK Chunk Specific Flags */
-#define SCTP_SACK_NONCE_SUM     0x01
-
-#include <netinet/sctp_uio.h>
-
-#endif /* !_NETINET_SCTP_H_ */
diff --git a/sys/netinet/sctp_asconf.c b/sys/netinet/sctp_asconf.c
deleted file mode 100644 (file)
index 9c98506..0000000
+++ /dev/null
@@ -1,2893 +0,0 @@
-/*     $KAME: sctp_asconf.c,v 1.23 2004/08/17 06:28:01 t-momose Exp $  */
-
-/*
- * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#if !(defined(__OpenBSD__) || defined(__APPLE__))
-#include "opt_ipsec.h"
-#endif
-#if defined(__FreeBSD__)
-#include "opt_compat.h"
-#include "opt_inet6.h"
-#include "opt_inet.h"
-#endif
-#if defined(__NetBSD__)
-#include "opt_inet.h"
-#endif
-
-#ifdef __APPLE__
-#include <sctp.h>
-#elif !defined(__OpenBSD__)
-#include "opt_sctp.h"
-#endif
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/kernel.h>
-#include <sys/sysctl.h>
-#include <sys/thread2.h>
-
-#include <net/if.h>
-#include <net/if_types.h>
-#include <net/route.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#include <netinet/in_pcb.h>
-#include <netinet/in_var.h>
-#include <netinet/ip_var.h>
-
-#ifdef INET6
-#include <netinet/ip6.h>
-#include <netinet6/ip6_var.h>
-#if defined(__FreeBSD__) || (__NetBSD__)
-#include <netinet6/in6_pcb.h>
-#elif defined(__OpenBSD__)
-#include <netinet/in_pcb.h>
-#endif
-#include <netinet/icmp6.h>
-#include <netinet6/nd6.h>
-#endif /* INET6 */
-
-#include <netinet/in_pcb.h>
-
-#include <netinet/sctp_var.h>
-#include <netinet/sctp_pcb.h>
-#include <netinet/sctp_header.h>
-#include <netinet/sctputil.h>
-#include <netinet/sctp_output.h>
-#include <netinet/sctp_asconf.h>
-
-/*
- * debug flags:
- *   SCTP_DEBUG_ASCONF1: protocol info, general info and errors
- *   SCTP_DEBUG_ASCONF2: detailed info
- */
-#ifdef SCTP_DEBUG
-extern u_int32_t sctp_debug_on;
-
-#if defined(SCTP_BASE_FREEBSD) || defined(__APPLE__)
-#define strlcpy strncpy
-#endif
-#endif /* SCTP_DEBUG */
-
-/*
- * draft-ietf-tsvwg-addip-sctp
- *
- * Address management only currently supported
- * For the bound all case:
- *     the asoc local addr list is always a "DO NOT USE" list
- * For the subset bound case:
- *     If ASCONFs are allowed:
- *             the endpoint local addr list is the usable address list
- *             the asoc local addr list is the "DO NOT USE" list
- *     If ASCONFs are not allowed:
- *             the endpoint local addr list is the default usable list
- *             the asoc local addr list is the usable address list
- *
- * An ASCONF parameter queue exists per asoc which holds the pending
- * address operations.  Lists are updated upon receipt of ASCONF-ACK.
- *
- * Deleted addresses are always immediately removed from the lists as
- * they will (shortly) no longer exist in the kernel.  We send ASCONFs
- * as a courtesy, only if allowed.
- */
-
-/*
- * ASCONF parameter processing
- * response_required: set if a reply is required (eg. SUCCESS_REPORT)
- * returns a mbuf to an "error" response parameter or NULL/"success" if ok
- * FIX: allocating this many mbufs on the fly is pretty inefficient...
- */
-
-static struct mbuf *
-sctp_asconf_success_response(uint32_t id)
-{
-       struct mbuf *m_reply = NULL;
-       struct sctp_asconf_paramhdr *aph;
-
-       MGET(m_reply, MB_DONTWAIT, MT_DATA);
-       if (m_reply == NULL) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("asconf_success_response: couldn't get mbuf!\n");
-               }
-#endif /* SCTP_DEBUG */
-               return NULL;
-       }
-       aph = mtod(m_reply, struct sctp_asconf_paramhdr *);
-       aph->correlation_id = id;
-       aph->ph.param_type = htons(SCTP_SUCCESS_REPORT);
-       aph->ph.param_length = sizeof(struct sctp_asconf_paramhdr);
-       m_reply->m_len = aph->ph.param_length;
-       aph->ph.param_length = htons(aph->ph.param_length);
-
-       return m_reply;
-}
-
-static struct mbuf *
-sctp_asconf_error_response(uint32_t id, uint16_t cause, uint8_t *error_tlv,
-    uint16_t tlv_length)
-{
-       struct mbuf *m_reply = NULL;
-       struct sctp_asconf_paramhdr *aph;
-       struct sctp_error_cause *error;
-       uint8_t *tlv;
-
-       MGET(m_reply, MB_DONTWAIT, MT_DATA);
-       if (m_reply == NULL) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("asconf_error_response: couldn't get mbuf!\n");
-               }
-#endif /* SCTP_DEBUG */
-               return NULL;
-       }
-       aph = mtod(m_reply, struct sctp_asconf_paramhdr *);
-       error = (struct sctp_error_cause *)(aph + 1);
-
-       aph->correlation_id = id;
-       aph->ph.param_type = htons(SCTP_ERROR_CAUSE_IND);
-       error->code = htons(cause);
-       error->length = tlv_length + sizeof(struct sctp_error_cause);
-       aph->ph.param_length = error->length +
-           sizeof(struct sctp_asconf_paramhdr);
-
-       if (aph->ph.param_length > MLEN) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("asconf_error_response: tlv_length (%xh) too big\n",
-                           tlv_length);
-               }
-#endif /* SCTP_DEBUG */
-               sctp_m_freem(m_reply);  /* discard */
-               return NULL;
-       }
-
-       if (error_tlv != NULL) {
-               tlv = (uint8_t *)(error + 1);
-               memcpy(tlv, error_tlv, tlv_length);
-       }
-
-       m_reply->m_len = aph->ph.param_length;
-       error->length = htons(error->length);
-       aph->ph.param_length = htons(aph->ph.param_length);
-
-       return m_reply;
-}
-
-static struct mbuf *
-sctp_process_asconf_add_ip(struct sctp_asconf_paramhdr *aph,
-    struct sctp_tcb *stcb, int response_required)
-{
-       struct mbuf *m_reply = NULL;
-       struct sockaddr_storage sa_store;
-       struct sctp_ipv4addr_param *v4addr;
-       uint16_t param_type, param_length, aparam_length;
-       struct sockaddr *sa;
-       struct sockaddr_in *sin;
-#ifdef INET6
-       struct sockaddr_in6 *sin6;
-       struct sctp_ipv6addr_param *v6addr;
-#endif /* INET6 */
-
-       aparam_length = ntohs(aph->ph.param_length);
-       v4addr = (struct sctp_ipv4addr_param *)(aph + 1);
-#ifdef INET6
-       v6addr = (struct sctp_ipv6addr_param *)(aph + 1);
-#endif /* INET6 */
-       param_type = ntohs(v4addr->ph.param_type);
-       param_length = ntohs(v4addr->ph.param_length);
-
-       sa = (struct sockaddr *)&sa_store;
-       switch (param_type) {
-       case SCTP_IPV4_ADDRESS:
-               if (param_length != sizeof(struct sctp_ipv4addr_param)) {
-                       /* invalid param size */
-                       return NULL;
-               }
-               sin = (struct sockaddr_in *)&sa_store;
-               bzero(sin, sizeof(*sin));
-               sin->sin_family = AF_INET;
-               sin->sin_len = sizeof(struct sockaddr_in);
-               sin->sin_port = stcb->rport;
-               sin->sin_addr.s_addr = v4addr->addr;
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_asconf_add_ip: adding ");
-                       sctp_print_address(sa);
-               }
-#endif /* SCTP_DEBUG */
-               break;
-       case SCTP_IPV6_ADDRESS:
-#ifdef INET6
-               if (param_length != sizeof(struct sctp_ipv6addr_param)) {
-                       /* invalid param size */
-                       return NULL;
-               }
-               sin6 = (struct sockaddr_in6 *)&sa_store;
-               bzero(sin6, sizeof(*sin6));
-               sin6->sin6_family = AF_INET6;
-               sin6->sin6_len = sizeof(struct sockaddr_in6);
-               sin6->sin6_port = stcb->rport;
-               memcpy((caddr_t)&sin6->sin6_addr, v6addr->addr,
-                   sizeof(struct in6_addr));
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_asconf_add_ip: adding ");
-                       sctp_print_address(sa);
-               }
-#endif /* SCTP_DEBUG */
-#else
-               /* IPv6 not enabled! */
-               /* FIX ME: currently sends back an invalid param error */
-               m_reply = sctp_asconf_error_response(aph->correlation_id,
-                   SCTP_ERROR_INVALID_PARAM, (uint8_t *)aph, aparam_length);
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_asconf_add_ip: v6 disabled- skipping ");
-                       sctp_print_address(sa);
-               }
-#endif /* SCTP_DEBUG */
-               return m_reply;
-#endif /* INET6 */
-               break;
-       default:
-               m_reply = sctp_asconf_error_response(aph->correlation_id,
-                   SCTP_ERROR_UNRESOLVABLE_ADDR, (uint8_t *)aph,
-                   aparam_length);
-               return m_reply;
-       } /* end switch */
-
-       /* add the address */
-       if (sctp_add_remote_addr(stcb, sa, 0, 6) != 0) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_asconf_add_ip: error adding address\n");
-               }
-#endif /* SCTP_DEBUG */
-               m_reply = sctp_asconf_error_response(aph->correlation_id,
-                   SCTP_ERROR_RESOURCE_SHORTAGE, (uint8_t *)aph,
-                   aparam_length);
-       } else {
-               /* notify upper layer */
-               sctp_ulp_notify(SCTP_NOTIFY_ASCONF_ADD_IP, stcb, 0, sa);
-               if (response_required) {
-                       m_reply =
-                           sctp_asconf_success_response(aph->correlation_id);
-               }
-       }
-
-       return m_reply;
-}
-
-static struct mbuf *
-sctp_process_asconf_delete_ip(struct mbuf *m, struct sctp_asconf_paramhdr *aph,
-    struct sctp_tcb *stcb, int response_required)
-{
-       struct mbuf *m_reply = NULL;
-       struct sockaddr_storage sa_store, sa_source;
-       struct sctp_ipv4addr_param *v4addr;
-       uint16_t param_type, param_length, aparam_length;
-       struct sockaddr *sa;
-       struct sockaddr_in *sin;
-       struct ip *iph;
-       int result;
-#ifdef INET6
-       struct sockaddr_in6 *sin6;
-       struct sctp_ipv6addr_param *v6addr;
-#endif /* INET6 */
-
-       aparam_length = ntohs(aph->ph.param_length);
-       v4addr = (struct sctp_ipv4addr_param *)(aph + 1);
-#ifdef INET6
-       v6addr = (struct sctp_ipv6addr_param *)(aph + 1);
-#endif /* INET6 */
-       param_type = ntohs(v4addr->ph.param_type);
-       param_length = ntohs(v4addr->ph.param_length);
-
-       /* get the source IP address for deletion check */
-       iph = mtod(m, struct ip *);
-       if (iph->ip_v == IPVERSION) {
-               /* IPv4 source */
-               sin = (struct sockaddr_in *)&sa_source;
-               bzero(sin, sizeof(*sin));
-               sin->sin_family = AF_INET;
-               sin->sin_len = sizeof(struct sockaddr_in);
-               sin->sin_port = stcb->rport;
-               sin->sin_addr.s_addr = iph->ip_src.s_addr;
-       }
-#ifdef INET6
-       else if (iph->ip_v == (IPV6_VERSION >> 4)) {
-               /* IPv6 source */
-               struct ip6_hdr *ip6;
-
-               sin6 = (struct sockaddr_in6 *)&sa_source;
-               bzero(sin6, sizeof(*sin6));
-               sin6->sin6_family = AF_INET6;
-               sin6->sin6_len = sizeof(struct sockaddr_in6);
-               sin6->sin6_port = stcb->rport;
-               ip6 = mtod(m, struct ip6_hdr *);
-               sin6->sin6_addr = ip6->ip6_src;
-       }
-#endif /* INET6 */
-       else
-               return NULL;
-
-       sa = (struct sockaddr *)&sa_store;
-       switch (param_type) {
-       case SCTP_IPV4_ADDRESS:
-               if (param_length != sizeof(struct sctp_ipv4addr_param)) {
-                       /* invalid param size */
-                       return NULL;
-               }
-               sin = (struct sockaddr_in *)&sa_store;
-               bzero(sin, sizeof(*sin));
-               sin->sin_family = AF_INET;
-               sin->sin_len = sizeof(struct sockaddr_in);
-               sin->sin_port = stcb->rport;
-               sin->sin_addr.s_addr = v4addr->addr;
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_asconf_delete_ip: deleting ");
-                       sctp_print_address(sa);
-               }
-#endif /* SCTP_DEBUG */
-               break;
-       case SCTP_IPV6_ADDRESS:
-               if (param_length != sizeof(struct sctp_ipv6addr_param)) {
-                       /* invalid param size */
-                       return NULL;
-               }
-#ifdef INET6
-               sin6 = (struct sockaddr_in6 *)&sa_store;
-               bzero(sin6, sizeof(*sin6));
-               sin6->sin6_family = AF_INET6;
-               sin6->sin6_len = sizeof(struct sockaddr_in6);
-               sin6->sin6_port = stcb->rport;
-               memcpy(&sin6->sin6_addr, v6addr->addr,
-                   sizeof(struct in6_addr));
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_asconf_delete_ip: deleting ");
-                       sctp_print_address(sa);
-               }
-#endif /* SCTP_DEBUG */
-#else
-               /* IPv6 not enabled!  No "action" needed; just ack it */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_asconf_delete_ip: v6 disabled- ignoring: ");
-                       sctp_print_address(sa);
-               }
-#endif /* SCTP_DEBUG */
-               /* just respond with a "success" ASCONF-ACK */
-               return NULL;
-#endif /* INET6 */
-               break;
-       default:
-               m_reply = sctp_asconf_error_response(aph->correlation_id,
-                   SCTP_ERROR_UNRESOLVABLE_ADDR, (uint8_t *)aph,
-                   aparam_length);
-               return m_reply;
-       } /* end switch */
-
-       /* make sure the source address is not being deleted */
-       if ((memcmp(sa, &sa_source, sizeof(struct sockaddr_in)) == 0)
-#ifdef INET6
-           || (memcmp(sa, &sa_source, sizeof(struct sockaddr_in6)) == 0)
-#endif /* INET6 */
-               ) {
-               /* trying to delete the source address! */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_asconf_delete_ip: tried to delete source addr\n");
-               }
-#endif /* SCTP_DEBUG */
-               m_reply = sctp_asconf_error_response(aph->correlation_id,
-                   SCTP_ERROR_DELETE_SOURCE_ADDR, (uint8_t *)aph,
-                   aparam_length);
-               return m_reply;
-       }
-
-       /* delete the address */
-       result = sctp_del_remote_addr(stcb, sa);
-       /*
-        * note if result == -2, the address doesn't exist in the asoc
-        * but since it's being deleted anyways, we just ack the delete
-        * -- but this probably means something has already gone awry
-        */
-       if (result == -1) {
-               /* only one address in the asoc */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_asconf_delete_ip: tried to delete last IP addr!\n");
-               }
-#endif /* SCTP_DEBUG */
-               m_reply = sctp_asconf_error_response(aph->correlation_id,
-                   SCTP_ERROR_DELETE_LAST_ADDR, (uint8_t *)aph,
-                   aparam_length);
-       } else {
-               /* notify upper layer */
-               sctp_ulp_notify(SCTP_NOTIFY_ASCONF_DELETE_IP, stcb, 0, sa);
-       }
-
-       if (response_required) {
-               m_reply = sctp_asconf_success_response(aph->correlation_id);
-       }
-       return m_reply;
-}
-
-static struct mbuf *
-sctp_process_asconf_set_primary(struct sctp_asconf_paramhdr *aph,
-    struct sctp_tcb *stcb, int response_required)
-{
-       struct mbuf *m_reply = NULL;
-       struct sockaddr_storage sa_store;
-       struct sctp_ipv4addr_param *v4addr;
-       uint16_t param_type, param_length, aparam_length;
-       struct sockaddr *sa;
-       struct sockaddr_in *sin;
-#ifdef INET6
-       struct sockaddr_in6 *sin6;
-       struct sctp_ipv6addr_param *v6addr;
-#endif /* INET6 */
-
-       aparam_length = ntohs(aph->ph.param_length);
-       v4addr = (struct sctp_ipv4addr_param *)(aph + 1);
-#ifdef INET6
-       v6addr = (struct sctp_ipv6addr_param *)(aph + 1);
-#endif /* INET6 */
-       param_type = ntohs(v4addr->ph.param_type);
-       param_length = ntohs(v4addr->ph.param_length);
-
-       sa = (struct sockaddr *)&sa_store;
-       switch (param_type) {
-       case SCTP_IPV4_ADDRESS:
-               if (param_length != sizeof(struct sctp_ipv4addr_param)) {
-                       /* invalid param size */
-                       return NULL;
-               }
-               sin = (struct sockaddr_in *)&sa_store;
-               bzero(sin, sizeof(*sin));
-               sin->sin_family = AF_INET;
-               sin->sin_len = sizeof(struct sockaddr_in);
-               sin->sin_addr.s_addr = v4addr->addr;
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_asconf_set_primary: ");
-                       sctp_print_address(sa);
-               }
-#endif /* SCTP_DEBUG */
-               break;
-       case SCTP_IPV6_ADDRESS:
-               if (param_length != sizeof(struct sctp_ipv6addr_param)) {
-                       /* invalid param size */
-                       return NULL;
-               }
-#ifdef INET6
-               sin6 = (struct sockaddr_in6 *)&sa_store;
-               bzero(sin6, sizeof(*sin6));
-               sin6->sin6_family = AF_INET6;
-               sin6->sin6_len = sizeof(struct sockaddr_in6);
-               memcpy((caddr_t)&sin6->sin6_addr, v6addr->addr,
-                   sizeof(struct in6_addr));
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_asconf_set_primary: ");
-                       sctp_print_address(sa);
-               }
-#endif /* SCTP_DEBUG */
-#else
-               /* IPv6 not enabled!  No "action" needed; just ack it */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_asconf_set_primary: v6 disabled- ignoring: ");
-                       sctp_print_address(sa);
-               }
-#endif /* SCTP_DEBUG */
-               /* just respond with a "success" ASCONF-ACK */
-               return NULL;
-#endif /* INET6 */
-               break;
-       default:
-               m_reply = sctp_asconf_error_response(aph->correlation_id,
-                   SCTP_ERROR_UNRESOLVABLE_ADDR, (uint8_t *)aph,
-                   aparam_length);
-               return m_reply;
-       } /* end switch */
-
-       /* set the primary address */
-       if (sctp_set_primary_addr(stcb, sa, NULL) == 0) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_asconf_set_primary: primary address set\n");
-               }
-#endif /* SCTP_DEBUG */
-               /* notify upper layer */
-               sctp_ulp_notify(SCTP_NOTIFY_ASCONF_SET_PRIMARY, stcb, 0, sa);
-
-               if (response_required) {
-                       m_reply = sctp_asconf_success_response(aph->correlation_id);
-               }
-       } else {
-               /* couldn't set the requested primary address! */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_asconf_set_primary: set primary failed!\n");
-               }
-#endif /* SCTP_DEBUG */
-               /* must have been an invalid address, so report */
-               m_reply = sctp_asconf_error_response(aph->correlation_id,
-                   SCTP_ERROR_UNRESOLVABLE_ADDR, (uint8_t *)aph,
-                   aparam_length);
-       }
-
-       return m_reply;
-}
-
-/*
- * handles an ASCONF chunk
- * if all parameters are processed ok, send a plain (empty) ASCONF-ACK
- */
-void
-sctp_handle_asconf(struct mbuf *m, unsigned int offset, struct sctp_asconf_chunk *cp,
-    struct sctp_tcb *stcb, struct sctp_nets *net)
-{
-       struct sctp_association *asoc;
-       uint32_t serial_num;
-       struct mbuf *m_ack, *m_result, *m_tail;
-       struct sctp_asconf_ack_chunk *ack_cp;
-       struct sctp_asconf_paramhdr *aph, *ack_aph;
-       struct sctp_ipv6addr_param *p_addr;
-       unsigned int asconf_limit;
-       int error = 0;          /* did an error occur? */
-       /* asconf param buffer */
-       static u_int8_t aparam_buf[DEFAULT_PARAM_BUFFER];
-
-       /* verify minimum length */
-       if (ntohs(cp->ch.chunk_length) < sizeof(struct sctp_asconf_chunk)) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("handle_asconf: chunk too small = %xh\n",
-                           ntohs(cp->ch.chunk_length));
-               }
-#endif /* SCTP_DEBUG */
-               return;
-       }
-
-       asoc = &stcb->asoc;
-       serial_num = ntohl(cp->serial_number);
-
-       if (serial_num == asoc->asconf_seq_in) {
-               /* got a duplicate ASCONF */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("handle_asconf: got duplicate serial number = %xh\n",
-                              serial_num);
-               }
-#endif /* SCTP_DEBUG */
-               /* resend last ASCONF-ACK... */
-               sctp_send_asconf_ack(stcb, 1);
-               return;
-       } else if (serial_num != (asoc->asconf_seq_in + 1)) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("handle_asconf: incorrect serial number = %xh (expected next = %xh)\n",
-                           serial_num, asoc->asconf_seq_in+1);
-               }
-#endif /* SCTP_DEBUG */
-               return;
-       }
-
-       /* it's the expected "next" sequence number, so process it */
-       asoc->asconf_seq_in = serial_num;       /* update sequence */
-       /* get length of all the param's in the ASCONF */
-       asconf_limit = offset + ntohs(cp->ch.chunk_length);
-#ifdef SCTP_DEBUG
-       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-               kprintf("handle_asconf: asconf_limit=%u, sequence=%xh\n",
-                   asconf_limit, serial_num);
-       }
-#endif /* SCTP_DEBUG */
-       if (asoc->last_asconf_ack_sent != NULL) {
-               /* free last ASCONF-ACK message sent */
-               sctp_m_freem(asoc->last_asconf_ack_sent);
-               asoc->last_asconf_ack_sent = NULL;
-       }
-       MGETHDR(m_ack, MB_DONTWAIT, MT_DATA);
-       if (m_ack == NULL) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("handle_asconf: couldn't get mbuf!\n");
-               }
-#endif /* SCTP_DEBUG */
-               return;
-       }
-       m_tail = m_ack;         /* current reply chain's tail */
-
-       /* fill in ASCONF-ACK header */
-       ack_cp = mtod(m_ack, struct sctp_asconf_ack_chunk *);
-       ack_cp->ch.chunk_type = SCTP_ASCONF_ACK;
-       ack_cp->ch.chunk_flags = 0;
-       ack_cp->serial_number = htonl(serial_num);
-       /* set initial lengths (eg. just an ASCONF-ACK), ntohx at the end! */
-       m_ack->m_len = sizeof(struct sctp_asconf_ack_chunk);
-       ack_cp->ch.chunk_length = sizeof(struct sctp_asconf_ack_chunk);
-       m_ack->m_pkthdr.len = sizeof(struct sctp_asconf_ack_chunk);
-
-       /* skip the lookup address parameter */
-       offset += sizeof(struct sctp_asconf_chunk);
-       p_addr = (struct sctp_ipv6addr_param *)sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr), (uint8_t *)&aparam_buf);
-       if (p_addr == NULL) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("handle_asconf: couldn't get lookup addr!\n");
-               }
-#endif /* SCTP_DEBUG */
-
-               /* respond with a missing/invalid mandatory parameter error */
-               return;
-       }
-       /* param_length is already validated in process_control... */
-       offset += ntohs(p_addr->ph.param_length);   /* skip lookup addr */
-
-       /* get pointer to first asconf param in ASCONF */
-       aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset, sizeof(struct sctp_asconf_paramhdr), (uint8_t *)&aparam_buf);
-       /* get pointer to first asconf param in ASCONF-ACK */
-       if (aph == NULL) {
-               kprintf("Gak in asconf\n");
-               return;
-       }
-       ack_aph = (struct sctp_asconf_paramhdr *)(mtod(m_ack, caddr_t) + sizeof(struct sctp_asconf_ack_chunk));
-       if (ack_aph == NULL) {
-               kprintf("Gak in asconf2\n");
-               return;
-       }
-
-       /* process through all parameters */
-       while (aph != NULL) {
-               unsigned int param_length, param_type;
-
-               param_type = ntohs(aph->ph.param_type);
-               param_length = ntohs(aph->ph.param_length);
-               if (offset + param_length > asconf_limit) {
-                       /* parameter goes beyond end of chunk! */
-                       sctp_m_freem(m_ack);
-                       return;
-               }
-               m_result = NULL;
-
-               if (param_length > sizeof(aparam_buf)) {
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("handle_asconf: param length (%u) larger than buffer size!\n", param_length);
-                       }
-#endif /* SCTP_DEBUG */
-                       sctp_m_freem(m_ack);
-                       return;
-               }
-               if (param_length <= sizeof(struct sctp_paramhdr)) {
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("handle_asconf: param length (%u) too short\n", param_length);
-                       }
-#endif /* SCTP_DEBUG */
-                       sctp_m_freem(m_ack);
-               }
-
-               /* get the entire parameter */
-               aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset, param_length, aparam_buf);
-               if (aph == NULL) {
-                       kprintf("Gag\n");
-                       sctp_m_freem(m_ack);
-                       return;
-               }
-               switch (param_type) {
-               case SCTP_ADD_IP_ADDRESS:
-                       asoc->peer_supports_asconf = 1;
-                       m_result = sctp_process_asconf_add_ip(aph, stcb, error);
-                       break;
-               case SCTP_DEL_IP_ADDRESS:
-                       asoc->peer_supports_asconf = 1;
-                       m_result = sctp_process_asconf_delete_ip(m, aph, stcb,
-                           error);
-                       break;
-               case SCTP_ERROR_CAUSE_IND:
-                       /* not valid in an ASCONF chunk */
-                       break;
-               case SCTP_SET_PRIM_ADDR:
-                       asoc->peer_supports_asconf_setprim = 1;
-                       m_result = sctp_process_asconf_set_primary(aph, stcb,
-                           error);
-                       break;
-               case SCTP_SUCCESS_REPORT:
-                       /* not valid in an ASCONF chunk */
-                       break;
-               case SCTP_ULP_ADAPTION:
-                       /* FIX */
-                       break;
-               default:
-                       if ((param_type & 0x8000) == 0) {
-                               /* Been told to STOP at this param */
-                               asconf_limit = offset;
-                               /* FIX FIX - We need to call sctp_arethere_unrecognized_parameters()
-                                * to get a operr and send it for any param's with the
-                                * 0x4000 bit set OR do it here ourselves... note we still
-                                * must STOP if the 0x8000 bit is clear.
-                                */
-                       }
-                       /* unknown/invalid param type */
-                       break;
-               } /* switch */
-
-               /* add any (error) result to the reply mbuf chain */
-               if (m_result != NULL) {
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("handle_asconf: adding reply...\n");
-                       }
-#endif /* SCTP_DEBUG */
-                       m_tail->m_next = m_result;
-                       m_tail = m_result;
-                       /* update lengths, make sure it's aligned too */
-                       m_result->m_len = SCTP_SIZE32(m_result->m_len);
-                       m_ack->m_pkthdr.len += m_result->m_len;
-                       ack_cp->ch.chunk_length += m_result->m_len;
-                       /* set flag to force success reports */
-                       error = 1;
-               }
-
-               offset += SCTP_SIZE32(param_length);
-               /* update remaining ASCONF message length to process */
-               if (offset >= asconf_limit) {
-                       /* no more data in the mbuf chain */
-                       break;
-               }
-               /* get pointer to next asconf param */
-               aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset,
-                   sizeof(struct sctp_asconf_paramhdr),
-                   (uint8_t *)&aparam_buf);
-               if (aph == NULL) {
-                       /* can't get an asconf paramhdr */
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("handle_asconf: can't get asconf param hdr!\n");
-                       }
-#endif /* SCTP_DEBUG */
-                       /* FIX ME - add error here... */
-               }
-       } /* while */
-
-       ack_cp->ch.chunk_length = htons(ack_cp->ch.chunk_length);
-       /* save the ASCONF-ACK reply */
-       asoc->last_asconf_ack_sent = m_ack;
-       /* and send (a new one) it out... */
-       sctp_send_asconf_ack(stcb, 0);
-}
-
-/*
- * does the address match?
- * returns 0 if not, 1 if so
- */
-static uint32_t
-sctp_asconf_addr_match(struct sctp_asconf_addr *aa, struct sockaddr *sa)
-{
-#ifdef INET6
-       if (sa->sa_family == AF_INET6) {
-               /* IPv6 sa address */
-               /* XXX scopeid */
-               struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa;
-               if ((aa->ap.addrp.ph.param_type == SCTP_IPV6_ADDRESS) &&
-                   (memcmp(&aa->ap.addrp.addr, &sin6->sin6_addr,
-                           sizeof(struct in6_addr)) == 0)) {
-                       return (1);
-               }
-       } else
-#endif /* INET6 */
-       if (sa->sa_family == AF_INET) {
-               /* IPv4 sa address */
-               struct sockaddr_in *sin = (struct sockaddr_in *)sa;
-               if ((aa->ap.addrp.ph.param_type == SCTP_IPV4_ADDRESS) &&
-                   (memcmp(&aa->ap.addrp.addr, &sin->sin_addr,
-                           sizeof(struct in_addr)) == 0)) {
-                       return (1);
-               }
-       }
-       return (0);
-}
-
-/*
- * Cleanup for non-responded/OP ERR'd ASCONF
- */
-void
-sctp_asconf_cleanup(struct sctp_tcb *stcb, struct sctp_nets *net)
-{
-#ifdef SCTP_DEBUG
-       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-               kprintf("asconf_cleanup: marking peer ASCONF incapable and cleaning up\n");
-       }
-#endif /* SCTP_DEBUG */
-       /* mark peer as ASCONF incapable */
-       stcb->asoc.peer_supports_asconf = 0;
-       stcb->asoc.peer_supports_asconf_setprim = 0;
-       /*
-        * clear out any existing asconfs going out
-        */
-       sctp_timer_stop(SCTP_TIMER_TYPE_ASCONF, stcb->sctp_ep, stcb, net);
-       stcb->asoc.asconf_seq_out++;
-       /* remove the old ASCONF on our outbound queue */
-       sctp_toss_old_asconf(stcb);
-}
-
-/*
- * process an ADD/DELETE IP ack from peer
- * ifa:  corresponding ifaddr to the address being added/deleted
- * type: SCTP_ADD_IP_ADDRESS or SCTP_DEL_IP_ADDRESS
- * flag: 1=success, 0=failure
- */
-static void
-sctp_asconf_addr_mgmt_ack(struct sctp_tcb *stcb, struct ifaddr *addr,
-    uint16_t type, uint32_t flag)
-{
-
-       /*
-        * do the necessary asoc list work-
-        * if we get a failure indication, leave the address on the
-        *   "do not use" asoc list
-        * if we get a success indication, remove the address from
-        *   the list
-        */
-       /*
-        * Note: this will only occur for ADD_IP_ADDRESS, since
-        * DEL_IP_ADDRESS is never actually added to the list...
-        */
-       if (flag) {
-               /* success case, so remove from the list */
-               sctp_del_local_addr_assoc(stcb, addr);
-       }
-       /* else, leave it on the list */
-}
-
-/*
- * add an asconf add/delete IP address parameter to the queue
- * type = SCTP_ADD_IP_ADDRESS, SCTP_DEL_IP_ADDRESS, SCTP_SET_PRIM_ADDR
- * returns 0 if completed, non-zero if not completed
- * NOTE: if adding, but delete already scheduled (and not yet
- *     sent out), simply remove from queue.  Same for deleting
- *     an address already scheduled for add.  If a duplicate
- *     operation is found, ignore the new one.
- */
-static uint32_t
-sctp_asconf_queue_add(struct sctp_tcb *stcb, struct ifaddr *ifa, uint16_t type)
-{
-       struct sctp_asconf_addr *aa, *aa_next;
-#ifdef SCTP_DEBUG
-       char buf[128];  /* for address in string format */
-#endif /* SCTP_DEBUG */
-
-       /* see if peer supports ASCONF */
-       if (stcb->asoc.peer_supports_asconf == 0) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("asconf_queue_add: peer doesn't support ASCONF\n");
-               }
-#endif /* SCTP_DEBUG */
-               return (-1);
-       }
-
-       /* make sure the request isn't already in the queue */
-       for (aa=TAILQ_FIRST(&stcb->asoc.asconf_queue); aa!=NULL; aa=aa_next) {
-               aa_next = TAILQ_NEXT(aa, next);
-               /* address match? */
-               if (sctp_asconf_addr_match(aa, ifa->ifa_addr) == 0)
-                       continue;
-               /* is the request already in queue (sent or not) */
-               if (aa->ap.aph.ph.param_type == type) {
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("asconf_queue_add: request already exists\n");
-                       }
-#endif /* SCTP_DEBUG */
-                       return (-1);
-               }
-               /* is the negative request already in queue, and not sent */
-               if (aa->sent == 0 &&
-                   /* add requested, delete already queued */
-                   ((type == SCTP_ADD_IP_ADDRESS &&
-                     aa->ap.aph.ph.param_type == SCTP_DEL_IP_ADDRESS) ||
-                    /* delete requested, add already queued */
-                    (type == SCTP_DEL_IP_ADDRESS &&
-                     aa->ap.aph.ph.param_type == SCTP_ADD_IP_ADDRESS))) {
-                       /* delete the existing entry in the queue */
-                       TAILQ_REMOVE(&stcb->asoc.asconf_queue, aa, next);
-                       /* take the entry off the appropriate list */
-                       sctp_asconf_addr_mgmt_ack(stcb, aa->ifa, type, 1);
-                       /* free the entry */
-                       kfree(aa, M_PCB);
-
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("asconf_queue_add: removing 'opposite' queued request\n");
-                       }
-#endif /* SCTP_DEBUG */
-                       return (-1);
-               }
-       } /* for each aa */
-
-       /* adding new request to the queue */
-       aa = kmalloc(sizeof(*aa), M_PCB, M_NOWAIT);
-       if (aa == NULL) {
-               /* didn't get memory */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("asconf_queue_add: failed to get memory!\n");
-               }
-#endif /* SCTP_DEBUG */
-               return (-1);
-       }
-       /* fill in asconf address parameter fields */
-       /* top level elements are "networked" during send */
-       aa->ap.aph.ph.param_type = type;
-       aa->ifa = ifa;
-       /* correlation_id filled in during send routine later... */
-       if (ifa->ifa_addr->sa_family == AF_INET6) {
-               /* IPv6 address */
-               struct sockaddr_in6 *sin6;
-
-               sin6 = (struct sockaddr_in6 *)ifa->ifa_addr;
-               aa->ap.addrp.ph.param_type = SCTP_IPV6_ADDRESS;
-               aa->ap.addrp.ph.param_length = (sizeof(struct sctp_ipv6addr_param));
-               aa->ap.aph.ph.param_length =
-                   sizeof(struct sctp_asconf_paramhdr) +
-                   sizeof(struct sctp_ipv6addr_param);
-               memcpy(&aa->ap.addrp.addr, &sin6->sin6_addr,
-                   sizeof(struct in6_addr));
-#ifdef SCTP_DEBUG
-               strlcpy(buf, ip6_sprintf(&sin6->sin6_addr), sizeof(buf));
-#endif /* SCTP_DEBUG */
-
-       } else if (ifa->ifa_addr->sa_family == AF_INET) {
-               /* IPv4 address */
-               struct sockaddr_in *sin = (struct sockaddr_in *)ifa->ifa_addr;
-               aa->ap.addrp.ph.param_type = SCTP_IPV4_ADDRESS;
-               aa->ap.addrp.ph.param_length = (sizeof(struct sctp_ipv4addr_param));
-               aa->ap.aph.ph.param_length =
-                   sizeof(struct sctp_asconf_paramhdr) +
-                   sizeof(struct sctp_ipv4addr_param);
-               memcpy(&aa->ap.addrp.addr, &sin->sin_addr,
-                   sizeof(struct in_addr));
-#ifdef SCTP_DEBUG
-               strlcpy(buf, inet_ntoa(sin->sin_addr), sizeof(buf));
-#endif /* SCTP_DEBUG */
-       } else {
-               /* invalid family! */
-               return (-1);
-       }
-       aa->sent = 0;                   /* clear sent flag */
-
-       /*
-        * if we are deleting an address it should go out last
-        * otherwise, add it to front of the pending queue
-        */
-       if (type == SCTP_ADD_IP_ADDRESS) {
-               /* add goes to the front of the queue */
-               TAILQ_INSERT_HEAD(&stcb->asoc.asconf_queue, aa, next);
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("asconf_queue_add: appended asconf ADD_IP_ADDRESS: %s\n", buf);
-               }
-#endif /* SCTP_DEBUG */
-       } else {
-               /* delete and set primary goes to the back of the queue */
-               TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next);
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       if (type == SCTP_DEL_IP_ADDRESS) {
-                               kprintf("asconf_queue_add: inserted asconf DEL_IP_ADDRESS: %s\n", buf);
-                       } else {
-                               kprintf("asconf_queue_add: inserted asconf SET_PRIM_ADDR: %s\n", buf);
-                       }
-               }
-#endif /* SCTP_DEBUG */
-       }
-
-       return (0);
-}
-
-/*
- * add an asconf add/delete IP address parameter to the queue by addr
- * type = SCTP_ADD_IP_ADDRESS, SCTP_DEL_IP_ADDRESS, SCTP_SET_PRIM_ADDR
- * returns 0 if completed, non-zero if not completed
- * NOTE: if adding, but delete already scheduled (and not yet
- *     sent out), simply remove from queue.  Same for deleting
- *     an address already scheduled for add.  If a duplicate
- *     operation is found, ignore the new one.
- */
-static uint32_t
-sctp_asconf_queue_add_sa(struct sctp_tcb *stcb, struct sockaddr *sa,
-    uint16_t type)
-{
-       struct sctp_asconf_addr *aa, *aa_next;
-
-       /* see if peer supports ASCONF */
-       if (stcb->asoc.peer_supports_asconf == 0) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("asconf_queue_add_sa: peer doesn't support ASCONF\n");
-               }
-#endif /* SCTP_DEBUG */
-               return (-1);
-       }
-
-       /* make sure the request isn't already in the queue */
-       for (aa = TAILQ_FIRST(&stcb->asoc.asconf_queue); aa != NULL;
-           aa = aa_next) {
-               aa_next = TAILQ_NEXT(aa, next);
-               /* address match? */
-               if (sctp_asconf_addr_match(aa, sa) == 0)
-                       continue;
-               /* is the request already in queue (sent or not) */
-               if (aa->ap.aph.ph.param_type == type) {
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("asconf_queue_add_sa: request already exists\n");
-                       }
-#endif /* SCTP_DEBUG */
-                       return (-1);
-               }
-
-               /* is the negative request already in queue, and not sent */
-               if (aa->sent == 1)
-                       continue;
-               if (type == SCTP_ADD_IP_ADDRESS &&
-                   aa->ap.aph.ph.param_type == SCTP_DEL_IP_ADDRESS) {
-                       /* add requested, delete already queued */
-
-                       /* delete the existing entry in the queue */
-                       TAILQ_REMOVE(&stcb->asoc.asconf_queue, aa, next);
-                       /* free the entry */
-                       kfree(aa, M_PCB);
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("asconf_queue_add_sa: removing queued delete request\n");
-                       }
-#endif /* SCTP_DEBUG */
-                       return (-1);
-               } else if (type == SCTP_DEL_IP_ADDRESS &&
-                          aa->ap.aph.ph.param_type == SCTP_ADD_IP_ADDRESS) {
-                       /* delete requested, add already queued */
-
-                       /* delete the existing entry in the queue */
-                       TAILQ_REMOVE(&stcb->asoc.asconf_queue, aa, next);
-                       /* take the entry off the appropriate list */
-                       sctp_asconf_addr_mgmt_ack(stcb, aa->ifa, type, 1);
-                       /* free the entry */
-                       kfree(aa, M_PCB);
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("asconf_queue_add_sa: removing queued add request\n");
-                       }
-#endif /* SCTP_DEBUG */
-                       return (-1);
-               }
-       } /* for each aa */
-
-       /* adding new request to the queue */
-       aa = kmalloc(sizeof(*aa), M_PCB, M_NOWAIT);
-       if (aa == NULL) {
-               /* didn't get memory */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("asconf_queue_add_sa: failed to get memory!\n");
-               }
-#endif /* SCTP_DEBUG */
-               return (-1);
-       }
-       /* fill in asconf address parameter fields */
-       /* top level elements are "networked" during send */
-       aa->ap.aph.ph.param_type = type;
-       aa->ifa = sctp_find_ifa_by_addr(sa);
-       /* correlation_id filled in during send routine later... */
-       if (sa->sa_family == AF_INET6) {
-               /* IPv6 address */
-               struct sockaddr_in6 *sin6;
-
-               sin6 = (struct sockaddr_in6 *)sa;
-               aa->ap.addrp.ph.param_type = SCTP_IPV6_ADDRESS;
-               aa->ap.addrp.ph.param_length = (sizeof(struct sctp_ipv6addr_param));
-               aa->ap.aph.ph.param_length = sizeof(struct sctp_asconf_paramhdr) + sizeof(struct sctp_ipv6addr_param);
-               memcpy(&aa->ap.addrp.addr, &sin6->sin6_addr,
-                   sizeof(struct in6_addr));
-       } else if (sa->sa_family == AF_INET) {
-               /* IPv4 address */
-               struct sockaddr_in *sin = (struct sockaddr_in *)sa;
-               aa->ap.addrp.ph.param_type = SCTP_IPV4_ADDRESS;
-               aa->ap.addrp.ph.param_length = (sizeof(struct sctp_ipv4addr_param));
-               aa->ap.aph.ph.param_length = sizeof(struct sctp_asconf_paramhdr) + sizeof(struct sctp_ipv4addr_param);
-               memcpy(&aa->ap.addrp.addr, &sin->sin_addr,
-                   sizeof(struct in_addr));
-       } else {
-               /* invalid family! */
-               return (-1);
-       }
-       aa->sent = 0;                   /* clear sent flag */
-
-       /*
-        * if we are deleting an address it should go out last
-        * otherwise, add it to front of the pending queue
-        */
-       if (type == SCTP_ADD_IP_ADDRESS) {
-               /* add goes to the front of the queue */
-               TAILQ_INSERT_HEAD(&stcb->asoc.asconf_queue, aa, next);
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("asconf_queue_add_sa: appended asconf ADD_IP_ADDRESS\n");
-               }
-#endif /* SCTP_DEBUG */
-       } else {
-               /* delete and set primary goes to the back of the queue */
-               TAILQ_INSERT_TAIL(&stcb->asoc.asconf_queue, aa, next);
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       if (type == SCTP_DEL_IP_ADDRESS) {
-                               kprintf("asconf_queue_add_sa: inserted asconf DEL_IP_ADDRESS\n");
-                       } else {
-                               kprintf("asconf_queue_add_sa: inserted asconf SET_PRIM_ADDR\n");
-                       }
-               }
-#endif /* SCTP_DEBUG */
-       }
-
-       return (0);
-}
-
-/*
- * find a specific asconf param on our "sent" queue
- */
-static struct sctp_asconf_addr *
-sctp_asconf_find_param(struct sctp_tcb *stcb, uint32_t correlation_id)
-{
-       struct sctp_asconf_addr *aa;
-
-       TAILQ_FOREACH(aa, &stcb->asoc.asconf_queue, next) {
-               if (aa->ap.aph.correlation_id == correlation_id &&
-                   aa->sent == 1) {
-                       /* found it */
-                       return (aa);
-               }
-       }
-       /* didn't find it */
-       return (NULL);
-}
-
-/*
- * process an SCTP_ERROR_CAUSE_IND for a ASCONF-ACK parameter
- * and do notifications based on the error response
- */
-static void
-sctp_asconf_process_error(struct sctp_tcb *stcb,
-    struct sctp_asconf_paramhdr *aph)
-{
-       struct sctp_error_cause *eh;
-       struct sctp_paramhdr *ph;
-       uint16_t param_type;
-       uint16_t error_code;
-
-       eh = (struct sctp_error_cause *)(aph + 1);
-       ph = (struct sctp_paramhdr *)(eh + 1);
-       /* validate lengths */
-       if (htons(eh->length) + sizeof(struct sctp_error_cause) >
-           htons(aph->ph.param_length)) {
-               /* invalid error cause length */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("asconf_process_error: cause element too long\n");
-               }
-#endif /* SCTP_DEBUG */
-               return;
-       }
-       if (htons(ph->param_length) + sizeof(struct sctp_paramhdr) >
-           htons(eh->length)) {
-               /* invalid included TLV length */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("asconf_process_error: included TLV too long\n");
-               }
-#endif /* SCTP_DEBUG */
-               return;
-       }
-
-       /* which error code ? */
-       error_code = ntohs(eh->code);
-       param_type = ntohs(aph->ph.param_type);
-       /* FIX: this should go back up the REMOTE_ERROR ULP notify */
-       switch (error_code) {
-       case SCTP_ERROR_RESOURCE_SHORTAGE:
-               /* we allow ourselves to "try again" for this error */
-               break;
-       default:
-               /* peer can't handle it... */
-               switch (param_type) {
-               case SCTP_ADD_IP_ADDRESS:
-               case SCTP_DEL_IP_ADDRESS:
-                       stcb->asoc.peer_supports_asconf = 0;
-                       break;
-               case SCTP_SET_PRIM_ADDR:
-                       stcb->asoc.peer_supports_asconf_setprim = 0;
-                       break;
-               default:
-                       break;
-               }
-       }
-}
-
-/*
- * process an asconf queue param
- * aparam: parameter to process, will be removed from the queue
- * flag: 1=success, 0=failure
- */
-static void
-sctp_asconf_process_param_ack(struct sctp_tcb *stcb,
-    struct sctp_asconf_addr *aparam, uint32_t flag)
-{
-       uint16_t param_type;
-
-       /* process this param */
-       param_type = aparam->ap.aph.ph.param_type;
-#ifdef SCTP_DEBUG
-       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-               kprintf("process_param_ack: handling asconf parameter type=%xh\n", param_type);
-       }
-#endif /* SCTP_DEBUG */
-       switch (param_type) {
-       case SCTP_ADD_IP_ADDRESS:
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_param_ack: added IP address\n");
-               }
-#endif /* SCTP_DEBUG */
-               sctp_asconf_addr_mgmt_ack(stcb, aparam->ifa, param_type, flag);
-               break;
-       case SCTP_DEL_IP_ADDRESS:
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_param_ack: deleted IP address\n");
-               }
-#endif /* SCTP_DEBUG */
-               /* nothing really to do... lists already updated */
-               break;
-       case SCTP_SET_PRIM_ADDR:
-               /* nothing to do... peer may start using this addr */
-               if (flag == 0)
-                       stcb->asoc.peer_supports_asconf_setprim = 0;
-               break;
-       default:
-               /* should NEVER happen */
-               break;
-       } /* switch */
-
-       /* remove the param and free it */
-       TAILQ_REMOVE(&stcb->asoc.asconf_queue, aparam, next);
-       kfree(aparam, M_PCB);
-}
-
-/*
- * cleanup from a bad asconf ack parameter
- */
-static void
-sctp_asconf_ack_clear(struct sctp_tcb *stcb)
-{
-       /* assume peer doesn't really know how to do asconfs */
-       stcb->asoc.peer_supports_asconf = 0;
-       stcb->asoc.peer_supports_asconf_setprim = 0;
-       /* XXX we could free the pending queue here */
-}
-
-void
-sctp_handle_asconf_ack(struct mbuf *m, int offset,
-    struct sctp_asconf_ack_chunk *cp, struct sctp_tcb *stcb,
-    struct sctp_nets *net)
-{
-       struct sctp_association *asoc;
-       uint32_t serial_num;
-       uint16_t ack_length;
-       struct sctp_asconf_paramhdr *aph;
-       struct sctp_asconf_addr *aa, *aa_next;
-       uint32_t last_error_id = 0;             /* last error correlation id */
-       uint32_t id;
-       struct sctp_asconf_addr *ap;
-       /* asconf param buffer */
-       static u_int8_t aparam_buf[DEFAULT_PARAM_BUFFER];
-
-       /* verify minimum length */
-       if (ntohs(cp->ch.chunk_length) < sizeof(struct sctp_asconf_ack_chunk)) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("handle_asconf_ack: chunk too small = %xh\n",
-                              ntohs(cp->ch.chunk_length));
-               }
-#endif /* SCTP_DEBUG */
-               return;
-       }
-
-       asoc = &stcb->asoc;
-       serial_num = ntohl(cp->serial_number);
-
-       /*
-        * NOTE: we may want to handle this differently- currently, we
-        * will abort when we get an ack for the expected serial number + 1
-        * (eg. we didn't send it), process an ack normally if it is the
-        * expected serial number, and re-send the previous ack for *ALL*
-        * other serial numbers
-        */
-
-       /*
-        * if the serial number is the next expected, but I didn't send it,
-        * abort the asoc, since someone probably just hijacked us...
-        */
-       if (serial_num == (asoc->asconf_seq_out + 1)) {
-               sctp_abort_an_association(stcb->sctp_ep, stcb,
-                   SCTP_ERROR_ILLEGAL_ASCONF_ACK, NULL);
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("handle_asconf_ack: got unexpected next serial number! Aborting asoc!\n");
-               }
-#endif /* SCTP_DEBUG */
-               return;
-       }
-
-       if (serial_num != asoc->asconf_seq_out) {
-               /* got a duplicate/unexpected ASCONF-ACK */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("handle_asconf_ack: got duplicate/unexpected serial number = %xh (expected = %xh)\n", serial_num, asoc->asconf_seq_out);
-               }
-#endif /* SCTP_DEBUG */
-               return;
-       }
-       /* stop our timer */
-       sctp_timer_stop(SCTP_TIMER_TYPE_ASCONF, stcb->sctp_ep, stcb, net);
-
-       /* process the ASCONF-ACK contents */
-       ack_length = ntohs(cp->ch.chunk_length) -
-           sizeof(struct sctp_asconf_ack_chunk);
-       offset += sizeof(struct sctp_asconf_ack_chunk);
-       /* process through all parameters */
-       while (ack_length >= sizeof(struct sctp_asconf_paramhdr)) {
-               unsigned int param_length, param_type;
-
-               /* get pointer to next asconf parameter */
-               aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset,
-                   sizeof(struct sctp_asconf_paramhdr), aparam_buf);
-               if (aph == NULL) {
-                       /* can't get an asconf paramhdr */
-                       sctp_asconf_ack_clear(stcb);
-                       return;
-               }
-               param_type = ntohs(aph->ph.param_type);
-               param_length = ntohs(aph->ph.param_length);
-               if (param_length > ack_length) {
-                       sctp_asconf_ack_clear(stcb);
-                       return;
-               }
-               if (param_length < sizeof(struct sctp_paramhdr)) {
-                       sctp_asconf_ack_clear(stcb);
-                       return;
-               }
-
-               /* get the complete parameter... */
-               if (param_length > sizeof(aparam_buf)) {
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("param length (%u) larger than buffer size!\n", param_length);
-                       }
-#endif /* SCTP_DEBUG */
-                       sctp_asconf_ack_clear(stcb);
-                       return;
-               }
-               aph = (struct sctp_asconf_paramhdr *)sctp_m_getptr(m, offset, param_length, aparam_buf);
-               if (aph == NULL) {
-                       sctp_asconf_ack_clear(stcb);
-                       return;
-               }
-               /* correlation_id is transparent to peer, no ntohl needed */
-               id = aph->correlation_id;
-
-               switch (param_type) {
-               case SCTP_ERROR_CAUSE_IND:
-                       last_error_id = id;
-                       /* find the corresponding asconf param in our queue */
-                       ap = sctp_asconf_find_param(stcb, id);
-                       if (ap == NULL) {
-                               /* hmm... can't find this in our queue! */
-                               break;
-                       }
-                       /* process the parameter, failed flag */
-                       sctp_asconf_process_param_ack(stcb, ap, 0);
-                       /* process the error response */
-                       sctp_asconf_process_error(stcb, aph);
-                       break;
-               case SCTP_SUCCESS_REPORT:
-                       /* find the corresponding asconf param in our queue */
-                       ap = sctp_asconf_find_param(stcb, id);
-                       if (ap == NULL) {
-                               /* hmm... can't find this in our queue! */
-                               break;
-                       }
-                       /* process the parameter, success flag */
-                       sctp_asconf_process_param_ack(stcb, ap, 1);
-                       break;
-               default:
-                       break;
-               } /* switch */
-
-               /* update remaining ASCONF-ACK message length to process */
-               ack_length -= SCTP_SIZE32(param_length);
-               if (ack_length <= 0) {
-                       /* no more data in the mbuf chain */
-                       break;
-               }
-               offset += SCTP_SIZE32(param_length);
-       } /* while */
-
-       /*
-        * if there are any "sent" params still on the queue, these are
-        * implicitly "success", or "failed" (if we got an error back)
-        * ... so process these appropriately
-        *
-        * we assume that the correlation_id's are monotonically increasing
-        * beginning from 1 and that we don't have *that* many outstanding
-        * at any given time
-        */
-       if (last_error_id == 0)
-               last_error_id--;        /* set to "max" value */
-       for (aa = TAILQ_FIRST(&stcb->asoc.asconf_queue); aa != NULL;
-           aa = aa_next) {
-               aa_next = TAILQ_NEXT(aa, next);
-               if (aa->sent == 1) {
-                       /*
-                        * implicitly successful or failed
-                        * if correlation_id < last_error_id, then success
-                        * else, failure
-                        */
-                       if (aa->ap.aph.correlation_id < last_error_id)
-                               sctp_asconf_process_param_ack(stcb, aa,
-                                   SCTP_SUCCESS_REPORT);
-                       else
-                               sctp_asconf_process_param_ack(stcb, aa,
-                                   SCTP_ERROR_CAUSE_IND);
-               } else {
-                       /*
-                        * since we always process in order (FIFO queue)
-                        * if we reach one that hasn't been sent, the
-                        * rest should not have been sent either.
-                        * so, we're done...
-                        */
-                       break;
-               }
-       }
-
-       /* update the next sequence number to use */
-       asoc->asconf_seq_out++;
-       /* remove the old ASCONF on our outbound queue */
-       sctp_toss_old_asconf(stcb);
-       /* clear the sent flag to allow new ASCONFs */
-       asoc->asconf_sent = 0;
-       if (!TAILQ_EMPTY(&stcb->asoc.asconf_queue)) {
-               /* we have more params, so restart our timer */
-               sctp_timer_start(SCTP_TIMER_TYPE_ASCONF, stcb->sctp_ep,
-                   stcb, net);
-       }
-}
-
-/* is this an interface that we care about at all? */
-static uint32_t
-sctp_is_desired_interface_type(struct ifaddr *ifa)
-{
-       int result;
-
-       /* check the interface type to see if it's one we care about */
-       switch (ifa->ifa_ifp->if_type) {
-       case IFT_ETHER:
-       case IFT_ISO88023:
-       case IFT_STARLAN:
-       case IFT_P10:
-       case IFT_P80:
-       case IFT_HY:
-       case IFT_PPP:
-       case IFT_XETHER:
-       case IFT_SLIP:
-       case IFT_GIF:
-               result = 1;
-               break;
-       default:
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("ignoring interface type = %u\n",
-                              ifa->ifa_ifp->if_type);
-               }
-#endif /* SCTP_DEBUG */
-               result = 0;
-       } /* end switch */
-
-       return (result);
-}
-
-static uint32_t
-sctp_is_scopeid_in_nets(struct sctp_tcb *stcb, struct sockaddr *sa)
-{
-       struct sockaddr_in6 *sin6, *net6;
-       struct sctp_nets *net;
-
-       if (sa->sa_family != AF_INET6) {
-               /* wrong family */
-               return (0);
-       }
-
-       sin6 = (struct sockaddr_in6 *)sa;
-       if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr) == 0) {
-               /* not link local address */
-               return (0);
-       }
-
-       /* hunt through our destination nets list for this scope_id */
-       TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
-               if (((struct sockaddr *)(&net->ro._l_addr))->sa_family !=
-                   AF_INET6)
-                       continue;
-               net6 = (struct sockaddr_in6 *)&net->ro._l_addr;
-               if (IN6_IS_ADDR_LINKLOCAL(&net6->sin6_addr) == 0)
-                       continue;
-               if (sctp_is_same_scope(sin6, net6)) {
-                       /* found one */
-                       return (1);
-               }
-       }
-       /* didn't find one */
-       return (0);
-}
-
-/*
- * address management functions
- */
-static void
-sctp_addr_mgmt_assoc(struct sctp_inpcb *inp, struct sctp_tcb *stcb,
-    struct ifaddr *ifa, uint16_t type)
-{
-       int status;
-#ifdef SCTP_DEBUG
-       char buf[128];  /* for address in string format */
-#endif /* SCTP_DEBUG */
-
-       if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0 &&
-           (inp->sctp_flags & SCTP_PCB_FLAGS_DO_ASCONF) == 0) {
-               /* subset bound, no ASCONF allowed case, so ignore */
-               return;
-       }
-
-       /*
-        * note: we know this is not the subset bound, no ASCONF case
-        *      eg. this is boundall or subset bound w/ASCONF allowed
-        */
-
-       /* first, make sure it's a good address family */
-       if (ifa->ifa_addr->sa_family != AF_INET6 &&
-           ifa->ifa_addr->sa_family != AF_INET) {
-               return;
-       }
-
-       /* make sure we're "allowed" to add this type of addr */
-       if (ifa->ifa_addr->sa_family == AF_INET6) {
-               struct in6_ifaddr *ifa6;
-
-               /* invalid if we're not a v6 endpoint */
-               if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0)
-                       return;
-               /* is the v6 addr really valid ? */
-               ifa6 = (struct in6_ifaddr *)ifa;
-               if (IFA6_IS_DEPRECATED(ifa6) ||
-                   (ifa6->ia6_flags &
-                    (IN6_IFF_DETACHED | IN6_IFF_ANYCAST | IN6_IFF_NOTREADY))) {
-                       /* can't use an invalid address */
-                       return;
-               }
-       }
-
-       /* put this address on the "pending/do not use yet" list */
-       /*
-        * Note: we do this primarily for the subset bind case
-        * We don't have scoping flags at the EP level, so we must
-        * add link local/site local addresses to the EP, then need
-        * to "negate" them here.  Recall that this routine is only
-        * called for the subset bound w/ASCONF allowed case.
-        */
-
-       /*
-        * do a scope_id check against any link local addresses
-        * in the destination nets list to see if we should put
-        * this local address on the pending list or not
-        * eg. don't put on the list if we have a link local
-        * destination with the same scope_id
-        */
-       if (type == SCTP_ADD_IP_ADDRESS) {
-               if (sctp_is_scopeid_in_nets(stcb, ifa->ifa_addr) == 0) {
-                       sctp_add_local_addr_assoc(stcb, ifa);
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("addr_mgmt_assoc: added to pending list ");
-                               sctp_print_address(ifa->ifa_addr);
-                       }
-#endif /* SCTP_DEBUG */
-               }
-       }
-       /*
-        * check address scope
-        * if address is out of scope, don't queue anything...
-        * note: this would leave the address on both inp and asoc lists
-        */
-       if (ifa->ifa_addr->sa_family == AF_INET6) {
-               struct sockaddr_in6 *sin6;
-
-               sin6 = (struct sockaddr_in6 *)ifa->ifa_addr;
-#ifdef SCTP_DEBUG
-               strlcpy(buf, ip6_sprintf(&sin6->sin6_addr), sizeof(buf));
-#endif /* SCTP_DEBUG */
-               if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
-                       /* we skip unspecifed addresses */
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("addr_mgmt_assoc: unspecified IPv6 addr\n");
-                       }
-#endif /* SCTP_DEBUG */
-                       return;
-               }
-               if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) {
-                       if (stcb->asoc.local_scope == 0) {
-#ifdef SCTP_DEBUG
-                               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                                       kprintf("addr_mgmt_assoc: skipping link local IPv6 addr: %s\n", buf);
-                               }
-#endif /* SCTP_DEBUG */
-                               return;
-                       }
-                       /* is it the right link local scope? */
-                       if (sctp_is_scopeid_in_nets(stcb, ifa->ifa_addr) == 0) {
-#ifdef SCTP_DEBUG
-                               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                                       kprintf("addr_mgmt_assoc: skipping link local IPv6 addr: %s, wrong scope_id\n", buf);
-                               }
-#endif /* SCTP_DEBUG */
-                               return;
-                       }
-               }
-               if (stcb->asoc.site_scope == 0 &&
-                   IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr)) {
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("addr_mgmt_assoc: skipping site local IPv6 addr: %s\n", buf);
-                       }
-#endif /* SCTP_DEBUG */
-                       return;
-               }
-       } else if (ifa->ifa_addr->sa_family == AF_INET) {
-               struct sockaddr_in *sin;
-               struct in6pcb *inp6;
-
-               inp6 = (struct in6pcb *)&inp->ip_inp.inp;
-               /* invalid; we are a v6 only endpoint */
-               if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6)
-                       return;
-
-               sin = (struct sockaddr_in *)ifa->ifa_addr;
-#ifdef SCTP_DEBUG
-               strlcpy(buf, inet_ntoa(sin->sin_addr), sizeof(buf));
-#endif /* SCTP_DEBUG */
-               if (sin->sin_addr.s_addr == 0) {
-                       /* we skip unspecifed addresses */
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("addr_mgmt_assoc: unspecified IPv4 addr\n");
-                       }
-#endif /* SCTP_DEBUG */
-                       return;
-               }
-               if (stcb->asoc.ipv4_local_scope == 0 &&
-                   IN4_ISPRIVATE_ADDRESS(&sin->sin_addr)) {
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("addr_mgmt_assoc: skipping private IPv4 addr: %s\n", buf);
-                       }
-#endif /* SCTP_DEBUG */
-                       return;
-               }
-       } else {
-               /* else, not AF_INET or AF_INET6, so skip */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("addr_mgmt_assoc: not AF_INET or AF_INET6\n");
-               }
-#endif /* SCTP_DEBUG */
-               return;
-       }
-
-       /* queue an asconf for this address add/delete */
-       if (inp->sctp_flags & SCTP_PCB_FLAGS_DO_ASCONF) {
-               /* does the peer do asconf? */
-               if (stcb->asoc.peer_supports_asconf) {
-                       /* queue an asconf for this addr */
-                       status = sctp_asconf_queue_add(stcb, ifa, type);
-                       /*
-                        * if queued ok, and in correct state, set the
-                        * ASCONF timer
-                        * if in non-open state, we will set this timer
-                        * when the state does go open and do all the
-                        * asconf's
-                        */
-                       if (status == 0 &&
-                           SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) {
-                               sctp_timer_start(SCTP_TIMER_TYPE_ASCONF, inp,
-                                   stcb, stcb->asoc.primary_destination);
-                       }
-               }
-       } else {
-               /* this is the boundall, no ASCONF case */
-#if 0 /* assume kernel will delete this very shortly; add done above */
-               if (type == SCTP_DEL_IP_ADDRESS) {
-                       /* if deleting, add this addr to the do not use list */
-                       sctp_add_local_addr_assoc(stcb, ifa);
-               }
-#endif
-       }
-}
-
-static void
-sctp_addr_mgmt_ep(struct sctp_inpcb *inp, struct ifaddr *ifa, uint16_t type)
-{
-       struct sctp_tcb *stcb;
-
-       SCTP_INP_WLOCK(inp);
-       /* make sure we're "allowed" to add this type of addr */
-       if (ifa->ifa_addr->sa_family == AF_INET6) {
-               struct in6_ifaddr *ifa6;
-
-               /* invalid if we're not a v6 endpoint */
-               if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) {
-                       SCTP_INP_WUNLOCK(inp);
-                       return;
-               }
-               /* is the v6 addr really valid ? */
-               ifa6 = (struct in6_ifaddr *)ifa;
-               if (IFA6_IS_DEPRECATED(ifa6) ||
-                   (ifa6->ia6_flags &
-                    (IN6_IFF_DETACHED | IN6_IFF_ANYCAST | IN6_IFF_NOTREADY))) {
-                       /* can't use an invalid address */
-                       SCTP_INP_WUNLOCK(inp);
-                       return;
-               }
-       } else if (ifa->ifa_addr->sa_family == AF_INET) {
-               /* invalid; we are a v6 only endpoint */
-               if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
-                       SCTP_INP_WUNLOCK(inp);
-                       return;
-               }
-       } else {
-               /* invalid address family */
-               SCTP_INP_WUNLOCK(inp);
-               return;
-       }
-       /* is this endpoint subset bound ? */
-       if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0) {
-               /* subset bound endpoint */
-               if ((inp->sctp_flags & SCTP_PCB_FLAGS_DO_ASCONF) == 0) {
-                       /*
-                        * subset bound, but ASCONFs not allowed...
-                        * if adding, nothing to do, since not allowed
-                        * if deleting, remove address from endpoint
-                        *      peer will have to "timeout" this addr
-                        */
-                       if (type == SCTP_DEL_IP_ADDRESS) {
-                               sctp_del_local_addr_ep(inp, ifa);
-                       }
-                       /* no asconfs to queue for this inp... */
-                       SCTP_INP_WUNLOCK(inp);
-                       return;
-               } else {
-                       /*
-                        * subset bound, ASCONFs allowed...
-                        * if adding, add address to endpoint list
-                        * if deleting, remove address from endpoint
-                        */
-                       if (type == SCTP_ADD_IP_ADDRESS) {
-                               sctp_add_local_addr_ep(inp, ifa);
-                       } else {
-                               sctp_del_local_addr_ep(inp, ifa);
-                       }
-                       /* drop through and notify all asocs */
-               }
-       }
-
-       crit_enter();
-       /* process for all associations for this endpoint */
-       LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
-               SCTP_TCB_LOCK(stcb);
-               sctp_addr_mgmt_assoc(inp, stcb, ifa, type);
-               SCTP_TCB_UNLOCK(stcb);
-       } /* for each stcb */
-       crit_exit();
-       SCTP_INP_WUNLOCK(inp);
-}
-
-/*
- * restrict the use of this address
- */
-static void
-sctp_addr_mgmt_restrict_ep(struct sctp_inpcb *inp, struct ifaddr *ifa)
-{
-       struct sctp_tcb *stcb;
-
-       /* is this endpoint bound to all? */
-       if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0) {
-               /*
-                * Nothing to do for subset bound case.
-                * Allow sctp_bindx() to manage the address lists
-                */
-               return;
-       }
-
-       crit_enter();
-       SCTP_INP_RLOCK(inp);
-       /* process for all associations for this endpoint */
-       LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
-               /* put this address on the "pending/do not use yet" list */
-               SCTP_TCB_LOCK(stcb);
-               sctp_add_local_addr_assoc(stcb, ifa);
-               SCTP_TCB_UNLOCK(stcb);
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("restrict_ep: added addr to unusable list\n");
-               }
-#endif /* SCTP_DEBUG */
-       } /* for each stcb */
-       crit_exit();
-       SCTP_INP_RUNLOCK(inp);
-}
-
-/*
- * this is only called for kernel initiated address changes
- * eg. it will check the PCB_FLAGS_AUTO_ASCONF flag
- */
-static void
-sctp_addr_mgmt(struct ifaddr *ifa, uint16_t type) {
-       struct sockaddr *sa;
-       struct sctp_inpcb *inp;
-
-       /* make sure we care about this interface... */
-       if (!sctp_is_desired_interface_type(ifa)) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("sctp_addr_mgmt: ignoring this interface\n");
-               }
-#endif /* SCTP_DEBUG */
-               return;
-       }
-
-       sa = ifa->ifa_addr;
-       if (sa->sa_family != AF_INET && sa->sa_family != AF_INET6)
-               return;
-
-#ifdef SCTP_DEBUG
-       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-               if (type == SCTP_ADD_IP_ADDRESS)
-                       kprintf("sctp_addr_mgmt: kernel adds ");
-               else
-                       kprintf("sctp_addr_mgmt: kernel deletes ");
-               sctp_print_address(sa);
-       }
-#endif /* SCTP_DEBUG */
-
-       /* go through all our PCB's */
-       LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) {
-               if (inp->sctp_flags & SCTP_PCB_FLAGS_AUTO_ASCONF) {
-                       sctp_addr_mgmt_ep(inp, ifa, type);
-               } else {
-                       /* this address is going away anyways... */
-                       if (type == SCTP_DEL_IP_ADDRESS)
-                               return;
-                       /* (temporarily) restrict this address */
-                       sctp_addr_mgmt_restrict_ep(inp, ifa);
-               }
-               /* else, not allowing automatic asconf's, so ignore */
-       } /* for each inp */
-}
-
-/*
- * add/delete IP address requests from kernel (via routing change)
- * assumed that the address is non-broadcast, non-multicast
- * all addresses are passed from any type of interface-- need to filter
- * duplicate addresses may get requested
- */
-
-void
-sctp_add_ip_address(struct ifaddr *ifa)
-{
-       sctp_addr_mgmt(ifa, SCTP_ADD_IP_ADDRESS);
-}
-
-void
-sctp_delete_ip_address(struct ifaddr *ifa)
-{
-       struct sctp_inpcb *inp;
-
-       /* process the delete */
-       sctp_addr_mgmt(ifa, SCTP_DEL_IP_ADDRESS);
-
-       /*
-        * need to remove this ifaddr from any cached routes
-        * and also any from any assoc "restricted/pending" lists
-        */
-       /* make sure we care about this interface... */
-       if (!sctp_is_desired_interface_type(ifa)) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("sctp_delete_ip_address: ignoring this interface\n");
-               }
-#endif /* SCTP_DEBUG */
-               return;
-       }
-
-       /* go through all our PCB's */
-       SCTP_INP_INFO_RLOCK();
-       LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) {
-               struct sctp_tcb *stcb;
-               struct sctp_laddr *laddr, *laddr_next;
-
-               /* process for all associations for this endpoint */
-               SCTP_INP_RLOCK(inp);
-               LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
-                       struct sctp_nets *net;
-
-                       /* process through the nets list */
-                       TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
-                               struct rtentry *rt;
-                               /* delete this address if cached */
-                               rt = net->ro.ro_rt;
-                               if (rt != NULL && rt->rt_ifa == ifa) {
-/*                                     RTFREE(rt);*/
-                                       net->ro.ro_rt = NULL;
-                               }
-                       } /* for each net */
-                       /* process through the asoc "pending" list */
-                       laddr = LIST_FIRST(&stcb->asoc.sctp_local_addr_list);
-                       while (laddr != NULL) {
-                               laddr_next = LIST_NEXT(laddr, sctp_nxt_addr);
-                               /* remove if in use */
-                               if (laddr->ifa == ifa) {
-                                       sctp_remove_laddr(laddr);
-                               }
-                               laddr = laddr_next;
-                       } /* while */
-               } /* for each stcb */
-               /* process through the inp bound addr list */
-               laddr = LIST_FIRST(&inp->sctp_addr_list);
-               while (laddr != NULL) {
-                       laddr_next = LIST_NEXT(laddr, sctp_nxt_addr);
-                       /* remove if in use */
-                       if (laddr->ifa == ifa) {
-                               sctp_remove_laddr(laddr);
-                       }
-                       laddr = laddr_next;
-               } /* while */
-               SCTP_INP_RUNLOCK(inp);
-       } /* for each inp */
-       SCTP_INP_INFO_RUNLOCK();
-}
-
-/*
- * sa is the sockaddr to ask the peer to set primary to
- * returns: 0 = completed, -1 = error
- */
-int32_t
-sctp_set_primary_ip_address_sa(struct sctp_tcb *stcb, struct sockaddr *sa)
-{
-       /* NOTE: we currently don't check the validity of the address! */
-
-       /* queue an ASCONF:SET_PRIM_ADDR to be sent */
-       if (!sctp_asconf_queue_add_sa(stcb, sa, SCTP_SET_PRIM_ADDR)) {
-               /* set primary queuing succeeded */
-               if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) {
-                       sctp_timer_start(SCTP_TIMER_TYPE_ASCONF,
-                           stcb->sctp_ep, stcb,
-                           stcb->asoc.primary_destination);
-               }
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("set_primary_ip_address_sa: queued on tcb=%p, ",
-                           stcb);
-                       sctp_print_address(sa);
-               }
-#endif /* SCTP_DEBUG */
-       } else {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("set_primary_ip_address_sa: failed to add to queue on tcb=%p, ",
-                           stcb);
-                       sctp_print_address(sa);
-               }
-#endif /* SCTP_DEBUG */
-               return (-1);
-       }
-       return (0);
-}
-
-void
-sctp_set_primary_ip_address(struct ifaddr *ifa)
-{
-       struct sctp_inpcb *inp;
-
-       /* make sure we care about this interface... */
-       if (!sctp_is_desired_interface_type(ifa)) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("set_primary_ip_address: ignoring this interface\n");
-               }
-#endif /* SCTP_DEBUG */
-               return;
-       }
-
-       /* go through all our PCB's */
-       LIST_FOREACH(inp, &sctppcbinfo.listhead, sctp_list) {
-               struct sctp_tcb *stcb;
-
-               /* process for all associations for this endpoint */
-               LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
-                       /* queue an ASCONF:SET_PRIM_ADDR to be sent */
-                       if (!sctp_asconf_queue_add(stcb, ifa,
-                           SCTP_SET_PRIM_ADDR)) {
-                               /* set primary queuing succeeded */
-                               if (SCTP_GET_STATE(&stcb->asoc) ==
-                                   SCTP_STATE_OPEN) {
-                                       sctp_timer_start(SCTP_TIMER_TYPE_ASCONF,
-                                           stcb->sctp_ep, stcb,
-                                           stcb->asoc.primary_destination);
-                               }
-#ifdef SCTP_DEBUG
-                               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                                       kprintf("set_primary_ip_address: queued on stcb=%p, ",
-                                           stcb);
-                                       sctp_print_address(ifa->ifa_addr);
-                               }
-#endif /* SCTP_DEBUG */
-                       } else {
-#ifdef SCTP_DEBUG
-                               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                                       kprintf("set_primary_ip_address: failed to add to queue, ");
-                                       sctp_print_address(ifa->ifa_addr);
-                               }
-#endif /* SCTP_DEBUG */
-                       }
-               } /* for each stcb */
-       } /* for each inp */
-}
-
-static struct sockaddr *
-sctp_find_valid_localaddr(struct sctp_tcb *stcb)
-{
-       struct ifnet *ifn;
-
-       TAILQ_FOREACH(ifn, &ifnet, if_list) {
-               struct ifaddr_container *ifac;
-
-               if (stcb->asoc.loopback_scope == 0 && ifn->if_type == IFT_LOOP) {
-                       /* Skip if loopback_scope not set */
-                       continue;
-               }
-               TAILQ_FOREACH(ifac, &ifn->if_addrheads[mycpuid], ifa_link) {
-                       struct ifaddr *ifa = ifac->ifa;
-
-                       if (ifa->ifa_addr->sa_family == AF_INET &&
-                           stcb->asoc.ipv4_addr_legal) {
-                               struct sockaddr_in *sin;
-
-                               sin = (struct sockaddr_in *)ifa->ifa_addr;
-                               if (sin->sin_addr.s_addr == 0) {
-                                       /* skip unspecifed addresses */
-                                       continue;
-                               }
-                               if (stcb->asoc.ipv4_local_scope == 0 &&
-                                   IN4_ISPRIVATE_ADDRESS(&sin->sin_addr))
-                                       continue;
-
-                               if (sctp_is_addr_restricted(stcb,
-                                   ifa->ifa_addr))
-                                       continue;
-                               /* found a valid local v4 address to use */
-                               return (ifa->ifa_addr);
-                       } else if (ifa->ifa_addr->sa_family == AF_INET6 &&
-                           stcb->asoc.ipv6_addr_legal) {
-                               struct sockaddr_in6 *sin6;
-                               struct in6_ifaddr *ifa6;
-
-                               ifa6 = (struct in6_ifaddr *)ifa;
-                               if (IFA6_IS_DEPRECATED(ifa6) ||
-                                   (ifa6->ia6_flags & (IN6_IFF_DETACHED |
-                                    IN6_IFF_ANYCAST | IN6_IFF_NOTREADY)))
-                                       continue;
-
-                               sin6 = (struct sockaddr_in6 *)ifa->ifa_addr;
-                               if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
-                                       /* we skip unspecifed addresses */
-                                       continue;
-                               }
-                               if (stcb->asoc.local_scope == 0 &&
-                                   IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))
-                                       continue;
-                               if (stcb->asoc.site_scope == 0 &&
-                                   IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))
-                                       continue;
-
-                               /* found a valid local v6 address to use */
-                               return (ifa->ifa_addr);
-                       }
-               }
-       }
-       /* no valid addresses found */
-       return (NULL);
-}
-
-static struct sockaddr *
-sctp_find_valid_localaddr_ep(struct sctp_tcb *stcb)
-{
-       struct sctp_laddr *laddr;
-
-       LIST_FOREACH(laddr, &stcb->sctp_ep->sctp_addr_list, sctp_nxt_addr) {
-               if (laddr->ifa == NULL) {
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("find_valid_localaddr_ep: laddr error\n");
-                       }
-#endif /* SCTP_DEBUG */
-                       continue;
-               }
-               if (laddr->ifa->ifa_addr == NULL) {
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("find_valid_localaddr_ep: laddr->ifa error\n");
-                       }
-#endif /* SCTP_DEBUG */
-                       continue;
-               }
-               /* is the address restricted ? */
-               if (sctp_is_addr_restricted(stcb, laddr->ifa->ifa_addr))
-                       continue;
-
-               /* found a valid local address to use */
-               return (laddr->ifa->ifa_addr);
-       }
-       /* no valid addresses found */
-       return (NULL);
-}
-
-/*
- * builds an ASCONF chunk from queued ASCONF params
- * returns NULL on error (no mbuf, no ASCONF params queued, etc)
- */
-struct mbuf *
-sctp_compose_asconf(struct sctp_tcb *stcb)
-{
-       struct mbuf *m_asconf, *m_asconf_chk;
-       struct sctp_asconf_addr *aa;
-       struct sctp_asconf_chunk *acp;
-       struct sctp_asconf_paramhdr *aph;
-       struct sctp_asconf_addr_param *aap;
-       uint32_t p_length;
-       uint32_t correlation_id = 1;            /* 0 is reserved... */
-       caddr_t ptr, lookup_ptr;
-       uint8_t lookup_used = 0;
-
-       /* are there any asconf params to send? */
-       if (TAILQ_EMPTY(&stcb->asoc.asconf_queue)) {
-               return (NULL);
-       }
-
-       /*
-        * get a chunk header mbuf and a cluster for the asconf params
-        * since it's simpler to fill in the asconf chunk header lookup
-        * address on the fly
-        */
-       m_asconf_chk = NULL;
-       MGETHDR(m_asconf_chk, MB_DONTWAIT, MT_DATA);
-       if (m_asconf_chk == NULL) {
-               /* no mbuf's */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1)
-                       kprintf("compose_asconf: couldn't get chunk mbuf!\n");
-#endif /* SCTP_DEBUG */
-               return (NULL);
-       }
-       m_asconf = NULL;
-       MGETHDR(m_asconf, MB_DONTWAIT, MT_HEADER);
-       if (m_asconf == NULL) {
-               /* no mbuf's */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1)
-                       kprintf("compose_asconf: couldn't get mbuf!\n");
-#endif /* SCTP_DEBUG */
-               sctp_m_freem(m_asconf_chk);
-               return (NULL);
-       }
-       MCLGET(m_asconf, MB_DONTWAIT);
-       if ((m_asconf->m_flags & M_EXT) != M_EXT) {
-               /* failed to get cluster buffer */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1)
-                       kprintf("compose_asconf: couldn't get cluster!\n");
-#endif /* SCTP_DEBUG */
-               sctp_m_freem(m_asconf_chk);
-               sctp_m_freem(m_asconf);
-               return (NULL);
-       }
-
-       m_asconf_chk->m_len = sizeof(struct sctp_asconf_chunk);
-       m_asconf->m_len = 0;
-       acp = mtod(m_asconf_chk, struct sctp_asconf_chunk *);
-       bzero(acp, sizeof(struct sctp_asconf_chunk));
-       /* save pointers to lookup address and asconf params */
-       lookup_ptr = (caddr_t)(acp + 1);        /* after the header */
-       ptr = mtod(m_asconf, caddr_t);          /* beginning of cluster */
-
-       /* fill in chunk header info */
-       acp->ch.chunk_type = SCTP_ASCONF;
-       acp->ch.chunk_flags = 0;
-       acp->serial_number = htonl(stcb->asoc.asconf_seq_out);
-
-       /* add parameters... up to smallest MTU allowed */
-       TAILQ_FOREACH(aa, &stcb->asoc.asconf_queue, next) {
-               /* get the parameter length */
-               p_length = SCTP_SIZE32(aa->ap.aph.ph.param_length);
-               /* will it fit in current chunk? */
-               if (m_asconf->m_len + p_length > stcb->asoc.smallest_mtu) {
-                       /* won't fit, so we're done with this chunk */
-                       break;
-               }
-               /* assign (and store) a correlation id */
-               aa->ap.aph.correlation_id = correlation_id++;
-
-               /*
-                * fill in address if we're doing a delete
-                * this is a simple way for us to fill in the correlation
-                * address, which should only be used by the peer if we're
-                * deleting our source address and adding a new address
-                * (e.g. renumbering case)
-                */
-               if (lookup_used == 0 &&
-                   aa->ap.aph.ph.param_type == SCTP_DEL_IP_ADDRESS) {
-                       struct sctp_ipv6addr_param *lookup;
-                       uint16_t p_size, addr_size;
-
-                       lookup = (struct sctp_ipv6addr_param *)lookup_ptr;
-                       lookup->ph.param_type =
-                           htons(aa->ap.addrp.ph.param_type);
-                       if (aa->ap.addrp.ph.param_type == SCTP_IPV6_ADDRESS) {
-                               /* copy IPv6 address */
-                               p_size = sizeof(struct sctp_ipv6addr_param);
-                               addr_size = sizeof(struct in6_addr);
-                       } else {
-                               /* copy IPv4 address */
-                               p_size = sizeof(struct sctp_ipv4addr_param);
-                               addr_size = sizeof(struct in_addr);
-                       }
-                       lookup->ph.param_length = htons(SCTP_SIZE32(p_size));
-                       memcpy(lookup->addr, &aa->ap.addrp.addr, addr_size);
-                       m_asconf_chk->m_len += SCTP_SIZE32(p_size);
-                       lookup_used = 1;
-               }
-
-               /* copy into current space */
-               memcpy(ptr, &aa->ap, p_length);
-
-               /* network elements and update lengths */
-               aph = (struct sctp_asconf_paramhdr *) ptr;
-               aap = (struct sctp_asconf_addr_param *) ptr;
-               /* correlation_id is transparent to peer, no htonl needed */
-               aph->ph.param_type = htons(aph->ph.param_type);
-               aph->ph.param_length = htons(aph->ph.param_length);
-               aap->addrp.ph.param_type = htons(aap->addrp.ph.param_type);
-               aap->addrp.ph.param_length = htons(aap->addrp.ph.param_length);
-
-               m_asconf->m_len += SCTP_SIZE32(p_length);
-               ptr += SCTP_SIZE32(p_length);
-
-               /*
-                * these params are removed off the pending list upon
-                * getting an ASCONF-ACK back from the peer, just set flag
-                */
-               aa->sent = 1;
-       }
-       /* check to see if the lookup addr has been populated yet */
-       if (lookup_used == 0) {
-               /* NOTE: if the address param is optional, can skip this... */
-               /* add any valid (existing) address... */
-               struct sctp_ipv6addr_param *lookup;
-               uint16_t p_size, addr_size;
-               struct sockaddr *found_addr;
-               caddr_t addr_ptr;
-
-               if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL)
-                       found_addr = sctp_find_valid_localaddr(stcb);
-               else
-                       found_addr = sctp_find_valid_localaddr_ep(stcb);
-
-               lookup = (struct sctp_ipv6addr_param *)lookup_ptr;
-               if (found_addr != NULL) {
-                       if (found_addr->sa_family == AF_INET6) {
-                               /* copy IPv6 address */
-                               lookup->ph.param_type =
-                                   htons(SCTP_IPV6_ADDRESS);
-                               p_size = sizeof(struct sctp_ipv6addr_param);
-                               addr_size = sizeof(struct in6_addr);
-                               addr_ptr = (caddr_t)&((struct sockaddr_in6 *)
-                                   found_addr)->sin6_addr;
-                       } else {
-                               /* copy IPv4 address */
-                               lookup->ph.param_type =
-                                   htons(SCTP_IPV4_ADDRESS);
-                               p_size = sizeof(struct sctp_ipv4addr_param);
-                               addr_size = sizeof(struct in_addr);
-                               addr_ptr = (caddr_t)&((struct sockaddr_in *)
-                                   found_addr)->sin_addr;
-                       }
-                       lookup->ph.param_length = htons(SCTP_SIZE32(p_size));
-                       memcpy(lookup->addr, addr_ptr, addr_size);
-                       m_asconf_chk->m_len += SCTP_SIZE32(p_size);
-                       lookup_used = 1;
-               } else {
-                       /* uh oh... don't have any address?? */
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1)
-                               kprintf("compose_asconf: no lookup addr!\n");
-#endif /* SCTP_DEBUG */
-                       /* for now, we send a IPv4 address of 0.0.0.0 */
-                       lookup->ph.param_type = htons(SCTP_IPV4_ADDRESS);
-                       lookup->ph.param_length = htons(SCTP_SIZE32(sizeof(struct sctp_ipv4addr_param)));
-                       bzero(lookup->addr, sizeof(struct in_addr));
-                       m_asconf_chk->m_len += SCTP_SIZE32(sizeof(struct sctp_ipv4addr_param));
-                       lookup_used = 1;
-               }
-       }
-
-       /* chain it all together */
-       m_asconf_chk->m_next = m_asconf;
-       m_asconf_chk->m_pkthdr.len = m_asconf_chk->m_len + m_asconf->m_len;
-       acp->ch.chunk_length = ntohs(m_asconf_chk->m_pkthdr.len);
-
-       /* update "sent" flag */
-       stcb->asoc.asconf_sent++;
-
-       return (m_asconf_chk);
-}
-
-/*
- * section to handle address changes before an association is up
- * eg. changes during INIT/INIT-ACK/COOKIE-ECHO handshake
- */
-
-/*
- * processes the (local) addresses in the INIT-ACK chunk
- */
-static void
-sctp_process_initack_addresses(struct sctp_tcb *stcb, struct mbuf *m,
-    unsigned int offset, unsigned int length)
-{
-       struct sctp_paramhdr tmp_param, *ph;
-       uint16_t plen, ptype;
-       struct sctp_ipv6addr_param addr_store;
-       struct sockaddr_in6 sin6;
-       struct sockaddr_in sin;
-       struct sockaddr *sa;
-       struct ifaddr *ifa;
-
-#ifdef SCTP_DEBUG
-       if (sctp_debug_on & SCTP_DEBUG_ASCONF2) {
-               kprintf("processing init-ack addresses\n");
-       }
-#endif /* SCTP_DEBUG */
-
-       /* convert to upper bound */
-       length += offset;
-
-       if ((offset + sizeof(struct sctp_paramhdr)) > length) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("process_initack_addrs: invalid offset?\n");
-               }
-#endif /* SCTP_DEBUG */
-               return;
-       }
-
-       /* init the addresses */
-       bzero(&sin6, sizeof(sin6));
-       sin6.sin6_family = AF_INET6;
-       sin6.sin6_len = sizeof(sin6);
-       sin6.sin6_port = stcb->rport;
-
-       bzero(&sin, sizeof(sin));
-       sin.sin_len = sizeof(sin);
-       sin.sin_family = AF_INET;
-       sin.sin_port = stcb->rport;
-
-       /* go through the addresses in the init-ack */
-       ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset,
-           sizeof(struct sctp_paramhdr), (uint8_t *)&tmp_param);
-       while (ph != NULL) {
-               ptype = ntohs(ph->param_type);
-               plen = ntohs(ph->param_length);
-               if (ptype == SCTP_IPV6_ADDRESS) {
-                       struct sctp_ipv6addr_param *a6p;
-                       /* get the entire IPv6 address param */
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF2) {
-                               kprintf("process_initack_addrs: checking IPv6 param\n");
-                       }
-#endif /* SCTP_DEBUG */
-                       a6p = (struct sctp_ipv6addr_param *)
-                               sctp_m_getptr(m, offset,
-                                   sizeof(struct sctp_ipv6addr_param),
-                                   (uint8_t *)&addr_store);
-                       if (plen != sizeof(struct sctp_ipv6addr_param) ||
-                           a6p == NULL) {
-#ifdef SCTP_DEBUG
-                               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                                       kprintf("process_initack_addrs: invalid IPv6 param length\n");
-                               }
-#endif /* SCTP_DEBUG */
-                               return;
-                       }
-                       memcpy(&sin6.sin6_addr, a6p->addr,
-                           sizeof(struct in6_addr));
-                       sa = (struct sockaddr *)&sin6;
-               } else if (ptype == SCTP_IPV4_ADDRESS) {
-                       struct sctp_ipv4addr_param *a4p;
-                       /* get the entire IPv4 address param */
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF2) {
-                               kprintf("process_initack_addrs: checking IPv4 param\n");
-                       }
-#endif /* SCTP_DEBUG */
-                       a4p = (struct sctp_ipv4addr_param *)sctp_m_getptr(m, offset, sizeof(struct sctp_ipv4addr_param), (uint8_t *)&addr_store);
-                       if (plen != sizeof(struct sctp_ipv4addr_param) ||
-                           a4p == NULL) {
-#ifdef SCTP_DEBUG
-                               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                                       kprintf("process_initack_addrs: invalid IPv4 param length\n");
-                               }
-#endif /* SCTP_DEBUG */
-                               return;
-                       }
-                       sin.sin_addr.s_addr = a4p->addr;
-                       sa = (struct sockaddr *)&sin;
-               } else {
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF2) {
-                               kprintf("process_initack_addrs: skipping param type=%xh\n", ptype);
-                       }
-#endif /* SCTP_DEBUG */
-                       goto next_addr;
-               }
-
-               /* see if this address really (still) exists */
-               ifa = sctp_find_ifa_by_addr(sa);
-               if (ifa == NULL) {
-                       /* address doesn't exist anymore */
-                       int status;
-                       /* are ASCONFs allowed ? */
-                       if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_DO_ASCONF) &&
-                           stcb->asoc.peer_supports_asconf) {
-                               /* queue an ASCONF DEL_IP_ADDRESS */
-                               status = sctp_asconf_queue_add_sa(stcb, sa,
-                                   SCTP_DEL_IP_ADDRESS);
-                               /*
-                                * if queued ok, and in correct state,
-                                * set the ASCONF timer
-                                */
-                               if (status == 0 &&
-                                   SCTP_GET_STATE(&stcb->asoc) ==
-                                   SCTP_STATE_OPEN) {
-                                       sctp_timer_start(SCTP_TIMER_TYPE_ASCONF,
-                                           stcb->sctp_ep, stcb,
-                                           stcb->asoc.primary_destination);
-                               }
-                       }
-               } else {
-                       /* address still exists */
-                       /*
-                        * if subset bound, ep addr's managed by default
-                        * if not doing ASCONF, add the address to the assoc
-                        */
-                       if ((stcb->sctp_ep->sctp_flags &
-                            SCTP_PCB_FLAGS_BOUNDALL) == 0 &&
-                           (stcb->sctp_ep->sctp_flags &
-                            SCTP_PCB_FLAGS_DO_ASCONF) == 0) {
-#ifdef SCTP_DEBUG
-                               if (sctp_debug_on & SCTP_DEBUG_ASCONF2) {
-                                       kprintf("process_initack_addrs: adding local addr to asoc\n");
-                               }
-#endif /* SCTP_DEBUG */
-                               sctp_add_local_addr_assoc(stcb, ifa);
-                       }
-               }
-
-       next_addr:
-               /* get next parameter */
-               offset += SCTP_SIZE32(plen);
-               if ((offset + sizeof(struct sctp_paramhdr)) > length)
-                       return;
-               ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset,
-                   sizeof(struct sctp_paramhdr), (uint8_t *)&tmp_param);
-       } /* while */
-}
-
-/* FIX ME: need to verify return result for v6 address type if v6 disabled */
-/*
- * checks to see if a specific address is in the initack address list
- * returns 1 if found, 0 if not
- */
-static uint32_t
-sctp_addr_in_initack(struct sctp_tcb *stcb, struct mbuf *m, unsigned int offset,
-    unsigned int length, struct sockaddr *sa)
-{
-       struct sctp_paramhdr tmp_param, *ph;
-       uint16_t plen, ptype;
-       struct sctp_ipv6addr_param addr_store;
-       struct sockaddr_in *sin;
-       struct sctp_ipv4addr_param *a4p;
-#ifdef INET6
-       struct sockaddr_in6 *sin6, sin6_tmp;
-       struct sctp_ipv6addr_param *a6p;
-#endif /* INET6 */
-
-       if (
-#ifdef INET6
-               (sa->sa_family != AF_INET6) &&
-#endif /* INET6 */
-               (sa->sa_family != AF_INET))
-               return (0);
-
-#ifdef SCTP_DEBUG
-       if (sctp_debug_on & SCTP_DEBUG_ASCONF2) {
-               kprintf("find_initack_addr: starting search for ");
-               sctp_print_address(sa);
-       }
-#endif /* SCTP_DEBUG */
-       /* convert to upper bound */
-       length += offset;
-
-       if ((offset + sizeof(struct sctp_paramhdr)) > length) {
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("find_initack_addr: invalid offset?\n");
-               }
-#endif /* SCTP_DEBUG */
-               return (0);
-       }
-
-       /* go through the addresses in the init-ack */
-       ph = (struct sctp_paramhdr *)sctp_m_getptr(m, offset,
-           sizeof(struct sctp_paramhdr), (uint8_t *)&tmp_param);
-       while (ph != NULL) {
-               ptype = ntohs(ph->param_type);
-               plen = ntohs(ph->param_length);
-#ifdef INET6
-               if (ptype == SCTP_IPV6_ADDRESS && sa->sa_family == AF_INET6) {
-                       /* get the entire IPv6 address param */
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF2) {
-                               kprintf("addr_in_initack: checking IPv6 param\n");
-                       }
-#endif /* SCTP_DEBUG */
-                       a6p = (struct sctp_ipv6addr_param *)
-                               sctp_m_getptr(m, offset,
-                                   sizeof(struct sctp_ipv6addr_param),
-                                   (uint8_t *)&addr_store);
-                       if (plen != sizeof(struct sctp_ipv6addr_param) ||
-                           ph == NULL) {
-#ifdef SCTP_DEBUG
-                               if (sctp_debug_on & SCTP_DEBUG_ASCONF2) {
-                                       kprintf("addr_in_initack: invalid IPv6 param length\n");
-                               }
-#endif /* SCTP_DEBUG */
-                               return (0);
-                       }
-                       sin6 = (struct sockaddr_in6 *)sa;
-                       if (IN6_IS_SCOPE_LINKLOCAL(&sin6->sin6_addr)) {
-                               /* create a copy and clear scope */
-                               memcpy(&sin6_tmp, sin6,
-                                   sizeof(struct sockaddr_in6));
-                               sin6 = &sin6_tmp;
-                               in6_clearscope(&sin6->sin6_addr);
-                       }
-                       if (memcmp(&sin6->sin6_addr, a6p->addr,
-                           sizeof(struct in6_addr)) == 0) {
-                               /* found it */
-#ifdef SCTP_DEBUG
-                               if (sctp_debug_on & SCTP_DEBUG_ASCONF2) {
-                                       kprintf("addr_in_initack: found IPv6 addr\n");
-                               }
-#endif /* SCTP_DEBUG */
-                               return (1);
-                       }
-               } else
-#endif /* INET6 */
-
-               if (ptype == SCTP_IPV4_ADDRESS &&
-                   sa->sa_family == AF_INET) {
-                       /* get the entire IPv4 address param */
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF2) {
-                               kprintf("addr_in_initack: checking IPv4 param\n");
-                       }
-#endif /* SCTP_DEBUG */
-                       a4p = (struct sctp_ipv4addr_param *)sctp_m_getptr(m,
-                           offset, sizeof(struct sctp_ipv4addr_param),
-                           (uint8_t *)&addr_store);
-                       if (plen != sizeof(struct sctp_ipv4addr_param) ||
-                           ph == NULL) {
-#ifdef SCTP_DEBUG
-                               if (sctp_debug_on & SCTP_DEBUG_ASCONF2) {
-                                       kprintf("addr_in_initack: invalid IPv4 param length\n");
-                               }
-#endif /* SCTP_DEBUG */
-                               return (0);
-                       }
-                       sin = (struct sockaddr_in *)sa;
-                       if (sin->sin_addr.s_addr == a4p->addr) {
-                               /* found it */
-#ifdef SCTP_DEBUG
-                               if (sctp_debug_on & SCTP_DEBUG_ASCONF2) {
-                                       kprintf("addr_in_initack: found IPv4 addr\n");
-                               }
-#endif /* SCTP_DEBUG */
-                               return (1);
-                       }
-               } else {
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF2) {
-                               kprintf("addr_in_initack: skipping param type=%xh\n", ptype);
-                       }
-#endif /* SCTP_DEBUG */
-               }
-               /* get next parameter */
-               offset += SCTP_SIZE32(plen);
-               if (offset + sizeof(struct sctp_paramhdr) > length)
-                       return (0);
-               ph = (struct sctp_paramhdr *)
-                       sctp_m_getptr(m, offset, sizeof(struct sctp_paramhdr),
-                           (uint8_t *)&tmp_param);
-       } /* while */
-       /* not found! */
-#ifdef SCTP_DEBUG
-       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-               kprintf("addr_in_initack: not found!\n");
-       }
-#endif /* SCTP_DEBUG */
-       return (0);
-}
-
-/*
- * makes sure that the current endpoint local addr list is consistent
- * with the new association (eg. subset bound, asconf allowed)
- * adds addresses as necessary
- */
-static void
-sctp_check_address_list_ep(struct sctp_tcb *stcb, struct mbuf *m, int offset,
-    int length, struct sockaddr *init_addr)
-{
-       struct sctp_laddr *laddr;
-
-       /* go through the endpoint list */
-       LIST_FOREACH(laddr, &stcb->sctp_ep->sctp_addr_list, sctp_nxt_addr) {
-               /* be paranoid and validate the laddr */
-               if (laddr->ifa == NULL) {
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("check_addr_list_ep: laddr->ifa is NULL");
-                       }
-#endif
-                       continue;
-               }
-               if (laddr->ifa->ifa_addr == NULL) {
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                               kprintf("check_addr_list_ep: laddr->ifa->ifa_addr is NULL");
-                       }
-#endif
-                       continue;
-               }
-               /* do i have it implicitly? */
-               if (sctp_cmpaddr(laddr->ifa->ifa_addr, init_addr)) {
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_ASCONF2) {
-                               kprintf("check_address_list_all: skipping ");
-                               sctp_print_address(laddr->ifa->ifa_addr);
-                       }
-#endif /* SCTP_DEBUG */
-                       continue;
-               }
-               /* check to see if in the init-ack */
-               if (!sctp_addr_in_initack(stcb, m, offset, length,
-                                         laddr->ifa->ifa_addr)) {
-                       /* try to add it */
-                       sctp_addr_mgmt_assoc(stcb->sctp_ep, stcb, laddr->ifa,
-                           SCTP_ADD_IP_ADDRESS);
-               }
-       }
-}
-
-/*
- * makes sure that the current kernel address list is consistent
- * with the new association (with all addrs bound)
- * adds addresses as necessary
- */
-static void
-sctp_check_address_list_all(struct sctp_tcb *stcb, struct mbuf *m, int offset,
-    int length, struct sockaddr *init_addr, uint16_t local_scope,
-    uint16_t site_scope, uint16_t ipv4_scope, uint16_t loopback_scope)
-{
-       struct ifnet *ifn;
-
-       /* go through all our known interfaces */
-       TAILQ_FOREACH(ifn, &ifnet, if_list) {
-               struct ifaddr_container *ifac;
-
-               if (loopback_scope == 0 && ifn->if_type == IFT_LOOP) {
-                       /* skip loopback interface */
-                       continue;
-               }
-
-               /* go through each interface address */
-               TAILQ_FOREACH(ifac, &ifn->if_addrheads[mycpuid], ifa_link) {
-                       struct ifaddr *ifa = ifac->ifa;
-
-                       /* do i have it implicitly? */
-                       if (sctp_cmpaddr(ifa->ifa_addr, init_addr)) {
-#ifdef SCTP_DEBUG
-                               if (sctp_debug_on & SCTP_DEBUG_ASCONF2) {
-                                       kprintf("check_address_list_all: "
-                                               "skipping ");
-                                       sctp_print_address(ifa->ifa_addr);
-                               }
-#endif /* SCTP_DEBUG */
-                               continue;
-                       }
-                       /* check to see if in the init-ack */
-                       if (!sctp_addr_in_initack(stcb, m, offset, length,
-                           ifa->ifa_addr)) {
-                               /* try to add it */
-                               sctp_addr_mgmt_assoc(stcb->sctp_ep, stcb,
-                                   ifa, SCTP_ADD_IP_ADDRESS);
-                       }
-               } /* end foreach ifa */
-       } /* end foreach ifn */
-}
-
-/*
- * validates an init-ack chunk (from a cookie-echo) with current addresses
- * adds addresses from the init-ack into our local address list, if needed
- * queues asconf adds/deletes addresses as needed and makes appropriate
- * list changes for source address selection
- * m, offset: points to the start of the address list in an init-ack chunk
- * length: total length of the address params only
- * init_addr: address where my INIT-ACK was sent from
- */
-void
-sctp_check_address_list(struct sctp_tcb *stcb, struct mbuf *m, int offset,
-    int length, struct sockaddr *init_addr, uint16_t local_scope,
-    uint16_t site_scope, uint16_t ipv4_scope, uint16_t loopback_scope)
-{
-
-       /* process the local addresses in the initack */
-       sctp_process_initack_addresses(stcb, m, offset, length);
-
-       if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
-               /* bound all case */
-               sctp_check_address_list_all(stcb, m, offset, length, init_addr,
-                   local_scope, site_scope, ipv4_scope, loopback_scope);
-       } else {
-               /* subset bound case */
-               if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_DO_ASCONF) {
-                       /* asconf's allowed */
-                       sctp_check_address_list_ep(stcb, m, offset, length,
-                           init_addr);
-               }
-               /* else, no asconfs allowed, so what we sent is what we get */
-       }
-}
-
-/*
- * sctp_bindx() support
- */
-uint32_t
-sctp_addr_mgmt_ep_sa(struct sctp_inpcb *inp, struct sockaddr *sa, uint16_t type)
-{
-       struct ifaddr *ifa;
-
-       if (sa->sa_len == 0)
-               return (EINVAL);
-
-       ifa = sctp_find_ifa_by_addr(sa);
-       if (ifa != NULL) {
-#ifdef INET6
-               if (ifa->ifa_addr->sa_family == AF_INET6) {
-                       struct in6_ifaddr *ifa6;
-                       ifa6 = (struct in6_ifaddr *)ifa;
-                       if (IFA6_IS_DEPRECATED(ifa6) ||
-                           (ifa6->ia6_flags & (IN6_IFF_DETACHED |
-                            IN6_IFF_ANYCAST | IN6_IFF_NOTREADY))) {
-                               /* Can't bind a non-existent addr. */
-                               return (EINVAL);
-                       }
-               }
-#endif /* INET6 */
-               /* add this address */
-               sctp_addr_mgmt_ep(inp, ifa, type);
-       } else {
-               /* invalid address! */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_ASCONF1) {
-                       kprintf("addr_mgmt_ep_sa: got invalid address!\n");
-               }
-#endif /* SCTP_DEBUG */
-               return (EADDRNOTAVAIL);
-       }
-       return (0);
-}
diff --git a/sys/netinet/sctp_asconf.h b/sys/netinet/sctp_asconf.h
deleted file mode 100644 (file)
index 519f28d..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*     $KAME: sctp_asconf.h,v 1.7 2004/08/17 04:06:16 itojun Exp $     */
-/*     $DragonFly: src/sys/netinet/sctp_asconf.h,v 1.2 2006/05/20 02:42:12 dillon Exp $        */
-
-#ifndef _NETINET_SCTP_ASCONF_H_
-#define _NETINET_SCTP_ASCONF_H_
-
-#ifndef _SYS_TYPES_H_
-#include <sys/types.h>
-#endif
-
-/*
- * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if defined(_KERNEL) || (defined(__APPLE__) && defined(KERNEL))
-
-struct mbuf;
-struct sockaddr;
-struct sctp_inpcb;
-struct sctp_asconf_ack_chunk;
-struct sctp_asconf_chunk;
-struct sctp_tcb;
-struct sctp_nets;
-struct ifaddr;
-
-extern void sctp_asconf_cleanup(struct sctp_tcb *, struct sctp_nets *);
-
-extern struct mbuf *sctp_compose_asconf(struct sctp_tcb *);
-
-extern void sctp_handle_asconf(struct mbuf *, unsigned int, struct sctp_asconf_chunk *,
-       struct sctp_tcb *, struct sctp_nets *);
-
-extern void sctp_handle_asconf_ack(struct mbuf *, int,
-       struct sctp_asconf_ack_chunk *, struct sctp_tcb *, struct sctp_nets *);
-
-extern uint32_t sctp_addr_mgmt_ep_sa(struct sctp_inpcb *, struct sockaddr *,
-       uint16_t);
-
-extern void sctp_add_ip_address(struct ifaddr *);
-
-extern void sctp_delete_ip_address(struct ifaddr *);
-
-extern int32_t sctp_set_primary_ip_address_sa(struct sctp_tcb *,
-       struct sockaddr *);
-
-extern void sctp_set_primary_ip_address(struct ifaddr *);
-
-extern void sctp_check_address_list(struct sctp_tcb *, struct mbuf *, int, int,
-       struct sockaddr *, uint16_t, uint16_t, uint16_t, uint16_t);
-
-#endif /* _KERNEL */
-
-#endif /* !_NETINET_SCTP_ASCONF_H_ */
diff --git a/sys/netinet/sctp_callout.h b/sys/netinet/sctp_callout.h
deleted file mode 100644 (file)
index bdac4ac..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*     $KAME: sctp_callout.h,v 1.8 2005/01/25 07:35:42 itojun Exp $    */
-/*     $DragonFly: src/sys/netinet/sctp_callout.h,v 1.3 2006/05/20 02:42:12 dillon Exp $       */
-
-#ifndef _NETINET_SCTP_CALLOUT_H_
-#define _NETINET_SCTP_CALLOUT_H_
-
-#ifndef _SYS_QUEUE_H_
-#include <sys/queue.h>
-#endif
-
-#error "sctp_callout.h should never be used by dragonfly"
-
-/*
- * Copyright (C) 2002, 2003, 2004 Cisco Systems Inc,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#define _SCTP_NEEDS_CALLOUT_ 1
-
-#ifndef __NetBSD__
-struct callout {
-       TAILQ_ENTRY(callout) tqe;
-       int     c_time;                         /* ticks to the event */
-       void    *c_arg;                         /* function argument */
-       void    (*c_func)(void *);              /* function to call */
-       int     c_flags;                        /* state of this entry */
-};
-#endif
-#define SCTP_TICKS_PER_FASTTIMO 20             /* we get called about */
-                                                /* every 20ms */
-
-TAILQ_HEAD(calloutlist, callout);
-
-#define        CALLOUT_ACTIVE          0x0002 /* callout is currently active */
-#ifndef __NetBSD__
-#define        CALLOUT_PENDING         0x0004 /* callout is waiting for timeout */
-#define CALLOUT_FIRED          0x0008 /* it expired */
-#endif
-
-#define        callout_active(c)       ((c)->c_flags & CALLOUT_ACTIVE)
-#define        callout_deactivate(c)   ((c)->c_flags &= ~CALLOUT_ACTIVE)
-void   callout_init(struct callout *);
-#define        callout_pending(c)      ((c)->c_flags & CALLOUT_PENDING)
-
-void   callout_reset(struct callout *, int, void (*)(void *), void *);
-#ifndef __NetBSD__
-int    callout_stop(struct callout *);
-#endif
-#endif
diff --git a/sys/netinet/sctp_constants.h b/sys/netinet/sctp_constants.h
deleted file mode 100644 (file)
index bb97119..0000000
+++ /dev/null
@@ -1,832 +0,0 @@
-/*     $KAME: sctp_constants.h,v 1.16 2004/08/17 04:06:16 itojun Exp $ */
-/*     $DragonFly: src/sys/netinet/sctp_constants.h,v 1.3 2006/05/20 02:42:12 dillon Exp $     */
-
-#ifndef _NETINET_SCTP_CONSTANTS_H_
-#define _NETINET_SCTP_CONSTANTS_H_
-
-/*
- * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Cisco Systems, Inc.
- * 4. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#define SCTP_VERSION_STRING "KAME-BSD 1.1"
-/*#define SCTP_AUDITING_ENABLED 1 used for debug/auditing */
-#define SCTP_AUDIT_SIZE 256
-#define SCTP_STAT_LOG_SIZE 80000
-
-/* Places that CWND log can happen from */
-#define SCTP_CWND_LOG_FROM_FR  1
-#define SCTP_CWND_LOG_FROM_RTX 2
-#define SCTP_CWND_LOG_FROM_BRST        3
-#define SCTP_CWND_LOG_FROM_SS  4
-#define SCTP_CWND_LOG_FROM_CA  5
-#define SCTP_CWND_LOG_FROM_SAT 6
-#define SCTP_BLOCK_LOG_INTO_BLK 7
-#define SCTP_BLOCK_LOG_OUTOF_BLK 8
-#define SCTP_BLOCK_LOG_CHECK     9
-#define SCTP_STR_LOG_FROM_INTO_STRD 10
-#define SCTP_STR_LOG_FROM_IMMED_DEL 11
-#define SCTP_STR_LOG_FROM_INSERT_HD 12
-#define SCTP_STR_LOG_FROM_INSERT_MD 13
-#define SCTP_STR_LOG_FROM_INSERT_TL 14
-#define SCTP_STR_LOG_FROM_MARK_TSN  15
-#define SCTP_STR_LOG_FROM_EXPRS_DEL 16
-#define SCTP_FR_LOG_BIGGEST_TSNS    17
-#define SCTP_FR_LOG_STRIKE_TEST     18
-#define SCTP_FR_LOG_STRIKE_CHUNK    19
-#define SCTP_FR_T3_TIMEOUT          20
-#define SCTP_MAP_PREPARE_SLIDE      21
-#define SCTP_MAP_SLIDE_FROM         22
-#define SCTP_MAP_SLIDE_RESULT       23
-#define SCTP_MAP_SLIDE_CLEARED     24
-#define SCTP_MAP_SLIDE_NONE         25
-#define SCTP_FR_T3_MARK_TIME        26
-#define SCTP_FR_T3_MARKED           27
-#define SCTP_FR_T3_STOPPED          28
-#define SCTP_FR_MARKED              30
-#define SCTP_CWND_LOG_NOADV_SS      31
-#define SCTP_CWND_LOG_NOADV_CA      32
-#define SCTP_MAX_BURST_APPLIED      33
-#define SCTP_MAX_IFP_APPLIED        34
-#define SCTP_MAX_BURST_ERROR_STOP   35
-#define SCTP_INCREASE_PEER_RWND     36
-#define SCTP_DECREASE_PEER_RWND     37
-#define SCTP_SET_PEER_RWND_VIA_SACK 38
-#define SCTP_LOG_MBCNT_INCREASE     39
-#define SCTP_LOG_MBCNT_DECREASE     40
-#define SCTP_LOG_MBCNT_CHKSET       41
-/*
- * To turn on various logging, you must first define SCTP_STAT_LOGGING.
- * Then to get something to log you define one of the logging defines i.e.
- *
- * SCTP_CWND_LOGGING
- * SCTP_BLK_LOGGING
- * SCTP_STR_LOGGING
- * SCTP_FR_LOGGING
- *
- * Any one or a combination of the logging can be turned on.
- */
-#define SCTP_LOG_EVENT_CWND  1
-#define SCTP_LOG_EVENT_BLOCK 2
-#define SCTP_LOG_EVENT_STRM  3
-#define SCTP_LOG_EVENT_FR    4
-#define SCTP_LOG_EVENT_MAP   5
-#define SCTP_LOG_EVENT_MAXBURST 6
-#define SCTP_LOG_EVENT_RWND  7
-#define SCTP_LOG_EVENT_MBCNT 8
-
-
-/* number of associations by default for zone allocation */
-#define SCTP_MAX_NUM_OF_ASOC   40000
-/* how many addresses per assoc remote and local */
-#define SCTP_SCALE_FOR_ADDR    2
-
-/* default AUTO_ASCONF mode enable(1)/disable(0) value (sysctl) */
-#define SCTP_DEFAULT_AUTO_ASCONF       0
-
-/*
- * If you wish to use MD5 instead of SLA uncomment the line below.
- * Why you would like to do this:
- * a) There may be IPR on SHA-1, or so the FIP-180-1 page says,
- * b) MD5 is 3 times faster (has coded here).
- *
- * The disadvantage is it is thought that MD5 has been cracked... see RFC2104.
- */
-/*#define USE_MD5 1 */
-/*
- * Note: I can't seem to get this to compile now for some reason- the
- * kernel can't link in the md5 crypto
- */
-
-/* DEFINE HERE WHAT CRC YOU WANT TO USE */
-#define SCTP_USECRC_RFC2960  1
-/*#define SCTP_USECRC_FLETCHER 1*/
-/*#define SCTP_USECRC_SSHCRC32 1*/
-/*#define SCTP_USECRC_FASTCRC32 1*/
-/*#define SCTP_USECRC_CRC32 1*/
-/*#define SCTP_USECRC_TCP32 1*/
-/*#define SCTP_USECRC_CRC16SMAL 1*/
-/*#define SCTP_USECRC_CRC16 1 */
-/*#define SCTP_USECRC_MODADLER 1*/
-
-#ifndef SCTP_ADLER32_BASE
-#define SCTP_ADLER32_BASE 65521
-#endif
-
-#define SCTP_CWND_POSTS_LIST 256
-/*
- * the SCTP protocol signature
- * this includes the version number encoded in the last 4 bits
- * of the signature.
- */
-#define PROTO_SIGNATURE_A      0x30000000
-#define SCTP_VERSION_NUMBER    0x3
-
-#define MAX_TSN        0xffffffff
-#define MAX_SEQ        0xffff
-
-/* how many executions every N tick's */
-#define SCTP_MAX_ITERATOR_AT_ONCE 20
-
-/* number of clock ticks between iterator executions */
-#define SCTP_ITERATOR_TICKS 1
-
-/* option:
- * If you comment out the following you will receive the old
- * behavior of obeying cwnd for the fast retransmit algorithm.
- * With this defined a FR happens right away with-out waiting
- * for the flightsize to drop below the cwnd value (which is
- * reduced by the FR to 1/2 the inflight packets).
- */
-#define SCTP_IGNORE_CWND_ON_FR 1
-
-/*
- * Adds implementors guide behavior to only use newest highest
- * update in SACK gap ack's to figure out if you need to stroke
- * a chunk for FR.
- */
-#define SCTP_NO_FR_UNLESS_SEGMENT_SMALLER 1
-
-/* default max I can burst out after a fast retransmit */
-#define SCTP_DEF_MAX_BURST 8
-
-/* Packet transmit states in the sent field */
-#define SCTP_DATAGRAM_UNSENT           0
-#define SCTP_DATAGRAM_SENT             1
-#define SCTP_DATAGRAM_RESEND1          2 /* not used (in code, but may hit this value) */
-#define SCTP_DATAGRAM_RESEND2          3 /* not used (in code, but may hit this value) */
-#define SCTP_DATAGRAM_RESEND3          4 /* not used (in code, but may hit this value) */
-#define SCTP_DATAGRAM_RESEND           5
-#define SCTP_DATAGRAM_ACKED            10010
-#define SCTP_DATAGRAM_INBOUND          10011
-#define SCTP_READY_TO_TRANSMIT         10012
-#define SCTP_DATAGRAM_MARKED           20010
-#define SCTP_FORWARD_TSN_SKIP          30010
-
-/* SCTP chunk types */
-/* Moved to sctp.h so f/w and natd
- * boxes can find the chunk types.
- */
-
-/* align to 32-bit sizes */
-#define SCTP_SIZE32(x) ((((x)+3) >> 2) << 2)
-
-#define IS_SCTP_CONTROL(a) ((a)->chunk_type != SCTP_DATA)
-#define IS_SCTP_DATA(a) ((a)->chunk_type == SCTP_DATA)
-
-/* SCTP parameter types */
-#define SCTP_HEARTBEAT_INFO        0x0001
-#define SCTP_IPV4_ADDRESS          0x0005
-#define SCTP_IPV6_ADDRESS          0x0006
-#define SCTP_STATE_COOKIE          0x0007
-#define SCTP_UNRECOG_PARAM         0x0008
-#define SCTP_COOKIE_PRESERVE       0x0009
-#define SCTP_HOSTNAME_ADDRESS      0x000b
-#define SCTP_SUPPORTED_ADDRTYPE            0x000c
-#define SCTP_ECN_CAPABLE           0x8000
-/* draft-ietf-stewart-strreset-xxx */
-#define SCTP_STR_RESET_REQUEST      0x000d
-#define SCTP_STR_RESET_RESPONSE     0x000e
-
-/* ECN Nonce: draft-ladha-sctp-ecn-nonce */
-#define SCTP_ECN_NONCE_SUPPORTED    0x8001
-/*
- * draft-ietf-stewart-strreset-xxx
- *   param=0x8001  len=0xNNNN
- *   Byte | Byte | Byte | Byte
- *   Byte | Byte ...
- *
- *  Where each Byte is a chunk type
- *  extension supported so for example
- *  to support all chunks one would have (in hex):
- *
- *  80 01 00 09
- *  C0 C1 80 81
- *  82 00 00 00
- *
- *  Has the parameter.
- *   C0 = PR-SCTP    (RFC3758)
- *   C1, 80 = ASCONF (addip draft)
- *   81 = Packet Drop
- *   82 = Stream Reset
- */
-
-/* draft-ietf-tsvwg-prsctp */
-#define SCTP_SUPPORTED_CHUNK_EXT    0x8008
-
-/* number of extensions we support */
-#define SCTP_EXT_COUNT 5       /* num of extensions we support chunk wise */
-#define SCTP_PAD_EXT_COUNT 3    /* num of pad bytes needed to get to 32 bit boundary */
-
-
-#define SCTP_PRSCTP_SUPPORTED      0xc000
-/* draft-ietf-tsvwg-addip-sctp */
-#define SCTP_ADD_IP_ADDRESS        0xc001
-#define SCTP_DEL_IP_ADDRESS        0xc002
-#define SCTP_ERROR_CAUSE_IND       0xc003
-#define SCTP_SET_PRIM_ADDR         0xc004
-#define SCTP_SUCCESS_REPORT        0xc005
-#define SCTP_ULP_ADAPTION          0xc006
-
-/* Notification error codes */
-#define SCTP_NOTIFY_DATAGRAM_UNSENT    0x0001
-#define SCTP_NOTIFY_DATAGRAM_SENT      0x0002
-#define SCTP_FAILED_THRESHOLD          0x0004
-#define SCTP_HEARTBEAT_SUCCESS         0x0008
-#define SCTP_RESPONSE_TO_USER_REQ      0x000f
-#define SCTP_INTERNAL_ERROR            0x0010
-#define SCTP_SHUTDOWN_GUARD_EXPIRES    0x0020
-#define SCTP_RECEIVED_SACK             0x0040
-#define SCTP_PEER_FAULTY               0x0080
-
-/* Error causes used in SCTP op-err's and aborts */
-#define SCTP_CAUSE_INV_STRM            0x001
-#define SCTP_CAUSE_MISS_PARAM          0x002
-#define SCTP_CAUSE_STALE_COOKIE                0x003
-#define SCTP_CAUSE_OUT_OF_RESC         0x004
-#define SCTP_CAUSE_UNRESOLV_ADDR       0x005
-#define SCTP_CAUSE_UNRECOG_CHUNK       0x006
-#define SCTP_CAUSE_INVALID_PARAM       0x007
-/* This one is also the same as SCTP_UNRECOG_PARAM above */
-#define SCTP_CAUSE_UNRECOG_PARAM       0x008
-#define SCTP_CAUSE_NOUSER_DATA         0x009
-#define SCTP_CAUSE_COOKIE_IN_SHUTDOWN  0x00a
-#define SCTP_CAUSE_RESTART_W_NEWADDR   0x00b
-#define SCTP_CAUSE_USER_INITIATED_ABT  0x00c
-#define SCTP_CAUSE_PROTOCOL_VIOLATION  0x00d
-
-/* Error's from add ip */
-#define SCTP_CAUSE_DELETEING_LAST_ADDR 0x100
-#define SCTP_CAUSE_OPERATION_REFUSED   0x101
-#define SCTP_CAUSE_DELETING_SRC_ADDR   0x102
-#define SCTP_CAUSE_ILLEGAL_ASCONF      0x103
-
-/* bits for TOS field */
-#define SCTP_ECT0_BIT          0x02
-#define SCTP_ECT1_BIT          0x01
-#define SCTP_CE_BITS           0x03
-
-/* below turns off above */
-#define SCTP_FLEXIBLE_ADDRESS  0x20
-#define SCTP_NO_HEARTBEAT      0x40
-
-/* mask to get sticky */
-#define SCTP_STICKY_OPTIONS_MASK       0x0c
-
-/* MTU discovery flags */
-#define SCTP_DONT_FRAGMENT     0x0100
-#define SCTP_FRAGMENT_OK       0x0200
-#define SCTP_PR_SCTP_ENABLED   0x0400
-#define SCTP_PR_SCTP_BUFFER    0x0800
-
-/* Chunk flags */
-#define SCTP_WINDOW_PROBE      0x01
-
-/*
- * SCTP states for internal state machine
- * XXX (should match "user" values)
- */
-#define SCTP_STATE_EMPTY               0x0000
-#define SCTP_STATE_INUSE               0x0001
-#define SCTP_STATE_COOKIE_WAIT         0x0002
-#define SCTP_STATE_COOKIE_ECHOED       0x0004
-#define SCTP_STATE_OPEN                        0x0008
-#define SCTP_STATE_SHUTDOWN_SENT       0x0010
-#define SCTP_STATE_SHUTDOWN_RECEIVED   0x0020
-#define SCTP_STATE_SHUTDOWN_ACK_SENT   0x0040
-#define SCTP_STATE_SHUTDOWN_PENDING    0x0080
-#define SCTP_STATE_CLOSED_SOCKET       0x0100
-#define SCTP_STATE_MASK                        0x007f
-
-#define SCTP_GET_STATE(asoc)   ((asoc)->state & SCTP_STATE_MASK)
-
-/* SCTP reachability state for each address */
-#define SCTP_ADDR_REACHABLE            0x001
-#define SCTP_ADDR_NOT_REACHABLE                0x002
-#define SCTP_ADDR_NOHB                 0x004
-#define SCTP_ADDR_BEING_DELETED                0x008
-#define SCTP_ADDR_NOT_IN_ASSOC         0x010
-#define SCTP_ADDR_WAS_PRIMARY          0x020
-#define SCTP_ADDR_SWITCH_PRIMARY       0x040
-#define SCTP_ADDR_OUT_OF_SCOPE         0x080
-#define SCTP_ADDR_DOUBLE_SWITCH                0x100
-#define SCTP_ADDR_UNCONFIRMED          0x200
-
-#define SCTP_REACHABLE_MASK            0x203
-
-/* bound address types (e.g. valid address types to allow) */
-#define SCTP_BOUND_V6          0x01
-#define SCTP_BOUND_V4          0x02
-
-/* How long a cookie lives in seconds */
-#define SCTP_DEFAULT_COOKIE_LIFE       60
-
-/* resource limit of streams */
-#define MAX_SCTP_STREAMS       2048
-
-/* Maximum the mapping array will  grow to (TSN mapping array) */
-#define SCTP_MAPPING_ARRAY     512
-
-/* size of the inital malloc on the mapping array */
-#define SCTP_INITIAL_MAPPING_ARRAY  16
-/* how much we grow the mapping array each call */
-#define SCTP_MAPPING_ARRAY_INCR     32
-
-/*
- * Here we define the timer types used by the implementation
- * as arguments in the set/get timer type calls.
- */
-#define SCTP_TIMER_INIT        0
-#define SCTP_TIMER_RECV        1
-#define SCTP_TIMER_SEND        2
-#define SCTP_TIMER_HEARTBEAT   3
-#define SCTP_TIMER_PMTU                4
-#define SCTP_TIMER_MAXSHUTDOWN 5
-#define SCTP_TIMER_SIGNATURE   6
-/*
- * number of timer types in the base SCTP structure used in
- * the set/get and has the base default.
- */
-#define SCTP_NUM_TMRS  7
-
-/* timer types */
-#define SCTP_TIMER_TYPE_NONE           0
-#define SCTP_TIMER_TYPE_SEND           1
-#define SCTP_TIMER_TYPE_INIT           2
-#define SCTP_TIMER_TYPE_RECV           3
-#define SCTP_TIMER_TYPE_SHUTDOWN       4
-#define SCTP_TIMER_TYPE_HEARTBEAT      5
-#define SCTP_TIMER_TYPE_COOKIE         6
-#define SCTP_TIMER_TYPE_NEWCOOKIE      7
-#define SCTP_TIMER_TYPE_PATHMTURAISE   8
-#define SCTP_TIMER_TYPE_SHUTDOWNACK    9
-#define SCTP_TIMER_TYPE_ASCONF         10
-#define SCTP_TIMER_TYPE_SHUTDOWNGUARD  11
-#define SCTP_TIMER_TYPE_AUTOCLOSE      12
-#define SCTP_TIMER_TYPE_EVENTWAKE      13
-#define SCTP_TIMER_TYPE_STRRESET        14
-#define SCTP_TIMER_TYPE_INPKILL         15
-
-/*
- * Number of ticks before the soxwakeup() event that
- * is delayed is sent AFTER the accept() call
- */
-#define SCTP_EVENTWAKEUP_WAIT_TICKS    3000
-
-/*
- * Of course we really don't collect stale cookies, being folks
- * of decerning taste. However we do count them, if we get too
- * many before the association comes up.. we give up. Below is
- * the constant that dictates when we give it up...this is a
- * implemenation dependent treatment. In ours we do not ask for
- * a extension of time, but just retry this many times...
- */
-#define SCTP_MAX_STALE_COOKIES_I_COLLECT 10
-
-/* max number of TSN's dup'd that I will hold */
-#define SCTP_MAX_DUP_TSNS      20
-
-#define SCTP_TIMER_TYPE_ITERATOR        16
-/*
- * Here we define the types used when setting the retry amounts.
- */
-/* constants for type of set */
-#define SCTP_MAXATTEMPT_INIT   2
-#define SCTP_MAXATTEMPT_SEND   3
-
-/* Maximum TSN's we will summarize in a drop report */
-
-#define SCTP_MAX_DROP_REPORT 16
-
-/* How many drop re-attempts we make on  INIT/COOKIE-ECHO */
-#define SCTP_RETRY_DROPPED_THRESH 4
-
-/* And the max we will keep a history of in the tcb
- * which MUST be lower than 256.
- */
-
-#define SCTP_MAX_DROP_SAVE_REPORT 16
-
-/*
- * Here we define the default timers and the default number
- * of attemts we make for each respective side (send/init).
- */
-
-/* Maxmium number of chunks a single association can have
- * on it. Note that this is a squishy number since
- * the count can run over this if the user sends a large
- * message down .. the fragmented chunks don't count until
- * AFTER the message is on queue.. it would be the next
- * send that blocks things. This number will get tuned
- * up at boot in the sctp_init and use the number
- * of clusters as a base. This way high bandwidth
- * environments will not get impacted by the lower
- * bandwidth sending a bunch of 1 byte chunks
- */
-#define SCTP_ASOC_MAX_CHUNKS_ON_QUEUE 512
-
-#define MSEC_TO_TICKS(x) (((x) * hz) / 1000)
-#define TICKS_TO_MSEC(x) (((x) * 1000) / hz)
-#define SEC_TO_TICKS(x) ((x) * hz)
-
-/* init timer def = 1 sec */
-#define SCTP_INIT_SEC  1
-
-/* send timer def = 1 seconds */
-#define SCTP_SEND_SEC  1
-
-/* recv timer def = 200ms  */
-#define SCTP_RECV_MSEC 200
-
-/* 30 seconds + RTO (in ms) */
-#define SCTP_HB_DEFAULT_MSEC   30000
-
-/* Max time I will wait for Shutdown to complete */
-#define SCTP_DEF_MAX_SHUTDOWN_SEC 180
-
-
-/* This is how long a secret lives, NOT how long a cookie lives
- * how many ticks the current secret will live.
- */
-#define SCTP_DEFAULT_SECRET_LIFE_SEC 3600
-
-#define SCTP_RTO_UPPER_BOUND   (60000) /* 60 sec in ms */
-#define SCTP_RTO_UPPER_BOUND_SEC 60    /* for the init timer */
-#define SCTP_RTO_LOWER_BOUND   (1000)  /* 1 sec in ms */
-#define SCTP_RTO_INITIAL       (3000)  /* 3 sec in ms */
-
-
-#define SCTP_INP_KILL_TIMEOUT 1000 /* number of ms to retry kill of inpcb*/
-
-#define SCTP_DEF_MAX_INIT      8
-#define SCTP_DEF_MAX_SEND      10
-
-#define SCTP_DEF_PMTU_RAISE_SEC        600  /* 10 min between raise attempts */
-#define SCTP_DEF_PMTU_MIN      600
-
-#define SCTP_MSEC_IN_A_SEC     1000
-#define SCTP_USEC_IN_A_SEC     1000000
-#define SCTP_NSEC_IN_A_SEC     1000000000
-
-#define SCTP_MAX_OUTSTANDING_DG        10000
-
-/* How many streams I request initally by default */
-#define SCTP_OSTREAM_INITIAL 10
-
-#define SCTP_SEG_TO_RWND_UPD 32 /* How many smallest_mtu's need to increase before
-                                 * a window update sack is sent (should be a
-                                 * power of 2).
-                                 */
-#define SCTP_SCALE_OF_RWND_TO_UPD       4       /* Incr * this > hiwat, send
-                                                 * window update. Should be a
-                                                 * power of 2.
-                                                 */
-#define SCTP_MINIMAL_RWND              (4096) /* minimal rwnd */
-
-#define SCTP_ADDRMAX           20
-
-
-/* SCTP DEBUG Switch parameters */
-#define SCTP_DEBUG_TIMER1      0x00000001
-#define SCTP_DEBUG_TIMER2      0x00000002
-#define SCTP_DEBUG_TIMER3      0x00000004
-#define SCTP_DEBUG_TIMER4      0x00000008
-#define SCTP_DEBUG_OUTPUT1     0x00000010
-#define SCTP_DEBUG_OUTPUT2     0x00000020
-#define SCTP_DEBUG_OUTPUT3     0x00000040
-#define SCTP_DEBUG_OUTPUT4     0x00000080
-#define SCTP_DEBUG_UTIL1       0x00000100
-#define SCTP_DEBUG_UTIL2       0x00000200
-#define SCTP_DEBUG_INPUT1      0x00001000
-#define SCTP_DEBUG_INPUT2      0x00002000
-#define SCTP_DEBUG_INPUT3      0x00004000
-#define SCTP_DEBUG_INPUT4      0x00008000
-#define SCTP_DEBUG_ASCONF1     0x00010000
-#define SCTP_DEBUG_ASCONF2     0x00020000
-#define SCTP_DEBUG_OUTPUT5     0x00040000
-#define SCTP_DEBUG_PCB1                0x00100000
-#define SCTP_DEBUG_PCB2                0x00200000
-#define SCTP_DEBUG_PCB3                0x00400000
-#define SCTP_DEBUG_PCB4                0x00800000
-#define SCTP_DEBUG_INDATA1     0x01000000
-#define SCTP_DEBUG_INDATA2     0x02000000
-#define SCTP_DEBUG_INDATA3     0x04000000
-#define SCTP_DEBUG_INDATA4     0x08000000
-#define SCTP_DEBUG_USRREQ1     0x10000000
-#define SCTP_DEBUG_USRREQ2     0x20000000
-#define SCTP_DEBUG_PEEL1       0x40000000
-#define SCTP_DEBUG_ALL         0x7ff3f3ff
-#define SCTP_DEBUG_NOISY       0x00040000
-
-/* What sender needs to see to avoid SWS or we consider peers rwnd 0 */
-#define SCTP_SWS_SENDER_DEF    1420
-
-/*
- * SWS is scaled to the sb_hiwat of the socket.
- * A value of 2 is hiwat/4, 1 would be hiwat/2 etc.
- */
-/* What receiver needs to see in sockbuf or we tell peer its 1 */
-#define SCTP_SWS_RECEIVER_DEF  3000
-
-
-#define SCTP_INITIAL_CWND 4380
-
-/* amount peer is obligated to have in rwnd or I will abort */
-#define SCTP_MIN_RWND  1500
-
-#define SCTP_WINDOW_MIN        1500    /* smallest rwnd can be */
-#define SCTP_WINDOW_MAX 1048576        /* biggest I can grow rwnd to
-                                * My playing around suggests a
-                                * value greater than 64k does not
-                                * do much, I guess via the kernel
-                                * limitations on the stream/socket.
-                                */
-
-#define SCTP_MAX_BUNDLE_UP     256     /* max number of chunks to bundle */
-
-/*  I can handle a 1meg re-assembly */
-#define SCTP_DEFAULT_MAXMSGREASM 1048576
-
-#define SCTP_DEFAULT_MAXSEGMENT 65535
-
-#define DEFAULT_CHUNK_BUFFER   2048
-#define DEFAULT_PARAM_BUFFER   512
-
-#define SCTP_DEFAULT_MINSEGMENT 512    /* MTU size ... if no mtu disc */
-#define SCTP_HOW_MANY_SECRETS  2       /* how many secrets I keep */
-
-#define SCTP_NUMBER_OF_SECRETS 8       /* or 8 * 4 = 32 octets */
-#define SCTP_SECRET_SIZE       32      /* number of octets in a 256 bits */
-
-#ifdef USE_MD5
-#define SCTP_SIGNATURE_SIZE    16      /* size of a MD5 signature */
-#else
-#define SCTP_SIGNATURE_SIZE    20      /* size of a SLA-1 signature */
-#endif /* USE_MD5 */
-
-#define SCTP_SIGNATURE_ALOC_SIZE 20
-
-/*
- * SCTP upper layer notifications
- */
-#define SCTP_NOTIFY_ASSOC_UP           1
-#define SCTP_NOTIFY_ASSOC_DOWN         2
-#define SCTP_NOTIFY_INTERFACE_DOWN     3
-#define SCTP_NOTIFY_INTERFACE_UP       4
-#define SCTP_NOTIFY_DG_FAIL            5
-#define SCTP_NOTIFY_STRDATA_ERR        6
-#define SCTP_NOTIFY_ASSOC_ABORTED      7
-#define SCTP_NOTIFY_PEER_OPENED_STREAM 8
-#define SCTP_NOTIFY_STREAM_OPENED_OK   9
-#define SCTP_NOTIFY_ASSOC_RESTART      10
-#define SCTP_NOTIFY_HB_RESP             11
-#define SCTP_NOTIFY_ASCONF_SUCCESS     12
-#define SCTP_NOTIFY_ASCONF_FAILED      13
-#define SCTP_NOTIFY_PEER_SHUTDOWN      14
-#define SCTP_NOTIFY_ASCONF_ADD_IP      15
-#define SCTP_NOTIFY_ASCONF_DELETE_IP   16
-#define SCTP_NOTIFY_ASCONF_SET_PRIMARY 17
-#define SCTP_NOTIFY_PARTIAL_DELVIERY_INDICATION 18
-#define SCTP_NOTIFY_ADAPTION_INDICATION         19
-#define SCTP_NOTIFY_INTERFACE_CONFIRMED 20
-#define SCTP_NOTIFY_STR_RESET_RECV      21
-#define SCTP_NOTIFY_STR_RESET_SEND      22
-#define SCTP_NOTIFY_MAX                        22
-
-
-
-
-
-/* clock variance is 10ms */
-#define SCTP_CLOCK_GRANULARITY 10
-
-#define IP_HDR_SIZE 40         /* we use the size of a IP6 header here
-                                * this detracts a small amount for ipv4
-                                * but it simplifies the ipv6 addition
-                                */
-
-#ifndef IPPROTO_SCTP
-#define IPPROTO_SCTP 132       /* the Official IANA number :-) */
-#endif /* !IPPROTO_SCTP */
-
-#define SCTP_MAX_DATA_BUNDLING         256
-#define SCTP_MAX_CONTROL_BUNDLING      20
-
-/* modular comparison */
-/* True if a > b (mod = M) */
-#define compare_with_wrap(a, b, M) (((a > b) && ((a - b) < ((M >> 1) + 1))) || \
-              ((b > a) && ((b - a) > ((M >> 1) + 1))))
-
-
-/* Mapping array manipulation routines */
-#define SCTP_IS_TSN_PRESENT(arry, gap) ((arry[(gap >> 3)] >> (gap & 0x07)) & 0x01)
-#define SCTP_SET_TSN_PRESENT(arry, gap) (arry[(gap >> 3)] |= (0x01 << ((gap & 0x07))))
-#define SCTP_UNSET_TSN_PRESENT(arry, gap) (arry[(gap >> 3)] &= ((~(0x01 << ((gap & 0x07)))) & 0xff))
-
-/* pegs */
-#define SCTP_NUMBER_OF_PEGS    96
-/* peg index's */
-#define SCTP_PEG_SACKS_SEEN    0
-#define SCTP_PEG_SACKS_SENT    1
-#define SCTP_PEG_TSNS_SENT     2
-#define SCTP_PEG_TSNS_RCVD     3
-#define SCTP_DATAGRAMS_SENT    4
-#define SCTP_DATAGRAMS_RCVD    5
-#define SCTP_RETRANTSN_SENT    6
-#define SCTP_DUPTSN_RECVD      7
-#define SCTP_HB_RECV           8
-#define SCTP_HB_ACK_RECV       9
-#define SCTP_HB_SENT           10
-#define SCTP_WINDOW_PROBES     11
-#define SCTP_DATA_DG_RECV      12
-#define SCTP_TMIT_TIMER                13
-#define SCTP_RECV_TIMER                14
-#define SCTP_HB_TIMER          15
-#define SCTP_FAST_RETRAN       16
-#define SCTP_TIMERS_EXP                17
-#define SCTP_FR_INAWINDOW      18
-#define SCTP_RWND_BLOCKED      19
-#define SCTP_CWND_BLOCKED      20
-#define SCTP_RWND_DROPS                21
-#define SCTP_BAD_STRMNO                22
-#define SCTP_BAD_SSN_WRAP      23
-#define SCTP_DROP_NOMEMORY     24
-#define SCTP_DROP_FRAG         25
-#define SCTP_BAD_VTAGS         26
-#define SCTP_BAD_CSUM          27
-#define SCTP_INPKTS            28
-#define SCTP_IN_MCAST          29
-#define SCTP_HDR_DROPS         30
-#define SCTP_NOPORTS           31
-#define SCTP_CWND_NOFILL       32
-#define SCTP_CALLS_TO_CO       33
-#define SCTP_CO_NODATASNT      34
-#define SCTP_CWND_NOUSE_SS     35
-#define SCTP_MAX_BURST_APL     36
-#define SCTP_EXPRESS_ROUTE     37
-#define SCTP_NO_COPY_IN                38
-#define SCTP_CACHED_SRC                39
-#define SCTP_CWND_NOCUM                40
-#define SCTP_CWND_SS           41
-#define SCTP_CWND_CA           42
-#define SCTP_CWND_SKIP         43
-#define SCTP_CWND_NOUSE_CA     44
-#define SCTP_MAX_CWND          45
-#define SCTP_CWND_DIFF_CA      46
-#define SCTP_CWND_DIFF_SA      47
-#define SCTP_OQS_AT_SS         48
-#define SCTP_SQQ_AT_SS         49
-#define SCTP_OQS_AT_CA         50
-#define SCTP_SQQ_AT_CA         51
-#define SCTP_MOVED_MTU         52
-#define SCTP_MOVED_QMAX                53
-#define SCTP_SQC_AT_SS         54
-#define SCTP_SQC_AT_CA         55
-#define SCTP_MOVED_MAX         56
-#define SCTP_MOVED_NLEF                57
-#define SCTP_NAGLE_NOQ         58
-#define SCTP_NAGLE_OFF         59
-#define SCTP_OUTPUT_FRM_SND    60
-#define SCTP_SOS_NOSNT         61
-#define SCTP_NOS_NOSNT         62
-#define SCTP_SOSE_NOSNT                63
-#define SCTP_NOSE_NOSNT                64
-#define SCTP_DATA_OUT_ERR      65
-#define SCTP_DUP_SSN_RCVD      66
-#define SCTP_DUP_FR            67
-#define SCTP_VTAG_EXPR         68
-#define SCTP_VTAG_BOGUS                69
-#define SCTP_T3_SAFEGRD                70
-#define SCTP_PDRP_FMBOX                71
-#define SCTP_PDRP_FEHOS                72
-#define SCTP_PDRP_MB_DA                73
-#define SCTP_PDRP_MB_CT                74
-#define SCTP_PDRP_BWRPT                75
-#define SCTP_PDRP_CRUPT                76
-#define SCTP_PDRP_NEDAT                77
-#define SCTP_PDRP_PDBRK                78
-#define SCTP_PDRP_TSNNF                79
-#define SCTP_PDRP_DNFND                80
-#define SCTP_PDRP_DIWNP                81
-#define SCTP_PDRP_DIZRW                82
-#define SCTP_PDRP_BADD         83
-#define SCTP_PDRP_MARK         84
-#define SCTP_ECNE_RCVD         85
-#define SCTP_CWR_PERFO         86
-#define SCTP_ECNE_SENT         87
-#define SCTP_MSGC_DROP         88
-#define SCTP_SEND_QUEUE_POP    89
-#define SCTP_ERROUT_FRM_USR    90
-#define SCTP_SENDTO_FULL_CWND  91
-#define SCTP_QUEONLY_BURSTLMT   92
-#define SCTP_IFP_QUEUE_FULL     93
-#define SCTP_RESV2              94
-#define SCTP_RESV3              95
-
-/*
- * This value defines the number of vtag block time wait entry's
- * per list element.  Each entry will take 2 4 byte ints (and of
- * course the overhead of the next pointer as well). Using 15 as
- * an example will yield * ((8 * 15) + 8) or 128 bytes of overhead
- * for each timewait block that gets initialized. Increasing it to
- * 31 would yeild 256 bytes per block.
- */
-/* Undef the following turns on per EP behavior */
-#define SCTP_VTAG_TIMEWAIT_PER_STACK 1
-#ifdef SCTP_VTAG_TIMEWAIT_PER_STACK
-#define SCTP_NUMBER_IN_VTAG_BLOCK 15
-#else
-/* The hash list is smaller if we are on a ep basis */
-#define SCTP_NUMBER_IN_VTAG_BLOCK 3
-#endif
-/*
- * If we use the STACK option, we have an array of this size head
- * pointers. This array is mod'd the with the size to find which
- * bucket and then all entries must be searched to see if the tag
- * is in timed wait. If so we reject it.
- */
-#define SCTP_STACK_VTAG_HASH_SIZE 31
-
-/*
- * If we use the per-endpoint model than we do not have a hash
- * table of entries but instead have a single head pointer and
- * we must crawl through the entire list.
- */
-
-/*
- * Number of seconds of time wait, tied to MSL value (2 minutes),
- * so 2 * MSL = 4 minutes or 480 seconds.
- */
-#define SCTP_TIME_WAIT 480
-
-#define IN4_ISPRIVATE_ADDRESS(a) \
-   ((((u_char *)&(a)->s_addr)[0] == 10) || \
-    ((((u_char *)&(a)->s_addr)[0] == 172) && \
-     (((u_char *)&(a)->s_addr)[1] >= 16) && \
-     (((u_char *)&(a)->s_addr)[1] <= 32)) || \
-    ((((u_char *)&(a)->s_addr)[0] == 192) && \
-     (((u_char *)&(a)->s_addr)[1] == 168)))
-
-#define IN4_ISLOOPBACK_ADDRESS(a) \
-    ((((u_char *)&(a)->s_addr)[0] == 127) && \
-     (((u_char *)&(a)->s_addr)[1] == 0) && \
-     (((u_char *)&(a)->s_addr)[2] == 0) && \
-     (((u_char *)&(a)->s_addr)[3] == 1))
-
-
-#if defined(_KERNEL) || (defined(__APPLE__) && defined(KERNEL))
-
-#if defined(__FreeBSD__) || defined(__APPLE__) || defined(__DragonFly__)
-#define SCTP_GETTIME_TIMEVAL(x)        (microuptime(x))
-#define SCTP_GETTIME_TIMESPEC(x) (nanouptime(x))
-#else
-#define SCTP_GETTIME_TIMEVAL(x)        (microtime(x))
-#define SCTP_GETTIME_TIMESPEC(x) (nanotime(x))
-#endif /* __FreeBSD__ */
-
-#define sctp_sowwakeup(inp, so) \
-do { \
-       if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \
-               inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEOUTPUT; \
-       } else { \
-               sowwakeup(so); \
-       } \
-} while (0)
-
-#define sctp_sorwakeup(inp, so) \
-do { \
-       if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) { \
-               inp->sctp_flags |= SCTP_PCB_FLAGS_WAKEINPUT; \
-       } else { \
-               sorwakeup(so); \
-       } \
-} while (0)
-
-#endif /* _KERNEL */
-#endif
diff --git a/sys/netinet/sctp_crc32.c b/sys/netinet/sctp_crc32.c
deleted file mode 100644 (file)
index 02a526c..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-/*     $KAME: sctp_crc32.c,v 1.11 2004/08/17 04:06:16 itojun Exp $     */
-/*     $DragonFly: src/sys/netinet/sctp_crc32.c,v 1.1 2005/07/15 14:46:16 eirikn Exp $ */
-
-/*
- * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Cisco Systems, Inc.
- * 4. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#ifdef __APPLE__
-#include <sctp.h>
-#elif !defined(__OpenBSD__)
-#include "opt_sctp.h"
-#endif
-#include <sys/param.h>
-#include <netinet/sctp_crc32.h>
-
-#ifndef SCTP_USE_ADLER32
-
-#define SCTP_CRC32C_POLY 0x1EDC6F41
-#define SCTP_CRC32C(c, d) (c = ((c) >> 8) ^ sctp_crc_c[((c) ^ (d)) & 0xFF])
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-/* Copyright 2001, D. Otis.  Use this program, code or tables    */
-/* extracted from it, as desired without restriction.            */
-/*                                                               */
-/* 32 Bit Reflected CRC table generation for SCTP.               */
-/* To accommodate serial byte data being shifted out least       */
-/* significant bit first, the table's 32 bit words are reflected */
-/* which flips both byte and bit MS and LS positions.  The CRC   */
-/* is calculated MS bits first from the perspective of the serial*/
-/* stream.  The x^32 term is implied and the x^0 term may also   */
-/* be shown as +1.  The polynomial code used is 0x1EDC6F41.      */
-/* Castagnoli93                                                  */
-/* x^32+x^28+x^27+x^26+x^25+x^23+x^22+x^20+x^19+x^18+x^14+x^13+  */
-/* x^11+x^10+x^9+x^8+x^6+x^0                                     */
-/* Guy Castagnoli Stefan Braeuer and Martin Herrman              */
-/* "Optimization of Cyclic Redundancy-Check Codes                */
-/* with 24 and 32 Parity Bits",                                  */
-/* IEEE Transactions on Communications, Vol.41, No.6, June 1993  */
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-unsigned long  sctp_crc_c[256] = {
-       0x00000000L, 0xF26B8303L, 0xE13B70F7L, 0x1350F3F4L,
-       0xC79A971FL, 0x35F1141CL, 0x26A1E7E8L, 0xD4CA64EBL,
-       0x8AD958CFL, 0x78B2DBCCL, 0x6BE22838L, 0x9989AB3BL,
-       0x4D43CFD0L, 0xBF284CD3L, 0xAC78BF27L, 0x5E133C24L,
-       0x105EC76FL, 0xE235446CL, 0xF165B798L, 0x030E349BL,
-       0xD7C45070L, 0x25AFD373L, 0x36FF2087L, 0xC494A384L,
-       0x9A879FA0L, 0x68EC1CA3L, 0x7BBCEF57L, 0x89D76C54L,
-       0x5D1D08BFL, 0xAF768BBCL, 0xBC267848L, 0x4E4DFB4BL,
-       0x20BD8EDEL, 0xD2D60DDDL, 0xC186FE29L, 0x33ED7D2AL,
-       0xE72719C1L, 0x154C9AC2L, 0x061C6936L, 0xF477EA35L,
-       0xAA64D611L, 0x580F5512L, 0x4B5FA6E6L, 0xB93425E5L,
-       0x6DFE410EL, 0x9F95C20DL, 0x8CC531F9L, 0x7EAEB2FAL,
-       0x30E349B1L, 0xC288CAB2L, 0xD1D83946L, 0x23B3BA45L,
-       0xF779DEAEL, 0x05125DADL, 0x1642AE59L, 0xE4292D5AL,
-       0xBA3A117EL, 0x4851927DL, 0x5B016189L, 0xA96AE28AL,
-       0x7DA08661L, 0x8FCB0562L, 0x9C9BF696L, 0x6EF07595L,
-       0x417B1DBCL, 0xB3109EBFL, 0xA0406D4BL, 0x522BEE48L,
-       0x86E18AA3L, 0x748A09A0L, 0x67DAFA54L, 0x95B17957L,
-       0xCBA24573L, 0x39C9C670L, 0x2A993584L, 0xD8F2B687L,
-       0x0C38D26CL, 0xFE53516FL, 0xED03A29BL, 0x1F682198L,
-       0x5125DAD3L, 0xA34E59D0L, 0xB01EAA24L, 0x42752927L,
-       0x96BF4DCCL, 0x64D4CECFL, 0x77843D3BL, 0x85EFBE38L,
-       0xDBFC821CL, 0x2997011FL, 0x3AC7F2EBL, 0xC8AC71E8L,
-       0x1C661503L, 0xEE0D9600L, 0xFD5D65F4L, 0x0F36E6F7L,
-       0x61C69362L, 0x93AD1061L, 0x80FDE395L, 0x72966096L,
-       0xA65C047DL, 0x5437877EL, 0x4767748AL, 0xB50CF789L,
-       0xEB1FCBADL, 0x197448AEL, 0x0A24BB5AL, 0xF84F3859L,
-       0x2C855CB2L, 0xDEEEDFB1L, 0xCDBE2C45L, 0x3FD5AF46L,
-       0x7198540DL, 0x83F3D70EL, 0x90A324FAL, 0x62C8A7F9L,
-       0xB602C312L, 0x44694011L, 0x5739B3E5L, 0xA55230E6L,
-       0xFB410CC2L, 0x092A8FC1L, 0x1A7A7C35L, 0xE811FF36L,
-       0x3CDB9BDDL, 0xCEB018DEL, 0xDDE0EB2AL, 0x2F8B6829L,
-       0x82F63B78L, 0x709DB87BL, 0x63CD4B8FL, 0x91A6C88CL,
-       0x456CAC67L, 0xB7072F64L, 0xA457DC90L, 0x563C5F93L,
-       0x082F63B7L, 0xFA44E0B4L, 0xE9141340L, 0x1B7F9043L,
-       0xCFB5F4A8L, 0x3DDE77ABL, 0x2E8E845FL, 0xDCE5075CL,
-       0x92A8FC17L, 0x60C37F14L, 0x73938CE0L, 0x81F80FE3L,
-       0x55326B08L, 0xA759E80BL, 0xB4091BFFL, 0x466298FCL,
-       0x1871A4D8L, 0xEA1A27DBL, 0xF94AD42FL, 0x0B21572CL,
-       0xDFEB33C7L, 0x2D80B0C4L, 0x3ED04330L, 0xCCBBC033L,
-       0xA24BB5A6L, 0x502036A5L, 0x4370C551L, 0xB11B4652L,
-       0x65D122B9L, 0x97BAA1BAL, 0x84EA524EL, 0x7681D14DL,
-       0x2892ED69L, 0xDAF96E6AL, 0xC9A99D9EL, 0x3BC21E9DL,
-       0xEF087A76L, 0x1D63F975L, 0x0E330A81L, 0xFC588982L,
-       0xB21572C9L, 0x407EF1CAL, 0x532E023EL, 0xA145813DL,
-       0x758FE5D6L, 0x87E466D5L, 0x94B49521L, 0x66DF1622L,
-       0x38CC2A06L, 0xCAA7A905L, 0xD9F75AF1L, 0x2B9CD9F2L,
-       0xFF56BD19L, 0x0D3D3E1AL, 0x1E6DCDEEL, 0xEC064EEDL,
-       0xC38D26C4L, 0x31E6A5C7L, 0x22B65633L, 0xD0DDD530L,
-       0x0417B1DBL, 0xF67C32D8L, 0xE52CC12CL, 0x1747422FL,
-       0x49547E0BL, 0xBB3FFD08L, 0xA86F0EFCL, 0x5A048DFFL,
-       0x8ECEE914L, 0x7CA56A17L, 0x6FF599E3L, 0x9D9E1AE0L,
-       0xD3D3E1ABL, 0x21B862A8L, 0x32E8915CL, 0xC083125FL,
-       0x144976B4L, 0xE622F5B7L, 0xF5720643L, 0x07198540L,
-       0x590AB964L, 0xAB613A67L, 0xB831C993L, 0x4A5A4A90L,
-       0x9E902E7BL, 0x6CFBAD78L, 0x7FAB5E8CL, 0x8DC0DD8FL,
-       0xE330A81AL, 0x115B2B19L, 0x020BD8EDL, 0xF0605BEEL,
-       0x24AA3F05L, 0xD6C1BC06L, 0xC5914FF2L, 0x37FACCF1L,
-       0x69E9F0D5L, 0x9B8273D6L, 0x88D28022L, 0x7AB90321L,
-       0xAE7367CAL, 0x5C18E4C9L, 0x4F48173DL, 0xBD23943EL,
-       0xF36E6F75L, 0x0105EC76L, 0x12551F82L, 0xE03E9C81L,
-       0x34F4F86AL, 0xC69F7B69L, 0xD5CF889DL, 0x27A40B9EL,
-       0x79B737BAL, 0x8BDCB4B9L, 0x988C474DL, 0x6AE7C44EL,
-       0xBE2DA0A5L, 0x4C4623A6L, 0x5F16D052L, 0xAD7D5351L,
-};
-
-u_int32_t
-update_crc32(u_int32_t crc32,
-            unsigned char *buffer,
-            unsigned int length)
-{
-       unsigned int i;
-
-       for (i = 0; i < length; i++) {
-               SCTP_CRC32C(crc32, buffer[i]);
-       }
-       return (crc32);
-}
-
-
-u_int32_t
-sctp_csum_finalize(u_int32_t crc32)
-{
-       u_int32_t result;
-#if BYTE_ORDER == BIG_ENDIAN
-       u_int8_t byte0, byte1, byte2, byte3;
-#endif
-       /* Complement the result */
-       result = ~crc32;
-#if BYTE_ORDER == BIG_ENDIAN
-       /*
-        * For BIG-ENDIAN.. aka Motorola byte order the result is in
-        * little-endian form. So we must manually swap the bytes. Then
-        * we can call htonl() which does nothing...
-        */
-       byte0 = result & 0x000000ff;
-       byte1 = (result >> 8) & 0x000000ff;
-       byte2 = (result >> 16) & 0x000000ff;
-       byte3 = (result >> 24) & 0x000000ff;
-       result = ((byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3);
-       crc32 = htonl(result);
-#else
-       /*
-        * For INTEL platforms the result comes out in network order.
-        * No htonl is required or the swap above. So we optimize out
-        * both the htonl and the manual swap above.
-        */
-       crc32 = result;
-#endif
-       return (crc32);
-}
-
-#endif
diff --git a/sys/netinet/sctp_crc32.h b/sys/netinet/sctp_crc32.h
deleted file mode 100644 (file)
index 97830c7..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*     $KAME: sctp_crc32.h,v 1.4 2003/11/25 06:40:52 ono Exp $ */
-/*     $DragonFly: src/sys/netinet/sctp_crc32.h,v 1.2 2006/05/20 02:42:12 dillon Exp $ */
-
-#ifndef _NETINET_SCTP_CRC32_H_
-#define _NETINET_SCTP_CRC32_H_
-
-/*
- * Copyright (c) 2001, 2002, 2004 Cisco Systems, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Cisco Systems, Inc.
- * 4. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _SYS_TYPES_H_
-#include <sys/types.h>
-#endif
-
-#ifndef SCTP_USE_ADLER32
-#if defined(_KERNEL) || (defined(__APPLE__) && defined(KERNEL))
-u_int32_t update_crc32(u_int32_t, unsigned char *, unsigned int);
-
-u_int32_t sctp_csum_finalize(u_int32_t);
-
-#endif /* _KERNEL */
-#endif /* !SCTP_USE_ADLER32 */
-#endif /* _NETINET_SCTP_CRC32_H_ */
diff --git a/sys/netinet/sctp_hashdriver.c b/sys/netinet/sctp_hashdriver.c
deleted file mode 100644 (file)
index 7032186..0000000
+++ /dev/null
@@ -1,264 +0,0 @@
-/*     $KAME: sctp_hashdriver.c,v 1.5 2004/01/19 09:48:26 itojun Exp $ */
-/*     $DragonFly: src/sys/netinet/sctp_hashdriver.c,v 1.2 2006/01/14 11:33:50 swildner Exp $  */
-
-/*
- * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Cisco Systems, Inc.
- * 4. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/malloc.h>
-#include <sys/mbuf.h>
-#include <sys/domain.h>
-#include <sys/protosw.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/proc.h>
-#include <sys/kernel.h>
-#include <sys/sysctl.h>
-#include <sys/types.h>
-#include <netinet/sctp_constants.h>
-#ifdef USE_MD5
-#include <crypto/md5.h>
-#else
-#include <netinet/sctp_sha1.h>
-#endif /* USE_MD5 */
-#include <netinet/sctp_hashdriver.h>
-
-/*
- * Main driver for SCTP's hashing.
- * passing a two pointers and two lengths, returning a digest pointer
- * filled. The md5 code was taken directly from the RFC (2104) so to
- * understand it you may want to go look at the RFC referenced in the
- * SCTP spec. We did modify this code to either user OURs implementation
- * of SLA1 or the MD5 that comes from its RFC. SLA1 may have IPR issues
- * so you need to check in to this if you wish to use it... Or at least
- * that is what the FIP-180.1 web page says.
- */
-
-void
-sctp_hash_digest(char *key, int key_len, char *text, int text_len,
-                unsigned char *digest)
-{
-#ifdef USE_MD5
-       md5_ctxt context;
-#else
-       struct sha1_context context;
-#endif /* USE_MD5 */
-       /* inner padding - key XORd with ipad */
-       unsigned char k_ipad[65];
-       /* outer padding - key XORd with opad */
-       unsigned char k_opad[65];
-       unsigned char tk[20];
-       int i;
-
-       if (key_len > 64) {
-#ifdef USE_MD5
-               md5_ctxt tctx;
-               MD5Init(&tctx);
-               MD5Update(&tctx, key, key_len);
-               MD5Final(tk, &tctx);
-               key = tk;
-               key_len = 16;
-#else
-               struct sha1_context tctx;
-               SHA1_Init(&tctx);
-               SHA1_Process(&tctx, key, key_len);
-               SHA1_Final(&tctx, tk);
-               key = tk;
-               key_len = 20;
-#endif /* USE_MD5 */
-       }
-
-       /*
-        * the HMAC_MD5 transform looks like:
-        *
-        * MD5(K XOR opad, MD5(K XOR ipad, text))
-        *
-        * where K is an n byte key
-        * ipad is the byte 0x36 repeated 64 times
-        * opad is the byte 0x5c repeated 64 times
-        * and text is the data being protected
-        */
-
-       /* start out by storing key in pads */
-       bzero(k_ipad, sizeof k_ipad);
-       bzero(k_opad, sizeof k_opad);
-       bcopy(key, k_ipad, key_len);
-       bcopy(key, k_opad, key_len);
-
-       /* XOR key with ipad and opad values */
-       for (i = 0; i < 64; i++) {
-               k_ipad[i] ^= 0x36;
-               k_opad[i] ^= 0x5c;
-       }
-       /*
-        * perform inner MD5
-        */
-#ifdef USE_MD5
-       MD5Init(&context);                      /* init context for 1st pass */
-       MD5Update(&context, k_ipad, 64);        /* start with inner pad */
-       MD5Update(&context, text, text_len);    /* then text of datagram */
-       MD5Final(digest, &context);             /* finish up 1st pass */
-#else
-       SHA1_Init(&context);                    /* init context for 1st pass */
-       SHA1_Process(&context, k_ipad, 64);     /* start with inner pad */
-       SHA1_Process(&context, text, text_len); /* then text of datagram */
-       SHA1_Final(&context, digest);           /* finish up 1st pass */
-#endif /* USE_MD5 */
-
-       /*
-        * perform outer MD5
-        */
-#ifdef USE_MD5
-       MD5Init(&context);                      /* init context for 2nd pass */
-       MD5Update(&context, k_opad, 64);        /* start with outer pad */
-       MD5Update(&context, digest, 16);        /* then results of 1st hash */
-       MD5Final(digest, &context);             /* finish up 2nd pass */
-#else
-       SHA1_Init(&context);                    /* init context for 2nd pass */
-       SHA1_Process(&context, k_opad, 64);     /* start with outer pad */
-       SHA1_Process(&context, digest, 20);     /* then results of 1st hash */
-       SHA1_Final(&context, digest);           /* finish up 2nd pass */
-#endif /* USE_MD5 */
-}
-
-void
-sctp_hash_digest_m(char *key, int key_len, struct mbuf *m, int offset,
-                  unsigned char *digest)
-{
-       struct mbuf *m_at;
-#ifdef USE_MD5
-       md5_ctxt context;
-#else
-       struct sha1_context context;
-#endif /* USE_MD5 */
-       /* inner padding - key XORd with ipad */
-       unsigned char k_ipad[65];
-       /* outer padding - key XORd with opad */
-       unsigned char k_opad[65];
-       unsigned char tk[20];
-       int i;
-
-       if (key_len > 64) {
-#ifdef USE_MD5
-               md5_ctxt tctx;
-               MD5Init(&tctx);
-               MD5Update(&tctx, key, key_len);
-               MD5Final(tk, &tctx);
-               key = tk;
-               key_len = 16;
-#else
-               struct sha1_context tctx;
-               SHA1_Init(&tctx);
-               SHA1_Process(&tctx, key, key_len);
-               SHA1_Final(&tctx, tk);
-               key = tk;
-               key_len = 20;
-#endif /* USE_MD5 */
-       }
-
-       /*
-        * the HMAC_MD5 transform looks like:
-        *
-        * MD5(K XOR opad, MD5(K XOR ipad, text))
-        *
-        * where K is an n byte key
-        * ipad is the byte 0x36 repeated 64 times
-        * opad is the byte 0x5c repeated 64 times
-        * and text is the data being protected
-        */
-
-       /* start out by storing key in pads */
-       bzero(k_ipad, sizeof k_ipad);
-       bzero(k_opad, sizeof k_opad);
-       bcopy(key, k_ipad, key_len);
-       bcopy(key, k_opad, key_len);
-
-       /* XOR key with ipad and opad values */
-       for (i = 0; i < 64; i++) {
-               k_ipad[i] ^= 0x36;
-               k_opad[i] ^= 0x5c;
-       }
-
-       /* find the correct mbuf and offset into mbuf */
-       m_at = m;
-       while ((m_at != NULL) && (offset > m_at->m_len)) {
-               offset -= m_at->m_len;  /* update remaining offset left */
-               m_at = m_at->m_next;
-       }
-       /*
-        * perform inner MD5
-        */
-#ifdef USE_MD5
-       MD5Init(&context);                      /* init context for 1st pass */
-       MD5Update(&context, k_ipad, 64);        /* start with inner pad */
-       /******/
-       while (m_at != NULL) {
-               /* then text of datagram... */
-               MD5Update(&context, mtod(m_at, char *)+offset,
-                         m_at->m_len-offset);
-               /* only offset on the first mbuf */
-               offset = 0;
-               m_at = m_at->m_next;
-       }
-       /******/
-       MD5Final(digest, &context);             /* finish up 1st pass */
-#else
-       SHA1_Init(&context);                    /* init context for 1st pass */
-       SHA1_Process(&context, k_ipad, 64);     /* start with inner pad */
-       /******/
-       while (m_at != NULL) {
-               /* then text of datagram */
-               SHA1_Process(&context, mtod(m_at, char *)+offset,
-                            m_at->m_len-offset);
-               /* only offset on the first mbuf */
-               offset = 0;
-               m_at = m_at->m_next;
-       }
-       /******/
-       SHA1_Final(&context, digest);             /* finish up 1st pass */
-#endif /* USE_MD5 */
-
-       /*
-        * perform outer MD5
-        */
-#ifdef USE_MD5
-       MD5Init(&context);                      /* init context for 2nd pass */
-       MD5Update(&context, k_opad, 64);        /* start with outer pad */
-       MD5Update(&context, digest, 16);        /* then results of 1st hash */
-       MD5Final(digest, &context);             /* finish up 2nd pass */
-#else
-       SHA1_Init(&context);                    /* init context for 2nd pass */
-       SHA1_Process(&context, k_opad, 64);     /* start with outer pad */
-       SHA1_Process(&context, digest, 20);     /* then results of 1st hash */
-       SHA1_Final(&context, digest);           /* finish up 2nd pass */
-#endif /* USE_MD5 */
-}
diff --git a/sys/netinet/sctp_hashdriver.h b/sys/netinet/sctp_hashdriver.h
deleted file mode 100644 (file)
index e59af26..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*     $KAME: sctp_hashdriver.h,v 1.3 2002/10/09 18:01:21 itojun Exp $ */
-/*     $DragonFly: src/sys/netinet/sctp_hashdriver.h,v 1.2 2006/05/20 02:42:12 dillon Exp $    */
-
-#ifndef _NETINET_SCTP_HASHDRIVER_H_
-#define _NETINET_SCTP_HASHDRIVER_H_
-
-/*
- * Copyright (c) 2001, 2002 Cisco Systems, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Cisco Systems, Inc.
- * 4. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-struct mbuf;
-
-void sctp_hash_digest(char *, int, char *, int, unsigned char *);
-void sctp_hash_digest_m(char *, int, struct mbuf *, int, unsigned char *);
-
-#endif
diff --git a/sys/netinet/sctp_header.h b/sys/netinet/sctp_header.h
deleted file mode 100644 (file)
index 77928e2..0000000
+++ /dev/null
@@ -1,498 +0,0 @@
-/*     $KAME: sctp_header.h,v 1.13 2004/08/17 04:06:16 itojun Exp $    */
-/*     $DragonFly: src/sys/netinet/sctp_header.h,v 1.2 2006/05/20 02:42:12 dillon Exp $        */
-
-#ifndef _NETINET_SCTP_HEADER_H_
-#define _NETINET_SCTP_HEADER_H_
-
-/*
- * Copyright (c) 2001, 2002, 2003, 2004 Cisco Systems, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- *    must display the following acknowledgement:
- *      This product includes software developed by Cisco Systems, Inc.
- * 4. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY CISCO SYSTEMS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL CISCO SYSTEMS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef _SYS_TYPES_H_
-#include <sys/types.h>
-#endif
-#ifndef _SYS_TIME_H_
-#include <sys/time.h>
-#endif
-#ifndef _NETINET_SCTP_H_
-#include <netinet/sctp.h>
-#endif
-#ifndef _NETINET_SCTP_CONSTANTS_H_
-#include <netinet/sctp_constants.h>
-#endif
-
-/*
- * Parameter structures
- */
-struct sctp_ipv4addr_param {
-       struct sctp_paramhdr ph;        /* type=SCTP_IPV4_PARAM_TYPE, len=8 */
-       u_int32_t addr;                 /* IPV4 address */
-};
-
-struct sctp_ipv6addr_param {
-       struct sctp_paramhdr ph;        /* type=SCTP_IPV6_PARAM_TYPE, len=20 */
-       u_int8_t  addr[16];             /* IPV6 address */
-};
-
-/* Cookie Preservative */
-struct sctp_cookie_perserve_param {
-       struct sctp_paramhdr ph;        /* type=SCTP_COOKIE_PRESERVE, len=8 */
-       u_int32_t time;                 /* time in ms to extend cookie */
-};
-
-/* Host Name Address */
-struct sctp_host_name_param {
-       struct sctp_paramhdr ph;        /* type=SCTP_HOSTNAME_ADDRESS */
-       char name[1];                   /* host name */
-};
-
-/* supported address type */
-struct sctp_supported_addr_param {
-       struct sctp_paramhdr ph;        /* type=SCTP_SUPPORTED_ADDRTYPE */
-       u_int16_t addr_type[1];         /* array of supported address types */
-};
-
-/* ECN parameter */
-struct sctp_ecn_supported_param {
-       struct sctp_paramhdr ph;        /* type=SCTP_ECN_CAPABLE */
-};
-
-
-/* heartbeat info parameter */
-struct sctp_heartbeat_info_param {
-       struct sctp_paramhdr ph;
-       u_int32_t time_value_1;
-       u_int32_t time_value_2;
-       u_int32_t random_value1;
-       u_int32_t random_value2;
-       u_int16_t user_req;
-       u_int8_t addr_family;
-       u_int8_t addr_len;
-       char address[SCTP_ADDRMAX];
-};
-
-
-/* draft-ietf-tsvwg-prsctp */
-/* PR-SCTP supported parameter */
-struct sctp_prsctp_supported_param {
-       struct sctp_paramhdr ph;
-};
-
-
-/* draft-ietf-tsvwg-addip-sctp */
-struct sctp_asconf_paramhdr {          /* an ASCONF "parameter" */
-       struct sctp_paramhdr ph;        /* a SCTP parameter header */
-       u_int32_t correlation_id;       /* correlation id for this param */
-};
-
-struct sctp_asconf_addr_param {                /* an ASCONF address parameter */
-       struct sctp_asconf_paramhdr aph;        /* asconf "parameter" */
-       struct sctp_ipv6addr_param  addrp;      /* max storage size */
-};
-
-struct sctp_asconf_addrv4_param {              /* an ASCONF address (v4) parameter */
-       struct sctp_asconf_paramhdr aph;        /* asconf "parameter" */
-       struct sctp_ipv4addr_param  addrp;      /* max storage size */
-};
-
-
-/* ECN Nonce: draft-ladha-sctp-ecn-nonce */
-struct sctp_ecn_nonce_supported_param {
-       struct sctp_paramhdr ph;        /* type = 0x8001  len = 4 */
-};
-
-struct sctp_supported_chunk_types_param {
-       struct sctp_paramhdr ph;        /* type = 0x8002  len = x */
-       u_int8_t chunk_types[0];
-};
-
-/*
- * Structures for DATA chunks
- */
-struct sctp_data {
-       u_int32_t tsn;
-       u_int16_t stream_id;
-       u_int16_t stream_sequence;
-       u_int32_t protocol_id;
-       /* user data follows */
-};
-
-struct sctp_data_chunk {
-       struct sctp_chunkhdr ch;
-       struct sctp_data dp;
-};
-
-/*
- * Structures for the control chunks
- */
-
-/* Initiate (INIT)/Initiate Ack (INIT ACK) */
-struct sctp_init {
-       u_int32_t initiate_tag;         /* initiate tag */
-       u_int32_t a_rwnd;               /* a_rwnd */
-       u_int16_t num_outbound_streams; /* OS */
-       u_int16_t num_inbound_streams;  /* MIS */
-       u_int32_t initial_tsn;          /* I-TSN */
-       /* optional param's follow */
-};
-
-/* state cookie header */
-struct sctp_state_cookie {             /* this is our definition... */
-       u_int8_t  identification[16];   /* id of who we are */
-       u_int32_t cookie_life;          /* life I will award this cookie */
-       u_int32_t tie_tag_my_vtag;      /* my tag in old association */
-       u_int32_t tie_tag_peer_vtag;    /* peers tag in old association */
-       u_int32_t peers_vtag;           /* peers tag in INIT (for quick ref) */
-       u_int32_t my_vtag;              /* my tag in INIT-ACK (for quick ref) */
-       struct timeval time_entered;    /* the time I built cookie */
-       u_int32_t address[4];           /* 4 ints/128 bits */
-       u_int32_t addr_type;            /* address type */
-       u_int32_t laddress[4];          /* my local from address */
-       u_int32_t laddr_type;           /* my local from address type */
-       u_int32_t scope_id;             /* v6 scope id for link-locals */
-       u_int16_t peerport;             /* port address of the peer in the INIT */
-       u_int16_t myport;               /* my port address used in the INIT */
-       u_int8_t ipv4_addr_legal;       /* Are V4 addr legal? */
-       u_int8_t ipv6_addr_legal;       /* Are V6 addr legal? */
-       u_int8_t local_scope;           /* IPv6 local scope flag */
-       u_int8_t site_scope;            /* IPv6 site scope flag */
-       u_int8_t ipv4_scope;            /* IPv4 private addr scope */
-       u_int8_t loopback_scope;        /* loopback scope information */
-       u_int16_t reserved;
-       /*
-        * at the end is tacked on the INIT chunk and the
-        * INIT-ACK chunk (minus the cookie).
-        */
-};
-
-struct sctp_inv_mandatory_param {
-       u_int16_t cause;
-       u_int16_t length;
-       u_int32_t num_param;
-       u_int16_t param;
-       /*
-        * We include this to 0 it since only a missing cookie
-        * will cause this error.
-        */
-       u_int16_t resv;
-};
-
-struct sctp_unresolv_addr {
-       u_int16_t cause;
-       u_int16_t length;
-       u_int16_t addr_type;
-       u_int16_t reserved;     /* Only one invalid addr type */
-};
-
-/* state cookie parameter */
-struct sctp_state_cookie_param {
-       struct sctp_paramhdr ph;
-       struct sctp_state_cookie cookie;
-};
-
-struct sctp_init_chunk {
-       struct sctp_chunkhdr ch;
-       struct sctp_init init;
-};
-
-struct sctp_init_msg {
-       struct sctphdr sh;
-       struct sctp_init_chunk msg;
-};
-/* ... used for both INIT and INIT ACK */
-#define sctp_init_ack          sctp_init
-#define sctp_init_ack_chunk    sctp_init_chunk
-#define sctp_init_ack_msg      sctp_init_msg
-
-
-/* Selective Ack (SACK) */
-struct sctp_gap_ack_block {
-       u_int16_t start;                /* Gap Ack block start */
-       u_int16_t end;                  /* Gap Ack block end */
-};
-
-struct sctp_sack {
-       u_int32_t cum_tsn_ack;          /* cumulative TSN Ack */
-       u_int32_t a_rwnd;               /* updated a_rwnd of sender */
-       u_int16_t num_gap_ack_blks;     /* number of Gap Ack blocks */
-       u_int16_t num_dup_tsns;         /* number of duplicate TSNs */
-       /* struct sctp_gap_ack_block's follow */
-       /* u_int32_t duplicate_tsn's follow */
-};
-
-struct sctp_sack_chunk {
-       struct sctp_chunkhdr ch;
-       struct sctp_sack sack;
-};
-
-
-/* Heartbeat Request (HEARTBEAT) */
-struct sctp_heartbeat {
-       struct sctp_heartbeat_info_param hb_info;
-};
-
-struct sctp_heartbeat_chunk {
-       struct sctp_chunkhdr ch;
-       struct sctp_heartbeat heartbeat;
-};
-/* ... used for Heartbeat Ack (HEARTBEAT ACK) */
-#define sctp_heartbeat_ack             sctp_heartbeat
-#define sctp_heartbeat_ack_chunk       sctp_heartbeat_chunk
-
-
-/* Abort Asssociation (ABORT) */
-struct sctp_abort_chunk {
-       struct sctp_chunkhdr ch;
-       /* optional error cause may follow */
-};
-
-struct sctp_abort_msg {
-       struct sctphdr sh;
-       struct sctp_abort_chunk msg;
-};
-
-
-/* Shutdown Association (SHUTDOWN) */
-struct sctp_shutdown_chunk {
-       struct sctp_chunkhdr ch;
-       u_int32_t cumulative_tsn_ack;
-};
-
-
-/* Shutdown Acknowledgment (SHUTDOWN ACK) */
-struct sctp_shutdown_ack_chunk {
-       struct sctp_chunkhdr ch;
-};
-
-
-/* Operation Error (ERROR) */
-struct sctp_error_chunk {
-       struct sctp_chunkhdr ch;
-       /* optional error causes follow */
-};
-
-
-/* Cookie Echo (COOKIE ECHO) */
-struct sctp_cookie_echo_chunk {
-       struct sctp_chunkhdr ch;
-       struct sctp_state_cookie cookie;
-};
-
-/* Cookie Acknowledgment (COOKIE ACK) */
-struct sctp_cookie_ack_chunk {
-       struct sctp_chunkhdr ch;
-};
-
-/* Explicit Congestion Notification Echo (ECNE) */
-struct sctp_ecne_chunk {
-       struct sctp_chunkhdr ch;
-       u_int32_t tsn;
-};
-
-/* Congestion Window Reduced (CWR) */
-struct sctp_cwr_chunk {
-       struct sctp_chunkhdr ch;
-       u_int32_t tsn;
-};
-
-/* Shutdown Complete (SHUTDOWN COMPLETE) */
-struct sctp_shutdown_complete_chunk {
-       struct sctp_chunkhdr ch;
-};
-
-/* Oper error holding a stale cookie */
-struct sctp_stale_cookie_msg {
-       struct sctp_paramhdr ph;        /* really an error cause */
-       u_int32_t time_usec;
-};
-
-struct sctp_adaption_layer_indication {
-       struct sctp_paramhdr ph;
-       u_int32_t indication;
-};
-
-struct sctp_cookie_while_shutting_down {
-       struct sctphdr sh;
-       struct sctp_chunkhdr ch;
-       struct sctp_paramhdr ph;        /* really an error cause */
-};
-
-struct sctp_shutdown_complete_msg {
-       struct sctphdr sh;
-       struct sctp_shutdown_complete_chunk shut_cmp;
-};
-
-/* draft-ietf-tsvwg-addip-sctp */
-/* Address/Stream Configuration Change (ASCONF) */
-struct sctp_asconf_chunk {
-       struct sctp_chunkhdr ch;
-       u_int32_t serial_number;
-       /* lookup address parameter (mandatory) */
-       /* asconf parameters follow */
-};
-
-/* Address/Stream Configuration Acknowledge (ASCONF ACK) */
-struct sctp_asconf_ack_chunk {
-       struct sctp_chunkhdr ch;
-       u_int32_t serial_number;
-       /* asconf parameters follow */
-};
-
-/* draft-ietf-tsvwg-prsctp */
-/* Forward Cumulative TSN (FORWARD TSN) */
-struct sctp_forward_tsn_chunk {
-       struct sctp_chunkhdr ch;
-       u_int32_t new_cumulative_tsn;
-       /* stream/sequence pairs (sctp_strseq) follow */
-};
-
-struct sctp_strseq {
-       u_int16_t stream;
-       u_int16_t sequence;
-};
-
-struct sctp_forward_tsn_msg {
-       struct sctphdr sh;
-       struct sctp_forward_tsn_chunk msg;
-};
-
-/* should be a multiple of 4 - 1 aka 3/7/11 etc. */
-
-#define SCTP_NUM_DB_TO_VERIFY 3
-
-struct sctp_chunk_desc {
-       u_int8_t chunk_type;
-       u_int8_t data_bytes[SCTP_NUM_DB_TO_VERIFY];
-       u_int32_t tsn_ifany;
-};
-
-
-struct sctp_pktdrop_chunk {
-       struct sctp_chunkhdr ch;
-       u_int32_t bottle_bw;
-       u_int32_t current_onq;
-       u_int16_t trunc_len;
-       u_int16_t reserved;
-       u_int8_t data[0];
-};
-
-#define SCTP_RESET_YOUR  0x01   /* reset your streams and send response */
-#define SCTP_RESET_ALL   0x02   /* reset all of your streams */
-#define SCTP_RECIPRICAL  0x04   /* reset my streams too */
-
-struct sctp_stream_reset_request {
-       struct sctp_paramhdr ph;
-       u_int8_t reset_flags;              /* actual request */
-       u_int8_t reset_pad[3];
-       u_int32_t reset_req_seq;           /* monotonically increasing seq no */
-       u_int16_t list_of_streams[0];      /* if not all list of streams */
-};
-
-#define SCTP_RESET_PERFORMED        0x01   /* Peers sending str was reset */
-#define SCTP_RESET_DENIED           0x02   /* Asked for but refused       */
-
-struct sctp_stream_reset_response {
-       struct sctp_paramhdr ph;
-       u_int8_t reset_flags;              /* actual request */
-       u_int8_t reset_pad[3];
-       u_int32_t reset_req_seq_resp;   /* copied from reset_req reset_req_seq */
-       u_int32_t reset_at_tsn;         /* resetters next TSN to be assigned send wise */
-       u_int32_t cumulative_tsn;       /* resetters cum-ack point receive wise */
-       u_int16_t list_of_streams[0];   /* if not all list of streams */
-};
-
-/* convience structures, note that if you
- * are making a request for specific streams
- * then the request will need to be an overlay
- * structure.
- */
-
-struct sctp_stream_reset_req {
-       struct sctp_chunkhdr ch;
-       struct sctp_stream_reset_request sr_req;
-};
-
-struct sctp_stream_reset_resp {
-       struct sctp_chunkhdr ch;
-       struct sctp_stream_reset_response sr_resp;
-};
-
-
-/*
- * we pre-reserve enough room for a ECNE or CWR AND a SACK with no
- * missing pieces. If ENCE is missing we could have a couple of blocks.
- * This way we optimize so we MOST likely can bundle a SACK/ECN with
- * the smallest size data chunk I will split into. We could increase
- * throughput slightly by taking out these two but the  24-sack/8-CWR
- * i.e. 32 bytes I pre-reserve I feel is worth it for now.
- */
-#ifndef SCTP_MAX_OVERHEAD
-#ifdef AF_INET6
-#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
-                          sizeof(struct sctphdr) + \
-                          sizeof(struct sctp_ecne_chunk) + \
-                          sizeof(struct sctp_sack_chunk) + \
-                          sizeof(struct ip6_hdr))
-
-#define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \
-                          sizeof(struct sctphdr) + \
-                          sizeof(struct ip6_hdr))
-
-
-#define SCTP_MIN_OVERHEAD (sizeof(struct ip6_hdr) + \
-                          sizeof(struct sctphdr))
-
-#else
-#define SCTP_MAX_OVERHEAD (sizeof(struct sctp_data_chunk) + \
-                          sizeof(struct sctphdr) + \
-                          sizeof(struct sctp_ecne_chunk) + \
-                          sizeof(struct sctp_sack_chunk) + \
-                          sizeof(struct ip))
-
-#define SCTP_MED_OVERHEAD (sizeof(struct sctp_data_chunk) + \
-                          sizeof(struct sctphdr) + \
-                          sizeof(struct ip))
-
-
-#define SCTP_MIN_OVERHEAD (sizeof(struct ip) + \
-                          sizeof(struct sctphdr))
-
-#endif /* AF_INET6 */
-#endif /* !SCTP_MAX_OVERHEAD */
-
-#define SCTP_MED_V4_OVERHEAD (sizeof(struct sctp_data_chunk) + \
-                             sizeof(struct sctphdr) + \
-                             sizeof(struct ip))
-
-#define SCTP_MIN_V4_OVERHEAD (sizeof(struct ip) + \
-                             sizeof(struct sctphdr))
-
-#endif /* _NETINET_SCTP_HEADER_H_ */
diff --git a/sys/netinet/sctp_indata.c b/sys/netinet/sctp_indata.c
deleted file mode 100644 (file)
index bd8dbda..0000000
+++ /dev/null
@@ -1,4759 +0,0 @@
-/*     $KAME: sctp_indata.c,v 1.35 2004/08/17 04:06:17 itojun Exp $    */
-
-/*
- * Copyright (C) 2002, 2003, 2004 Cisco Systems Inc,
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#if !(defined(__OpenBSD__) || defined(__APPLE__))
-#include "opt_ipsec.h"
-#endif
-#if defined(__FreeBSD__) || defined(__DragonFly__)
-#include "opt_inet6.h"
-#include "opt_inet.h"
-#endif
-#if defined(__NetBSD__)
-#include "opt_inet.h"
-#endif
-
-#ifdef __APPLE__
-#include <sctp.h>
-#elif !defined(__OpenBSD__)
-#include "opt_sctp.h"
-#endif
-
-#include <sys/param.h>
-#include <sys/systm.h>
-#include <sys/mbuf.h>
-#include <sys/malloc.h>
-#include <sys/socket.h>
-#include <sys/socketvar.h>
-#include <sys/sysctl.h>
-
-#include <net/if.h>
-#include <net/route.h>
-
-
-#if defined(__FreeBSD__) && __FreeBSD_version >= 500000
-#include <sys/limits.h>
-#else
-#include <machine/limits.h>
-#endif
-#include <machine/cpu.h>
-
-#include <netinet/in.h>
-#include <netinet/in_systm.h>
-#include <netinet/ip.h>
-#ifdef INET6
-#include <netinet/ip6.h>
-#endif /* INET6 */
-#include <netinet/in_pcb.h>
-#include <netinet/in_var.h>
-#include <netinet/ip_var.h>
-#ifdef INET6
-#include <netinet6/ip6_var.h>
-#endif /* INET6 */
-#include <netinet/ip_icmp.h>
-#include <netinet/icmp_var.h>
-#include <netinet/sctp_var.h>
-#include <netinet/sctp_pcb.h>
-#include <netinet/sctp_header.h>
-#include <netinet/sctputil.h>
-#include <netinet/sctp_output.h>
-#include <netinet/sctp_input.h>
-#include <netinet/sctp_hashdriver.h>
-#include <netinet/sctp_indata.h>
-#include <netinet/sctp_uio.h>
-#include <netinet/sctp_timer.h>
-#ifdef IPSEC
-#ifndef __OpenBSD__
-#include <netinet6/ipsec.h>
-#include <netproto/key/key.h>
-#else
-#undef IPSEC
-#endif
-#endif /*IPSEC*/
-
-#include <net/net_osdep.h>
-
-#ifdef SCTP_DEBUG
-extern u_int32_t sctp_debug_on;
-#endif
-
-/*
- * NOTES: On the outbound side of things I need to check the sack timer to
- * see if I should generate a sack into the chunk queue (if I have data to
- * send that is and will be sending it .. for bundling.
- *
- * The callback in sctp_usrreq.c will get called when the socket is read
- * from. This will cause sctp_service_queues() to get called on the top
- * entry in the list.
- */
-
-extern int sctp_strict_sacks;
-
-void
-sctp_set_rwnd(struct sctp_tcb *stcb, struct sctp_association *asoc)
-{
-       u_int32_t calc, calc_w_oh;
-
-#ifdef SCTP_DEBUG
-       if (sctp_debug_on & SCTP_DEBUG_INDATA4) {
-               kprintf("cc:%lu hiwat:%lu lowat:%lu mbcnt:%lu mbmax:%lu\n",
-                      (u_long)stcb->sctp_socket->so_rcv.ssb_cc,
-                      (u_long)stcb->sctp_socket->so_rcv.ssb_hiwat,
-                      (u_long)stcb->sctp_socket->so_rcv.ssb_lowat,
-                      (u_long)stcb->sctp_socket->so_rcv.ssb_mbcnt,
-                      (u_long)stcb->sctp_socket->so_rcv.ssb_mbmax);
-               kprintf("Setting rwnd to: sb:%ld - (del:%d + reasm:%d str:%d)\n",
-                      sctp_sbspace(&stcb->sctp_socket->so_rcv),
-                      asoc->size_on_delivery_queue,
-                      asoc->size_on_reasm_queue,
-                      asoc->size_on_all_streams);
-       }
-#endif
-       if (stcb->sctp_socket->so_rcv.ssb_cc == 0 &&
-           asoc->size_on_delivery_queue == 0 &&
-           asoc->size_on_reasm_queue == 0 &&
-           asoc->size_on_all_streams == 0) {
-               /* Full rwnd granted */
-               asoc->my_rwnd = max(stcb->sctp_socket->so_rcv.ssb_hiwat,
-                                   SCTP_MINIMAL_RWND);
-               return;
-       }
-       /* get actual space */
-       calc = (u_int32_t)sctp_sbspace(&stcb->sctp_socket->so_rcv);
-
-       /* take out what has NOT been put on socket queue and
-        * we yet hold for putting up.
-        */
-       calc = sctp_sbspace_sub(calc, (u_int32_t)asoc->size_on_delivery_queue);
-       calc = sctp_sbspace_sub(calc, (u_int32_t)asoc->size_on_reasm_queue);
-       calc = sctp_sbspace_sub(calc, (u_int32_t)asoc->size_on_all_streams);
-
-       /* what is the overhead of all these rwnd's */
-       calc_w_oh = sctp_sbspace_sub(calc, stcb->asoc.my_rwnd_control_len);
-
-       asoc->my_rwnd = calc;
-       if (calc_w_oh == 0) {
-               /* If our overhead is greater than the advertised
-                * rwnd, we clamp the rwnd to 1. This lets us
-                * still accept inbound segments, but hopefully will
-                * shut the sender down when he finally gets the message.
-                */
-               asoc->my_rwnd = 1;
-       } else {
-               /* SWS threshold */
-               if (asoc->my_rwnd &&
-                   (asoc->my_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_receiver)) {
-                       /* SWS engaged, tell peer none left */
-                       asoc->my_rwnd = 1;
-#ifdef SCTP_DEBUG
-                       if (sctp_debug_on & SCTP_DEBUG_INDATA4) {
-                               kprintf(" - SWS zeros\n");
-                       }
-               } else {
-                       if (sctp_debug_on & SCTP_DEBUG_INDATA4) {
-                               kprintf("\n");
-                       }
-#endif
-               }
-       }
-}
-
-/*
- * Take a chk structure and build it into an mbuf. Hmm should we change things
- * so that instead we store the data side in a chunk?
- */
-static struct mbuf *
-sctp_build_ctl_nchunk(struct sctp_tcb *stcb, uint32_t tsn, uint32_t ppid,
-    uint32_t context, uint16_t stream_no, uint16_t stream_seq, uint8_t flags)
-{
-       struct sctp_sndrcvinfo *outinfo;
-       struct cmsghdr *cmh;
-       struct mbuf *ret;
-
-       if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_RECVDATAIOEVNT) == 0) {
-               /* user does not want the sndrcv ctl */
-               return (NULL);
-       }
-
-       MGETHDR(ret, MB_DONTWAIT, MT_CONTROL);
-       if (ret == NULL) {
-               /* No space */
-               return (ret);
-       }
-       /* We need a CMSG header followed by the struct  */
-       cmh = mtod(ret, struct cmsghdr *);
-       outinfo = (struct sctp_sndrcvinfo *)CMSG_DATA(cmh);
-       cmh->cmsg_level = IPPROTO_SCTP;
-       cmh->cmsg_type = SCTP_SNDRCV;
-       cmh->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo));
-       outinfo->sinfo_stream = stream_no;
-       outinfo->sinfo_ssn = stream_seq;
-       if (flags & SCTP_DATA_UNORDERED) {
-               outinfo->sinfo_flags = MSG_UNORDERED;
-       } else {
-               outinfo->sinfo_flags = 0;
-       }
-       outinfo->sinfo_ppid = ppid;
-       outinfo->sinfo_context = context;
-       outinfo->sinfo_assoc_id = sctp_get_associd(stcb);
-       outinfo->sinfo_tsn = tsn;
-       outinfo->sinfo_cumtsn = stcb->asoc.cumulative_tsn;
-       ret->m_len = cmh->cmsg_len;
-       ret->m_pkthdr.len = ret->m_len;
-       /*
-        * We track how many control len's have gone upon the sb
-        * and do not count these in the rwnd calculation.
-        */
-       stcb->asoc.my_rwnd_control_len +=
-           CMSG_LEN(sizeof(struct sctp_sndrcvinfo));
-
-       return (ret);
-}
-
-/*
- * Take a chk structure and build it into an mbuf.  Should we change things
- * so that instead we store the data side in a chunk?
- */
-static
-struct mbuf *
-sctp_build_ctl(struct sctp_tcb *stcb, struct sctp_tmit_chunk *chk)
-{
-       struct sctp_sndrcvinfo *outinfo;
-       struct cmsghdr *cmh;
-       struct mbuf *ret;
-       if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_RECVDATAIOEVNT) == 0) {
-               /* user does not want the sndrcv ctl */
-               return (NULL);
-       }
-       MGET(ret, MB_DONTWAIT, MT_CONTROL);
-       if (ret == NULL) {
-               /* No space */
-               return (ret);
-       }
-
-       /* We need a CMSG header followed by the struct  */
-       cmh = mtod(ret, struct cmsghdr *);
-       outinfo = (struct sctp_sndrcvinfo *)CMSG_DATA(cmh);
-       cmh->cmsg_level = IPPROTO_SCTP;
-       cmh->cmsg_type = SCTP_SNDRCV;
-       cmh->cmsg_len = CMSG_LEN(sizeof(struct sctp_sndrcvinfo));
-       outinfo->sinfo_stream = chk->rec.data.stream_number;
-       outinfo->sinfo_ssn = chk->rec.data.stream_seq;
-       if (chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) {
-               outinfo->sinfo_flags = MSG_UNORDERED;
-       } else {
-               outinfo->sinfo_flags = 0;
-       }
-       outinfo->sinfo_ppid = chk->rec.data.payloadtype;
-       outinfo->sinfo_context = chk->rec.data.context;
-       outinfo->sinfo_assoc_id = sctp_get_associd(stcb);
-       outinfo->sinfo_tsn = chk->rec.data.TSN_seq;
-       outinfo->sinfo_cumtsn = stcb->asoc.cumulative_tsn;
-       ret->m_len = cmh->cmsg_len;
-       stcb->asoc.my_rwnd_control_len +=
-           CMSG_LEN(sizeof(struct sctp_sndrcvinfo));
-
-       return (ret);
-}
-
-int
-sctp_deliver_data(struct sctp_tcb *stcb, struct sctp_association *asoc,
-    struct sctp_tmit_chunk *chk, int hold_locks)
-{
-       struct mbuf *control, *m;
-       int free_it;
-       struct sockaddr_in6 sin6;
-       struct sockaddr *to;
-
-#ifdef SCTP_DEBUG
-       if (sctp_debug_on & SCTP_DEBUG_INDATA1) {
-               kprintf("I am now in Deliver data! (%p)\n", chk);
-       }
-#endif
-       /* get a write lock on the inp if not already */
-       if (hold_locks == 0) {
-               SCTP_TCB_UNLOCK(stcb);
-               SCTP_INP_WLOCK(stcb->sctp_ep);
-               SCTP_TCB_LOCK(stcb);
-       }
-       free_it = 0;
-       /* We always add it to the queue */
-       if (stcb && (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) {
-               /* socket above is long gone */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_INDATA1) {
-                       kprintf("gone is gone!\n");
-               }
-#endif
-               if (chk != NULL) {
-                       if (chk->data)
-                               sctp_m_freem(chk->data);
-                       chk->data = NULL;
-                       sctp_free_remote_addr(chk->whoTo);
-                       SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
-                       sctppcbinfo.ipi_count_chunk--;
-                       if ((int)sctppcbinfo.ipi_count_chunk < 0) {
-                               panic("Chunk count is negative");
-                       }
-                       sctppcbinfo.ipi_gencnt_chunk++;
-               }
-               TAILQ_FOREACH(chk, &asoc->delivery_queue, sctp_next) {
-                       asoc->size_on_delivery_queue -= chk->send_size;
-                       asoc->cnt_on_delivery_queue--;
-                       /*
-                        * Lose the data pointer, since its in the socket buffer
-                        */
-                       if (chk->data)
-                               sctp_m_freem(chk->data);
-                       chk->data = NULL;
-                       /* Now free the address and data */
-                       sctp_free_remote_addr(chk->whoTo);
-                       SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
-                       sctppcbinfo.ipi_count_chunk--;
-                       if ((int)sctppcbinfo.ipi_count_chunk < 0) {
-                               panic("Chunk count is negative");
-                       }
-                       sctppcbinfo.ipi_gencnt_chunk++;
-               }
-               if (hold_locks == 0)
-                       SCTP_INP_WUNLOCK(stcb->sctp_ep);
-               return (0);
-       }
-       if (chk != NULL) {
-               TAILQ_INSERT_TAIL(&asoc->delivery_queue, chk, sctp_next);
-               asoc->size_on_delivery_queue += chk->send_size;
-               asoc->cnt_on_delivery_queue++;
-       }
-       if (asoc->fragmented_delivery_inprogress) {
-               /*
-                * oh oh, fragmented delivery in progress
-                * return out of here.
-                */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_INDATA1) {
-                       kprintf("Fragmented delivery in progress?\n");
-               }
-#endif
-               if (hold_locks == 0)
-                       SCTP_INP_WUNLOCK(stcb->sctp_ep);
-               return (0);
-       }
-       /* Now grab the first one  */
-       chk = TAILQ_FIRST(&asoc->delivery_queue);
-       if (chk == NULL) {
-               /* Nothing in queue */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_INDATA1) {
-                       kprintf("Nothing in queue?\n");
-               }
-#endif
-               asoc->size_on_delivery_queue = 0;
-               asoc->cnt_on_delivery_queue = 0;
-               if (hold_locks == 0)
-                       SCTP_INP_WUNLOCK(stcb->sctp_ep);
-               return (0);
-       }
-
-       if (stcb->sctp_socket->so_rcv.ssb_cc >= stcb->sctp_socket->so_rcv.ssb_hiwat) {
-               /* Boy, there really is NO room */
-               if (hold_locks == 0)
-                       SCTP_INP_WUNLOCK(stcb->sctp_ep);
-               return (0);
-       }
-#ifdef SCTP_DEBUG
-       if (sctp_debug_on & SCTP_DEBUG_INDATA1) {
-               kprintf("Now to the delivery with chk(%p)!\n", chk);
-       }
-#endif
-       /* XXX need to append PKTHDR to the socket buffer first */
-       if ((chk->data->m_flags & M_PKTHDR) == 0) {
-               MGETHDR(m, MB_DONTWAIT, MT_DATA);
-               if (m == NULL) {
-                       /* no room! */
-                       if (hold_locks == 0)
-                               SCTP_INP_WUNLOCK(stcb->sctp_ep);
-                       return (0);
-               }
-               m->m_pkthdr.len = chk->send_size;
-               m->m_len = 0;
-               m->m_next = chk->data;
-               chk->data = m;
-       }
-       if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) {
-               if (chk->data->m_next == NULL) {
-                       /* hopefully we hit here most of the time */
-                       chk->data->m_flags |= M_EOR;
-               } else {
-                       /* Add the flag to the LAST mbuf in the chain */
-                       m = chk->data;
-                       while (m->m_next != NULL) {
-                               m = m->m_next;
-                       }
-                       m->m_flags |= M_EOR;
-               }
-       }
-
-       if (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) {
-               struct sockaddr_in6 lsa6;
-
-               control = sctp_build_ctl(stcb, chk);
-               to = (struct sockaddr *)&chk->whoTo->ro._l_addr;
-               if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_NEEDS_MAPPED_V4) &&
-                   to->sa_family == AF_INET) {
-                       struct sockaddr_in *sin;
-
-                       sin = (struct sockaddr_in *)to;
-                       bzero(&sin6, sizeof(sin6));
-                       sin6.sin6_family = AF_INET6;
-                       sin6.sin6_len = sizeof(struct sockaddr_in6);
-                       sin6.sin6_addr.s6_addr16[2] = 0xffff;
-                       bcopy(&sin->sin_addr, &sin6.sin6_addr.s6_addr16[3],
-                           sizeof(sin6.sin6_addr.s6_addr16[3]));
-                       sin6.sin6_port = sin->sin_port;
-                       to = (struct sockaddr *)&sin6;
-               }
-               /* check and strip embedded scope junk */
-               to = (struct sockaddr *)sctp_recover_scope((struct sockaddr_in6 *)to,
-                   &lsa6);
-               if (((struct sockaddr_in *)to)->sin_port == 0) {
-                       kprintf("Huh a, port is %d not net:%p %d?\n",
-                              ((struct sockaddr_in *)to)->sin_port,
-                              chk->whoTo,
-                              (int)(ntohs(stcb->rport)));
-                       ((struct sockaddr_in *)to)->sin_port = stcb->rport;
-               }
-               if (sctp_sbspace(&stcb->sctp_socket->so_rcv) < (long)chk->send_size) {
-                       /* Gak not enough room */
-                       if (control) {
-                               sctp_m_freem(control);
-                               stcb->asoc.my_rwnd_control_len -=
-                                   CMSG_LEN(sizeof(struct sctp_sndrcvinfo));
-                       }
-                       goto skip;
-               }
-               lwkt_gettoken(&stcb->sctp_socket->so_rcv.ssb_token);
-               if (!sctp_sbappendaddr_nocheck(&stcb->sctp_socket->so_rcv,
-                   to, chk->data, control, stcb->asoc.my_vtag,
-                   stcb->sctp_ep)) {
-                       /* Gak not enough room */
-                       if (control) {
-                               sctp_m_freem(control);
-                               stcb->asoc.my_rwnd_control_len -=
-                                   CMSG_LEN(sizeof(struct sctp_sndrcvinfo));
-                       }
-               } else {
-                       if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) == 0) {
-                               if (sctp_add_to_socket_q(stcb->sctp_ep, stcb)) {
-                                       stcb->asoc.my_rwnd_control_len +=
-                                               sizeof(struct mbuf);
-                               }
-                       } else {
-                               stcb->asoc.my_rwnd_control_len += sizeof(struct mbuf);
-                       }
-                       free_it = 1;
-               }
-               lwkt_reltoken(&stcb->sctp_socket->so_rcv.ssb_token);
-       } else {
-               /* append to a already started message. */
-               lwkt_gettoken(&stcb->sctp_socket->so_rcv.ssb_token);
-               if (sctp_sbspace(&stcb->sctp_socket->so_rcv) >=
-                   (long)chk->send_size) {
-                       ssb_append(&stcb->sctp_socket->so_rcv, chk->data);
-                       free_it = 1;
-               }
-               lwkt_reltoken(&stcb->sctp_socket->so_rcv.ssb_token);
-       }
- skip:
-       if (hold_locks == 0)
-               SCTP_INP_WUNLOCK(stcb->sctp_ep);
-       /* free up the one we inserted */
-       if (free_it) {
-               /* Pull it off the queue */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_INDATA1) {
-                       kprintf("Free_it true, doing tickle wakeup\n");
-               }
-#endif
-               sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket);
-               TAILQ_REMOVE(&asoc->delivery_queue, chk, sctp_next);
-               asoc->size_on_delivery_queue -= chk->send_size;
-               asoc->cnt_on_delivery_queue--;
-               /* Lose the data pointer, since its in the socket buffer */
-               chk->data = NULL;
-               /* Now free the address and data */
-               sctp_free_remote_addr(chk->whoTo);
-               SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
-               sctppcbinfo.ipi_count_chunk--;
-               if ((int)sctppcbinfo.ipi_count_chunk < 0) {
-                       panic("Chunk count is negative");
-               }
-               sctppcbinfo.ipi_gencnt_chunk++;
-       }
-       return (free_it);
-}
-
-/*
- * We are delivering currently from the reassembly queue. We must continue to
- * deliver until we either:
- * 1) run out of space.
- * 2) run out of sequential TSN's
- * 3) hit the SCTP_DATA_LAST_FRAG flag.
- */
-static void
-sctp_service_reassembly(struct sctp_tcb *stcb, struct sctp_association *asoc, int hold_locks)
-{
-       struct sockaddr *to;
-       struct sockaddr_in6 sin6;
-       struct sctp_tmit_chunk *chk, *at;
-       struct mbuf *control, *m;
-       u_int16_t nxt_todel;
-       u_int16_t stream_no;
-       int cntDel;
-       cntDel = stream_no = 0;
-       if (hold_locks == 0) {
-               /*
-                * you always have the TCB lock, we need
-                * to have the inp write lock as well.
-                */
-               SCTP_TCB_UNLOCK(stcb);
-               SCTP_INP_WLOCK(stcb->sctp_ep);
-               SCTP_TCB_LOCK(stcb);
-       }
-       if (stcb && (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) {
-               /* socket above is long gone */
-               asoc->fragmented_delivery_inprogress = 0;
-               TAILQ_FOREACH(chk, &asoc->reasmqueue, sctp_next) {
-                       asoc->size_on_delivery_queue -= chk->send_size;
-                       asoc->cnt_on_delivery_queue--;
-                       /*
-                        * Lose the data pointer, since its in the socket buffer
-                        */
-                       if (chk->data)
-                               sctp_m_freem(chk->data);
-                       chk->data = NULL;
-                       /* Now free the address and data */
-                       sctp_free_remote_addr(chk->whoTo);
-                       SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
-                       sctppcbinfo.ipi_count_chunk--;
-                       if ((int)sctppcbinfo.ipi_count_chunk < 0) {
-                               panic("Chunk count is negative");
-                       }
-                       sctppcbinfo.ipi_gencnt_chunk++;
-               }
-               if (hold_locks == 0)
-                       SCTP_INP_WUNLOCK(stcb->sctp_ep);
-               return;
-       }
-       do {
-               if (stcb->sctp_socket->so_rcv.ssb_cc >=
-                   stcb->sctp_socket->so_rcv.ssb_hiwat) {
-                       if (cntDel) {
-                               sctp_sorwakeup(stcb->sctp_ep,
-                                              stcb->sctp_socket);
-                       }
-                       if (hold_locks == 0)
-                               SCTP_INP_WUNLOCK(stcb->sctp_ep);
-                       return;
-               }
-               chk = TAILQ_FIRST(&asoc->reasmqueue);
-               if (chk == NULL) {
-                       if (cntDel) {
-                               sctp_sorwakeup(stcb->sctp_ep,
-                                              stcb->sctp_socket);
-                       }
-                       if (hold_locks == 0)
-                               SCTP_INP_WUNLOCK(stcb->sctp_ep);
-                       return;
-               }
-               if (chk->rec.data.TSN_seq != (asoc->tsn_last_delivered + 1)) {
-                       /* Can't deliver more :< */
-                       if (cntDel) {
-                               sctp_sorwakeup(stcb->sctp_ep,
-                                              stcb->sctp_socket);
-                       }
-                       if (hold_locks == 0)
-                               SCTP_INP_WUNLOCK(stcb->sctp_ep);
-                       return;
-               }
-               stream_no = chk->rec.data.stream_number;
-               nxt_todel = asoc->strmin[stream_no].last_sequence_delivered + 1;
-               if (nxt_todel != chk->rec.data.stream_seq &&
-                   (chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) == 0) {
-                       /*
-                        * Not the next sequence to deliver in its stream OR
-                        * unordered
-                        */
-                       if (cntDel) {
-                               sctp_sorwakeup(stcb->sctp_ep,
-                                              stcb->sctp_socket);
-                       }
-                       if (hold_locks == 0)
-                               SCTP_INP_WUNLOCK(stcb->sctp_ep);
-                       return;
-               }
-
-               if ((chk->data->m_flags & M_PKTHDR) == 0) {
-                       MGETHDR(m, MB_DONTWAIT, MT_DATA);
-                       if (m == NULL) {
-                               /* no room! */
-                               if (hold_locks == 0)
-                                       SCTP_INP_WUNLOCK(stcb->sctp_ep);
-                               return;
-                       }
-                       m->m_pkthdr.len = chk->send_size;
-                       m->m_len = 0;
-                       m->m_next = chk->data;
-                       chk->data = m;
-               }
-               if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) {
-                       if (chk->data->m_next == NULL) {
-                               /* hopefully we hit here most of the time */
-                               chk->data->m_flags |= M_EOR;
-                       } else {
-                               /* Add the flag to the LAST mbuf in the chain */
-                               m = chk->data;
-                               while (m->m_next != NULL) {
-                                       m = m->m_next;
-                               }
-                               m->m_flags |= M_EOR;
-                       }
-               }
-               if (chk->rec.data.rcv_flags & SCTP_DATA_FIRST_FRAG) {
-                       struct sockaddr_in6 lsa6;
-
-                       control = sctp_build_ctl(stcb, chk);
-                       to = (struct sockaddr *)&chk->whoTo->ro._l_addr;
-                       if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_NEEDS_MAPPED_V4) &&
-                           to->sa_family == AF_INET) {
-                               struct sockaddr_in *sin;
-                               sin = (struct sockaddr_in *)to;
-                               bzero(&sin6, sizeof(sin6));
-                               sin6.sin6_family = AF_INET6;
-                               sin6.sin6_len = sizeof(struct sockaddr_in6);
-                               sin6.sin6_addr.s6_addr16[2] = 0xffff;
-                               bcopy(&sin->sin_addr,
-                                     &sin6.sin6_addr.s6_addr16[3],
-                                     sizeof(sin6.sin6_addr.s6_addr16[3]));
-                               sin6.sin6_port = sin->sin_port;
-                               to = (struct sockaddr *)&sin6;
-                       }
-                       /* check and strip embedded scope junk */
-                       to = (struct sockaddr *)sctp_recover_scope((struct sockaddr_in6 *)to,
-                                                                  &lsa6);
-                       if (((struct sockaddr_in *)to)->sin_port == 0) {
-                               kprintf("Huh b, port is %d not net:%p %d?\n",
-                                      ((struct sockaddr_in *)to)->sin_port,
-                                      chk->whoTo,
-                                      (int)(ntohs(stcb->rport)));
-                               ((struct sockaddr_in *)to)->sin_port = stcb->rport;
-                       }
-                       if (sctp_sbspace(&stcb->sctp_socket->so_rcv) <
-                           (long)chk->send_size) {
-                               if (control) {
-                                       sctp_m_freem(control);
-                                       stcb->asoc.my_rwnd_control_len -=
-                                               CMSG_LEN(sizeof(struct sctp_sndrcvinfo));
-                               }
-                               sctp_sorwakeup(stcb->sctp_ep,
-                                              stcb->sctp_socket);
-                               if (hold_locks == 0)
-                                       SCTP_INP_WUNLOCK(stcb->sctp_ep);
-                               return;
-                       }
-                       lwkt_gettoken(&stcb->sctp_socket->so_rcv.ssb_token);
-                       if (!sctp_sbappendaddr_nocheck(&stcb->sctp_socket->so_rcv,
-                                                 to, chk->data, control, stcb->asoc.my_vtag,
-                                                 stcb->sctp_ep)) {
-                               /* Gak not enough room */
-                               if (control) {
-                                       sctp_m_freem(control);
-                                       stcb->asoc.my_rwnd_control_len -=
-                                               CMSG_LEN(sizeof(struct sctp_sndrcvinfo));
-                               }
-                               sctp_sorwakeup(stcb->sctp_ep,
-                                              stcb->sctp_socket);
-                               if (hold_locks == 0)
-                                       SCTP_INP_WUNLOCK(stcb->sctp_ep);
-                               lwkt_reltoken(&stcb->sctp_socket->so_rcv.ssb_token);
-                               return;
-                       }
-                       lwkt_reltoken(&stcb->sctp_socket->so_rcv.ssb_token);
-                       if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) == 0) {
-                               if (sctp_add_to_socket_q(stcb->sctp_ep, stcb)) {
-                                       stcb->asoc.my_rwnd_control_len +=
-                                               sizeof(struct mbuf);
-                               }
-                       } else {
-                               stcb->asoc.my_rwnd_control_len += sizeof(struct mbuf);
-                       }
-                       cntDel++;
-               } else {
-                       if (sctp_sbspace(&stcb->sctp_socket->so_rcv) >=
-                           (long)chk->send_size) {
-                               lwkt_gettoken(&stcb->sctp_socket->so_rcv.ssb_token);
-                               ssb_append(&stcb->sctp_socket->so_rcv, chk->data);
-                               lwkt_reltoken(&stcb->sctp_socket->so_rcv.ssb_token);
-                               cntDel++;
-                       } else {
-                               /* out of space in the sb */
-                               sctp_sorwakeup(stcb->sctp_ep,
-                                              stcb->sctp_socket);
-                               if (hold_locks == 0)
-                                       SCTP_INP_WUNLOCK(stcb->sctp_ep);
-                               return;
-                       }
-               }
-               /* pull it we did it */
-               TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next);
-               if (chk->rec.data.rcv_flags & SCTP_DATA_LAST_FRAG) {
-                       asoc->fragmented_delivery_inprogress = 0;
-                       if ((chk->rec.data.rcv_flags & SCTP_DATA_UNORDERED) == 0) {
-                               asoc->strmin[stream_no].last_sequence_delivered++;
-                       }
-               }
-               asoc->tsn_last_delivered = chk->rec.data.TSN_seq;
-               asoc->size_on_reasm_queue -= chk->send_size;
-               asoc->cnt_on_reasm_queue--;
-               /* free up the chk */
-               sctp_free_remote_addr(chk->whoTo);
-               chk->data = NULL;
-               SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_chunk, chk);
-               sctppcbinfo.ipi_count_chunk--;
-               if ((int)sctppcbinfo.ipi_count_chunk < 0) {
-                       panic("Chunk count is negative");
-               }
-               sctppcbinfo.ipi_gencnt_chunk++;
-               if (asoc->fragmented_delivery_inprogress == 0) {
-                       /*
-                        * Now lets see if we can deliver the next one on the
-                        * stream
-                        */
-                       u_int16_t nxt_todel;
-                       struct sctp_stream_in *strm;
-
-                       strm = &asoc->strmin[stream_no];
-                       nxt_todel = strm->last_sequence_delivered + 1;
-                       chk = TAILQ_FIRST(&strm->inqueue);
-                       if (chk && (nxt_todel == chk->rec.data.stream_seq)) {
-                               while (chk != NULL) {
-                                       /* all delivered */
-                                       if (nxt_todel ==
-                                           chk->rec.data.stream_seq) {
-                                               at = TAILQ_NEXT(chk, sctp_next);
-                                               TAILQ_REMOVE(&strm->inqueue,
-                                                            chk, sctp_next);
-                                               asoc->size_on_all_streams -=
-                                                       chk->send_size;
-                                               asoc->cnt_on_all_streams--;
-                                               strm->last_sequence_delivered++;
-                                               /*
-                                                * We ignore the return of
-                                                * deliver_data here since we
-                                                * always can hold the chunk on
-                                                * the d-queue. And we have a
-                                                * finite number that can be
-                                                * delivered from the strq.
-                                                */
-                                               sctp_deliver_data(stcb, asoc, chk, 1);
-                                               chk = at;
-                                       } else {
-                                               break;
-                                       }
-                                       nxt_todel =
-                                               strm->last_sequence_delivered + 1;
-                               }
-                       }
-                       if (!TAILQ_EMPTY(&asoc->delivery_queue)) {
-                               /* Here if deliver_data fails, we must break */
-                               if (sctp_deliver_data(stcb, asoc, NULL, 1) == 0)
-                                       break;
-                       }
-                       sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket);
-                       if (hold_locks == 0)
-                               SCTP_INP_WUNLOCK(stcb->sctp_ep);
-                       return;
-               }
-               chk = TAILQ_FIRST(&asoc->reasmqueue);
-       } while (chk);
-       if (cntDel) {
-               sctp_sorwakeup(stcb->sctp_ep, stcb->sctp_socket);
-       }
-       if (hold_locks == 0)
-               SCTP_INP_WUNLOCK(stcb->sctp_ep);
-}
-
-/*
- * Queue the chunk either right into the socket buffer if it is the next one
- * to go OR put it in the correct place in the delivery queue.  If we do
- * append to the so_buf, keep doing so until we are out of order.
- * One big question still remains, what to do when the socket buffer is FULL??
- */
-static void
-sctp_queue_data_to_stream(struct sctp_tcb *stcb, struct sctp_association *asoc,
-    struct sctp_tmit_chunk *chk, int *abort_flag)
-{
-       struct sctp_stream_in *strm;
-       struct sctp_tmit_chunk *at;
-       int queue_needed;
-       u_int16_t nxt_todel;
-       struct mbuf *oper;
-
-/*** FIX FIX FIX ???
- * Need to add code to deal with 16 bit seq wrap
- * without a TSN wrap for ordered delivery (maybe).
- * FIX FIX FIX ???
- */
-       queue_needed = 1;
-       asoc->size_on_all_streams += chk->send_size;
-       asoc->cnt_on_all_streams++;
-       strm = &asoc->strmin[chk->rec.data.stream_number];
-       nxt_todel = strm->last_sequence_delivered + 1;
-#ifdef SCTP_STR_LOGGING
-       sctp_log_strm_del(chk, NULL, SCTP_STR_LOG_FROM_INTO_STRD);
-#endif
-#ifdef SCTP_DEBUG
-       if (sctp_debug_on & SCTP_DEBUG_INDATA1) {
-               kprintf("queue to stream called for ssn:%u lastdel:%u nxt:%u\n",
-                   (u_int)chk->rec.data.stream_seq,
-                   (u_int)strm->last_sequence_delivered, (u_int)nxt_todel);
-       }
-#endif
-       if (compare_with_wrap(strm->last_sequence_delivered,
-           chk->rec.data.stream_seq, MAX_SEQ) ||
-           (strm->last_sequence_delivered == chk->rec.data.stream_seq)) {
-               /* The incoming sseq is behind where we last delivered? */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_INDATA1) {
-                       kprintf("Duplicate S-SEQ:%d delivered:%d from peer, Abort  association\n",
-                           chk->rec.data.stream_seq,
-                           strm->last_sequence_delivered);
-               }
-#endif
-               /*
-                * throw it in the stream so it gets cleaned up in
-                * association destruction
-                */
-               TAILQ_INSERT_HEAD(&strm->inqueue, chk, sctp_next);
-               MGET(oper, MB_DONTWAIT, MT_DATA);
-               if (oper) {
-                       struct sctp_paramhdr *ph;
-                       u_int32_t *ippp;
-
-                       oper->m_len = sizeof(struct sctp_paramhdr) +
-                           sizeof(*ippp);
-                       ph = mtod(oper, struct sctp_paramhdr *);
-                       ph->param_type = htons(SCTP_CAUSE_PROTOCOL_VIOLATION);
-                       ph->param_length = htons(oper->m_len);
-                       ippp = (u_int32_t *)(ph + 1);
-                       *ippp = htonl(0x00000001);
-               }
-               sctp_abort_an_association(stcb->sctp_ep, stcb,
-                   SCTP_PEER_FAULTY, oper);
-
-               *abort_flag = 1;
-               return;
-
-       }
-       if (nxt_todel == chk->rec.data.stream_seq) {
-               /* can be delivered right away */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_INDATA1) {
-                       kprintf("It's NEXT!\n");
-               }
-#endif
-#ifdef SCTP_STR_LOGGING
-               sctp_log_strm_del(chk, NULL, SCTP_STR_LOG_FROM_IMMED_DEL);
-#endif
-               queue_needed = 0;
-               asoc->size_on_all_streams -= chk->send_size;
-               asoc->cnt_on_all_streams--;
-               strm->last_sequence_delivered++;
-               sctp_deliver_data(stcb, asoc, chk, 0);
-               chk = TAILQ_FIRST(&strm->inqueue);
-               while (chk != NULL) {
-                       /* all delivered */
-                       nxt_todel = strm->last_sequence_delivered + 1;
-                       if (nxt_todel == chk->rec.data.stream_seq) {
-                               at = TAILQ_NEXT(chk, sctp_next);
-                               TAILQ_REMOVE(&strm->inqueue, chk, sctp_next);
-                               asoc->size_on_all_streams -= chk->send_size;
-                               asoc->cnt_on_all_streams--;
-                               strm->last_sequence_delivered++;
-                               /*
-                                * We ignore the return of deliver_data here
-                                * since we always can hold the chunk on the
-                                * d-queue. And we have a finite number that
-                                * can be delivered from the strq.
-                                */
-#ifdef SCTP_STR_LOGGING
-                               sctp_log_strm_del(chk, NULL,
-                                   SCTP_STR_LOG_FROM_IMMED_DEL);
-#endif
-                               sctp_deliver_data(stcb, asoc, chk, 0);
-                               chk = at;
-                               continue;
-                       }
-                       break;
-               }
-       }
-       if (queue_needed) {
-               /*
-                * Ok, we did not deliver this guy, find
-                * the correct place to put it on the queue.
-                */
-#ifdef SCTP_DEBUG
-               if (sctp_debug_on & SCTP_DEBUG_INDATA1) {
-                       kprintf("Queue Needed!\n");
-               }
-#endif
-               if (TAILQ_EMPTY(&strm->inqueue)) {
-                       /* Empty queue */
-#ifdef SCTP_STR_LOGGING
-                       sctp_log_strm_del(chk, NULL, SCTP_STR_LOG_FROM_INSERT_HD);
-#endif
-                       TAILQ_INSERT_HEAD(&strm->inqueue, chk, sctp_next);
-               } else {
-                       TAILQ_FOREACH(at, &strm->inqueue, sctp_next) {
-                               if (compare_with_wrap(at->rec.data.stream_seq,
-                                   chk->rec.data.stream_seq, MAX_SEQ)) {
-                                       /*
-                                        * one in queue is bigger than the new
-                                        * one, insert before this one
-                                        */
-#ifdef SCTP_STR_LOGGING
-                                       sctp_log_strm_del(chk, at,
-                                           SCTP_STR_LOG_FROM_INSERT_MD);
-#endif
-                                       TAILQ_INSERT_BEFORE(at, chk, sctp_next);
-                                       break;
-                               } else if (at->rec.data.stream_seq ==
-                                   chk->rec.data.stream_seq) {
-                                       /*
-                                        * Gak, He sent me a duplicate str seq
-          &n