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