Home | History | Annotate | Download | only in netinet

Lines Matching defs:asoc

943 	loopback_scope = stcb->asoc.scope.loopback_scope;
945 ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope;
946 ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal;
949 local_scope = stcb->asoc.scope.local_scope;
950 site_scope = stcb->asoc.scope.site_scope;
951 ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal;
954 conn_addr_legal = stcb->asoc.scope.conn_addr_legal;
958 vrf = sctp_find_vrf(stcb->asoc.vrf_id);
1318 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
1329 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
1454 atomic_add_int(&locked_tcb->asoc.refcnt, 1);
1479 atomic_subtract_int(&locked_tcb->asoc.refcnt, 1);
1500 atomic_subtract_int(&locked_tcb->asoc.refcnt, 1);
1524 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
1533 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
1565 atomic_subtract_int(&locked_tcb->asoc.refcnt, 1);
1594 atomic_subtract_int(&locked_tcb->asoc.refcnt, 1);
1621 atomic_subtract_int(&locked_tcb->asoc.refcnt, 1);
1653 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
1662 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
1694 atomic_subtract_int(&locked_tcb->asoc.refcnt, 1);
1723 atomic_subtract_int(&locked_tcb->asoc.refcnt, 1);
1750 atomic_subtract_int(&locked_tcb->asoc.refcnt, 1);
1771 atomic_subtract_int(&locked_tcb->asoc.refcnt, 1);
1810 if (stcb->asoc.assoc_id == id) {
1819 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
2471 if (stcb->asoc.my_vtag == vtag) {
2481 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
2493 if (stcb->asoc.peer_vtag == remote_tag) {
3030 atomic_add_int(&stcb->asoc.refcnt, 1);
3036 atomic_subtract_int(&stcb->asoc.refcnt, 1);
3058 if (stcb->asoc.in_asocid_hash) {
3075 if (stcb->asoc.in_asocid_hash) {
3077 lhd = &new_inp->sctp_asocidhash[SCTP_PCBHASH_ASOC(stcb->asoc.assoc_id,
3082 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
3113 if (oladdr == stcb->asoc.last_used_address) {
3114 stcb->asoc.last_used_address = laddr;
3124 stcb->asoc.dack_timer.ep = (void *)new_inp;
3125 stcb->asoc.asconf_timer.ep = (void *)new_inp;
3126 stcb->asoc.strreset_timer.ep = (void *)new_inp;
3127 stcb->asoc.shut_guard_timer.ep = (void *)new_inp;
3128 stcb->asoc.autoclose_timer.ep = (void *)new_inp;
3129 stcb->asoc.delayed_event_timer.ep = (void *)new_inp;
3130 stcb->asoc.delete_prim_timer.ep = (void *)new_inp;
3132 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
3799 struct sctp_tcb *asoc, *nasoc;
3864 LIST_FOREACH_SAFE(asoc, &inp->sctp_asoc_list, sctp_tcblist, nasoc) {
3865 SCTP_TCB_LOCK(asoc);
3866 if (asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
3869 if (asoc->asoc.state & SCTP_STATE_IN_ACCEPT_QUEUE) {
3872 * timer on the asoc due to it was not
3875 asoc->asoc.state &= ~SCTP_STATE_IN_ACCEPT_QUEUE;
3876 sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, asoc, NULL);
3878 SCTP_TCB_UNLOCK(asoc);
3881 if (((SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_COOKIE_WAIT) ||
3882 (SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_COOKIE_ECHOED)) &&
3883 (asoc->asoc.total_output_queue_size == 0)) {
3890 if (sctp_free_assoc(inp, asoc, SCTP_PCBFREE_NOFORCE,
3897 asoc->sctp_socket = NULL;
3898 asoc->asoc.state |= SCTP_STATE_CLOSED_SOCKET;
3899 if ((asoc->asoc.size_on_reasm_queue > 0) ||
3900 (asoc->asoc.control_pdapi) ||
3901 (asoc->asoc.size_on_all_streams > 0) ||
3907 asoc->sctp_ep->last_abort_code = SCTP_FROM_SCTP_PCB+SCTP_LOC_3;
3908 sctp_send_abort_tcb(asoc, op_err, SCTP_SO_LOCKED);
3910 if ((SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_OPEN) ||
3911 (SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
3914 if (sctp_free_assoc(inp, asoc,
3919 } else if (TAILQ_EMPTY(&asoc->asoc.send_queue) &&
3920 TAILQ_EMPTY(&asoc->asoc.sent_queue) &&
3921 (asoc->asoc.stream_queue_cnt == 0)) {
3922 if (asoc->asoc.locked_on_sending) {
3925 if ((SCTP_GET_STATE(&asoc->asoc) != SCTP_STATE_SHUTDOWN_SENT) &&
3926 (SCTP_GET_STATE(&asoc->asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) {
3933 if ((SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_OPEN) ||
3934 (SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
3937 SCTP_SET_STATE(&asoc->asoc, SCTP_STATE_SHUTDOWN_SENT);
3938 SCTP_CLEAR_SUBSTATE(&asoc->asoc, SCTP_STATE_SHUTDOWN_PENDING);
3939 sctp_stop_timers_for_shutdown(asoc);
3940 if (asoc->asoc.alternate) {
3941 netp = asoc->asoc.alternate;
3943 netp = asoc->asoc.primary_destination;
3945 sctp_send_shutdown(asoc, netp);
3946 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWN, asoc->sctp_ep, asoc,
3948 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, asoc->sctp_ep, asoc,
3949 asoc->asoc.primary_destination);
3950 sctp_chunk_output(inp, asoc, SCTP_OUTPUT_FROM_SHUT_TMR, SCTP_SO_LOCKED);
3956 asoc->asoc.state |= SCTP_STATE_SHUTDOWN_PENDING;
3957 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, asoc->sctp_ep, asoc,
3958 asoc->asoc.primary_destination);
3959 if (asoc->asoc.locked_on_sending) {
3960 sp = TAILQ_LAST(&((asoc->asoc.locked_on_sending)->outqueue),
3964 (void *)asoc->asoc.locked_on_sending,
3965 asoc->asoc.locked_on_sending->stream_no);
3968 asoc->asoc.state |= SCTP_STATE_PARTIAL_MSG_LEFT;
3971 if (TAILQ_EMPTY(&asoc->asoc.send_queue) &&
3972 TAILQ_EMPTY(&asoc->asoc.sent_queue) &&
3973 (asoc->asoc.state & SCTP_STATE_PARTIAL_MSG_LEFT)) {
3977 asoc->sctp_ep->last_abort_code = SCTP_FROM_SCTP_PCB+SCTP_LOC_5;
3978 sctp_send_abort_tcb(asoc, op_err, SCTP_SO_LOCKED);
3980 if ((SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_OPEN) ||
3981 (SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
3984 if (sctp_free_assoc(inp, asoc,
3991 sctp_chunk_output(inp, asoc, SCTP_OUTPUT_FROM_CLOSING, SCTP_SO_LOCKED);
3995 SCTP_TCB_UNLOCK(asoc);
4027 LIST_FOREACH_SAFE(asoc, &inp->sctp_asoc_list, sctp_tcblist, nasoc) {
4028 SCTP_TCB_LOCK(asoc);
4029 if (asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
4030 if (asoc->asoc.state & SCTP_STATE_IN_ACCEPT_QUEUE) {
4031 asoc->asoc.state &= ~SCTP_STATE_IN_ACCEPT_QUEUE;
4032 sctp_timer_start(SCTP_TIMER_TYPE_ASOCKILL, inp, asoc, NULL);
4035 SCTP_TCB_UNLOCK(asoc);
4039 if ((SCTP_GET_STATE(&asoc->asoc) != SCTP_STATE_COOKIE_WAIT) &&
4040 ((asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) == 0)) {
4044 asoc->sctp_ep->last_abort_code = SCTP_FROM_SCTP_PCB+SCTP_LOC_7;
4045 sctp_send_abort_tcb(asoc, op_err, SCTP_SO_LOCKED);
4047 } else if (asoc->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
4049 SCTP_TCB_UNLOCK(asoc);
4052 if ((SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_OPEN) ||
4053 (SCTP_GET_STATE(&asoc->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
4056 if (sctp_free_assoc(inp, asoc, SCTP_PCBFREE_FORCE, SCTP_FROM_SCTP_PCB+SCTP_LOC_8) == 0) {
4163 * free each asoc if it is not already closed/free. we can't use the
4251 LIST_FOREACH_SAFE(asoc, &inp->sctp_asoc_free_list, sctp_tcblist, nasoc) {
4252 LIST_REMOVE(asoc, sctp_tcblist);
4253 SCTP_ZONE_FREE(SCTP_BASE_INFO(ipi_zone_asoc), asoc);
4287 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
4374 stcb->asoc.scope.ipv4_local_scope = 1;
4377 stcb->asoc.scope.ipv4_local_scope = 1;
4383 (stcb->asoc.scope.ipv4_local_scope == 0)) {
4405 if (sctp_is_address_on_local_host(newaddr, stcb->asoc.vrf_id)) {
4406 stcb->asoc.scope.loopback_scope = 1;
4407 stcb->asoc.scope.local_scope = 0;
4408 stcb->asoc.scope.ipv4_local_scope = 1;
4409 stcb->asoc.scope.site_scope = 1;
4419 stcb->asoc.scope.ipv4_local_scope = 1;
4420 stcb->asoc.scope.site_scope = 1;
4426 stcb->asoc.scope.site_scope = 1;
4431 (stcb->asoc.scope.loopback_scope == 0)) {
4434 (stcb->asoc.scope.local_scope == 0)) {
4437 (stcb->asoc.scope.site_scope == 0)) {
4502 net->addr_is_local = sctp_is_address_on_local_host(newaddr, stcb->asoc.vrf_id);
4504 stcb->asoc.scope.loopback_scope = 1;
4505 stcb->asoc.scope.ipv4_local_scope = 1;
4506 stcb->asoc.scope.local_scope = 0;
4507 stcb->asoc.scope.site_scope = 1;
4510 net->failure_threshold = stcb->asoc.def_net_failure;
4511 net->pf_threshold = stcb->asoc.def_net_pf_threshold;
4529 stcb->asoc.numnets++;
4531 net->cwr_window_tsn = net->last_cwr_tsn = stcb->asoc.sending_seq - 1;
4532 net->port = stcb->asoc.port;
4533 net->dscp = stcb->asoc.default_dscp;
4535 net->flowlabel = stcb->asoc.default_flowlabel;
4547 net->heart_beat_delay = stcb->asoc.heart_beat_delay;
4578 SCTP_RTALLOC((sctp_route_t *)&net->ro, stcb->asoc.vrf_id);
4588 stcb->asoc.vrf_id);
4636 stcb->asoc.smallest_mtu = net->mtu;
4638 if (stcb->asoc.smallest_mtu > net->mtu) {
4639 stcb->asoc.smallest_mtu = net->mtu;
4657 if (stcb->asoc.cc_functions.sctp_set_initial_cc_param != NULL)
4658 (*stcb->asoc.cc_functions.sctp_set_initial_cc_param)(stcb, net);
4669 net->flowid = stcb->asoc.my_vtag ^
4679 netfirst = TAILQ_FIRST(&stcb->asoc.nets);
4682 TAILQ_INSERT_TAIL(&stcb->asoc.nets, net, sctp_next);
4685 TAILQ_INSERT_HEAD(&stcb->asoc.nets, net, sctp_next);
4691 TAILQ_INSERT_HEAD(&stcb->asoc.nets, net, sctp_next);
4698 TAILQ_INSERT_HEAD(&stcb->asoc.nets, net, sctp_next);
4713 TAILQ_INSERT_TAIL(&stcb->asoc.nets, net, sctp_next);
4726 TAILQ_INSERT_AFTER(&stcb->asoc.nets, netlook,
4738 if (stcb->asoc.primary_destination == 0) {
4739 stcb->asoc.primary_destination = net;
4740 } else if ((stcb->asoc.primary_destination->ro.ro_rt == NULL) &&
4744 stcb->asoc.primary_destination = net;
4747 net = TAILQ_FIRST(&stcb->asoc.nets);
4748 if ((net != stcb->asoc.primary_destination) &&
4749 (stcb->asoc.primary_destination)) {
4755 TAILQ_REMOVE(&stcb->asoc.nets,
4756 stcb->asoc.primary_destination, sctp_next);
4757 TAILQ_INSERT_HEAD(&stcb->asoc.nets,
4758 stcb->asoc.primary_destination, sctp_next);
4793 stcb->asoc.in_asocid_hash = 1;
4821 struct sctp_association *asoc;
4992 asoc = &stcb->asoc;
4994 asoc->assoc_id = sctp_aloc_a_assoc_id(inp, stcb);
5030 head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashasocmark))];
5037 if (asoc->strmout) {
5038 SCTP_FREE(asoc->strmout, SCTP_M_STRMO);
5039 asoc->strmout = NULL;
5041 if (asoc->mapping_array) {
5042 SCTP_FREE(asoc->mapping_array, SCTP_M_MAP);
5043 asoc->mapping_array = NULL;
5045 if (asoc->nr_mapping_array) {
5046 SCTP_FREE(asoc->nr_mapping_array, SCTP_M_MAP);
5047 asoc->nr_mapping_array = NULL;
5061 SCTP_OS_TIMER_INIT(&asoc->dack_timer.timer);
5062 SCTP_OS_TIMER_INIT(&asoc->strreset_timer.timer);
5063 SCTP_OS_TIMER_INIT(&asoc->asconf_timer.timer);
5064 SCTP_OS_TIMER_INIT(&asoc->shut_guard_timer.timer);
5065 SCTP_OS_TIMER_INIT(&asoc->autoclose_timer.timer);
5066 SCTP_OS_TIMER_INIT(&asoc->delayed_event_timer.timer);
5067 SCTP_OS_TIMER_INIT(&asoc->delete_prim_timer.timer);
5085 struct sctp_association *asoc;
5087 asoc = &stcb->asoc;
5088 asoc->numnets--;
5089 TAILQ_REMOVE(&asoc->nets, net, sctp_next);
5090 if (net == asoc->primary_destination) {
5094 lnet = TAILQ_FIRST(&asoc->nets);
5105 if (asoc->deleted_primary != NULL) {
5109 asoc->deleted_primary = net;
5120 asoc->primary_destination = sctp_find_alternate_net(stcb, lnet, 0);
5122 if (net == asoc->last_data_chunk_from) {
5124 asoc->last_data_chunk_from = TAILQ_FIRST(&asoc->nets);
5126 if (net == asoc->last_control_chunk_from) {
5128 asoc->last_control_chunk_from = NULL;
5130 if (net == stcb->asoc.alternate) {
5131 sctp_free_remote_addr(stcb->asoc.alternate);
5132 stcb->asoc.alternate = NULL;
5147 * (tasoc->asoc.nets) and then if it is there, we do a LIST_REMOVE
5151 struct sctp_association *asoc;
5154 asoc = &stcb->asoc;
5157 TAILQ_FOREACH_SAFE(net, &asoc->nets, sctp_next, nnet) {
5164 if (asoc->numnets < 2) {
5318 struct sctp_association *asoc;
5338 if (stcb->asoc.state == 0) {
5342 /* there is no asoc, really TSNH :-0 */
5345 if (stcb->asoc.alternate) {
5346 sctp_free_remote_addr(stcb->asoc.alternate);
5347 stcb->asoc.alternate = NULL;
5358 asoc = &stcb->asoc;
5371 if ((stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) &&
5377 if (stcb->asoc.refcnt) {
5380 /* no asoc destroyed */
5389 (void)SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer);
5390 asoc->dack_timer.self = NULL;
5391 (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer);
5395 * free-asoc timer which we DON'T want to
5398 if (asoc->strreset_timer.type == SCTP_TIMER_TYPE_STRRESET)
5399 asoc->strreset_timer.self = NULL;
5400 (void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer);
5401 asoc->asconf_timer.self = NULL;
5402 (void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer);
5403 asoc->autoclose_timer.self = NULL;
5404 (void)SCTP_OS_TIMER_STOP(&asoc->shut_guard_timer.timer);
5405 asoc->shut_guard_timer.self = NULL;
5406 (void)SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer);
5407 asoc->delayed_event_timer.self = NULL;
5409 (void)SCTP_OS_TIMER_STOP(&asoc->delete_prim_timer.timer);
5410 asoc->delete_prim_timer.self = NULL;
5411 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
5420 if ((stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) == 0) {
5421 stcb->asoc.state |= SCTP_STATE_ABOUT_TO_BE_FREED;
5426 sq->sinfo_cumtsn = stcb->asoc.cumulative_tsn;
5441 stcb->asoc.control_pdapi = sq;
5448 stcb->asoc.control_pdapi = NULL;
5462 if ((stcb->asoc.refcnt) || (stcb->asoc.state & SCTP_STATE_IN_ACCEPT_QUEUE)) {
5465 if ((stcb->asoc.refcnt) ||
5468 stcb->asoc.state &= ~SCTP_STATE_IN_ACCEPT_QUEUE;
5485 /* no asoc destroyed */
5500 * killing of the asoc. Note that
5507 atomic_add_int(&stcb->asoc.refcnt, 1);
5554 atomic_add_int(&stcb->asoc.refcnt, -1);
5556 if (stcb->asoc.refcnt) {
5557 stcb->asoc.state &= ~SCTP_STATE_IN_ACCEPT_QUEUE;
5566 asoc->state = 0;
5570 if (stcb->asoc.in_asocid_hash) {
5581 sctp_add_vtag_to_timewait(asoc->my_vtag, SCTP_BASE_SYSCTL(sctp_vtag_time_wait),
5587 (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer);
5588 (void)SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer);
5589 (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer);
5590 (void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer);
5591 (void)SCTP_OS_TIMER_STOP(&asoc->shut_guard_timer.timer);
5592 (void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer);
5593 (void)SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer);
5594 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
5600 asoc->strreset_timer.type = SCTP_TIMER_TYPE_NONE;
5606 for (i = 0; i < asoc->streamoutcnt; i++) {
5609 outs = &asoc->strmout[i];
5613 sctp_free_spbufspace(stcb, asoc, sp);
5635 TAILQ_FOREACH_SAFE(strrst, &asoc->resetHead, next_resp, nstrrst) {
5636 TAILQ_REMOVE(&asoc->resetHead, strrst, next_resp);
5639 TAILQ_FOREACH_SAFE(sq, &asoc->pending_reply_queue, next, nsq) {
5640 TAILQ_REMOVE(&asoc->pending_reply_queue, sq, next);
5653 TAILQ_FOREACH_SAFE(chk, &asoc->free_chunks, sctp_next, nchk) {
5654 TAILQ_REMOVE(&asoc->free_chunks, chk, sctp_next);
5664 asoc->free_chunk_cnt--;
5668 TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) {
5669 if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) {
5670 asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--;
5676 TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next);
5699 TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) {
5701 if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) {
5702 asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--;
5709 TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next);
5729 for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
5730 if (stcb->asoc.strmout[i].chunks_on_queues > 0) {
5731 panic("%u chunks left for stream %u.", stcb->asoc.strmout[i].chunks_on_queues, i);
5736 TAILQ_FOREACH_SAFE(chk, &asoc->control_send_queue, sctp_next, nchk) {
5737 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next);
5750 TAILQ_FOREACH_SAFE(chk, &asoc->asconf_send_queue, sctp_next, nchk) {
5751 TAILQ_REMOVE(&asoc->asconf_send_queue, chk, sctp_next);
5763 TAILQ_FOREACH_SAFE(chk, &asoc->reasmqueue, sctp_next, nchk) {
5764 TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next);
5777 if (asoc->mapping_array) {
5778 SCTP_FREE(asoc->mapping_array, SCTP_M_MAP);
5779 asoc->mapping_array = NULL;
5781 if (asoc->nr_mapping_array) {
5782 SCTP_FREE(asoc->nr_mapping_array, SCTP_M_MAP);
5783 asoc->nr_mapping_array = NULL;
5786 if (asoc->strmout) {
5787 SCTP_FREE(asoc->strmout, SCTP_M_STRMO);
5788 asoc->strmout = NULL;
5790 asoc->strm_realoutsize = asoc->streamoutcnt = 0;
5791 if (asoc->strmin) {
5794 asoc->streamincnt; i++) {
5795 TAILQ_FOREACH_SAFE(ctl, &asoc->strmin[i].inqueue, next, nctl) {
5796 TAILQ_REMOVE(&asoc->strmin[i].inqueue, ctl, next);
5811 SCTP_FREE(asoc->strmin, SCTP_M_STRMI);
5812 asoc->strmin = NULL;
5814 asoc->streamincnt = 0;
5815 TAILQ_FOREACH_SAFE(net, &asoc->nets, sctp_next, nnet) {
5821 TAILQ_REMOVE(&asoc->nets, net, sctp_next);
5824 LIST_FOREACH_SAFE(laddr, &asoc->sctp_restricted_addrs, sctp_nxt_addr, naddr) {
5830 TAILQ_FOREACH_SAFE(aparam, &asoc->asconf_queue, next, naparam) {
5832 TAILQ_REMOVE(&asoc->asconf_queue, aparam, next);
5835 TAILQ_FOREACH_SAFE(aack, &asoc->asconf_ack_sent, next, naack) {
5837 TAILQ_REMOVE(&asoc->asconf_ack_sent, aack, next);
5844 if (asoc->local_hmacs)
5845 sctp_free_hmaclist(asoc->local_hmacs);
5846 if (asoc->peer_hmacs)
5847 sctp_free_hmaclist(asoc->peer_hmacs);
5849 if (asoc->local_auth_chunks)
5850 sctp_free_chunklist(asoc->local_auth_chunks);
5851 if (asoc->peer_auth_chunks)
5852 sctp_free_chunklist(asoc->peer_auth_chunks);
5854 sctp_free_authinfo(&asoc->authinfo);
5856 LIST_FOREACH_SAFE(shared_key, &asoc->shared_keys, next, nshared_key) {
5915 /* destroyed the asoc */
6128 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
6135 stcb->asoc.primary_destination = net;
6185 if (stcb->asoc.last_used_address == laddr)
6187 stcb->asoc.last_used_address = NULL;
6189 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
6232 list = &stcb->asoc.sctp_restricted_addrs;
6322 LIST_FOREACH(laddr, &stcb->asoc.sctp_restricted_addrs, sctp_nxt_addr) {
6983 * nets structure in the asoc. The from address in the mbuf should
7040 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
7046 atomic_add_int(&stcb->asoc.refcnt, 1);
7048 atomic_add_int(&stcb->asoc.refcnt, -1);
7056 if (stcb->asoc.scope.ipv4_addr_legal) {
7065 if (stcb->asoc.scope.ipv6_addr_legal) {
7074 if (stcb->asoc.scope.conn_addr_legal) {
7094 if (stcb->asoc.state == 0) {
7103 stcb->asoc.peer_supports_asconf = 0;
7121 if (stcb->asoc.scope.ipv4_addr_legal) {
7144 atomic_add_int(&stcb->asoc.refcnt, 1);
7147 atomic_add_int(&stcb->asoc.refcnt, -1);
7162 if (stcb->asoc.state == 0) {
7170 if (stcb->asoc.state == 0) {
7185 if (SCTP_GET_STATE(&stcb_tmp->asoc) & SCTP_STATE_COOKIE_WAIT) {
7194 if (stcb->asoc.state == 0) {
7205 if (stcb->asoc.scope.ipv6_addr_legal) {
7229 atomic_add_int(&stcb->asoc.refcnt, 1);
7232 atomic_add_int(&stcb->asoc.refcnt, -1);
7240 if (stcb->asoc.state == 0) {
7256 if (stcb->asoc.state == 0) {
7271 if (SCTP_GET_STATE(&stcb_tmp->asoc) & SCTP_STATE_COOKIE_WAIT) {
7279 if (stcb->asoc.state == 0) {
7291 if (stcb->asoc.state != SCTP_STATE_OPEN) {
7298 stcb->asoc.peers_adaptation = ntohl(aip->indication);
7299 stcb->asoc.adaptation_needed = 1;
7310 stcb->asoc.peer_supports_asconf = 1;
7359 stcb->asoc.peer_supports_nat = 1;
7362 stcb->asoc.peer_supports_prsctp = 1;
7374 stcb->asoc.peer_supports_asconf = 0;
7375 stcb->asoc.peer_supports_prsctp = 0;
7376 stcb->asoc.peer_supports_pktdrop = 0;
7377 stcb->asoc.peer_supports_strreset = 0;
7378 stcb->asoc.peer_supports_nr_sack = 0;
7379 stcb->asoc.peer_supports_auth = 0;
7386 stcb->asoc.peer_supports_asconf = 1;
7389 stcb->asoc.peer_supports_prsctp = 1;
7392 stcb->asoc.peer_supports_pktdrop = 1;
7395 stcb->asoc.peer_supports_nr_sack = 1;
7398 stcb->asoc.peer_supports_strreset = 1;
7401 stcb->asoc.peer_supports_auth = 1;
7451 if (stcb->asoc.peer_hmacs != NULL)
7452 sctp_free_hmaclist(stcb->asoc.peer_hmacs);
7453 stcb->asoc.peer_hmacs = sctp_alloc_hmaclist(num_hmacs);
7454 if (stcb->asoc.peer_hmacs != NULL) {
7456 (void)sctp_auth_add_hmacid(stcb->asoc.peer_hmacs,
7477 if (stcb->asoc.peer_auth_chunks != NULL)
7478 sctp_clear_chunklist(stcb->asoc.peer_auth_chunks);
7480 stcb->asoc.peer_auth_chunks = sctp_alloc_chunklist();
7483 stcb->asoc.peer_auth_chunks);
7524 TAILQ_FOREACH_SAFE(net, &stcb->asoc.nets, sctp_next, nnet) {
7527 /* This address has been removed from the asoc */
7529 stcb->asoc.numnets--;
7530 TAILQ_REMOVE(&stcb->asoc.nets, net, sctp_next);
7532 if (net == stcb->asoc.primary_destination) {
7533 stcb->asoc.primary_destination = NULL;
7539 stcb->asoc.ecn_allowed = 0;
7543 stcb->asoc.peer_supports_auth = 1;
7545 stcb->asoc.peer_supports_auth = 0;
7547 if (!stcb->asoc.peer_supports_auth && got_chklist) {
7551 if (!SCTP_BASE_SYSCTL(sctp_asconf_auth_nochk) && stcb->asoc.peer_supports_asconf &&
7552 !stcb->asoc.peer_supports_auth) {
7555 } else if ((stcb->asoc.peer_supports_asconf) && (stcb->asoc.peer_supports_auth) &&
7586 if (stcb->asoc.authinfo.peer_random != NULL)
7587 sctp_free_key(stcb->asoc.authinfo.peer_random);
7588 stcb->asoc.authinfo.peer_random = new_key;
7589 sctp_clear_cachedkeys(stcb, stcb->asoc.authinfo.assoc_keyid);
7590 sctp_clear_cachedkeys(stcb, stcb->asoc.authinfo.recv_keyid);
7613 stcb->asoc.primary_destination = net;
7614 if (!(net->dest_state & SCTP_ADDR_PF) && (stcb->asoc.alternate)) {
7615 sctp_free_remote_addr(stcb->asoc.alternate);
7616 stcb->asoc.alternate = NULL;
7618 net = TAILQ_FIRST(&stcb->asoc.nets);
7619 if (net != stcb->asoc.primary_destination) {
7625 TAILQ_REMOVE(&stcb->asoc.nets, stcb->asoc.primary_destination, sctp_next);
7626 TAILQ_INSERT_HEAD(&stcb->asoc.nets, stcb->asoc.primary_destination, sctp_next);
7664 if (stcb->asoc.my_vtag == tag) {
7717 struct sctp_association *asoc;
7727 asoc = &stcb->asoc;
7728 if (asoc->cumulative_tsn == asoc->highest_tsn_inside_map) {
7733 cumulative_tsn_p1 = asoc->cumulative_tsn + 1;
7736 TAILQ_FOREACH_SAFE(chk, &asoc->reasmqueue, sctp_next, nchk) {
7740 SCTP_CALC_TSN_TO_GAP(gap, chk->rec.data.TSN_seq, asoc->mapping_array_base_tsn);
7741 asoc->size_on_reasm_queue = sctp_sbspace_sub(asoc->size_on_reasm_queue, chk->send_size);
7742 sctp_ucount_decr(asoc->cnt_on_reasm_queue);
7743 SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap);
7744 TAILQ_REMOVE(&asoc->reasmqueue, chk, sctp_next);
7753 for (strmat = 0; strmat < asoc->streamincnt; strmat++) {
7754 TAILQ_FOREACH_SAFE(ctl, &asoc->strmin[strmat].inqueue, next, nctl) {
7758 SCTP_CALC_TSN_TO_GAP(gap, ctl->sinfo_tsn, asoc->mapping_array_base_tsn);
7759 asoc->size_on_all_streams = sctp_sbspace_sub(asoc->size_on_all_streams, ctl->length);
7760 sctp_ucount_decr(asoc->cnt_on_all_streams);
7761 SCTP_UNSET_TSN_PRESENT(asoc->mapping_array, gap);
7762 TAILQ_REMOVE(&asoc->strmin[strmat].inqueue, ctl, next);
7775 for (i = asoc->highest_tsn_inside_map; SCTP_TSN_GE(i, asoc->mapping_array_base_tsn); i--) {
7776 SCTP_CALC_TSN_TO_GAP(gap, i, asoc->mapping_array_base_tsn);
7777 if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, gap)) {
7778 asoc->highest_tsn_inside_map = i;
7784 asoc->highest_tsn_inside_map = asoc->mapping_array_base_tsn - 1;
7806 * asoc->highest_tsn_inside_map?
7808 asoc->last_revoke_count = cnt;
7809 (void)SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer);