Deleted Added
full compact
sctp_pcb.c (165647) sctp_pcb.c (166023)
1/*-
2 * Copyright (c) 2001-2006, Cisco Systems, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.

--- 17 unchanged lines hidden (view full) ---

26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/* $KAME: sctp_pcb.c,v 1.38 2005/03/06 16:04:18 itojun Exp $ */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001-2006, Cisco Systems, Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are met:
6 *
7 * a) Redistributions of source code must retain the above copyright notice,
8 * this list of conditions and the following disclaimer.

--- 17 unchanged lines hidden (view full) ---

26 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
28 * THE POSSIBILITY OF SUCH DAMAGE.
29 */
30
31/* $KAME: sctp_pcb.c,v 1.38 2005/03/06 16:04:18 itojun Exp $ */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.c 165647 2006-12-29 20:21:42Z rrs $");
35
34__FBSDID("$FreeBSD: head/sys/netinet/sctp_pcb.c 166023 2007-01-15 15:12:10Z rrs $");
36#include "opt_ipsec.h"
37#include "opt_compat.h"
38#include "opt_inet6.h"
39#include "opt_inet.h"
40#include "opt_sctp.h"
41
42#include <sys/param.h>
43#include <sys/systm.h>

--- 622 unchanged lines hidden (view full) ---

666 SCTP_INP_RUNLOCK(inp);
667 continue;
668 }
669 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) &&
670 (inp->sctp_lport == lport)) {
671 /* got it */
672 if ((nam->sa_family == AF_INET) &&
673 (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
35#include "opt_ipsec.h"
36#include "opt_compat.h"
37#include "opt_inet6.h"
38#include "opt_inet.h"
39#include "opt_sctp.h"
40
41#include <sys/param.h>
42#include <sys/systm.h>

--- 622 unchanged lines hidden (view full) ---

665 SCTP_INP_RUNLOCK(inp);
666 continue;
667 }
668 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) &&
669 (inp->sctp_lport == lport)) {
670 /* got it */
671 if ((nam->sa_family == AF_INET) &&
672 (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
674 (((struct inpcb *)inp)->inp_flags & IN6P_IPV6_V6ONLY)
675 ) {
673 SCTP_IPV6_V6ONLY(inp)) {
676 /* IPv4 on a IPv6 socket with ONLY IPv6 set */
677 SCTP_INP_RUNLOCK(inp);
678 continue;
679 }
680 /* A V6 address and the endpoint is NOT bound V6 */
681 if (nam->sa_family == AF_INET6 &&
682 (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) {
683 SCTP_INP_RUNLOCK(inp);

--- 742 unchanged lines hidden (view full) ---

1426 } else {
1427 /*
1428 * unsupported socket type (RAW, etc)- in case we missed it
1429 * in protosw
1430 */
1431 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_ep, inp);
1432 return (EOPNOTSUPP);
1433 }
674 /* IPv4 on a IPv6 socket with ONLY IPv6 set */
675 SCTP_INP_RUNLOCK(inp);
676 continue;
677 }
678 /* A V6 address and the endpoint is NOT bound V6 */
679 if (nam->sa_family == AF_INET6 &&
680 (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) {
681 SCTP_INP_RUNLOCK(inp);

--- 742 unchanged lines hidden (view full) ---

1424 } else {
1425 /*
1426 * unsupported socket type (RAW, etc)- in case we missed it
1427 * in protosw
1428 */
1429 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_ep, inp);
1430 return (EOPNOTSUPP);
1431 }
1434 inp->sctp_tcbhash = hashinit(sctp_pcbtblsize,
1435 M_PCB,
1432 inp->sctp_tcbhash = SCTP_HASH_INIT(sctp_pcbtblsize,
1436 &inp->sctp_hashmark);
1437 if (inp->sctp_tcbhash == NULL) {
1438 printf("Out of SCTP-INPCB->hashinit - no resources\n");
1439 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_ep, inp);
1440 return (ENOBUFS);
1441 }
1442 SCTP_INP_INFO_WLOCK();
1443 SCTP_INP_LOCK_INIT(inp);

--- 143 unchanged lines hidden (view full) ---

1587 /* Ok. Let's restart timer. */
1588 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
1589 sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, new_inp,
1590 stcb, net);
1591 }
1592
1593 SCTP_INP_INFO_WUNLOCK();
1594 if (new_inp->sctp_tcbhash != NULL) {
1433 &inp->sctp_hashmark);
1434 if (inp->sctp_tcbhash == NULL) {
1435 printf("Out of SCTP-INPCB->hashinit - no resources\n");
1436 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_ep, inp);
1437 return (ENOBUFS);
1438 }
1439 SCTP_INP_INFO_WLOCK();
1440 SCTP_INP_LOCK_INIT(inp);

--- 143 unchanged lines hidden (view full) ---

1584 /* Ok. Let's restart timer. */
1585 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
1586 sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, new_inp,
1587 stcb, net);
1588 }
1589
1590 SCTP_INP_INFO_WUNLOCK();
1591 if (new_inp->sctp_tcbhash != NULL) {
1595 SCTP_FREE(new_inp->sctp_tcbhash);
1592 SCTP_HASH_FREE(new_inp->sctp_tcbhash, new_inp->sctp_hashmark);
1596 new_inp->sctp_tcbhash = NULL;
1597 }
1598 if ((new_inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0) {
1599 /* Subset bound, so copy in the laddr list from the old_inp */
1600 LIST_FOREACH(oladdr, &old_inp->sctp_addr_list, sctp_nxt_addr) {
1601 laddr = (struct sctp_laddr *)SCTP_ZONE_GET(
1602 sctppcbinfo.ipi_zone_laddr);
1603 if (laddr == NULL) {

--- 51 unchanged lines hidden (view full) ---

1655
1656 LIST_FOREACH(t_inp, head, sctp_hash) {
1657 if (t_inp->sctp_lport != lport) {
1658 continue;
1659 }
1660 /* This one is in use. */
1661 /* check the v6/v4 binding issue */
1662 if ((t_inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
1593 new_inp->sctp_tcbhash = NULL;
1594 }
1595 if ((new_inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0) {
1596 /* Subset bound, so copy in the laddr list from the old_inp */
1597 LIST_FOREACH(oladdr, &old_inp->sctp_addr_list, sctp_nxt_addr) {
1598 laddr = (struct sctp_laddr *)SCTP_ZONE_GET(
1599 sctppcbinfo.ipi_zone_laddr);
1600 if (laddr == NULL) {

--- 51 unchanged lines hidden (view full) ---

1652
1653 LIST_FOREACH(t_inp, head, sctp_hash) {
1654 if (t_inp->sctp_lport != lport) {
1655 continue;
1656 }
1657 /* This one is in use. */
1658 /* check the v6/v4 binding issue */
1659 if ((t_inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
1663 (((struct inpcb *)t_inp)->inp_flags & IN6P_IPV6_V6ONLY)
1664 ) {
1660 SCTP_IPV6_V6ONLY(t_inp)) {
1665 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
1666 /* collision in V6 space */
1667 return (1);
1668 } else {
1669 /* inp is BOUND_V4 no conflict */
1670 continue;
1671 }
1672 } else if (t_inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
1673 /* t_inp is bound v4 and v6, conflict always */
1674 return (1);
1675 } else {
1676 /* t_inp is bound only V4 */
1677 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
1661 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
1662 /* collision in V6 space */
1663 return (1);
1664 } else {
1665 /* inp is BOUND_V4 no conflict */
1666 continue;
1667 }
1668 } else if (t_inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
1669 /* t_inp is bound v4 and v6, conflict always */
1670 return (1);
1671 } else {
1672 /* t_inp is bound only V4 */
1673 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
1678 (((struct inpcb *)inp)->inp_flags & IN6P_IPV6_V6ONLY)
1679 ) {
1674 SCTP_IPV6_V6ONLY(t_inp)) {
1680 /* no conflict */
1681 continue;
1682 }
1683 /* else fall through to conflict */
1684 }
1685 return (1);
1686 }
1687 return (0);

--- 31 unchanged lines hidden (view full) ---

1719 /* already did a bind, subsequent binds NOT allowed ! */
1720 return (EINVAL);
1721 }
1722 if (addr != NULL) {
1723 if (addr->sa_family == AF_INET) {
1724 struct sockaddr_in *sin;
1725
1726 /* IPV6_V6ONLY socket? */
1675 /* no conflict */
1676 continue;
1677 }
1678 /* else fall through to conflict */
1679 }
1680 return (1);
1681 }
1682 return (0);

--- 31 unchanged lines hidden (view full) ---

1714 /* already did a bind, subsequent binds NOT allowed ! */
1715 return (EINVAL);
1716 }
1717 if (addr != NULL) {
1718 if (addr->sa_family == AF_INET) {
1719 struct sockaddr_in *sin;
1720
1721 /* IPV6_V6ONLY socket? */
1727 if (
1728 (ip_inp->inp_flags & IN6P_IPV6_V6ONLY)
1729 ) {
1722 if (SCTP_IPV6_V6ONLY(ip_inp)) {
1730 return (EINVAL);
1731 }
1732 if (addr->sa_len != sizeof(*sin))
1733 return (EINVAL);
1734
1735 sin = (struct sockaddr_in *)addr;
1736 lport = sin->sin_port;
1737

--- 717 unchanged lines hidden (view full) ---

2455 LIST_REMOVE(asoc, sctp_tcblist);
2456 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_asoc, asoc);
2457 SCTP_DECR_ASOC_COUNT();
2458 }
2459 /* *** END TEMP CODE *** */
2460#endif
2461 /* Now lets see about freeing the EP hash table. */
2462 if (inp->sctp_tcbhash != NULL) {
1723 return (EINVAL);
1724 }
1725 if (addr->sa_len != sizeof(*sin))
1726 return (EINVAL);
1727
1728 sin = (struct sockaddr_in *)addr;
1729 lport = sin->sin_port;
1730

--- 717 unchanged lines hidden (view full) ---

2448 LIST_REMOVE(asoc, sctp_tcblist);
2449 SCTP_ZONE_FREE(sctppcbinfo.ipi_zone_asoc, asoc);
2450 SCTP_DECR_ASOC_COUNT();
2451 }
2452 /* *** END TEMP CODE *** */
2453#endif
2454 /* Now lets see about freeing the EP hash table. */
2455 if (inp->sctp_tcbhash != NULL) {
2463 SCTP_FREE(inp->sctp_tcbhash);
2464 inp->sctp_tcbhash = 0;
2456 SCTP_HASH_FREE(inp->sctp_tcbhash, inp->sctp_hashmark);
2457 inp->sctp_tcbhash = NULL;
2465 }
2466 /* Now we must put the ep memory back into the zone pool */
2467 SCTP_INP_LOCK_DESTROY(inp);
2468 SCTP_INP_READ_DESTROY(inp);
2469 SCTP_ASOC_CREATE_LOCK_DESTROY(inp);
2470 SCTP_INP_INFO_WUNLOCK();
2471
2472 SCTP_ITERATOR_UNLOCK();

--- 638 unchanged lines hidden (view full) ---

3111 }
3112 }
3113 }
3114 /* not found. */
3115 return (-2);
3116}
3117
3118
2458 }
2459 /* Now we must put the ep memory back into the zone pool */
2460 SCTP_INP_LOCK_DESTROY(inp);
2461 SCTP_INP_READ_DESTROY(inp);
2462 SCTP_ASOC_CREATE_LOCK_DESTROY(inp);
2463 SCTP_INP_INFO_WUNLOCK();
2464
2465 SCTP_ITERATOR_UNLOCK();

