Lines Matching refs:asoc

2412 	LIST_FOREACH(laddr, &stcb->asoc.sctp_restricted_addrs, sctp_nxt_addr) {  in sctp_is_addr_restricted()
2687 starting_point = stcb->asoc.last_used_address; in sctp_choose_boundspecific_stcb()
2689 if (stcb->asoc.last_used_address == NULL) { in sctp_choose_boundspecific_stcb()
2691 stcb->asoc.last_used_address = LIST_FIRST(&inp->sctp_addr_list); in sctp_choose_boundspecific_stcb()
2694 for (laddr = stcb->asoc.last_used_address; laddr; in sctp_choose_boundspecific_stcb()
2715 stcb->asoc.last_used_address = laddr; in sctp_choose_boundspecific_stcb()
2720 stcb->asoc.last_used_address = NULL; in sctp_choose_boundspecific_stcb()
2724 stcb->asoc.last_used_address = starting_point; in sctp_choose_boundspecific_stcb()
2727 if (stcb->asoc.last_used_address == NULL) { in sctp_choose_boundspecific_stcb()
2729 stcb->asoc.last_used_address = LIST_FIRST(&inp->sctp_addr_list); in sctp_choose_boundspecific_stcb()
2732 for (laddr = stcb->asoc.last_used_address; laddr; in sctp_choose_boundspecific_stcb()
2754 stcb->asoc.last_used_address = laddr; in sctp_choose_boundspecific_stcb()
2759 stcb->asoc.last_used_address = NULL; in sctp_choose_boundspecific_stcb()
2859 if (sctp_is_address_in_scope(ifa, &stcb->asoc.scope, 0) == 0) { in sctp_select_nth_preferred_addr_from_ifn_boundall()
2920 if (sctp_is_address_in_scope(ifa, &stcb->asoc.scope, 0) == 0) { in sctp_count_num_preferred_boundall()
3131 if (sctp_is_address_in_scope(sifa, &stcb->asoc.scope, 0) == 0) { in sctp_choose_boundall()
3190 if (sctp_is_address_in_scope(sifa, &stcb->asoc.scope, 0) == 0) { in sctp_choose_boundall()
3212 if ((retried == 0) && (stcb->asoc.scope.ipv4_local_scope == 0)) { in sctp_choose_boundall()
3213 stcb->asoc.scope.ipv4_local_scope = 1; in sctp_choose_boundall()
3217 stcb->asoc.scope.ipv4_local_scope = 0; in sctp_choose_boundall()
3261 &stcb->asoc.scope, 0) == 0) { in sctp_choose_boundall()
3596 stcb->asoc.max_init_times = initmsg.sinit_max_attempts; in sctp_process_cmsgs_for_init()
3598 stcb->asoc.pre_open_streams = initmsg.sinit_num_ostreams; in sctp_process_cmsgs_for_init()
3600 stcb->asoc.max_inbound_streams = initmsg.sinit_max_instreams; in sctp_process_cmsgs_for_init()
3602 stcb->asoc.initial_init_rto_max = initmsg.sinit_max_init_timeo; in sctp_process_cmsgs_for_init()
3603 if (stcb->asoc.streamoutcnt < stcb->asoc.pre_open_streams) { in sctp_process_cmsgs_for_init()
3612 stcb->asoc.streamoutcnt, stcb->asoc.pre_open_streams); in sctp_process_cmsgs_for_init()
3616 (stcb->asoc.pre_open_streams * sizeof(struct sctp_stream_out)), in sctp_process_cmsgs_for_init()
3620 SCTP_FREE(stcb->asoc.strmout, SCTP_M_STRMO); in sctp_process_cmsgs_for_init()
3621 stcb->asoc.strmout = tmp_str; in sctp_process_cmsgs_for_init()
3622 stcb->asoc.strm_realoutsize = stcb->asoc.streamoutcnt = stcb->asoc.pre_open_streams; in sctp_process_cmsgs_for_init()
3624 stcb->asoc.pre_open_streams = stcb->asoc.streamoutcnt; in sctp_process_cmsgs_for_init()
3626 for (i = 0; i < stcb->asoc.streamoutcnt; i++) { in sctp_process_cmsgs_for_init()
3627 TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); in sctp_process_cmsgs_for_init()
3628 stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], NULL); in sctp_process_cmsgs_for_init()
3629 stcb->asoc.strmout[i].chunks_on_queues = 0; in sctp_process_cmsgs_for_init()
3632 stcb->asoc.strmout[i].abandoned_sent[j] = 0; in sctp_process_cmsgs_for_init()
3633 stcb->asoc.strmout[i].abandoned_unsent[j] = 0; in sctp_process_cmsgs_for_init()
3636 stcb->asoc.strmout[i].abandoned_sent[0] = 0; in sctp_process_cmsgs_for_init()
3637 stcb->asoc.strmout[i].abandoned_unsent[0] = 0; in sctp_process_cmsgs_for_init()
3639 stcb->asoc.strmout[i].next_mid_ordered = 0; in sctp_process_cmsgs_for_init()
3640 stcb->asoc.strmout[i].next_mid_unordered = 0; in sctp_process_cmsgs_for_init()
3641 stcb->asoc.strmout[i].sid = i; in sctp_process_cmsgs_for_init()
3642 stcb->asoc.strmout[i].last_msg_incomplete = 0; in sctp_process_cmsgs_for_init()
3643 stcb->asoc.strmout[i].state = SCTP_STREAM_OPENING; in sctp_process_cmsgs_for_init()
3664 if (sctp_add_remote_addr(stcb, (struct sockaddr *)&sin, NULL, stcb->asoc.port, in sctp_process_cmsgs_for_init()
3696 if (sctp_add_remote_addr(stcb, (struct sockaddr *)&sin, NULL, stcb->asoc.port, in sctp_process_cmsgs_for_init()
3703 if (sctp_add_remote_addr(stcb, (struct sockaddr *)&sin6, NULL, stcb->asoc.port, in sctp_process_cmsgs_for_init()
3898 if ((stcb != NULL) && (stcb->asoc.ecn_supported == 1)) { in sctp_get_ect()
3928 if (net == stcb->asoc.primary_destination) { in sctp_handle_no_route()
3934 if (stcb->asoc.alternate) { in sctp_handle_no_route()
3935 sctp_free_remote_addr(stcb->asoc.alternate); in sctp_handle_no_route()
3937 stcb->asoc.alternate = alt; in sctp_handle_no_route()
3938 atomic_add_int(&stcb->asoc.alternate->ref_count, 1); in sctp_handle_no_route()
4007 vrf_id = stcb->asoc.vrf_id; in sctp_lowlevel_chunk_output()
4020 tos_value = stcb->asoc.default_dscp; in sctp_lowlevel_chunk_output()
4253 if ((stcb != NULL) && (stcb->asoc.smallest_mtu > mtu)) { in sctp_lowlevel_chunk_output()
4288 flowlabel = stcb->asoc.default_flowlabel; in sctp_lowlevel_chunk_output()
4595 if ((stcb != NULL) && (stcb->asoc.smallest_mtu > mtu)) { in sctp_lowlevel_chunk_output()
4602 (stcb->asoc.smallest_mtu > ND_IFINFO(ifp)->linkmtu)) { in sctp_lowlevel_chunk_output()
4635 net = stcb->asoc.primary_destination; in sctp_send_initiate()
4637 net = TAILQ_FIRST(&stcb->asoc.nets); in sctp_send_initiate()
4684 init->init.initiate_tag = htonl(stcb->asoc.my_vtag); in sctp_send_initiate()
4688 init->init.num_outbound_streams = htons(stcb->asoc.pre_open_streams); in sctp_send_initiate()
4689 init->init.num_inbound_streams = htons(stcb->asoc.max_inbound_streams); in sctp_send_initiate()
4690 init->init.initial_tsn = htonl(stcb->asoc.init_seq_number); in sctp_send_initiate()
4703 if (stcb->asoc.ecn_supported == 1) { in sctp_send_initiate()
4712 if (stcb->asoc.prsctp_supported == 1) { in sctp_send_initiate()
4721 if (stcb->asoc.rcv_edmid != SCTP_EDMID_NONE) { in sctp_send_initiate()
4726 zero_chksum->edmid = htonl(stcb->asoc.rcv_edmid); in sctp_send_initiate()
4742 if (stcb->asoc.prsctp_supported == 1) { in sctp_send_initiate()
4744 if (stcb->asoc.idata_supported) { in sctp_send_initiate()
4748 if (stcb->asoc.auth_supported == 1) { in sctp_send_initiate()
4751 if (stcb->asoc.asconf_supported == 1) { in sctp_send_initiate()
4755 if (stcb->asoc.reconfig_supported == 1) { in sctp_send_initiate()
4758 if (stcb->asoc.idata_supported) { in sctp_send_initiate()
4761 if (stcb->asoc.nrsack_supported == 1) { in sctp_send_initiate()
4764 if (stcb->asoc.pktdrop_supported == 1) { in sctp_send_initiate()
4775 if (stcb->asoc.auth_supported) { in sctp_send_initiate()
4777 if (stcb->asoc.authinfo.random != NULL) { in sctp_send_initiate()
4786 parameter_len = (uint16_t)sizeof(struct sctp_auth_random) + stcb->asoc.authinfo.random_len; in sctp_send_initiate()
4788 memcpy(randp, stcb->asoc.authinfo.random->key, parameter_len); in sctp_send_initiate()
4793 if (stcb->asoc.local_hmacs != NULL) { in sctp_send_initiate()
4803 stcb->asoc.local_hmacs->num_algo * sizeof(uint16_t)); in sctp_send_initiate()
4806 sctp_serialize_hmaclist(stcb->asoc.local_hmacs, (uint8_t *)hmacs->hmac_ids); in sctp_send_initiate()
4811 if (stcb->asoc.local_auth_chunks != NULL) { in sctp_send_initiate()
4821 sctp_auth_get_chklist_size(stcb->asoc.local_auth_chunks)); in sctp_send_initiate()
4824 sctp_serialize_auth_chunks(stcb->asoc.local_auth_chunks, chunks->chunk_types); in sctp_send_initiate()
4831 if (stcb->asoc.cookie_preserve_req > 0) { in sctp_send_initiate()
4843 cookie_preserve->time = htonl(stcb->asoc.cookie_preserve_req); in sctp_send_initiate()
4844 stcb->asoc.cookie_preserve_req = 0; in sctp_send_initiate()
4848 if (stcb->asoc.scope.ipv4_addr_legal || stcb->asoc.scope.ipv6_addr_legal) { in sctp_send_initiate()
4857 if (stcb->asoc.scope.ipv4_addr_legal) { in sctp_send_initiate()
4860 if (stcb->asoc.scope.ipv6_addr_legal) { in sctp_send_initiate()
4867 if (stcb->asoc.scope.ipv4_addr_legal) { in sctp_send_initiate()
4870 if (stcb->asoc.scope.ipv6_addr_legal) { in sctp_send_initiate()
4885 m_last = sctp_add_addresses_to_i_ia(inp, stcb, &stcb->asoc.scope, in sctp_send_initiate()
4906 stcb->asoc.ifp_had_enobuf = 1; in sctp_send_initiate()
4910 stcb->asoc.ifp_had_enobuf = 0; in sctp_send_initiate()
5283 sctp_are_there_new_addresses(struct sctp_association *asoc, in sctp_are_there_new_addresses() argument
5316 if (asoc->scope.ipv4_addr_legal) { in sctp_are_there_new_addresses()
5323 if (asoc->scope.ipv6_addr_legal) { in sctp_are_there_new_addresses()
5334 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_are_there_new_addresses()
5405 if (asoc->scope.ipv4_addr_legal) { in sctp_are_there_new_addresses()
5428 if (asoc->scope.ipv6_addr_legal) { in sctp_are_there_new_addresses()
5444 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_are_there_new_addresses()
5506 struct sctp_association *asoc; in sctp_send_initiate_ack() local
5541 asoc = &stcb->asoc; in sctp_send_initiate_ack()
5543 asoc = NULL; in sctp_send_initiate_ack()
5545 if ((asoc != NULL) && in sctp_send_initiate_ack()
5547 …if (sctp_are_there_new_addresses(asoc, init_pkt, offset, offset + ntohs(init_chk->ch.chunk_length)… in sctp_send_initiate_ack()
5618 if (asoc != NULL) { in sctp_send_initiate_ack()
5620 stc.tie_tag_my_vtag = asoc->my_vtag_nonce; in sctp_send_initiate_ack()
5621 stc.tie_tag_peer_vtag = asoc->peer_vtag_nonce; in sctp_send_initiate_ack()
5622 stc.cookie_life = asoc->cookie_life; in sctp_send_initiate_ack()
5623 net = asoc->primary_destination; in sctp_send_initiate_ack()
5750 stc.loopback_scope = asoc->scope.loopback_scope; in sctp_send_initiate_ack()
5751 stc.ipv4_scope = asoc->scope.ipv4_local_scope; in sctp_send_initiate_ack()
5752 stc.site_scope = asoc->scope.site_scope; in sctp_send_initiate_ack()
5753 stc.local_scope = asoc->scope.local_scope; in sctp_send_initiate_ack()
5756 TAILQ_FOREACH(lnet, &asoc->nets, sctp_next) { in sctp_send_initiate_ack()
5834 if (asoc != NULL) { in sctp_send_initiate_ack()
5835 stc.rcv_edmid = asoc->rcv_edmid; in sctp_send_initiate_ack()
5853 if ((asoc != NULL) && in sctp_send_initiate_ack()
5858 initack->init.initiate_tag = htonl(asoc->my_vtag); in sctp_send_initiate_ack()
5859 initack->init.initial_tsn = htonl(asoc->init_seq_number); in sctp_send_initiate_ack()
5863 if (asoc) { in sctp_send_initiate_ack()
5864 atomic_add_int(&asoc->refcnt, 1); in sctp_send_initiate_ack()
5870 if ((asoc->peer_supports_nat) && (vtag == asoc->my_vtag)) { in sctp_send_initiate_ack()
5882 atomic_subtract_int(&asoc->refcnt, 1); in sctp_send_initiate_ack()
5912 if (asoc != NULL) { in sctp_send_initiate_ack()
5913 if (asoc->streamoutcnt > asoc->pre_open_streams) { in sctp_send_initiate_ack()
5914 i_want = asoc->streamoutcnt; in sctp_send_initiate_ack()
5916 i_want = asoc->pre_open_streams; in sctp_send_initiate_ack()
5943 if (((asoc != NULL) && (asoc->ecn_supported == 1)) || in sctp_send_initiate_ack()
5944 ((asoc == NULL) && (inp->ecn_supported == 1))) { in sctp_send_initiate_ack()
5953 if (((asoc != NULL) && (asoc->prsctp_supported == 1)) || in sctp_send_initiate_ack()
5954 ((asoc == NULL) && (inp->prsctp_supported == 1))) { in sctp_send_initiate_ack()
5963 if (((asoc != NULL) && (asoc->rcv_edmid != SCTP_EDMID_NONE)) || in sctp_send_initiate_ack()
5964 ((asoc == NULL) && (inp->rcv_edmid != SCTP_EDMID_NONE))) { in sctp_send_initiate_ack()
5969 if (asoc != NULL) { in sctp_send_initiate_ack()
5970 zero_chksum->edmid = htonl(asoc->rcv_edmid); in sctp_send_initiate_ack()
5989 if (((asoc != NULL) && (asoc->prsctp_supported == 1)) || in sctp_send_initiate_ack()
5990 ((asoc == NULL) && (inp->prsctp_supported == 1))) { in sctp_send_initiate_ack()
5992 if (((asoc != NULL) && (asoc->idata_supported == 1)) || in sctp_send_initiate_ack()
5993 ((asoc == NULL) && (inp->idata_supported == 1))) { in sctp_send_initiate_ack()
5997 if (((asoc != NULL) && (asoc->auth_supported == 1)) || in sctp_send_initiate_ack()
5998 ((asoc == NULL) && (inp->auth_supported == 1))) { in sctp_send_initiate_ack()
6001 if (((asoc != NULL) && (asoc->asconf_supported == 1)) || in sctp_send_initiate_ack()
6002 ((asoc == NULL) && (inp->asconf_supported == 1))) { in sctp_send_initiate_ack()
6006 if (((asoc != NULL) && (asoc->reconfig_supported == 1)) || in sctp_send_initiate_ack()
6007 ((asoc == NULL) && (inp->reconfig_supported == 1))) { in sctp_send_initiate_ack()
6010 if (((asoc != NULL) && (asoc->idata_supported == 1)) || in sctp_send_initiate_ack()
6011 ((asoc == NULL) && (inp->idata_supported == 1))) { in sctp_send_initiate_ack()
6014 if (((asoc != NULL) && (asoc->nrsack_supported == 1)) || in sctp_send_initiate_ack()
6015 ((asoc == NULL) && (inp->nrsack_supported == 1))) { in sctp_send_initiate_ack()
6018 if (((asoc != NULL) && (asoc->pktdrop_supported == 1)) || in sctp_send_initiate_ack()
6019 ((asoc == NULL) && (inp->pktdrop_supported == 1))) { in sctp_send_initiate_ack()
6031 if (((asoc != NULL) && (asoc->auth_supported == 1)) || in sctp_send_initiate_ack()
6032 ((asoc == NULL) && (inp->auth_supported == 1))) { in sctp_send_initiate_ack()
6180 if (asoc != NULL) { in sctp_send_initiate_ack()
6181 use_zero_crc = (asoc->rcv_edmid != SCTP_EDMID_NONE) && (asoc->rcv_edmid == edmid); in sctp_send_initiate_ack()
6195 if (asoc != NULL) { in sctp_send_initiate_ack()
6196 asoc->ifp_had_enobuf = 1; in sctp_send_initiate_ack()
6201 if (asoc != NULL) { in sctp_send_initiate_ack()
6202 asoc->ifp_had_enobuf = 0; in sctp_send_initiate_ack()
6210 struct sctp_association *asoc, in sctp_prune_prsctp() argument
6218 if ((asoc->prsctp_supported) && in sctp_prune_prsctp()
6219 (asoc->sent_queue_cnt_removeable > 0)) { in sctp_prune_prsctp()
6220 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) { in sctp_prune_prsctp()
6264 TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) { in sctp_prune_prsctp()
6292 struct sctp_association *asoc; in sctp_get_frag_point() local
6295 asoc = &stcb->asoc; in sctp_get_frag_point()
6303 if (asoc->idata_supported) { in sctp_get_frag_point()
6305 if (sctp_auth_is_required_chunk(SCTP_IDATA, asoc->peer_auth_chunks)) { in sctp_get_frag_point()
6306 overhead += sctp_get_auth_chunk_len(asoc->peer_hmac_id); in sctp_get_frag_point()
6310 if (sctp_auth_is_required_chunk(SCTP_DATA, asoc->peer_auth_chunks)) { in sctp_get_frag_point()
6311 overhead += sctp_get_auth_chunk_len(asoc->peer_hmac_id); in sctp_get_frag_point()
6317 if (asoc->smallest_mtu % 4 > 0) { in sctp_get_frag_point()
6318 overhead += (asoc->smallest_mtu % 4); in sctp_get_frag_point()
6320 KASSERT(asoc->smallest_mtu > overhead, in sctp_get_frag_point()
6322 asoc->smallest_mtu, overhead)); in sctp_get_frag_point()
6323 frag_point = asoc->smallest_mtu - overhead; in sctp_get_frag_point()
6327 if ((asoc->sctp_frag_point > 0) && in sctp_get_frag_point()
6328 (asoc->sctp_frag_point < frag_point)) { in sctp_get_frag_point()
6329 frag_point = asoc->sctp_frag_point; in sctp_get_frag_point()
6405 if (srcv->sinfo_stream >= stcb->asoc.streamoutcnt) { in sctp_msg_append()
6411 if ((stcb->asoc.stream_locked) && in sctp_msg_append()
6412 (stcb->asoc.stream_locked_on != srcv->sinfo_stream)) { in sctp_msg_append()
6417 if ((stcb->asoc.strmout[srcv->sinfo_stream].state != SCTP_STREAM_OPEN) && in sctp_msg_append()
6418 (stcb->asoc.strmout[srcv->sinfo_stream].state != SCTP_STREAM_OPENING)) { in sctp_msg_append()
6422 if (stcb->asoc.strmout[srcv->sinfo_stream].state > SCTP_STREAM_OPEN) { in sctp_msg_append()
6433 (stcb->asoc.state & SCTP_STATE_SHUTDOWN_PENDING)) { in sctp_msg_append()
6478 sp->auth_keyid = stcb->asoc.authinfo.active_keyid; in sctp_msg_append()
6480 if (sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.peer_auth_chunks)) { in sctp_msg_append()
6484 strm = &stcb->asoc.strmout[srcv->sinfo_stream]; in sctp_msg_append()
6486 atomic_add_int(&stcb->asoc.stream_queue_cnt, 1); in sctp_msg_append()
6488 stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, &stcb->asoc, strm, sp); in sctp_msg_append()
6653 struct sctp_association *asoc,
6669 struct sctp_association *asoc; in sctp_sendall_iterator() local
6696 if (stcb->asoc.alternate) { in sctp_sendall_iterator()
6697 net = stcb->asoc.alternate; in sctp_sendall_iterator()
6699 net = stcb->asoc.primary_destination; in sctp_sendall_iterator()
6723 atomic_add_int(&stcb->asoc.refcnt, 1); in sctp_sendall_iterator()
6737 atomic_subtract_int(&stcb->asoc.refcnt, 1); in sctp_sendall_iterator()
6743 asoc = &stcb->asoc; in sctp_sendall_iterator()
6746 if (TAILQ_EMPTY(&asoc->send_queue) && in sctp_sendall_iterator()
6747 TAILQ_EMPTY(&asoc->sent_queue) && in sctp_sendall_iterator()
6749 if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { in sctp_sendall_iterator()
6790 if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { in sctp_sendall_iterator()
6794 if (TAILQ_EMPTY(&asoc->send_queue) && in sctp_sendall_iterator()
6795 TAILQ_EMPTY(&asoc->sent_queue) && in sctp_sendall_iterator()
6796 (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT)) { in sctp_sendall_iterator()
6805 atomic_add_int(&stcb->asoc.refcnt, 1); in sctp_sendall_iterator()
6808 atomic_subtract_int(&stcb->asoc.refcnt, 1); in sctp_sendall_iterator()
6815 un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) + in sctp_sendall_iterator()
6816 (stcb->asoc.stream_queue_cnt * SCTP_DATA_CHUNK_OVERHEAD(stcb))); in sctp_sendall_iterator()
6819 (stcb->asoc.total_flight > 0) && in sctp_sendall_iterator()
6820 (un_sent < (int)(stcb->asoc.smallest_mtu - SCTP_MIN_OVERHEAD))) { in sctp_sendall_iterator()
6829 (void)sctp_med_chunk_output(inp, stcb, &stcb->asoc, &num_out, in sctp_sendall_iterator()
6991 sctp_toss_old_cookies(struct sctp_tcb *stcb, struct sctp_association *asoc) in sctp_toss_old_cookies() argument
6995 TAILQ_FOREACH_SAFE(chk, &asoc->control_send_queue, sctp_next, nchk) { in sctp_toss_old_cookies()
6997 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next); in sctp_toss_old_cookies()
6998 asoc->ctrl_queue_cnt--; in sctp_toss_old_cookies()
7011 struct sctp_association *asoc; in sctp_toss_old_asconf() local
7015 asoc = &stcb->asoc; in sctp_toss_old_asconf()
7016 TAILQ_FOREACH_SAFE(chk, &asoc->asconf_send_queue, sctp_next, nchk) { in sctp_toss_old_asconf()
7021 if (SCTP_TSN_GT(ntohl(acp->serial_number), asoc->asconf_seq_out_acked)) { in sctp_toss_old_asconf()
7026 TAILQ_REMOVE(&asoc->asconf_send_queue, chk, sctp_next); in sctp_toss_old_asconf()
7027 asoc->ctrl_queue_cnt--; in sctp_toss_old_asconf()
7039 struct sctp_association *asoc, in sctp_clean_up_datalist() argument
7049 TAILQ_REMOVE(&asoc->send_queue, data_list[i], sctp_next); in sctp_clean_up_datalist()
7050 asoc->send_queue_cnt--; in sctp_clean_up_datalist()
7068 tp1 = TAILQ_LAST(&asoc->sent_queue, sctpchunk_listhead); in sctp_clean_up_datalist()
7083 TAILQ_INSERT_AFTER(&asoc->sent_queue, tp1, data_list[i], sctp_next); in sctp_clean_up_datalist()
7085 TAILQ_INSERT_TAIL(&asoc->sent_queue, in sctp_clean_up_datalist()
7091 asoc->sent_queue_cnt++; in sctp_clean_up_datalist()
7092 if ((asoc->peers_rwnd <= 0) && in sctp_clean_up_datalist()
7093 (asoc->total_flight == 0) && in sctp_clean_up_datalist()
7115 asoc->peers_rwnd, data_list[i]->send_size, SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)); in sctp_clean_up_datalist()
7117 asoc->peers_rwnd = sctp_sbspace_sub(asoc->peers_rwnd, in sctp_clean_up_datalist()
7119 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) { in sctp_clean_up_datalist()
7121 asoc->peers_rwnd = 0; in sctp_clean_up_datalist()
7124 if (asoc->cc_functions.sctp_cwnd_update_packet_transmitted) { in sctp_clean_up_datalist()
7125 (*asoc->cc_functions.sctp_cwnd_update_packet_transmitted) (stcb, net); in sctp_clean_up_datalist()
7130 sctp_clean_up_ctl(struct sctp_tcb *stcb, struct sctp_association *asoc, int so_locked) in sctp_clean_up_ctl() argument
7134 TAILQ_FOREACH_SAFE(chk, &asoc->control_send_queue, sctp_next, nchk) { in sctp_clean_up_ctl()
7149 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next); in sctp_clean_up_ctl()
7150 asoc->ctrl_queue_cnt--; in sctp_clean_up_ctl()
7156 asoc->fwd_tsn_cnt--; in sctp_clean_up_ctl()
7161 if (chk != asoc->str_reset) { in sctp_clean_up_ctl()
7188 if (stcb->asoc.total_flight == 0) { in sctp_can_we_split_this()
7239 struct sctp_association *asoc; in sctp_move_to_outqueue() local
7250 asoc = &stcb->asoc; in sctp_move_to_outqueue()
7260 (stcb->asoc.idata_supported == 0) && in sctp_move_to_outqueue()
7285 atomic_subtract_int(&asoc->stream_queue_cnt, 1); in sctp_move_to_outqueue()
7287 stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp); in sctp_move_to_outqueue()
7291 stcb->asoc.trigger_reset = 1; in sctp_move_to_outqueue()
7322 atomic_subtract_int(&stcb->asoc.total_output_queue_size, sp->length); in sctp_move_to_outqueue()
7544 chk->asoc = &stcb->asoc; in sctp_move_to_outqueue()
7547 if (stcb->asoc.idata_supported == 0) { in sctp_move_to_outqueue()
7589 stcb->asoc.ss_functions.sctp_ss_scheduled(stcb, net, asoc, strq, to_move); in sctp_move_to_outqueue()
7590 chk->rec.data.tsn = atomic_fetchadd_int(&asoc->sending_seq, 1); in sctp_move_to_outqueue()
7597 if (stcb->asoc.idata_supported == 0) { in sctp_move_to_outqueue()
7609 if (asoc->tsn_out_at >= SCTP_TSN_LOG_SIZE) { in sctp_move_to_outqueue()
7610 asoc->tsn_out_at = 0; in sctp_move_to_outqueue()
7611 asoc->tsn_out_wrapped = 1; in sctp_move_to_outqueue()
7613 asoc->out_tsnlog[asoc->tsn_out_at].tsn = chk->rec.data.tsn; in sctp_move_to_outqueue()
7614 asoc->out_tsnlog[asoc->tsn_out_at].strm = chk->rec.data.sid; in sctp_move_to_outqueue()
7615 asoc->out_tsnlog[asoc->tsn_out_at].seq = chk->rec.data.mid; in sctp_move_to_outqueue()
7616 asoc->out_tsnlog[asoc->tsn_out_at].sz = chk->send_size; in sctp_move_to_outqueue()
7617 asoc->out_tsnlog[asoc->tsn_out_at].flgs = chk->rec.data.rcv_flags; in sctp_move_to_outqueue()
7618 asoc->out_tsnlog[asoc->tsn_out_at].stcb = (void *)stcb; in sctp_move_to_outqueue()
7619 asoc->out_tsnlog[asoc->tsn_out_at].in_pos = asoc->tsn_out_at; in sctp_move_to_outqueue()
7620 asoc->out_tsnlog[asoc->tsn_out_at].in_out = 2; in sctp_move_to_outqueue()
7621 asoc->tsn_out_at++; in sctp_move_to_outqueue()
7623 if (stcb->asoc.idata_supported == 0) { in sctp_move_to_outqueue()
7660 asoc->pr_sctp_cnt++; in sctp_move_to_outqueue()
7672 atomic_subtract_int(&asoc->stream_queue_cnt, 1); in sctp_move_to_outqueue()
7674 stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp); in sctp_move_to_outqueue()
7678 stcb->asoc.trigger_reset = 1; in sctp_move_to_outqueue()
7690 asoc->chunks_on_out_queue++; in sctp_move_to_outqueue()
7692 TAILQ_INSERT_TAIL(&asoc->send_queue, chk, sctp_next); in sctp_move_to_outqueue()
7693 asoc->send_queue_cnt++; in sctp_move_to_outqueue()
7703 struct sctp_association *asoc; in sctp_fill_outqueue() local
7709 asoc = &stcb->asoc; in sctp_fill_outqueue()
7732 strq = stcb->asoc.ss_functions.sctp_ss_select_stream(stcb, net, asoc); in sctp_fill_outqueue()
7742 strq = stcb->asoc.ss_functions.sctp_ss_select_stream(stcb, net, asoc); in sctp_fill_outqueue()
7759 stcb->asoc.ss_functions.sctp_ss_packet_done(stcb, net, asoc); in sctp_fill_outqueue()
7762 if ((stcb->asoc.sctp_cmt_on_off == 0) && in sctp_fill_outqueue()
7763 (net == stcb->asoc.primary_destination)) { in sctp_fill_outqueue()
7766 } else if (stcb->asoc.sctp_cmt_on_off > 0) { in sctp_fill_outqueue()
7774 sctp_fix_ecn_echo(struct sctp_association *asoc) in sctp_fix_ecn_echo() argument
7778 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { in sctp_fix_ecn_echo()
7788 struct sctp_association *asoc; in sctp_move_chunks_from_net() local
7796 asoc = &stcb->asoc; in sctp_move_chunks_from_net()
7797 for (i = 0; i < stcb->asoc.streamoutcnt; i++) { in sctp_move_chunks_from_net()
7798 TAILQ_FOREACH(sp, &stcb->asoc.strmout[i].outqueue, next) { in sctp_move_chunks_from_net()
7805 TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) { in sctp_move_chunks_from_net()
7816 struct sctp_association *asoc, in sctp_med_chunk_output() argument
7864 auth_keyid = stcb->asoc.authinfo.active_keyid; in sctp_med_chunk_output()
7865 if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) || in sctp_med_chunk_output()
7889 if ((TAILQ_EMPTY(&asoc->control_send_queue) || in sctp_med_chunk_output()
7890 (asoc->ctrl_queue_cnt == stcb->asoc.ecn_echo_cnt_onq)) && in sctp_med_chunk_output()
7891 TAILQ_EMPTY(&asoc->asconf_send_queue) && in sctp_med_chunk_output()
7892 TAILQ_EMPTY(&asoc->send_queue) && in sctp_med_chunk_output()
7898 if (asoc->peers_rwnd == 0) { in sctp_med_chunk_output()
7901 if (asoc->total_flight > 0) { in sctp_med_chunk_output()
7906 if (stcb->asoc.ecn_echo_cnt_onq) { in sctp_med_chunk_output()
7909 (asoc->ctrl_queue_cnt == stcb->asoc.ecn_echo_cnt_onq)) { in sctp_med_chunk_output()
7913 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { in sctp_med_chunk_output()
7921 max_rwnd_per_dest = ((asoc->peers_rwnd + asoc->total_flight) / asoc->numnets); in sctp_med_chunk_output()
7923 max_send_per_dest = SCTP_SB_LIMIT_SND(stcb->sctp_socket) / asoc->numnets; in sctp_med_chunk_output()
7928 TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) { in sctp_med_chunk_output()
7941 (!stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, asoc))) { in sctp_med_chunk_output()
7942 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_med_chunk_output()
7955 if ((net != stcb->asoc.alternate) && in sctp_med_chunk_output()
7965 if ((stcb->asoc.cc_functions.sctp_cwnd_new_transmission_begins) && in sctp_med_chunk_output()
7967 (*stcb->asoc.cc_functions.sctp_cwnd_new_transmission_begins) (stcb, net); in sctp_med_chunk_output()
7990 if (TAILQ_EMPTY(&asoc->control_send_queue) && in sctp_med_chunk_output()
7991 TAILQ_EMPTY(&asoc->asconf_send_queue) && in sctp_med_chunk_output()
7992 TAILQ_EMPTY(&asoc->send_queue)) { in sctp_med_chunk_output()
7997 if (asoc->sctp_cmt_on_off > 0) { in sctp_med_chunk_output()
7999 start_at = asoc->last_net_cmt_send_started; in sctp_med_chunk_output()
8002 start_at = TAILQ_FIRST(&asoc->nets); in sctp_med_chunk_output()
8004 start_at = TAILQ_NEXT(asoc->last_net_cmt_send_started, sctp_next); in sctp_med_chunk_output()
8006 start_at = TAILQ_FIRST(&asoc->nets); in sctp_med_chunk_output()
8009 asoc->last_net_cmt_send_started = start_at; in sctp_med_chunk_output()
8011 start_at = TAILQ_FIRST(&asoc->nets); in sctp_med_chunk_output()
8013 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { in sctp_med_chunk_output()
8015 if (asoc->alternate) { in sctp_med_chunk_output()
8016 chk->whoTo = asoc->alternate; in sctp_med_chunk_output()
8018 chk->whoTo = asoc->primary_destination; in sctp_med_chunk_output()
8033 if (TAILQ_EMPTY(&asoc->control_send_queue) && in sctp_med_chunk_output()
8034 TAILQ_EMPTY(&asoc->asconf_send_queue) && in sctp_med_chunk_output()
8071 if (mtu > asoc->peers_rwnd) { in sctp_med_chunk_output()
8072 if (asoc->total_flight > 0) { in sctp_med_chunk_output()
8074 r_mtu = asoc->peers_rwnd; in sctp_med_chunk_output()
8088 TAILQ_FOREACH_SAFE(chk, &asoc->asconf_send_queue, sctp_next, nchk) { in sctp_med_chunk_output()
8093 if (asoc->alternate == NULL) { in sctp_med_chunk_output()
8094 if (asoc->primary_destination != net) { in sctp_med_chunk_output()
8098 if (asoc->alternate != net) { in sctp_med_chunk_output()
8124 stcb->asoc.peer_auth_chunks)) { in sctp_med_chunk_output()
8125 omtu = sctp_get_auth_chunk_len(stcb->asoc.peer_hmac_id); in sctp_med_chunk_output()
8147 stcb->asoc.peer_auth_chunks))) { in sctp_med_chunk_output()
8216 stcb->asoc.authinfo.active_keyid, in sctp_med_chunk_output()
8219 htonl(stcb->asoc.peer_vtag), in sctp_med_chunk_output()
8232 asoc->ifp_had_enobuf = 1; in sctp_med_chunk_output()
8248 asoc->ifp_had_enobuf = 0; in sctp_med_chunk_output()
8291 TAILQ_FOREACH_SAFE(chk, &asoc->control_send_queue, sctp_next, nchk) { in sctp_med_chunk_output()
8315 if (asoc->alternate == NULL) { in sctp_med_chunk_output()
8316 if (asoc->primary_destination != net) { in sctp_med_chunk_output()
8320 if (asoc->alternate != net) { in sctp_med_chunk_output()
8351 stcb->asoc.peer_auth_chunks)) { in sctp_med_chunk_output()
8352 omtu = sctp_get_auth_chunk_len(stcb->asoc.peer_hmac_id); in sctp_med_chunk_output()
8374 stcb->asoc.peer_auth_chunks))) { in sctp_med_chunk_output()
8423 if (SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) { in sctp_med_chunk_output()
8470 switch (asoc->snd_edmid) { in sctp_med_chunk_output()
8506 stcb->asoc.authinfo.active_keyid, in sctp_med_chunk_output()
8509 htonl(stcb->asoc.peer_vtag), in sctp_med_chunk_output()
8522 asoc->ifp_had_enobuf = 1; in sctp_med_chunk_output()
8537 asoc->ifp_had_enobuf = 0; in sctp_med_chunk_output()
8577 if ((asoc->sctp_cmt_on_off > 0) && in sctp_med_chunk_output()
8578 (net != stcb->asoc.alternate) && in sctp_med_chunk_output()
8585 if ((asoc->sctp_cmt_on_off > 0) && in sctp_med_chunk_output()
8596 if ((asoc->sctp_cmt_on_off > 0) && in sctp_med_chunk_output()
8612 stcb->asoc.peer_auth_chunks); in sctp_med_chunk_output()
8614 mtu -= sctp_get_auth_chunk_len(stcb->asoc.peer_hmac_id); in sctp_med_chunk_output()
8643 TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) { in sctp_med_chunk_output()
8660 if (asoc->sctp_cmt_on_off == 0) { in sctp_med_chunk_output()
8661 if ((asoc->alternate) && in sctp_med_chunk_output()
8662 (asoc->alternate != net) && in sctp_med_chunk_output()
8665 } else if ((net != asoc->primary_destination) && in sctp_med_chunk_output()
8666 (asoc->alternate == NULL) && in sctp_med_chunk_output()
8689 (asoc->state & SCTP_STATE_SHUTDOWN_PENDING)) { in sctp_med_chunk_output()
8696 ((chk->flags & CHUNK_FLAGS_FRAGMENT_OK) && (chk->send_size <= asoc->peers_rwnd))) { in sctp_med_chunk_output()
8791 if ((one_chunk) && (stcb->asoc.total_flight == 0)) { in sctp_med_chunk_output()
8809 switch (asoc->snd_edmid) { in sctp_med_chunk_output()
8862 htonl(stcb->asoc.peer_vtag), in sctp_med_chunk_output()
8873 asoc->ifp_had_enobuf = 1; in sctp_med_chunk_output()
8895 asoc->ifp_had_enobuf = 0; in sctp_med_chunk_output()
8909 (void)SCTP_GETTIME_TIMEVAL(&asoc->time_last_sent); in sctp_med_chunk_output()
8911 *now = asoc->time_last_sent; in sctp_med_chunk_output()
8913 asoc->time_last_sent = *now; in sctp_med_chunk_output()
8920 sctp_clean_up_datalist(stcb, asoc, data_list, bundle_at, net); in sctp_med_chunk_output()
8932 start_at = TAILQ_FIRST(&asoc->nets); in sctp_med_chunk_output()
8949 sctp_clean_up_ctl(stcb, asoc, so_locked); in sctp_med_chunk_output()
9006 chk->asoc = &stcb->asoc; in sctp_queue_op_err()
9013 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); in sctp_queue_op_err()
9014 chk->asoc->ctrl_queue_cnt++; in sctp_queue_op_err()
9096 chk->asoc = &stcb->asoc; in sctp_send_cookie_echo()
9100 TAILQ_INSERT_HEAD(&chk->asoc->control_send_queue, chk, sctp_next); in sctp_send_cookie_echo()
9101 chk->asoc->ctrl_queue_cnt++; in sctp_send_cookie_echo()
9152 chk->asoc = &stcb->asoc; in sctp_send_heartbeat_ack()
9156 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); in sctp_send_heartbeat_ack()
9157 chk->asoc->ctrl_queue_cnt++; in sctp_send_heartbeat_ack()
9189 chk->asoc = &stcb->asoc; in sctp_send_cookie_ack()
9191 if (chk->asoc->last_control_chunk_from != NULL) { in sctp_send_cookie_ack()
9192 chk->whoTo = chk->asoc->last_control_chunk_from; in sctp_send_cookie_ack()
9202 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); in sctp_send_cookie_ack()
9203 chk->asoc->ctrl_queue_cnt++; in sctp_send_cookie_ack()
9234 chk->asoc = &stcb->asoc; in sctp_send_shutdown_ack()
9245 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); in sctp_send_shutdown_ack()
9246 chk->asoc->ctrl_queue_cnt++; in sctp_send_shutdown_ack()
9258 TAILQ_FOREACH(chk, &stcb->asoc.control_send_queue, sctp_next) { in sctp_send_shutdown()
9288 chk->asoc = &stcb->asoc; in sctp_send_shutdown()
9298 shutdown_cp->cumulative_tsn_ack = htonl(stcb->asoc.cumulative_tsn); in sctp_send_shutdown()
9300 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); in sctp_send_shutdown()
9301 chk->asoc->ctrl_queue_cnt++; in sctp_send_shutdown()
9303 TAILQ_REMOVE(&stcb->asoc.control_send_queue, chk, sctp_next); in sctp_send_shutdown()
9309 shutdown_cp->cumulative_tsn_ack = htonl(stcb->asoc.cumulative_tsn); in sctp_send_shutdown()
9310 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next); in sctp_send_shutdown()
9328 if ((!TAILQ_EMPTY(&stcb->asoc.asconf_send_queue)) && in sctp_send_asconf()
9355 chk->asoc = &stcb->asoc; in sctp_send_asconf()
9360 TAILQ_INSERT_TAIL(&chk->asoc->asconf_send_queue, chk, sctp_next); in sctp_send_asconf()
9361 chk->asoc->ctrl_queue_cnt++; in sctp_send_asconf()
9379 latest_ack = TAILQ_LAST(&stcb->asoc.asconf_ack_sent, sctp_asconf_ackhead); in sctp_send_asconf_ack()
9384 latest_ack->last_sent_to == stcb->asoc.last_control_chunk_from) { in sctp_send_asconf_ack()
9386 net = sctp_find_alternate_net(stcb, stcb->asoc.last_control_chunk_from, 0); in sctp_send_asconf_ack()
9389 if (stcb->asoc.last_control_chunk_from == NULL) { in sctp_send_asconf_ack()
9390 if (stcb->asoc.alternate) { in sctp_send_asconf_ack()
9391 net = stcb->asoc.alternate; in sctp_send_asconf_ack()
9393 net = stcb->asoc.primary_destination; in sctp_send_asconf_ack()
9396 net = stcb->asoc.last_control_chunk_from; in sctp_send_asconf_ack()
9401 if (stcb->asoc.last_control_chunk_from == NULL) { in sctp_send_asconf_ack()
9402 if (stcb->asoc.alternate) { in sctp_send_asconf_ack()
9403 net = stcb->asoc.alternate; in sctp_send_asconf_ack()
9405 net = stcb->asoc.primary_destination; in sctp_send_asconf_ack()
9408 net = stcb->asoc.last_control_chunk_from; in sctp_send_asconf_ack()
9413 TAILQ_FOREACH(ack, &stcb->asoc.asconf_ack_sent, next) { in sctp_send_asconf_ack()
9449 chk->asoc = &stcb->asoc; in sctp_send_asconf_ack()
9451 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next); in sctp_send_asconf_ack()
9452 chk->asoc->ctrl_queue_cnt++; in sctp_send_asconf_ack()
9460 struct sctp_association *asoc, in sctp_chunk_retransmission() argument
9498 auth_keyid = stcb->asoc.authinfo.active_keyid; in sctp_chunk_retransmission()
9502 if ((TAILQ_EMPTY(&asoc->sent_queue)) && in sctp_chunk_retransmission()
9503 (TAILQ_EMPTY(&asoc->control_send_queue))) { in sctp_chunk_retransmission()
9505 asoc->sent_queue_retran_cnt); in sctp_chunk_retransmission()
9506 asoc->sent_queue_cnt = 0; in sctp_chunk_retransmission()
9507 asoc->sent_queue_cnt_removeable = 0; in sctp_chunk_retransmission()
9512 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { in sctp_chunk_retransmission()
9520 if (chk != asoc->str_reset) { in sctp_chunk_retransmission()
9538 stcb->asoc.peer_auth_chunks))) { in sctp_chunk_retransmission()
9553 switch (asoc->snd_edmid) { in sctp_chunk_retransmission()
9572 auth_offset, auth, stcb->asoc.authinfo.active_keyid, in sctp_chunk_retransmission()
9574 inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag), in sctp_chunk_retransmission()
9581 asoc->ifp_had_enobuf = 1; in sctp_chunk_retransmission()
9586 asoc->ifp_had_enobuf = 0; in sctp_chunk_retransmission()
9598 sctp_ucount_decr(stcb->asoc.sent_queue_retran_cnt); in sctp_chunk_retransmission()
9603 sctp_clean_up_ctl(stcb, asoc, so_locked); in sctp_chunk_retransmission()
9611 if (TAILQ_EMPTY(&asoc->sent_queue)) { in sctp_chunk_retransmission()
9622 data_auth_reqd = sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.peer_auth_chunks); in sctp_chunk_retransmission()
9623 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) { in sctp_chunk_retransmission()
9642 atomic_add_int(&stcb->asoc.refcnt, 1); in sctp_chunk_retransmission()
9646 atomic_subtract_int(&stcb->asoc.refcnt, 1); in sctp_chunk_retransmission()
9668 if ((asoc->peers_rwnd < mtu) && (asoc->total_flight > 0)) { in sctp_chunk_retransmission()
9672 tsn = asoc->last_acked_seq + 1; in sctp_chunk_retransmission()
9685 if (asoc->peers_rwnd < mtu) { in sctp_chunk_retransmission()
9687 if ((asoc->peers_rwnd == 0) && in sctp_chunk_retransmission()
9688 (asoc->total_flight == 0)) { in sctp_chunk_retransmission()
9723 dmtu = sctp_get_auth_chunk_len(stcb->asoc.peer_hmac_id); in sctp_chunk_retransmission()
9764 if (one_chunk && (asoc->total_flight <= 0)) { in sctp_chunk_retransmission()
9783 dmtu = sctp_get_auth_chunk_len(stcb->asoc.peer_hmac_id); in sctp_chunk_retransmission()
9847 switch (asoc->snd_edmid) { in sctp_chunk_retransmission()
9860 inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag), in sctp_chunk_retransmission()
9868 asoc->ifp_had_enobuf = 1; in sctp_chunk_retransmission()
9873 asoc->ifp_had_enobuf = 0; in sctp_chunk_retransmission()
9888 (void)SCTP_GETTIME_TIMEVAL(&asoc->time_last_sent); in sctp_chunk_retransmission()
9889 *now = asoc->time_last_sent; in sctp_chunk_retransmission()
9892 asoc->time_last_sent = *now; in sctp_chunk_retransmission()
9916 sctp_ucount_decr(asoc->sent_queue_retran_cnt); in sctp_chunk_retransmission()
9918 data_list[i]->sent_rcv_time = asoc->time_last_sent; in sctp_chunk_retransmission()
9931 atomic_add_int(&((asoc)->total_output_queue_size), data_list[i]->book_size); in sctp_chunk_retransmission()
9936 asoc->peers_rwnd, data_list[i]->send_size, SCTP_BASE_SYSCTL(sctp_peer_chunk_oh)); in sctp_chunk_retransmission()
9938 asoc->peers_rwnd = sctp_sbspace_sub(asoc->peers_rwnd, in sctp_chunk_retransmission()
9951 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) { in sctp_chunk_retransmission()
9953 asoc->peers_rwnd = 0; in sctp_chunk_retransmission()
9958 if ((data_list[i] == TAILQ_FIRST(&asoc->sent_queue)) && in sctp_chunk_retransmission()
9985 if (asoc->sent_queue_retran_cnt <= 0) { in sctp_chunk_retransmission()
9987 asoc->sent_queue_retran_cnt = 0; in sctp_chunk_retransmission()
10003 struct sctp_association *asoc) in sctp_timer_validation() argument
10008 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_timer_validation()
10017 if (asoc->alternate) { in sctp_timer_validation()
10018 sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, asoc->alternate); in sctp_timer_validation()
10020 sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, asoc->primary_destination); in sctp_timer_validation()
10044 struct sctp_association *asoc; in sctp_chunk_output() local
10056 asoc = &stcb->asoc; in sctp_chunk_output()
10070 un_sent = (stcb->asoc.total_output_queue_size - stcb->asoc.total_flight); in sctp_chunk_output()
10073 (TAILQ_EMPTY(&asoc->control_send_queue)) && in sctp_chunk_output()
10074 (TAILQ_EMPTY(&asoc->asconf_send_queue)) && in sctp_chunk_output()
10075 (asoc->sent_queue_retran_cnt == 0) && in sctp_chunk_output()
10076 (asoc->trigger_reset == 0)) { in sctp_chunk_output()
10084 if (SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) { in sctp_chunk_output()
10089 while (asoc->sent_queue_retran_cnt) { in sctp_chunk_output()
10100 (void)sctp_med_chunk_output(inp, stcb, asoc, &num_out, &reason_code, 1, in sctp_chunk_output()
10107 …ret = sctp_chunk_retransmission(inp, stcb, asoc, &num_out, &now, &now_filled, &fr_done, so_locked); in sctp_chunk_output()
10125 (void)sctp_med_chunk_output(inp, stcb, asoc, &num_out, &reason_code, 1, in sctp_chunk_output()
10131 sctp_timer_validation(inp, stcb, asoc); in sctp_chunk_output()
10153 (void)sctp_med_chunk_output(inp, stcb, asoc, &num_out, &reason_code, 1, from_where, in sctp_chunk_output()
10157 if ((asoc->fr_max_burst > 0) && (tot_frs >= asoc->fr_max_burst)) { in sctp_chunk_output()
10170 TAILQ_FOREACH(net, &asoc->nets, sctp_next) { in sctp_chunk_output()
10187 if (asoc->max_burst > 0) { in sctp_chunk_output()
10189 if ((net->flight_size + (asoc->max_burst * net->mtu)) < net->cwnd) { in sctp_chunk_output()
10195 asoc->cc_functions.sctp_cwnd_update_after_output(stcb, net, asoc->max_burst); in sctp_chunk_output()
10197 sctp_log_maxburst(stcb, net, 0, asoc->max_burst, SCTP_MAX_BURST_APPLIED); in sctp_chunk_output()
10216 error = sctp_med_chunk_output(inp, stcb, asoc, &num_out, in sctp_chunk_output()
10222 sctp_log_maxburst(stcb, asoc->primary_destination, error, burst_cnt, SCTP_MAX_BURST_ERROR_STOP); in sctp_chunk_output()
10247 un_sent = stcb->asoc.total_output_queue_size - stcb->asoc.total_flight; in sctp_chunk_output()
10248 if ((un_sent < (int)(stcb->asoc.smallest_mtu - SCTP_MIN_OVERHEAD)) && in sctp_chunk_output()
10249 (stcb->asoc.total_flight > 0)) { in sctp_chunk_output()
10254 if (TAILQ_EMPTY(&asoc->control_send_queue) && in sctp_chunk_output()
10255 TAILQ_EMPTY(&asoc->send_queue) && in sctp_chunk_output()
10260 if ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) <= 0) { in sctp_chunk_output()
10265 ((asoc->max_burst == 0) || in sctp_chunk_output()
10267 (burst_cnt < asoc->max_burst))); in sctp_chunk_output()
10270 if ((asoc->max_burst > 0) && (burst_cnt >= asoc->max_burst)) { in sctp_chunk_output()
10272 asoc->burst_limit_applied = 1; in sctp_chunk_output()
10274 sctp_log_maxburst(stcb, asoc->primary_destination, 0, burst_cnt, SCTP_MAX_BURST_APPLIED); in sctp_chunk_output()
10277 asoc->burst_limit_applied = 0; in sctp_chunk_output()
10291 if (stcb->asoc.ecn_echo_cnt_onq) in sctp_chunk_output()
10292 sctp_fix_ecn_echo(asoc); in sctp_chunk_output()
10294 if (stcb->asoc.trigger_reset) { in sctp_chunk_output()
10331 struct sctp_association *asoc) in send_forward_tsn() argument
10343 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { in send_forward_tsn()
10361 asoc->fwd_tsn_cnt++; in send_forward_tsn()
10371 chk->asoc = asoc; in send_forward_tsn()
10381 TAILQ_INSERT_TAIL(&asoc->control_send_queue, chk, sctp_next); in send_forward_tsn()
10382 asoc->ctrl_queue_cnt++; in send_forward_tsn()
10389 TAILQ_FOREACH(at, &asoc->sent_queue, sctp_next) { in send_forward_tsn()
10395 if (!asoc->idata_supported && (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED)) { in send_forward_tsn()
10401 if (asoc->idata_supported) { in send_forward_tsn()
10415 if (cnt_of_space > (asoc->smallest_mtu - ovh)) { in send_forward_tsn()
10417 cnt_of_space = asoc->smallest_mtu - ovh; in send_forward_tsn()
10422 asoc->advanced_peer_ack_point); in send_forward_tsn()
10424 advance_peer_ack_point = asoc->advanced_peer_ack_point; in send_forward_tsn()
10436 if (asoc->idata_supported) { in send_forward_tsn()
10445 at = TAILQ_FIRST(&asoc->sent_queue); in send_forward_tsn()
10458 asoc->advanced_peer_ack_point); in send_forward_tsn()
10468 if (asoc->idata_supported) { in send_forward_tsn()
10481 if (asoc->idata_supported) { in send_forward_tsn()
10493 if (asoc->idata_supported) { in send_forward_tsn()
10513 TAILQ_FOREACH(at, &asoc->sent_queue, sctp_next) { in send_forward_tsn()
10517 if (!asoc->idata_supported && (at->rec.data.rcv_flags & SCTP_DATA_UNORDERED)) { in send_forward_tsn()
10524 if (asoc->idata_supported) { in send_forward_tsn()
10552 struct sctp_association *asoc; in sctp_send_sack() local
10572 if (stcb->asoc.nrsack_supported == 1) { in sctp_send_sack()
10578 asoc = &stcb->asoc; in sctp_send_sack()
10580 if (asoc->last_data_chunk_from == NULL) { in sctp_send_sack()
10585 sctp_set_rwnd(stcb, asoc); in sctp_send_sack()
10586 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { in sctp_send_sack()
10589 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next); in sctp_send_sack()
10590 asoc->ctrl_queue_cnt--; in sctp_send_sack()
10607 if (stcb->asoc.delayed_ack) { in sctp_send_sack()
10614 stcb->asoc.send_sack = 1; in sctp_send_sack()
10623 asoc->data_pkts_seen = 0; in sctp_send_sack()
10626 a_chk->asoc = asoc; in sctp_send_sack()
10632 if ((asoc->last_data_chunk_from->dest_state & SCTP_ADDR_REACHABLE) == 0) { in sctp_send_sack()
10637 a_chk->whoTo = sctp_find_alternate_net(stcb, asoc->last_data_chunk_from, 0); in sctp_send_sack()
10640 a_chk->whoTo = asoc->last_data_chunk_from; in sctp_send_sack()
10643 a_chk->whoTo = asoc->last_data_chunk_from; in sctp_send_sack()
10648 if (SCTP_TSN_GT(asoc->highest_tsn_inside_map, asoc->highest_tsn_inside_nr_map)) { in sctp_send_sack()
10649 highest_tsn = asoc->highest_tsn_inside_map; in sctp_send_sack()
10651 highest_tsn = asoc->highest_tsn_inside_nr_map; in sctp_send_sack()
10653 if (highest_tsn == asoc->cumulative_tsn) { in sctp_send_sack()
10676 if (stcb->asoc.delayed_ack) { in sctp_send_sack()
10683 stcb->asoc.send_sack = 1; in sctp_send_sack()
10698 if ((asoc->sctp_cmt_on_off > 0) && in sctp_send_sack()
10705 flags |= (asoc->cmt_dac_pkts_rcvd << 6); in sctp_send_sack()
10706 asoc->cmt_dac_pkts_rcvd = 0; in sctp_send_sack()
10709 stcb->asoc.cumack_logsnt[stcb->asoc.cumack_log_atsnt] = asoc->cumulative_tsn; in sctp_send_sack()
10710 stcb->asoc.cumack_log_atsnt++; in sctp_send_sack()
10711 if (stcb->asoc.cumack_log_atsnt >= SCTP_TSN_LOG_SIZE) { in sctp_send_sack()
10712 stcb->asoc.cumack_log_atsnt = 0; in sctp_send_sack()
10722 if (highest_tsn > asoc->mapping_array_base_tsn) { in sctp_send_sack()
10723 siz = (((highest_tsn - asoc->mapping_array_base_tsn) + 1) + 7) / 8; in sctp_send_sack()
10725 siz = (((MAX_TSN - asoc->mapping_array_base_tsn) + 1) + highest_tsn + 7) / 8; in sctp_send_sack()
10731 if (asoc->highest_tsn_inside_map > asoc->mapping_array_base_tsn) { in sctp_send_sack()
10732 siz = (((asoc->highest_tsn_inside_map - asoc->mapping_array_base_tsn) + 1) + 7) / 8; in sctp_send_sack()
10734 siz = (((MAX_TSN - asoc->mapping_array_base_tsn) + 1) + asoc->highest_tsn_inside_map + 7) / 8; in sctp_send_sack()
10738 if (SCTP_TSN_GT(asoc->mapping_array_base_tsn, asoc->cumulative_tsn)) { in sctp_send_sack()
10741 offset = asoc->mapping_array_base_tsn - asoc->cumulative_tsn; in sctp_send_sack()
10744 SCTP_TSN_GT(highest_tsn, asoc->cumulative_tsn)) || in sctp_send_sack()
10746 SCTP_TSN_GT(asoc->highest_tsn_inside_map, asoc->cumulative_tsn))) { in sctp_send_sack()
10749 tsn_map = asoc->mapping_array[i]; in sctp_send_sack()
10751 tsn_map |= asoc->nr_mapping_array[i]; in sctp_send_sack()
10811 if (asoc->highest_tsn_inside_nr_map > asoc->mapping_array_base_tsn) { in sctp_send_sack()
10812 siz = (((asoc->highest_tsn_inside_nr_map - asoc->mapping_array_base_tsn) + 1) + 7) / 8; in sctp_send_sack()
10814 siz = (((MAX_TSN - asoc->mapping_array_base_tsn) + 1) + asoc->highest_tsn_inside_nr_map + 7) / 8; in sctp_send_sack()
10817 if (SCTP_TSN_GT(asoc->mapping_array_base_tsn, asoc->cumulative_tsn)) { in sctp_send_sack()
10820 offset = asoc->mapping_array_base_tsn - asoc->cumulative_tsn; in sctp_send_sack()
10822 if (SCTP_TSN_GT(asoc->highest_tsn_inside_nr_map, asoc->cumulative_tsn)) { in sctp_send_sack()
10825 tsn_map = asoc->nr_mapping_array[i]; in sctp_send_sack()
10884 if ((limit_reached == 0) && (asoc->numduptsns)) { in sctp_send_sack()
10886 for (i = 0; i < asoc->numduptsns; i++) { in sctp_send_sack()
10887 *dup = htonl(asoc->dup_tsns[i]); in sctp_send_sack()
10895 asoc->numduptsns = 0; in sctp_send_sack()
10906 sack->sack.cum_tsn_ack = htonl(asoc->cumulative_tsn); in sctp_send_sack()
10907 sack->sack.a_rwnd = htonl(asoc->my_rwnd); in sctp_send_sack()
10918 nr_sack->nr_sack.cum_tsn_ack = htonl(asoc->cumulative_tsn); in sctp_send_sack()
10919 nr_sack->nr_sack.a_rwnd = htonl(asoc->my_rwnd); in sctp_send_sack()
10928 TAILQ_INSERT_TAIL(&asoc->control_send_queue, a_chk, sctp_next); in sctp_send_sack()
10929 asoc->my_last_reported_rwnd = asoc->my_rwnd; in sctp_send_sack()
10930 asoc->ctrl_queue_cnt++; in sctp_send_sack()
10931 asoc->send_sack = 0; in sctp_send_sack()
10956 stcb->asoc.peer_auth_chunks)) { in sctp_send_abort_tcb()
10963 switch (stcb->asoc.snd_edmid) { in sctp_send_abort_tcb()
11002 if (stcb->asoc.alternate) { in sctp_send_abort_tcb()
11003 net = stcb->asoc.alternate; in sctp_send_abort_tcb()
11005 net = stcb->asoc.primary_destination; in sctp_send_abort_tcb()
11010 if (stcb->asoc.peer_vtag == 0) { in sctp_send_abort_tcb()
11012 vtag = stcb->asoc.my_vtag; in sctp_send_abort_tcb()
11015 vtag = stcb->asoc.peer_vtag; in sctp_send_abort_tcb()
11029 m_out, auth_offset, auth, stcb->asoc.authinfo.active_keyid, 1, 0, 0, in sctp_send_abort_tcb()
11031 stcb->asoc.primary_destination->port, NULL, in sctp_send_abort_tcb()
11037 stcb->asoc.ifp_had_enobuf = 1; in sctp_send_abort_tcb()
11041 stcb->asoc.ifp_had_enobuf = 0; in sctp_send_abort_tcb()
11066 vtag = stcb->asoc.my_vtag; in sctp_send_shutdown_complete()
11069 vtag = stcb->asoc.peer_vtag; in sctp_send_shutdown_complete()
11071 switch (stcb->asoc.snd_edmid) { in sctp_send_shutdown_complete()
11095 stcb->asoc.ifp_had_enobuf = 1; in sctp_send_shutdown_complete()
11099 stcb->asoc.ifp_had_enobuf = 0; in sctp_send_shutdown_complete()
11406 chk->asoc = &stcb->asoc; in sctp_send_hb()
11471 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next); in sctp_send_hb()
11472 stcb->asoc.ctrl_queue_cnt++; in sctp_send_hb()
11481 struct sctp_association *asoc; in sctp_send_ecn_echo() local
11488 asoc = &stcb->asoc; in sctp_send_ecn_echo()
11490 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { in sctp_send_ecn_echo()
11517 chk->asoc = &stcb->asoc; in sctp_send_ecn_echo()
11531 stcb->asoc.ecn_echo_cnt_onq++; in sctp_send_ecn_echo()
11538 TAILQ_INSERT_HEAD(&stcb->asoc.control_send_queue, chk, sctp_next); in sctp_send_ecn_echo()
11539 asoc->ctrl_queue_cnt++; in sctp_send_ecn_echo()
11546 struct sctp_association *asoc; in sctp_send_packet_dropped() local
11560 asoc = &stcb->asoc; in sctp_send_packet_dropped()
11562 if (asoc->pktdrop_supported == 0) { in sctp_send_packet_dropped()
11612 min(stcb->asoc.smallest_mtu, MCLBYTES)) { in sctp_send_packet_dropped()
11617 len = min(stcb->asoc.smallest_mtu, MCLBYTES) - SCTP_MAX_OVERHEAD; in sctp_send_packet_dropped()
11620 chk->asoc = &stcb->asoc; in sctp_send_packet_dropped()
11672 if (asoc->my_rwnd) { in sctp_send_packet_dropped()
11673 drp->current_onq = htonl(asoc->size_on_reasm_queue + in sctp_send_packet_dropped()
11674 asoc->size_on_all_streams + in sctp_send_packet_dropped()
11675 asoc->my_rwnd_control_len + in sctp_send_packet_dropped()
11687 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next); in sctp_send_packet_dropped()
11688 asoc->ctrl_queue_cnt++; in sctp_send_packet_dropped()
11694 struct sctp_association *asoc; in sctp_send_cwr() local
11702 asoc = &stcb->asoc; in sctp_send_cwr()
11703 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) { in sctp_send_cwr()
11731 chk->asoc = asoc; in sctp_send_cwr()
11749 TAILQ_INSERT_TAIL(&asoc->control_send_queue, chk, sctp_next); in sctp_send_cwr()
11750 asoc->ctrl_queue_cnt++; in sctp_send_cwr()
11768 for (i = 0; i < stcb->asoc.streamoutcnt; i++) { in sctp_add_stream_reset_out()
11769 if ((stcb->asoc.strmout[i].state == SCTP_STREAM_RESET_PENDING) && in sctp_add_stream_reset_out()
11770 (stcb->asoc.strmout[i].chunks_on_queues == 0) && in sctp_add_stream_reset_out()
11771 TAILQ_EMPTY(&stcb->asoc.strmout[i].outqueue)) { in sctp_add_stream_reset_out()
11778 if (number_entries == stcb->asoc.streamoutcnt) { in sctp_add_stream_reset_out()
11792 for (i = 0; i < stcb->asoc.streamoutcnt; i++) { in sctp_add_stream_reset_out()
11793 if ((stcb->asoc.strmout[i].state == SCTP_STREAM_RESET_PENDING) && in sctp_add_stream_reset_out()
11794 (stcb->asoc.strmout[i].chunks_on_queues == 0) && in sctp_add_stream_reset_out()
11795 TAILQ_EMPTY(&stcb->asoc.strmout[i].outqueue)) { in sctp_add_stream_reset_out()
11798 stcb->asoc.strmout[i].state = SCTP_STREAM_RESET_IN_FLIGHT; in sctp_add_stream_reset_out()
11805 for (i = 0; i < stcb->asoc.streamoutcnt; i++) { in sctp_add_stream_reset_out()
11806 stcb->asoc.strmout[i].state = SCTP_STREAM_RESET_IN_FLIGHT; in sctp_add_stream_reset_out()
11929 struct sctp_association *asoc; in sctp_send_deferred_reset_response() local
11933 asoc = &stcb->asoc; in sctp_send_deferred_reset_response()
11940 asoc->last_reset_action[0] = response; in sctp_send_deferred_reset_response()
11941 if (asoc->stream_reset_outstanding) { in sctp_send_deferred_reset_response()
11953 chk->asoc = &stcb->asoc; in sctp_send_deferred_reset_response()
11967 if (stcb->asoc.alternate) { in sctp_send_deferred_reset_response()
11968 chk->whoTo = stcb->asoc.alternate; in sctp_send_deferred_reset_response()
11970 chk->whoTo = stcb->asoc.primary_destination; in sctp_send_deferred_reset_response()
11980 TAILQ_INSERT_TAIL(&asoc->control_send_queue, in sctp_send_deferred_reset_response()
11983 asoc->ctrl_queue_cnt++; in sctp_send_deferred_reset_response()
12086 struct sctp_association *asoc; in sctp_send_stream_reset_out_if_possible() local
12091 asoc = &stcb->asoc; in sctp_send_stream_reset_out_if_possible()
12092 asoc->trigger_reset = 0; in sctp_send_stream_reset_out_if_possible()
12093 if (asoc->stream_reset_outstanding) { in sctp_send_stream_reset_out_if_possible()
12105 chk->asoc = &stcb->asoc; in sctp_send_stream_reset_out_if_possible()
12120 if (stcb->asoc.alternate) { in sctp_send_stream_reset_out_if_possible()
12121 chk->whoTo = stcb->asoc.alternate; in sctp_send_stream_reset_out_if_possible()
12123 chk->whoTo = stcb->asoc.primary_destination; in sctp_send_stream_reset_out_if_possible()
12131 seq = stcb->asoc.str_reset_seq_out; in sctp_send_stream_reset_out_if_possible()
12132 …if (sctp_add_stream_reset_out(stcb, chk, seq, (stcb->asoc.str_reset_seq_in - 1), (stcb->asoc.sendi… in sctp_send_stream_reset_out_if_possible()
12134 asoc->stream_reset_outstanding++; in sctp_send_stream_reset_out_if_possible()
12141 asoc->str_reset = chk; in sctp_send_stream_reset_out_if_possible()
12143 TAILQ_INSERT_TAIL(&asoc->control_send_queue, in sctp_send_stream_reset_out_if_possible()
12146 asoc->ctrl_queue_cnt++; in sctp_send_stream_reset_out_if_possible()
12148 if (stcb->asoc.send_sack) { in sctp_send_stream_reset_out_if_possible()
12164 struct sctp_association *asoc; in sctp_send_str_reset_req() local
12172 asoc = &stcb->asoc; in sctp_send_str_reset_req()
12173 if (asoc->stream_reset_outstanding) { in sctp_send_str_reset_req()
12210 chk->asoc = &stcb->asoc; in sctp_send_str_reset_req()
12225 if (stcb->asoc.alternate) { in sctp_send_str_reset_req()
12226 chk->whoTo = stcb->asoc.alternate; in sctp_send_str_reset_req()
12228 chk->whoTo = stcb->asoc.primary_destination; in sctp_send_str_reset_req()
12237 seq = stcb->asoc.str_reset_seq_out; in sctp_send_str_reset_req()
12241 …ret = sctp_add_stream_reset_out(stcb, chk, seq, (stcb->asoc.str_reset_seq_in - 1), (stcb->asoc.sen… in sctp_send_str_reset_req()
12244 asoc->stream_reset_outstanding++; in sctp_send_str_reset_req()
12248 ((stcb->asoc.strm_realoutsize - stcb->asoc.streamoutcnt) < adding_o)) { in sctp_send_str_reset_req()
12257 oldstream = stcb->asoc.strmout; in sctp_send_str_reset_req()
12259 SCTP_MALLOC(stcb->asoc.strmout, struct sctp_stream_out *, in sctp_send_str_reset_req()
12260 (stcb->asoc.streamoutcnt + adding_o) * sizeof(struct sctp_stream_out), in sctp_send_str_reset_req()
12262 if (stcb->asoc.strmout == NULL) { in sctp_send_str_reset_req()
12265 stcb->asoc.strmout = oldstream; in sctp_send_str_reset_req()
12275 stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, false); in sctp_send_str_reset_req()
12276 for (i = 0; i < stcb->asoc.streamoutcnt; i++) { in sctp_send_str_reset_req()
12277 TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); in sctp_send_str_reset_req()
12283 stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], &oldstream[i]); in sctp_send_str_reset_req()
12284 stcb->asoc.strmout[i].chunks_on_queues = oldstream[i].chunks_on_queues; in sctp_send_str_reset_req()
12287 stcb->asoc.strmout[i].abandoned_sent[j] = oldstream[i].abandoned_sent[j]; in sctp_send_str_reset_req()
12288 stcb->asoc.strmout[i].abandoned_unsent[j] = oldstream[i].abandoned_unsent[j]; in sctp_send_str_reset_req()
12291 stcb->asoc.strmout[i].abandoned_sent[0] = oldstream[i].abandoned_sent[0]; in sctp_send_str_reset_req()
12292 stcb->asoc.strmout[i].abandoned_unsent[0] = oldstream[i].abandoned_unsent[0]; in sctp_send_str_reset_req()
12294 stcb->asoc.strmout[i].next_mid_ordered = oldstream[i].next_mid_ordered; in sctp_send_str_reset_req()
12295 stcb->asoc.strmout[i].next_mid_unordered = oldstream[i].next_mid_unordered; in sctp_send_str_reset_req()
12296 stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete; in sctp_send_str_reset_req()
12297 stcb->asoc.strmout[i].sid = i; in sctp_send_str_reset_req()
12298 stcb->asoc.strmout[i].state = oldstream[i].state; in sctp_send_str_reset_req()
12302 TAILQ_INSERT_TAIL(&stcb->asoc.strmout[i].outqueue, sp, next); in sctp_send_str_reset_req()
12306 stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc); in sctp_send_str_reset_req()
12307 for (i = stcb->asoc.streamoutcnt; i < (stcb->asoc.streamoutcnt + adding_o); i++) { in sctp_send_str_reset_req()
12308 TAILQ_INIT(&stcb->asoc.strmout[i].outqueue); in sctp_send_str_reset_req()
12309 stcb->asoc.strmout[i].chunks_on_queues = 0; in sctp_send_str_reset_req()
12312 stcb->asoc.strmout[i].abandoned_sent[j] = 0; in sctp_send_str_reset_req()
12313 stcb->asoc.strmout[i].abandoned_unsent[j] = 0; in sctp_send_str_reset_req()
12316 stcb->asoc.strmout[i].abandoned_sent[0] = 0; in sctp_send_str_reset_req()
12317 stcb->asoc.strmout[i].abandoned_unsent[0] = 0; in sctp_send_str_reset_req()
12319 stcb->asoc.strmout[i].next_mid_ordered = 0; in sctp_send_str_reset_req()
12320 stcb->asoc.strmout[i].next_mid_unordered = 0; in sctp_send_str_reset_req()
12321 stcb->asoc.strmout[i].sid = i; in sctp_send_str_reset_req()
12322 stcb->asoc.strmout[i].last_msg_incomplete = 0; in sctp_send_str_reset_req()
12323 stcb->asoc.ss_functions.sctp_ss_init_stream(stcb, &stcb->asoc.strmout[i], NULL); in sctp_send_str_reset_req()
12324 stcb->asoc.strmout[i].state = SCTP_STREAM_CLOSED; in sctp_send_str_reset_req()
12326 stcb->asoc.strm_realoutsize = stcb->asoc.streamoutcnt + adding_o; in sctp_send_str_reset_req()
12331 asoc->strm_pending_add_size = adding_o; in sctp_send_str_reset_req()
12332 asoc->peer_req_out = peer_asked; in sctp_send_str_reset_req()
12335 asoc->stream_reset_outstanding++; in sctp_send_str_reset_req()
12340 asoc->stream_reset_outstanding++; in sctp_send_str_reset_req()
12345 asoc->stream_reset_outstanding++; in sctp_send_str_reset_req()
12349 asoc->stream_reset_outstanding++; in sctp_send_str_reset_req()
12351 asoc->str_reset = chk; in sctp_send_str_reset_req()
12353 TAILQ_INSERT_TAIL(&asoc->control_send_queue, in sctp_send_str_reset_req()
12356 asoc->ctrl_queue_cnt++; in sctp_send_str_reset_req()
12357 if (stcb->asoc.send_sack) { in sctp_send_str_reset_req()
12434 struct sctp_association *asoc, in sctp_copy_it_in() argument
12489 sp->auth_keyid = stcb->asoc.authinfo.active_keyid; in sctp_copy_it_in()
12491 if (sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.peer_auth_chunks)) { in sctp_copy_it_in()
12579 struct sctp_association *asoc; in sctp_lower_sosend() local
12827 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); in sctp_lower_sosend()
12853 asoc = &stcb->asoc; in sctp_lower_sosend()
12854 if ((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) || in sctp_lower_sosend()
12855 (asoc->state & SCTP_STATE_WAS_ABORTED)) { in sctp_lower_sosend()
12856 if (asoc->state & SCTP_STATE_WAS_ABORTED) { in sctp_lower_sosend()
12869 atomic_add_int(&asoc->refcnt, 1); in sctp_lower_sosend()
12873 sndrcvninfo_buf = asoc->def_send; in sctp_lower_sosend()
12920 max_out = asoc->smallest_mtu - sizeof(struct sctp_paramhdr); in sctp_lower_sosend()
12934 if ((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) || in sctp_lower_sosend()
12935 (asoc->state & SCTP_STATE_WAS_ABORTED)) { in sctp_lower_sosend()
12937 if (asoc->state & SCTP_STATE_WAS_ABORTED) { in sctp_lower_sosend()
12963 atomic_subtract_int(&asoc->refcnt, 1); in sctp_lower_sosend()
12983 KASSERT((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) == 0, in sctp_lower_sosend()
12985 KASSERT((asoc->state & SCTP_STATE_WAS_ABORTED) == 0, in sctp_lower_sosend()
13000 if (asoc->alternate != NULL) { in sctp_lower_sosend()
13001 net = asoc->alternate; in sctp_lower_sosend()
13003 net = asoc->primary_destination; in sctp_lower_sosend()
13016 if (sndlen > (ssize_t)asoc->smallest_mtu) { in sctp_lower_sosend()
13023 if (sinfo_stream >= asoc->streamoutcnt) { in sctp_lower_sosend()
13028 if ((asoc->strmout[sinfo_stream].state != SCTP_STREAM_OPEN) && in sctp_lower_sosend()
13029 (asoc->strmout[sinfo_stream].state != SCTP_STREAM_OPENING)) { in sctp_lower_sosend()
13033 if (asoc->strmout[sinfo_stream].state > SCTP_STREAM_OPEN) { in sctp_lower_sosend()
13047 …inqueue_bytes = asoc->total_output_queue_size - (asoc->chunks_on_out_queue * SCTP_DATA_CHUNK_OVERH… in sctp_lower_sosend()
13053 if ((SCTP_SB_LIMIT_SND(so) < (amount + inqueue_bytes + asoc->sb_send_resv)) || in sctp_lower_sosend()
13054 (asoc->chunks_on_out_queue >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue))) { in sctp_lower_sosend()
13064 atomic_add_int(&asoc->sb_send_resv, (int)sndlen); in sctp_lower_sosend()
13069 KASSERT((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) == 0, in sctp_lower_sosend()
13071 KASSERT((asoc->state & SCTP_STATE_WAS_ABORTED) == 0, in sctp_lower_sosend()
13079 …inqueue_bytes = asoc->total_output_queue_size - (asoc->chunks_on_out_queue * SCTP_DATA_CHUNK_OVERH… in sctp_lower_sosend()
13106 …((asoc->chunks_on_out_queue + asoc->stream_queue_cnt) >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue… in sctp_lower_sosend()
13108 …inqueue_bytes = asoc->total_output_queue_size - (asoc->chunks_on_out_queue * SCTP_DATA_CHUNK_OVERH… in sctp_lower_sosend()
13111 …((asoc->stream_queue_cnt + asoc->chunks_on_out_queue) >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue… in sctp_lower_sosend()
13116 asoc->stream_queue_cnt, in sctp_lower_sosend()
13117 asoc->chunks_on_out_queue, in sctp_lower_sosend()
13120 sctp_log_block(SCTP_BLOCK_LOG_INTO_BLKA, asoc, sndlen); in sctp_lower_sosend()
13140 if ((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) || in sctp_lower_sosend()
13141 (asoc->state & SCTP_STATE_WAS_ABORTED)) { in sctp_lower_sosend()
13142 if (asoc->state & SCTP_STATE_WAS_ABORTED) { in sctp_lower_sosend()
13155 asoc, asoc->total_output_queue_size); in sctp_lower_sosend()
13157 …inqueue_bytes = asoc->total_output_queue_size - (asoc->chunks_on_out_queue * SCTP_DATA_CHUNK_OVERH… in sctp_lower_sosend()
13171 KASSERT((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) == 0, in sctp_lower_sosend()
13173 KASSERT((asoc->state & SCTP_STATE_WAS_ABORTED) == 0, in sctp_lower_sosend()
13185 if ((asoc->stream_locked) && in sctp_lower_sosend()
13186 (asoc->stream_locked_on != sinfo_stream)) { in sctp_lower_sosend()
13190 strm = &asoc->strmout[sinfo_stream]; in sctp_lower_sosend()
13194 sp = sctp_copy_it_in(stcb, asoc, sndrcvninfo, uio, net, max_len, user_marks_eor, &error); in sctp_lower_sosend()
13196 if ((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) || in sctp_lower_sosend()
13197 (asoc->state & SCTP_STATE_WAS_ABORTED)) { in sctp_lower_sosend()
13198 if (asoc->state & SCTP_STATE_WAS_ABORTED) { in sctp_lower_sosend()
13219 (asoc->state & SCTP_STATE_SHUTDOWN_PENDING)) { in sctp_lower_sosend()
13235 strm = &asoc->strmout[sinfo_stream]; in sctp_lower_sosend()
13238 asoc->stream_locked = 0; in sctp_lower_sosend()
13245 if (asoc->idata_supported == 0) { in sctp_lower_sosend()
13246 asoc->stream_locked = 1; in sctp_lower_sosend()
13247 asoc->stream_locked_on = sinfo_stream; in sctp_lower_sosend()
13252 atomic_add_int(&asoc->stream_queue_cnt, 1); in sctp_lower_sosend()
13258 asoc->ss_functions.sctp_ss_add_to_stream(stcb, asoc, strm, sp); in sctp_lower_sosend()
13281 KASSERT((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) == 0, in sctp_lower_sosend()
13283 KASSERT((asoc->state & SCTP_STATE_WAS_ABORTED) == 0, in sctp_lower_sosend()
13290 …inqueue_bytes = asoc->total_output_queue_size - (asoc->chunks_on_out_queue * SCTP_DATA_CHUNK_OVERH… in sctp_lower_sosend()
13304 if ((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) || in sctp_lower_sosend()
13305 (asoc->state & SCTP_STATE_WAS_ABORTED)) { in sctp_lower_sosend()
13311 if (asoc->state & SCTP_STATE_WAS_ABORTED) { in sctp_lower_sosend()
13360 KASSERT((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) == 0, in sctp_lower_sosend()
13362 KASSERT((asoc->state & SCTP_STATE_WAS_ABORTED) == 0, in sctp_lower_sosend()
13370 if ((asoc->prsctp_supported) && (asoc->sent_queue_cnt_removeable > 0)) { in sctp_lower_sosend()
13375 sctp_prune_prsctp(stcb, asoc, sndrcvninfo, (int)sndlen); in sctp_lower_sosend()
13376 …inqueue_bytes = asoc->total_output_queue_size - (asoc->chunks_on_out_queue * SCTP_DATA_CHUNK_OVERH… in sctp_lower_sosend()
13407 (asoc->sctp_cmt_on_off == 0)) { in sctp_lower_sosend()
13410 } else if (asoc->ifp_had_enobuf) { in sctp_lower_sosend()
13415 asoc->ifp_had_enobuf = 0; in sctp_lower_sosend()
13417 un_sent = asoc->total_output_queue_size - asoc->total_flight; in sctp_lower_sosend()
13419 (asoc->total_flight > 0) && in sctp_lower_sosend()
13420 (asoc->stream_queue_cnt < SCTP_MAX_DATA_BUNDLING) && in sctp_lower_sosend()
13421 (un_sent < (int)(asoc->smallest_mtu - SCTP_MIN_OVERHEAD))) { in sctp_lower_sosend()
13443 sctp_misc_ints(SCTP_CWNDLOG_PRESEND, asoc->total_output_queue_size, in sctp_lower_sosend()
13444 asoc->total_flight, in sctp_lower_sosend()
13445 asoc->chunks_on_out_queue, asoc->total_flight_count); in sctp_lower_sosend()
13477 …inqueue_bytes = asoc->total_output_queue_size - (asoc->chunks_on_out_queue * SCTP_DATA_CHUNK_OVERH… in sctp_lower_sosend()
13483 asoc, uio->uio_resid); in sctp_lower_sosend()
13499 if ((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) || in sctp_lower_sosend()
13500 (asoc->state & SCTP_STATE_WAS_ABORTED)) { in sctp_lower_sosend()
13501 if (asoc->state & SCTP_STATE_WAS_ABORTED) { in sctp_lower_sosend()
13524 asoc, asoc->total_output_queue_size); in sctp_lower_sosend()
13530 KASSERT((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) == 0, in sctp_lower_sosend()
13532 KASSERT((asoc->state & SCTP_STATE_WAS_ABORTED) == 0, in sctp_lower_sosend()
13536 strm = &asoc->strmout[sinfo_stream]; in sctp_lower_sosend()
13540 if (asoc->idata_supported == 0) { in sctp_lower_sosend()
13541 asoc->stream_locked = 1; in sctp_lower_sosend()
13542 asoc->stream_locked_on = sinfo_stream; in sctp_lower_sosend()
13547 asoc->stream_locked = 0; in sctp_lower_sosend()
13553 asoc->stream_locked = 0; in sctp_lower_sosend()
13572 KASSERT((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) == 0, in sctp_lower_sosend()
13574 KASSERT((asoc->state & SCTP_STATE_WAS_ABORTED) == 0, in sctp_lower_sosend()
13581 if (TAILQ_EMPTY(&asoc->send_queue) && in sctp_lower_sosend()
13582 TAILQ_EMPTY(&asoc->sent_queue) && in sctp_lower_sosend()
13584 if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { in sctp_lower_sosend()
13599 if (asoc->alternate != NULL) { in sctp_lower_sosend()
13600 netp = asoc->alternate; in sctp_lower_sosend()
13602 netp = asoc->primary_destination; in sctp_lower_sosend()
13624 if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { in sctp_lower_sosend()
13628 if (TAILQ_EMPTY(&asoc->send_queue) && in sctp_lower_sosend()
13629 TAILQ_EMPTY(&asoc->sent_queue) && in sctp_lower_sosend()
13630 (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT)) { in sctp_lower_sosend()
13636 atomic_subtract_int(&asoc->refcnt, 1); in sctp_lower_sosend()
13659 KASSERT((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) == 0, in sctp_lower_sosend()
13661 KASSERT((asoc->state & SCTP_STATE_WAS_ABORTED) == 0, in sctp_lower_sosend()
13664 some_on_control = !TAILQ_EMPTY(&asoc->control_send_queue); in sctp_lower_sosend()
13680 KASSERT((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) == 0, in sctp_lower_sosend()
13682 KASSERT((asoc->state & SCTP_STATE_WAS_ABORTED) == 0, in sctp_lower_sosend()
13686 (asoc->sctp_cmt_on_off == 0)) { in sctp_lower_sosend()
13689 } else if (asoc->ifp_had_enobuf) { in sctp_lower_sosend()
13694 asoc->ifp_had_enobuf = 0; in sctp_lower_sosend()
13696 un_sent = asoc->total_output_queue_size - asoc->total_flight; in sctp_lower_sosend()
13698 (asoc->total_flight > 0) && in sctp_lower_sosend()
13699 (asoc->stream_queue_cnt < SCTP_MAX_DATA_BUNDLING) && in sctp_lower_sosend()
13700 (un_sent < (int)(asoc->smallest_mtu - SCTP_MIN_OVERHEAD))) { in sctp_lower_sosend()
13722 sctp_misc_ints(SCTP_CWNDLOG_PRESEND, asoc->total_output_queue_size, in sctp_lower_sosend()
13723 asoc->total_flight, in sctp_lower_sosend()
13724 asoc->chunks_on_out_queue, asoc->total_flight_count); in sctp_lower_sosend()
13729 KASSERT((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) == 0, in sctp_lower_sosend()
13731 KASSERT((asoc->state & SCTP_STATE_WAS_ABORTED) == 0, in sctp_lower_sosend()
13735 if ((queue_only == 0) && (nagle_applies == 0) && (asoc->peers_rwnd && un_sent)) { in sctp_lower_sosend()
13738 (asoc->peers_rwnd == 0) && in sctp_lower_sosend()
13739 (asoc->total_flight == 0)) { in sctp_lower_sosend()
13746 (void)sctp_med_chunk_output(inp, stcb, asoc, &num_out, in sctp_lower_sosend()
13753 queue_only, asoc->peers_rwnd, un_sent, in sctp_lower_sosend()
13754 asoc->total_flight, asoc->chunks_on_out_queue, in sctp_lower_sosend()
13755 asoc->total_output_queue_size, error); in sctp_lower_sosend()
13759 KASSERT((asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) == 0, in sctp_lower_sosend()
13761 KASSERT((asoc->state & SCTP_STATE_WAS_ABORTED) == 0, in sctp_lower_sosend()
13771 atomic_subtract_int(&asoc->sb_send_resv, (int)sndlen); in sctp_lower_sosend()
13774 atomic_subtract_int(&asoc->refcnt, 1); in sctp_lower_sosend()
13805 if (stcb->asoc.auth_supported == 0) { in sctp_add_auth_chunk()
13809 if (!sctp_auth_is_required_chunk(chunk, stcb->asoc.peer_auth_chunks)) { in sctp_add_auth_chunk()
13826 sctp_get_hmac_digest_len(stcb->asoc.peer_hmac_id); in sctp_add_auth_chunk()
13828 auth->hmac_id = htons(stcb->asoc.peer_hmac_id); in sctp_add_auth_chunk()