--- 638 unchanged lines hidden (view full) ---

3104 }
3105 }
3106 }
3107 /* not found. */
3108 return (-2);
3109}
3110
3111
3119static void
3120sctp_add_vtag_to_timewait(struct sctp_inpcb *inp, uint32_t tag)
3112void
3113sctp_add_vtag_to_timewait(struct sctp_inpcb *inp, uint32_t tag, uint32_t time)
3121{
3122 struct sctpvtaghead *chain;
3123 struct sctp_tagblock *twait_block;
3124 struct timeval now;
3125 int set, i;
3126
3127 SCTP_GETTIME_TIMEVAL(&now);
3128 chain = &sctppcbinfo.vtag_timewait[(tag % SCTP_STACK_VTAG_HASH_SIZE)];
3129 set = 0;
3130 if (!LIST_EMPTY(chain)) {
3131 /* Block(s) present, lets find space, and expire on the fly */
3132 LIST_FOREACH(twait_block, chain, sctp_nxt_tagblock) {
3133 for (i = 0; i < SCTP_NUMBER_IN_VTAG_BLOCK; i++) {
3134 if ((twait_block->vtag_block[i].v_tag == 0) &&
3135 !set) {
3136 twait_block->vtag_block[i].tv_sec_at_expire =
3114{
3115 struct sctpvtaghead *chain;
3116 struct sctp_tagblock *twait_block;
3117 struct timeval now;
3118 int set, i;
3119
3120 SCTP_GETTIME_TIMEVAL(&now);
3121 chain = &sctppcbinfo.vtag_timewait[(tag % SCTP_STACK_VTAG_HASH_SIZE)];
3122 set = 0;
3123 if (!LIST_EMPTY(chain)) {
3124 /* Block(s) present, lets find space, and expire on the fly */
3125 LIST_FOREACH(twait_block, chain, sctp_nxt_tagblock) {
3126 for (i = 0; i < SCTP_NUMBER_IN_VTAG_BLOCK; i++) {
3127 if ((twait_block->vtag_block[i].v_tag == 0) &&
3128 !set) {
3129 twait_block->vtag_block[i].tv_sec_at_expire =
3137 now.tv_sec + SCTP_TIME_WAIT;
3130 now.tv_sec + time;
3138 twait_block->vtag_block[i].v_tag = tag;
3139 set = 1;
3140 } else if ((twait_block->vtag_block[i].v_tag) &&
3141 ((long)twait_block->vtag_block[i].tv_sec_at_expire >
3142 now.tv_sec)) {
3143 /* Audit expires this guy */
3144 twait_block->vtag_block[i].tv_sec_at_expire = 0;
3145 twait_block->vtag_block[i].v_tag = 0;

--- 16 unchanged lines hidden (view full) ---

3162 }
3163 /* Need to add a new block to chain */
3164 if (!set) {
3165 SCTP_MALLOC(twait_block, struct sctp_tagblock *,
3166 sizeof(struct sctp_tagblock), "TimeWait");
3167 if (twait_block == NULL) {
3168 return;
3169 }
3131 twait_block->vtag_block[i].v_tag = tag;
3132 set = 1;
3133 } else if ((twait_block->vtag_block[i].v_tag) &&
3134 ((long)twait_block->vtag_block[i].tv_sec_at_expire >
3135 now.tv_sec)) {
3136 /* Audit expires this guy */
3137 twait_block->vtag_block[i].tv_sec_at_expire = 0;
3138 twait_block->vtag_block[i].v_tag = 0;

--- 16 unchanged lines hidden (view full) ---

3155 }
3156 /* Need to add a new block to chain */
3157 if (!set) {
3158 SCTP_MALLOC(twait_block, struct sctp_tagblock *,
3159 sizeof(struct sctp_tagblock), "TimeWait");
3160 if (twait_block == NULL) {
3161 return;
3162 }
3170 memset(twait_block, 0, sizeof(struct sctp_timewait));
3163 memset(twait_block, 0, sizeof(struct sctp_tagblock));
3171 LIST_INSERT_HEAD(chain, twait_block, sctp_nxt_tagblock);
3172 twait_block->vtag_block[0].tv_sec_at_expire = now.tv_sec +
3173 SCTP_TIME_WAIT;
3174 twait_block->vtag_block[0].v_tag = tag;
3175 }
3176}
3177
3178

--- 235 unchanged lines hidden (view full) ---

3414 }
3415 SOCK_UNLOCK(so);
3416 sctp_sowwakeup(inp, so);
3417 sctp_sorwakeup(inp, so);
3418 wakeup(&so->so_timeo);
3419 }
3420 }
3421 }
3164 LIST_INSERT_HEAD(chain, twait_block, sctp_nxt_tagblock);
3165 twait_block->vtag_block[0].tv_sec_at_expire = now.tv_sec +
3166 SCTP_TIME_WAIT;
3167 twait_block->vtag_block[0].v_tag = tag;
3168 }
3169}
3170
3171

--- 235 unchanged lines hidden (view full) ---

3407 }
3408 SOCK_UNLOCK(so);
3409 sctp_sowwakeup(inp, so);
3410 sctp_sorwakeup(inp, so);
3411 wakeup(&so->so_timeo);
3412 }
3413 }
3414 }
3422 /* Stop any timer someone may have started */
3423 SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer);
3424 /*
3425 * Make it invalid too, that way if its about to run it will abort
3426 * and return.
3427 */
3415 /*
3416 * Make it invalid too, that way if its about to run it will abort
3417 * and return.
3418 */
3428 asoc->strreset_timer.type = SCTP_TIMER_TYPE_NONE;
3429 sctp_iterator_asoc_being_freed(inp, stcb);
3430 /* re-increment the lock */
3431 if (from_inpcbfree == SCTP_NORMAL_PROC) {
3432 atomic_add_int(&stcb->asoc.refcnt, -1);
3433 }
3419 sctp_iterator_asoc_being_freed(inp, stcb);
3420 /* re-increment the lock */
3421 if (from_inpcbfree == SCTP_NORMAL_PROC) {
3422 atomic_add_int(&stcb->asoc.refcnt, -1);
3423 }
3434 /* now restop the timers to be sure - this is paranoia at is finest! */
3435 SCTP_OS_TIMER_STOP(&asoc->hb_timer.timer);
3436 SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer);
3437 SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer);
3438 SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer);
3439 SCTP_OS_TIMER_STOP(&asoc->shut_guard_timer.timer);
3440 SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer);
3441 SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer);
3442
3443 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3444 SCTP_OS_TIMER_STOP(&net->fr_timer.timer);
3445 SCTP_OS_TIMER_STOP(&net->rxt_timer.timer);
3446 SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer);
3447 }
3448 asoc->state = 0;
3449 if (inp->sctp_tcbhash) {
3450 LIST_REMOVE(stcb, sctp_tcbhash);
3451 }
3452 if (stcb->asoc.in_restart_hash) {
3453 LIST_REMOVE(stcb, sctp_tcbrestarhash);
3454 }
3455 /* Now lets remove it from the list of ALL associations in the EP */
3456 LIST_REMOVE(stcb, sctp_tcblist);
3457 if (from_inpcbfree == SCTP_NORMAL_PROC) {
3458 SCTP_INP_INCR_REF(inp);
3459 SCTP_INP_WUNLOCK(inp);
3460 SCTP_ITERATOR_UNLOCK();
3461 }
3462 /* pull from vtag hash */
3463 LIST_REMOVE(stcb, sctp_asocs);
3424 asoc->state = 0;
3425 if (inp->sctp_tcbhash) {
3426 LIST_REMOVE(stcb, sctp_tcbhash);
3427 }
3428 if (stcb->asoc.in_restart_hash) {
3429 LIST_REMOVE(stcb, sctp_tcbrestarhash);
3430 }
3431 /* Now lets remove it from the list of ALL associations in the EP */
3432 LIST_REMOVE(stcb, sctp_tcblist);
3433 if (from_inpcbfree == SCTP_NORMAL_PROC) {
3434 SCTP_INP_INCR_REF(inp);
3435 SCTP_INP_WUNLOCK(inp);
3436 SCTP_ITERATOR_UNLOCK();
3437 }
3438 /* pull from vtag hash */
3439 LIST_REMOVE(stcb, sctp_asocs);
3464 sctp_add_vtag_to_timewait(inp, asoc->my_vtag);
3440 sctp_add_vtag_to_timewait(inp, asoc->my_vtag, SCTP_TIME_WAIT);
3465
3441
3442
3443 /*
3444 * Now restop the timers to be sure - this is paranoia at is finest!
3445 */
3446 SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer);
3447 SCTP_OS_TIMER_STOP(&asoc->hb_timer.timer);
3448 SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer);
3449 SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer);
3450 SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer);
3451 SCTP_OS_TIMER_STOP(&asoc->shut_guard_timer.timer);
3452 SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer);
3453 SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer);
3454
3455 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3456 SCTP_OS_TIMER_STOP(&net->fr_timer.timer);
3457 SCTP_OS_TIMER_STOP(&net->rxt_timer.timer);
3458 SCTP_OS_TIMER_STOP(&net->pmtu_timer.timer);
3459 }
3460
3461 asoc->strreset_timer.type = SCTP_TIMER_TYPE_NONE;
3466 prev = NULL;
3467 /*
3468 * The chunk lists and such SHOULD be empty but we check them just
3469 * in case.
3470 */
3471 /* anything on the wheel needs to be removed */
3472 for (i = 0; i < asoc->streamoutcnt; i++) {
3473 struct sctp_stream_out *outs;

--- 745 unchanged lines hidden (view full) ---

4219
4220 /* init the iterator head */
4221 LIST_INIT(&sctppcbinfo.iteratorhead);
4222
4223 /* init the hash table of endpoints */
4224 TUNABLE_INT_FETCH("net.inet.sctp.tcbhashsize", &sctp_hashtblsize);
4225 TUNABLE_INT_FETCH("net.inet.sctp.pcbhashsize", &sctp_pcbtblsize);
4226 TUNABLE_INT_FETCH("net.inet.sctp.chunkscale", &sctp_chunkscale);
3462 prev = NULL;
3463 /*
3464 * The chunk lists and such SHOULD be empty but we check them just
3465 * in case.
3466 */
3467 /* anything on the wheel needs to be removed */
3468 for (i = 0; i < asoc->streamoutcnt; i++) {
3469 struct sctp_stream_out *outs;

--- 745 unchanged lines hidden (view full) ---

4215
4216 /* init the iterator head */
4217 LIST_INIT(&sctppcbinfo.iteratorhead);
4218
4219 /* init the hash table of endpoints */
4220 TUNABLE_INT_FETCH("net.inet.sctp.tcbhashsize", &sctp_hashtblsize);
4221 TUNABLE_INT_FETCH("net.inet.sctp.pcbhashsize", &sctp_pcbtblsize);
4222 TUNABLE_INT_FETCH("net.inet.sctp.chunkscale", &sctp_chunkscale);
4227
4228 sctppcbinfo.sctp_asochash = hashinit((sctp_hashtblsize * 31),
4229 M_PCB,
4223 sctppcbinfo.sctp_asochash = SCTP_HASH_INIT((sctp_hashtblsize * 31),
4230 &sctppcbinfo.hashasocmark);
4224 &sctppcbinfo.hashasocmark);
4231
4232 sctppcbinfo.sctp_ephash = hashinit(sctp_hashtblsize,
4233 M_PCB,
4225 sctppcbinfo.sctp_ephash = SCTP_HASH_INIT(sctp_hashtblsize,
4234 &sctppcbinfo.hashmark);
4226 &sctppcbinfo.hashmark);
4235
4236 sctppcbinfo.sctp_tcpephash = hashinit(sctp_hashtblsize,
4237 M_PCB,
4227 sctppcbinfo.sctp_tcpephash = SCTP_HASH_INIT(sctp_hashtblsize,
4238 &sctppcbinfo.hashtcpmark);
4228 &sctppcbinfo.hashtcpmark);
4239
4240 sctppcbinfo.hashtblsize = sctp_hashtblsize;
4241
4229 sctppcbinfo.hashtblsize = sctp_hashtblsize;
4230
4242 /*
4243 * init the small hash table we use to track restarted asoc's
4244 */
4245 sctppcbinfo.sctp_restarthash = hashinit(SCTP_STACK_VTAG_HASH_SIZE,
4246 M_PCB,
4231 /* init the small hash table we use to track restarted asoc's */
4232 sctppcbinfo.sctp_restarthash = SCTP_HASH_INIT(SCTP_STACK_VTAG_HASH_SIZE,
4247 &sctppcbinfo.hashrestartmark);
4248
4249 /* init the zones */
4250 /*
4251 * FIX ME: Should check for NULL returns, but if it does fail we are
4252 * doomed to panic anyways... add later maybe.
4253 */
4254 SCTP_ZONE_INIT(sctppcbinfo.ipi_zone_ep, "sctp_ep",

--- 48 unchanged lines hidden (view full) ---

4303 /* stream out queue cont */
4304 sctppcbinfo.ipi_count_strmoq = 0;
4305
4306 sctppcbinfo.ipi_free_strmoq = 0;
4307 sctppcbinfo.ipi_free_chunks = 0;
4308
4309 SCTP_OS_TIMER_INIT(&sctppcbinfo.addr_wq_timer.timer);
4310
4233 &sctppcbinfo.hashrestartmark);
4234
4235 /* init the zones */
4236 /*
4237 * FIX ME: Should check for NULL returns, but if it does fail we are
4238 * doomed to panic anyways... add later maybe.
4239 */
4240 SCTP_ZONE_INIT(sctppcbinfo.ipi_zone_ep, "sctp_ep",

--- 48 unchanged lines hidden (view full) ---

4289 /* stream out queue cont */
4290 sctppcbinfo.ipi_count_strmoq = 0;
4291
4292 sctppcbinfo.ipi_free_strmoq = 0;
4293 sctppcbinfo.ipi_free_chunks = 0;
4294
4295 SCTP_OS_TIMER_INIT(&sctppcbinfo.addr_wq_timer.timer);
4296
4311 /* port stuff */
4312 sctppcbinfo.lastlow = ipport_firstauto;
4313 /* Init the TIMEWAIT list */
4314 for (i = 0; i < SCTP_STACK_VTAG_HASH_SIZE; i++) {
4315 LIST_INIT(&sctppcbinfo.vtag_timewait[i]);
4316 }
4317
4318}
4319
4320

--- 990 unchanged lines hidden ---
4297 /* Init the TIMEWAIT list */
4298 for (i = 0; i < SCTP_STACK_VTAG_HASH_SIZE; i++) {
4299 LIST_INIT(&sctppcbinfo.vtag_timewait[i]);
4300 }
4301
4302}
4303
4304

--- 990 unchanged lines hidden ---