Home | History | Annotate | Download | only in netinet

Lines Matching defs:asoc

2436 	LIST_FOREACH(laddr, &stcb->asoc.sctp_restricted_addrs, sctp_nxt_addr) {
2676 starting_point = stcb->asoc.last_used_address;
2678 if (stcb->asoc.last_used_address == NULL) {
2680 stcb->asoc.last_used_address = LIST_FIRST(&inp->sctp_addr_list);
2683 for (laddr = stcb->asoc.last_used_address; laddr;
2704 stcb->asoc.last_used_address = laddr;
2709 stcb->asoc.last_used_address = NULL;
2713 stcb->asoc.last_used_address = starting_point;
2716 if (stcb->asoc.last_used_address == NULL) {
2718 stcb->asoc.last_used_address = LIST_FIRST(&inp->sctp_addr_list);
2721 for (laddr = stcb->asoc.last_used_address; laddr;
2743 stcb->asoc.last_used_address = laddr;
2748 stcb->asoc.last_used_address = NULL;
2843 if (sctp_is_address_in_scope(ifa, &stcb->asoc.scope, 0) == 0) {
2889 if (sctp_is_address_in_scope(ifa, &stcb->asoc.scope, 0) == 0) {
3083 if (sctp_is_address_in_scope(sifa, &stcb->asoc.scope, 0) == 0) {
3130 if (sctp_is_address_in_scope(sifa, &stcb->asoc.scope, 0) == 0) {
3151 if ((retried == 0) && (stcb->asoc.scope.ipv4_local_scope == 0)) {
3152 stcb->asoc.scope.ipv4_local_scope = 1;
3156 stcb->asoc.scope.ipv4_local_scope = 0;
3185 &stcb->asoc.scope, 0) == 0) {
3524 stcb->asoc.max_init_times = initmsg.sinit_max_attempts;
3526 stcb->asoc.pre_open_streams = initmsg.sinit_num_ostreams;
3528 stcb->asoc.max_inbound_streams = initmsg.sinit_max_instreams;
3530 stcb->asoc.initial_init_rto_max = initmsg.sinit_max_init_timeo;
3531 if (stcb->asoc.streamoutcnt < stcb->asoc.pre_open_streams) {
3537 stcb->asoc.streamoutcnt, stcb->asoc.pre_open_streams);
3541 (stcb->asoc.pre_open_streams * sizeof(struct sctp_stream_out)),
3545 SCTP_FREE(stcb->asoc.strmout, SCTP_M_STRMO);
3546 stcb->asoc.strmout = tmp_str;
3547 stcb->asoc.strm_realoutsize = stcb->asoc.streamoutcnt = stcb->asoc.pre_open_streams;
3549 stcb->asoc.pre_open_streams = stcb->asoc.streamoutcnt;
3551 for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
3552 TAILQ_INIT(&stcb->asoc.strmout[i].outqueue);
3553 stcb->asoc.strmout[i].chunks_on_queues = 0;
3554 stcb->asoc.strmout[i].next_sequence_send = 0;
3555 stcb->asoc.strmout[i].stream_no = i;
3556 stcb->asoc.strmout[i].last_msg_incomplete = 0;
3557 stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], NULL);
3840 if ((stcb != NULL) && (stcb->asoc.ecn_allowed == 1)) {
3870 if (net == stcb->asoc.primary_destination) {
3876 if (stcb->asoc.alternate) {
3877 sctp_free_remote_addr(stcb->asoc.alternate);
3879 stcb->asoc.alternate = alt;
3880 atomic_add_int(&stcb->asoc.alternate->ref_count, 1);
3971 vrf_id = stcb->asoc.vrf_id;
3984 tos_value = stcb->asoc.default_dscp;
4249 (stcb) && (stcb->asoc.scope.loopback_scope))) {
4272 atomic_add_int(&stcb->asoc.refcnt, 1);
4276 atomic_subtract_int(&stcb->asoc.refcnt, 1);
4296 /* PMTU check versus smallest asoc MTU goes here */
4304 if (mtu && (stcb->asoc.smallest_mtu > mtu)) {
4305 sctp_mtu_size_reset(inp, &stcb->asoc, mtu);
4342 flowlabel = stcb->asoc.default_flowlabel;
4705 (stcb) && (stcb->asoc.scope.loopback_scope))) {
4732 atomic_add_int(&stcb->asoc.refcnt, 1);
4736 atomic_subtract_int(&stcb->asoc.refcnt, 1);
4761 /* PMTU check versus smallest asoc MTU goes here */
4776 (stcb->asoc.smallest_mtu > mtu)) {
4777 sctp_mtu_size_reset(inp, &stcb->asoc, mtu);
4791 (stcb->asoc.smallest_mtu > ND_IFINFO(ifp)->linkmtu)) {
4793 &stcb->asoc,
4888 net = stcb->asoc.primary_destination;
4890 net = TAILQ_FIRST(&stcb->asoc.nets);
4934 stcb->asoc.peer_supports_asconf = 1;
4943 init->init.initiate_tag = htonl(stcb->asoc.my_vtag);
4947 init->init.num_outbound_streams = htons(stcb->asoc.pre_open_streams);
4948 init->init.num_inbound_streams = htons(stcb->asoc.max_inbound_streams);
4949 init->init.initial_tsn = htonl(stcb->asoc.init_seq_number);
4951 if (stcb->asoc.scope.ipv4_addr_legal || stcb->asoc.scope.ipv6_addr_legal) {
4955 if (stcb->asoc.scope.ipv4_addr_legal) {
4958 if (stcb->asoc.scope.ipv6_addr_legal) {
4965 if (stcb->asoc.scope.ipv4_addr_legal) {
4968 if (stcb->asoc.scope.ipv6_addr_legal) {
5005 if (stcb->asoc.cookie_preserve_req) {
5017 cookie_preserve->time = htonl(stcb->asoc.cookie_preserve_req);
5018 stcb->asoc.cookie_preserve_req = 0;
5023 if (stcb->asoc.ecn_allowed == 1) {
5060 if (stcb->asoc.sctp_nr_sack_on_off == 1) {
5071 if (stcb->asoc.authinfo.random != NULL) {
5080 parameter_len = (uint16_t)sizeof(struct sctp_auth_random) + stcb->asoc.authinfo.random_len;
5082 memcpy(randp, stcb->asoc.authinfo.random->key, parameter_len);
5087 if ((stcb->asoc.local_hmacs != NULL) &&
5088 (stcb->asoc.local_hmacs->num_algo > 0)) {
5098 stcb->asoc.local_hmacs->num_algo * sizeof(uint16_t));
5101 sctp_serialize_hmaclist(stcb->asoc.local_hmacs, (uint8_t *)hmacs->hmac_ids);
5106 if (sctp_auth_get_chklist_size(stcb->asoc.local_auth_chunks) > 0) {
5116 sctp_auth_get_chklist_size(stcb->asoc.local_auth_chunks));
5119 sctp_serialize_auth_chunks(stcb->asoc.local_auth_chunks, chunks->chunk_types);
5133 sctp_add_addresses_to_i_ia(inp, stcb, &stcb->asoc.scope, m, cnt_inits_to, &padding_len, &chunk_len);
5499 sctp_are_there_new_addresses(struct sctp_association *asoc,
5538 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
5621 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
5674 struct sctp_association *asoc;
5710 asoc = &stcb->asoc;
5712 asoc = NULL;
5715 if ((asoc != NULL) &&
5716 (SCTP_GET_STATE(asoc) != SCTP_STATE_COOKIE_WAIT) &&
5717 (sctp_are_there_new_addresses(asoc, init_pkt, offset, src))) {
5775 if (asoc != NULL) {
5777 stc.tie_tag_my_vtag = asoc->my_vtag_nonce;
5778 stc.tie_tag_peer_vtag = asoc->peer_vtag_nonce;
5779 stc.cookie_life = asoc->cookie_life;
5780 net = asoc->primary_destination;
5949 stc.loopback_scope = asoc->scope.loopback_scope;
5950 stc.ipv4_scope = asoc->scope.ipv4_local_scope;
5951 stc.site_scope = asoc->scope.site_scope;
5952 stc.local_scope = asoc->scope.local_scope;
5955 TAILQ_FOREACH(lnet, &asoc->nets, sctp_next) {
6060 if ((asoc != NULL) &&
6061 ((SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_WAIT) ||
6062 (SCTP_GET_STATE(asoc) == SCTP_STATE_INUSE) ||
6063 (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED))) {
6065 initack->init.initiate_tag = htonl(asoc->my_vtag);
6066 initack->init.initial_tsn = htonl(asoc->init_seq_number);
6073 if (asoc) {
6074 atomic_add_int(&asoc->refcnt, 1);
6078 if ((asoc->peer_supports_nat) && (vtag == asoc->my_vtag)) {
6089 atomic_add_int(&asoc->refcnt, -1);
6116 if (asoc != NULL) {
6117 if (asoc->streamoutcnt > inp->sctp_ep.pre_open_stream_count) {
6118 i_want = asoc->streamoutcnt;
6149 if (((asoc != NULL) && (asoc->ecn_allowed == 1)) ||
6356 struct sctp_association *asoc,
6364 if ((asoc->peer_supports_prsctp) &&
6365 (asoc->sent_queue_cnt_removeable > 0)) {
6366 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
6410 TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) {
6432 } /* if enabled in asoc */
6437 struct sctp_association *asoc)
6452 if (stcb->asoc.sctp_frag_point > asoc->smallest_mtu)
6453 siz = asoc->smallest_mtu - ovh;
6455 siz = (stcb->asoc.sctp_frag_point - ovh);
6464 if (sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.peer_auth_chunks))
6465 siz -= sctp_get_auth_chunk_len(stcb->asoc.peer_hmac_id);
6546 if (srcv->sinfo_stream >= stcb->asoc.streamoutcnt) {
6552 if ((stcb->asoc.stream_locked) &&
6553 (stcb->asoc.stream_locked_on != srcv->sinfo_stream)) {
6558 strm = &stcb->asoc.strmout[srcv->sinfo_stream];
6560 if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_SENT) ||
6561 (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_ACK_SENT) ||
6562 (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) ||
6563 (stcb->asoc.state & SCTP_STATE_SHUTDOWN_PENDING)) {
6606 sp->auth_keyid = stcb->asoc.authinfo.active_keyid;
6608 if (sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.peer_auth_chunks)) {
6616 atomic_add_int(&stcb->asoc.stream_queue_cnt, 1);
6618 stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, &stcb->asoc, strm, sp, 1);
6793 struct sctp_association *asoc,
6812 struct sctp_association *asoc;
6845 if (stcb->asoc.alternate) {
6846 net = stcb->asoc.alternate;
6848 net = stcb->asoc.primary_destination;
6869 atomic_add_int(&stcb->asoc.refcnt, 1);
6883 atomic_add_int(&stcb->asoc.refcnt, -1);
6890 asoc = &stcb->asoc;
6896 if (TAILQ_EMPTY(&asoc->send_queue) &&
6897 TAILQ_EMPTY(&asoc->sent_queue) &&
6899 if (asoc->locked_on_sending) {
6903 if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) &&
6904 (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_RECEIVED) &&
6905 (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) {
6907 if (SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) {
6910 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT);
6911 SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
6917 asoc->primary_destination);
6932 if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) &&
6933 (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_RECEIVED) &&
6934 (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) {
6935 if (asoc->locked_on_sending) {
6938 sp = TAILQ_LAST(&asoc->locked_on_sending->outqueue, sctp_streamhead);
6941 asoc->state |= SCTP_STATE_PARTIAL_MSG_LEFT;
6944 asoc->state |= SCTP_STATE_SHUTDOWN_PENDING;
6945 if (TAILQ_EMPTY(&asoc->send_queue) &&
6946 TAILQ_EMPTY(&asoc->sent_queue) &&
6947 (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT)) {
6949 atomic_add_int(&stcb->asoc.refcnt, 1);
6952 atomic_add_int(&stcb->asoc.refcnt, -1);
6956 asoc->primary_destination);
6962 un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) +
6963 (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk)));
6966 (stcb->asoc.total_flight > 0) &&
6967 (un_sent < (int)(stcb->asoc.smallest_mtu - SCTP_MIN_OVERHEAD))) {
6976 frag_point = sctp_get_frag_point(stcb, &stcb->asoc);
6977 (void)sctp_med_chunk_output(inp, stcb, &stcb->asoc, &num_out,
7130 sctp_toss_old_cookies(struct sctp_tcb *stcb, struct sctp_association *asoc)
7134 TAILQ_FOREACH_SAFE(chk, &asoc->control_send_queue, sctp_next, nchk) {
7136 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next);
7141 asoc->ctrl_queue_cnt--;
7150 struct sctp_association *asoc;
7154 asoc = &stcb->asoc;
7155 TAILQ_FOREACH_SAFE(chk, &asoc->asconf_send_queue, sctp_next, nchk) {
7160 if (SCTP_TSN_GT(ntohl(acp->serial_number), asoc->asconf_seq_out_acked)) {
7165 TAILQ_REMOVE(&asoc->asconf_send_queue, chk, sctp_next);
7170 asoc->ctrl_queue_cnt--;
7179 struct sctp_association *asoc,
7189 TAILQ_REMOVE(&asoc->send_queue, data_list[i], sctp_next);
7190 asoc->send_queue_cnt--;
7208 tp1 = TAILQ_LAST(&asoc->sent_queue, sctpchunk_listhead);
7223 TAILQ_INSERT_AFTER(&asoc->sent_queue, tp1, data_list[i], sctp_next);
7225 TAILQ_INSERT_TAIL(&asoc->sent_queue,
7231 asoc->sent_queue_cnt++;
7232 if ((asoc->peers_rwnd <= 0) &&
7233 (asoc->total_flight == 0) &&
7255 asoc->peers_rwnd, data_list[i]->send_size, SCTP_BASE_SYSCTL(sctp_peer_chunk_oh));
7257 asoc->peers_rwnd = sctp_sbspace_sub(asoc->peers_rwnd,
7259 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
7261 asoc->peers_rwnd = 0;
7264 if (asoc->cc_functions.sctp_cwnd_update_packet_transmitted) {
7265 (*asoc->cc_functions.sctp_cwnd_update_packet_transmitted)(stcb, net);
7270 sctp_clean_up_ctl(struct sctp_tcb *stcb, struct sctp_association *asoc, int so_locked
7278 TAILQ_FOREACH_SAFE(chk, &asoc->control_send_queue, sctp_next, nchk) {
7293 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next);
7298 asoc->ctrl_queue_cnt--;
7300 asoc->fwd_tsn_cnt--;
7304 if (chk != asoc->str_reset) {
7332 if (stcb->asoc.total_flight == 0) {
7388 struct sctp_association *asoc;
7398 asoc = &stcb->asoc;
7444 atomic_subtract_int(&asoc->stream_queue_cnt, 1);
7446 stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp, send_lock_up);
7458 stcb->asoc.locked_on_sending = NULL;
7488 atomic_subtract_int(&stcb->asoc.total_output_queue_size, sp->length);
7508 if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) {
7744 chk->asoc = &stcb->asoc;
7773 chk->rec.data.TSN_seq = atomic_fetchadd_int(&asoc->sending_seq, 1);
7775 chk->rec.data.TSN_seq = asoc->sending_seq++;
7791 if (asoc->tsn_out_at >= SCTP_TSN_LOG_SIZE) {
7792 asoc->tsn_out_at = 0;
7793 asoc->tsn_out_wrapped = 1;
7795 asoc->out_tsnlog[asoc->tsn_out_at].tsn = chk->rec.data.TSN_seq;
7796 asoc->out_tsnlog[asoc->tsn_out_at].strm = chk->rec.data.stream_number;
7797 asoc->out_tsnlog[asoc->tsn_out_at].seq = chk->rec.data.stream_seq;
7798 asoc->out_tsnlog[asoc->tsn_out_at].sz = chk->send_size;
7799 asoc->out_tsnlog[asoc->tsn_out_at].flgs = chk->rec.data.rcv_flags;
7800 asoc->out_tsnlog[asoc->tsn_out_at].stcb = (void *)stcb;
7801 asoc->out_tsnlog[asoc->tsn_out_at].in_pos = asoc->tsn_out_at;
7802 asoc->out_tsnlog[asoc->tsn_out_at].in_out = 2;
7803 asoc->tsn_out_at++;
7830 asoc->pr_sctp_cnt++;
7834 atomic_subtract_int(&asoc->stream_queue_cnt, 1);
7849 stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, strq, sp, send_lock_up);
7862 stcb->asoc.locked_on_sending = NULL;
7867 asoc->chunks_on_out_queue++;
7869 TAILQ_INSERT_TAIL(&asoc->send_queue, chk, sctp_next);
7870 asoc->send_queue_cnt++;
7887 struct sctp_association *asoc;
7893 asoc = &stcb->asoc;
7920 if (asoc->locked_on_sending) {
7922 strq = asoc->locked_on_sending;
7925 strq = stcb->asoc.ss_functions.sctp_ss_select_stream(stcb, net, asoc);
7934 stcb->asoc.ss_functions.sctp_ss_scheduled(stcb, net, asoc, strq, moved_how_much);
7937 asoc->locked_on_sending = strq;
7942 asoc->locked_on_sending = NULL;
7946 strq = stcb->asoc.ss_functions.sctp_ss_select_stream(stcb, net, asoc);
7958 stcb->asoc.ss_functions.sctp_ss_packet_done(stcb, net, asoc);
7961 if ((stcb->asoc.sctp_cmt_on_off == 0) &&
7962 (net == stcb->asoc.primary_destination)) {
7965 } else if (stcb->asoc.sctp_cmt_on_off > 0) {
7973 sctp_fix_ecn_echo(struct sctp_association *asoc)
7977 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
7987 struct sctp_association *asoc;
7995 asoc = &stcb->asoc;
7996 for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
7997 TAILQ_FOREACH(sp, &stcb->asoc.strmout[i].outqueue, next) {
8004 TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) {
8015 struct sctp_association *asoc,
8065 auth_keyid = stcb->asoc.authinfo.active_keyid;
8067 if ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) ||
8068 (asoc->state & SCTP_STATE_SHUTDOWN_RECEIVED) ||
8085 if ((control_only) || (asoc->stream_reset_outstanding))
8091 if ((TAILQ_EMPTY(&asoc->control_send_queue) ||
8092 (asoc->ctrl_queue_cnt == stcb->asoc.ecn_echo_cnt_onq)) &&
8093 TAILQ_EMPTY(&asoc->asconf_send_queue) &&
8094 TAILQ_EMPTY(&asoc->send_queue) &&
8095 stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, asoc)) {
8100 if (asoc->peers_rwnd == 0) {
8103 if (asoc->total_flight > 0) {
8108 if (stcb->asoc.ecn_echo_cnt_onq) {
8111 (asoc->ctrl_queue_cnt == stcb->asoc.ecn_echo_cnt_onq)) {
8115 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
8123 max_rwnd_per_dest = ((asoc->peers_rwnd + asoc->total_flight) / asoc->numnets);
8125 max_send_per_dest = SCTP_SB_LIMIT_SND(stcb->sctp_socket) / asoc->numnets;
8130 TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) {
8144 (!stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, asoc))) {
8145 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
8158 if ((net != stcb->asoc.alternate) &&
8168 if ((stcb->asoc.cc_functions.sctp_cwnd_new_transmission_begins) &&
8170 (*stcb->asoc.cc_functions.sctp_cwnd_new_transmission_begins)(stcb, net);
8193 if (TAILQ_EMPTY(&asoc->control_send_queue) &&
8194 TAILQ_EMPTY(&asoc->asconf_send_queue) &&
8195 TAILQ_EMPTY(&asoc->send_queue)) {
8200 if (asoc->sctp_cmt_on_off > 0) {
8202 start_at = asoc->last_net_cmt_send_started;
8205 start_at = TAILQ_FIRST(&asoc->nets);
8207 start_at = TAILQ_NEXT(asoc->last_net_cmt_send_started, sctp_next);
8209 start_at = TAILQ_FIRST(&asoc->nets);
8212 asoc->last_net_cmt_send_started = start_at;
8214 start_at = TAILQ_FIRST(&asoc->nets);
8216 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
8218 if (asoc->alternate) {
8219 chk->whoTo = asoc->alternate;
8221 chk->whoTo = asoc->primary_destination;
8236 if (TAILQ_EMPTY(&asoc->control_send_queue) &&
8237 TAILQ_EMPTY(&asoc->asconf_send_queue) &&
8294 if (mtu > asoc->peers_rwnd) {
8295 if (asoc->total_flight > 0) {
8297 r_mtu = asoc->peers_rwnd;
8310 TAILQ_FOREACH_SAFE(chk, &asoc->asconf_send_queue, sctp_next, nchk) {
8315 if (asoc->alternate == NULL) {
8316 if (asoc->primary_destination != net) {
8320 if (asoc->alternate != net) {
8346 stcb->asoc.peer_auth_chunks)) {
8347 omtu = sctp_get_auth_chunk_len(stcb->asoc.peer_hmac_id);
8369 stcb->asoc.peer_auth_chunks))) {
8434 stcb->asoc.authinfo.active_keyid,
8437 htonl(stcb->asoc.peer_vtag),
8444 asoc->ifp_had_enobuf = 1;
8470 asoc->ifp_had_enobuf = 0;
8520 TAILQ_FOREACH_SAFE(chk, &asoc->control_send_queue, sctp_next, nchk) {
8537 if (asoc->alternate == NULL) {
8538 if (asoc->primary_destination != net) {
8542 if (asoc->alternate != net) {
8573 stcb->asoc.peer_auth_chunks)) {
8574 omtu = sctp_get_auth_chunk_len(stcb->asoc.peer_hmac_id);
8596 stcb->asoc.peer_auth_chunks))) {
8645 if (SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) {
8704 stcb->asoc.authinfo.active_keyid,
8707 htonl(stcb->asoc.peer_vtag),
8714 asoc->ifp_had_enobuf = 1;
8742 asoc->ifp_had_enobuf = 0;
8792 if ((asoc->sctp_cmt_on_off > 0) &&
8793 (net != stcb->asoc.alternate) &&
8800 if ((asoc->sctp_cmt_on_off > 0) &&
8811 if ((asoc->sctp_cmt_on_off > 0) &&
8827 stcb->asoc.peer_auth_chunks);
8829 mtu -= sctp_get_auth_chunk_len(stcb->asoc.peer_hmac_id);
8863 if ((((asoc->state & SCTP_STATE_OPEN) == SCTP_STATE_OPEN) &&
8866 TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) {
8883 if (asoc->sctp_cmt_on_off == 0) {
8884 if ((asoc->alternate) &&
8885 (asoc->alternate != net) &&
8888 } else if ((net != asoc->primary_destination) &&
8889 (asoc->alternate == NULL) &&
8912 ((asoc->state & SCTP_STATE_SHUTDOWN_PENDING) == SCTP_STATE_SHUTDOWN_PENDING)) {
8919 ((chk->flags & CHUNK_FLAGS_FRAGMENT_OK) && (chk->send_size <= asoc->peers_rwnd))) {
9003 if ((one_chunk) && (stcb->asoc.total_flight == 0)) {
9017 } /* if asoc.state OPEN */
9055 htonl(stcb->asoc.peer_vtag),
9064 asoc->ifp_had_enobuf = 1;
9097 asoc->ifp_had_enobuf = 0;
9120 (void)SCTP_GETTIME_TIMEVAL(&asoc->time_last_sent);
9122 *now = asoc->time_last_sent;
9124 asoc->time_last_sent = *now;
9131 sctp_clean_up_datalist(stcb, asoc, data_list, bundle_at, net);
9143 start_at = TAILQ_FIRST(&asoc->nets);
9160 sctp_clean_up_ctl(stcb, asoc, so_locked);
9199 chk->asoc = &stcb->asoc;
9206 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue,
9209 chk->asoc->ctrl_queue_cnt++;
9292 chk->asoc = &stcb->asoc;
9296 TAILQ_INSERT_HEAD(&chk->asoc->control_send_queue, chk, sctp_next);
9297 chk->asoc->ctrl_queue_cnt++;
9360 chk->asoc = &stcb->asoc;
9364 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
9365 chk->asoc->ctrl_queue_cnt++;
9397 chk->asoc = &stcb->asoc;
9399 if (chk->asoc->last_control_chunk_from != NULL) {
9400 chk->whoTo = chk->asoc->last_control_chunk_from;
9410 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
9411 chk->asoc->ctrl_queue_cnt++;
9443 chk->asoc = &stcb->asoc;
9454 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
9455 chk->asoc->ctrl_queue_cnt++;
9486 chk->asoc = &stcb->asoc;
9496 shutdown_cp->cumulative_tsn_ack = htonl(stcb->asoc.cumulative_tsn);
9498 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
9499 chk->asoc->ctrl_queue_cnt++;
9516 if ((!TAILQ_EMPTY(&stcb->asoc.asconf_send_queue)) &&
9543 chk->asoc = &stcb->asoc;
9548 TAILQ_INSERT_TAIL(&chk->asoc->asconf_send_queue, chk, sctp_next);
9549 chk->asoc->ctrl_queue_cnt++;
9567 latest_ack = TAILQ_LAST(&stcb->asoc.asconf_ack_sent, sctp_asconf_ackhead);
9572 latest_ack->last_sent_to == stcb->asoc.last_control_chunk_from) {
9574 net = sctp_find_alternate_net(stcb, stcb->asoc.last_control_chunk_from, 0);
9577 if (stcb->asoc.last_control_chunk_from == NULL) {
9578 if (stcb->asoc.alternate) {
9579 net = stcb->asoc.alternate;
9581 net = stcb->asoc.primary_destination;
9584 net = stcb->asoc.last_control_chunk_from;
9589 if (stcb->asoc.last_control_chunk_from == NULL) {
9590 if (stcb->asoc.alternate) {
9591 net = stcb->asoc.alternate;
9593 net = stcb->asoc.primary_destination;
9596 net = stcb->asoc.last_control_chunk_from;
9601 TAILQ_FOREACH(ack, &stcb->asoc.asconf_ack_sent, next) {
9646 chk->asoc = &stcb->asoc;
9648 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
9649 chk->asoc->ctrl_queue_cnt++;
9658 struct sctp_association *asoc,
9706 auth_keyid = stcb->asoc.authinfo.active_keyid;
9710 if ((TAILQ_EMPTY(&asoc->sent_queue)) &&
9711 (TAILQ_EMPTY(&asoc->control_send_queue))) {
9713 asoc->sent_queue_retran_cnt);
9714 asoc->sent_queue_cnt = 0;
9715 asoc->sent_queue_cnt_removeable = 0;
9720 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
9728 if (chk != asoc->str_reset) {
9746 stcb->asoc.peer_auth_chunks))) {
9769 auth_offset, auth, stcb->asoc.authinfo.active_keyid,
9771 inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag),
9790 sctp_ucount_decr(stcb->asoc.sent_queue_retran_cnt);
9795 sctp_clean_up_ctl(stcb, asoc, so_locked);
9803 if (TAILQ_EMPTY(&asoc->sent_queue)) {
9806 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED) ||
9807 (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_WAIT)) {
9814 data_auth_reqd = sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.peer_auth_chunks);
9815 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
9831 atomic_add_int(&stcb->asoc.refcnt, 1);
9834 atomic_subtract_int(&stcb->asoc.refcnt, 1);
9861 if ((asoc->peers_rwnd < mtu) && (asoc->total_flight > 0)) {
9865 tsn = asoc->last_acked_seq + 1;
9878 if (asoc->peers_rwnd < mtu) {
9880 if ((asoc->peers_rwnd == 0) &&
9881 (asoc->total_flight == 0)) {
9916 dmtu = sctp_get_auth_chunk_len(stcb->asoc.peer_hmac_id);
9957 if (one_chunk && (asoc->total_flight <= 0)) {
9976 dmtu = sctp_get_auth_chunk_len(stcb->asoc.peer_hmac_id);
10042 inp->sctp_lport, stcb->rport, htonl(stcb->asoc.peer_vtag),
10066 (void)SCTP_GETTIME_TIMEVAL(&asoc->time_last_sent);
10067 *now = asoc->time_last_sent;
10070 asoc->time_last_sent = *now;
10094 sctp_ucount_decr(asoc->sent_queue_retran_cnt);
10096 data_list[i]->sent_rcv_time = asoc->time_last_sent;
10107 atomic_add_int(&((asoc)->total_output_queue_size),data_list[i]->book_size);
10114 asoc->peers_rwnd, data_list[i]->send_size, SCTP_BASE_SYSCTL(sctp_peer_chunk_oh));
10116 asoc->peers_rwnd = sctp_sbspace_sub(asoc->peers_rwnd,
10129 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
10131 asoc->peers_rwnd = 0;
10136 if ((data_list[i] == TAILQ_FIRST(&asoc->sent_queue)) &&
10163 if (asoc->sent_queue_retran_cnt <= 0) {
10165 asoc->sent_queue_retran_cnt = 0;
10181 struct sctp_association *asoc)
10186 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
10195 if (asoc->alternate) {
10196 sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, asoc->alternate);
10198 sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, asoc->primary_destination);
10226 struct sctp_association *asoc;
10233 int frag_point = sctp_get_frag_point(stcb, &stcb->asoc);
10245 asoc = &stcb->asoc;
10258 un_sent = (stcb->asoc.total_output_queue_size - stcb->asoc.total_flight);
10261 (TAILQ_EMPTY(&asoc->control_send_queue)) &&
10262 (TAILQ_EMPTY(&asoc->asconf_send_queue)) &&
10263 (asoc->sent_queue_retran_cnt == 0)) {
10270 if (SCTP_OS_TIMER_PENDING(&stcb->asoc.dack_timer.timer)) {
10272 (void)SCTP_OS_TIMER_STOP(&stcb->asoc.dack_timer.timer);
10274 while (asoc->sent_queue_retran_cnt) {
10285 (void)sctp_med_chunk_output(inp, stcb, asoc, &num_out, &reason_code, 1,
10292 ret = sctp_chunk_retransmission(inp, stcb, asoc, &num_out, &now, &now_filled, &fr_done, so_locked);
10310 (void)sctp_med_chunk_output(inp, stcb, asoc, &num_out, &reason_code, 1,
10316 sctp_timer_validation(inp, stcb, asoc);
10338 (void)sctp_med_chunk_output(inp, stcb, asoc, &num_out, &reason_code, 1, from_where,
10342 if ((asoc->fr_max_burst > 0) && (tot_frs >= asoc->fr_max_burst)) {
10355 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
10368 * if ((asoc->sat_network) || (net->addr_is_local))
10369 * { burst_limit = asoc->max_burst *
10372 if (asoc->max_burst > 0) {
10374 if ((net->flight_size + (asoc->max_burst * net->mtu)) < net->cwnd) {
10376 asoc->cc_functions.sctp_cwnd_update_after_output(stcb, net, asoc->max_burst);
10378 sctp_log_maxburst(stcb, net, 0, asoc->max_burst, SCTP_MAX_BURST_APPLIED);
10395 error = sctp_med_chunk_output(inp, stcb, asoc, &num_out,
10401 sctp_log_maxburst(stcb, asoc->primary_destination, error, burst_cnt, SCTP_MAX_BURST_ERROR_STOP);
10426 un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) +
10427 (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk)));
10428 if ((un_sent < (int)(stcb->asoc.smallest_mtu - SCTP_MIN_OVERHEAD)) &&
10429 (stcb->asoc.total_flight > 0) &&
10430 ((stcb->asoc.locked_on_sending == NULL) ||
10435 if (TAILQ_EMPTY(&asoc->control_send_queue) &&
10436 TAILQ_EMPTY(&asoc->send_queue) &&
10437 stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, asoc)) {
10441 if ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) <= 0) {
10446 ((asoc->max_burst == 0) ||
10448 (burst_cnt < asoc->max_burst)));
10451 if ((asoc->max_burst > 0) && (burst_cnt >= asoc->max_burst)) {
10453 asoc->burst_limit_applied = 1;
10455 sctp_log_maxburst(stcb, asoc->primary_destination, 0, burst_cnt, SCTP_MAX_BURST_APPLIED);
10458 asoc->burst_limit_applied = 0;
10472 if (stcb->asoc.ecn_echo_cnt_onq)
10473 sctp_fix_ecn_echo(asoc);
10529 struct sctp_association *asoc)
10536 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
10554 asoc->fwd_tsn_cnt++;
10558 chk->asoc = asoc;
10568 TAILQ_INSERT_TAIL(&asoc->control_send_queue, chk, sctp_next);
10569 asoc->ctrl_queue_cnt++;
10583 TAILQ_FOREACH(at, &asoc->sent_queue, sctp_next) {
10605 if (cnt_of_space > (asoc->smallest_mtu - ovh)) {
10607 cnt_of_space = asoc->smallest_mtu - ovh;
10612 asoc->advanced_peer_ack_point);
10615 advance_peer_ack_point = asoc->advanced_peer_ack_point;
10632 at = TAILQ_FIRST(&asoc->sent_queue);
10645 asoc
10683 at = TAILQ_FIRST(&asoc->sent_queue);
10719 struct sctp_association *asoc;
10739 if ((stcb->asoc.sctp_nr_sack_on_off == 1) &&
10740 (stcb->asoc.peer_supports_nr_sack == 1)) {
10746 asoc = &stcb->asoc;
10748 if (asoc->last_data_chunk_from == NULL) {
10753 sctp_set_rwnd(stcb, asoc);
10754 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
10757 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next);
10758 asoc->ctrl_queue_cnt--;
10775 if (stcb->asoc.delayed_ack) {
10781 stcb->asoc.send_sack = 1;
10790 asoc->data_pkts_seen = 0;
10792 a_chk->asoc = asoc;
10798 if ((asoc->numduptsns) ||
10799 (!(asoc->last_data_chunk_from->dest_state & SCTP_ADDR_REACHABLE))) {
10803 * alternate than asoc->last_data_chunk_from
10805 if ((asoc->last_data_chunk_from->dest_state & SCTP_ADDR_REACHABLE) &&
10806 (asoc->used_alt_onsack > asoc->numnets)) {
10810 asoc->used_alt_onsack++;
10811 a_chk->whoTo = sctp_find_alternate_net(stcb, asoc->last_data_chunk_from, 0);
10815 a_chk->whoTo = asoc->last_data_chunk_from;
10816 asoc->used_alt_onsack = 0;
10823 asoc->used_alt_onsack = 0;
10824 a_chk->whoTo = asoc->last_data_chunk_from;
10829 if (SCTP_TSN_GT(asoc->highest_tsn_inside_map, asoc->highest_tsn_inside_nr_map)) {
10830 highest_tsn = asoc->highest_tsn_inside_map;
10832 highest_tsn = asoc->highest_tsn_inside_nr_map;
10834 if (highest_tsn == asoc->cumulative_tsn) {
10857 if (stcb->asoc.delayed_ack) {
10863 stcb->asoc.send_sack = 1;
10878 if ((asoc->sctp_cmt_on_off > 0) &&
10885 flags |= (asoc->cmt_dac_pkts_rcvd << 6);
10886 asoc->cmt_dac_pkts_rcvd = 0;
10889 stcb->asoc.cumack_logsnt[stcb->asoc.cumack_log_atsnt] = asoc->cumulative_tsn;
10890 stcb->asoc.cumack_log_atsnt++;
10891 if (stcb->asoc.cumack_log_atsnt >= SCTP_TSN_LOG_SIZE) {
10892 stcb->asoc.cumack_log_atsnt = 0;
10902 if (highest_tsn > asoc->mapping_array_base_tsn) {
10903 siz = (((highest_tsn - asoc->mapping_array_base_tsn) + 1) + 7) / 8;
10911 if (asoc->highest_tsn_inside_map > asoc->mapping_array_base_tsn) {
10912 siz = (((asoc->highest_tsn_inside_map - asoc->mapping_array_base_tsn) + 1) + 7) / 8;
10914 siz = (((MAX_TSN - asoc->mapping_array_base_tsn) + 1) + asoc->highest_tsn_inside_map + 7) / 8;
10918 if (SCTP_TSN_GT(asoc->mapping_array_base_tsn, asoc->cumulative_tsn)) {
10921 offset = asoc->mapping_array_base_tsn - asoc->cumulative_tsn;
10924 SCTP_TSN_GT(highest_tsn, asoc->cumulative_tsn)) ||
10926 SCTP_TSN_GT(asoc->highest_tsn_inside_map, asoc->cumulative_tsn))) {
10929 tsn_map = asoc->mapping_array[i];
10931 tsn_map |= asoc->nr_mapping_array[i];
10992 if (asoc->highest_tsn_inside_nr_map > asoc->mapping_array_base_tsn) {
10993 siz = (((asoc->highest_tsn_inside_nr_map - asoc->mapping_array_base_tsn) + 1) + 7) / 8;
10995 siz = (((MAX_TSN - asoc->mapping_array_base_tsn) + 1) + asoc->highest_tsn_inside_nr_map + 7) / 8;
10998 if (SCTP_TSN_GT(asoc->mapping_array_base_tsn, asoc->cumulative_tsn)) {
11001 offset = asoc->mapping_array_base_tsn - asoc->cumulative_tsn;
11003 if (SCTP_TSN_GT(asoc->highest_tsn_inside_nr_map, asoc->cumulative_tsn)) {
11006 tsn_map = asoc->nr_mapping_array[i];
11063 if ((limit_reached == 0) && (asoc->numduptsns)) {
11065 for (i = 0; i < asoc->numduptsns; i++) {
11066 *dup = htonl(asoc->dup_tsns[i]);
11074 asoc->numduptsns = 0;
11085 sack->sack.cum_tsn_ack = htonl(asoc->cumulative_tsn);
11086 sack->sack.a_rwnd = htonl(asoc->my_rwnd);
11097 nr_sack->nr_sack.cum_tsn_ack = htonl(asoc->cumulative_tsn);
11098 nr_sack->nr_sack.a_rwnd = htonl(asoc->my_rwnd);
11107 TAILQ_INSERT_TAIL(&asoc->control_send_queue, a_chk, sctp_next);
11108 asoc->my_last_reported_rwnd = asoc->my_rwnd;
11109 asoc->ctrl_queue_cnt++;
11110 asoc->send_sack = 0;
11144 stcb->asoc.peer_auth_chunks)) {
11182 if (stcb->asoc.alternate) {
11183 net = stcb->asoc.alternate;
11185 net = stcb->asoc.primary_destination;
11190 if (stcb->asoc.peer_vtag == 0) {
11192 vtag = stcb->asoc.my_vtag;
11195 vtag = stcb->asoc
11208 m_out, auth_offset, auth, stcb->asoc.authinfo.active_keyid, 1, 0, 0,
11210 stcb->asoc.primary_destination->port, NULL,
11236 vtag = stcb->asoc.my_vtag;
11239 vtag = stcb->asoc.peer_vtag;
11710 chk->asoc = &stcb->asoc;
11800 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next);
11801 stcb->asoc.ctrl_queue_cnt++;
11810 struct sctp_association *asoc;
11817 asoc = &stcb->asoc;
11819 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
11844 chk->asoc = &stcb->asoc;
11858 stcb->asoc.ecn_echo_cnt_onq++;
11865 TAILQ_INSERT_HEAD(&stcb->asoc.control_send_queue, chk, sctp_next);
11866 asoc->ctrl_queue_cnt++;
11873 struct sctp_association *asoc;
11887 asoc = &stcb->asoc;
11889 if (asoc->peer_supports_pktdrop == 0) {
11936 min(stcb->asoc.smallest_mtu, MCLBYTES)) {
11941 len = min(stcb->asoc.smallest_mtu, MCLBYTES) - SCTP_MAX_OVERHEAD;
11944 chk->asoc = &stcb->asoc;
11997 if (asoc->my_rwnd) {
11998 drp->current_onq = htonl(asoc->size_on_reasm_queue +
11999 asoc->size_on_all_streams +
12000 asoc->my_rwnd_control_len +
12012 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next);
12013 asoc->ctrl_queue_cnt++;
12019 struct sctp_association *asoc;
12027 asoc = &stcb->asoc;
12028 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
12051 chk->asoc = &stcb->asoc;
12069 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next);
12070 asoc->ctrl_queue_cnt++;
12322 struct sctp_association *asoc;
12327 asoc = &stcb->asoc;
12328 if (asoc->stream_reset_outstanding) {
12354 chk->asoc = &stcb->asoc;
12370 if (stcb->asoc.alternate) {
12371 chk->whoTo = stcb->asoc.alternate;
12373 chk->whoTo = stcb->asoc.primary_destination;
12382 seq = stcb->asoc.str_reset_seq_out;
12385 seq, (stcb->asoc.str_reset_seq_in - 1), (stcb->asoc.sending_seq - 1));
12386 asoc->stream_reset_out_is_outstanding = 1;
12388 asoc->stream_reset_outstanding++;
12391 ((stcb->asoc.strm_realoutsize - stcb->asoc.streamoutcnt) < adding_o)) {
12397 oldstream = stcb->asoc.strmout;
12399 SCTP_MALLOC(stcb->asoc.strmout, struct sctp_stream_out *,
12400 ((stcb->asoc.streamoutcnt+adding_o) * sizeof(struct sctp_stream_out)),
12402 if (stcb->asoc.strmout == NULL) {
12404 stcb->asoc.strmout = oldstream;
12414 stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 0, 1);
12415 for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
12416 TAILQ_INIT(&stcb->asoc.strmout[i].outqueue);
12417 stcb->asoc.strmout[i].chunks_on_queues = oldstream[i].chunks_on_queues;
12418 stcb->asoc.strmout[i].next_sequence_send = oldstream[i].next_sequence_send;
12419 stcb->asoc.strmout[i].last_msg_incomplete = oldstream[i].last_msg_incomplete;
12420 stcb->asoc.strmout[i].stream_no = i;
12421 stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], &oldstream[i]);
12425 TAILQ_INSERT_TAIL(&stcb->asoc.strmout[i].outqueue, sp, next);
12428 if (stcb->asoc.last_out_stream == &oldstream[i]) {
12429 stcb->asoc.last_out_stream = &stcb->asoc.strmout[i];
12431 if (stcb->asoc.locked_on_sending == &oldstream[i]) {
12432 stcb->asoc.locked_on_sending = &stcb->asoc.strmout[i];
12436 stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1);
12437 for (i = stcb->asoc.streamoutcnt; i < (stcb->asoc.streamoutcnt + adding_o); i++) {
12438 TAILQ_INIT(&stcb->asoc.strmout[i].outqueue);
12439 stcb->asoc.strmout[i].chunks_on_queues = 0;
12440 stcb->asoc.strmout[i].next_sequence_send = 0x0;
12441 stcb->asoc.strmout[i].stream_no = i;
12442 stcb->asoc.strmout[i].last_msg_incomplete = 0;
12443 stcb->asoc.ss_functions.sctp_ss_init_stream(&stcb->asoc.strmout[i], NULL);
12445 stcb->asoc.strm_realoutsize = stcb->asoc.streamoutcnt + adding_o;
12451 asoc->strm_pending_add_size = adding_o;
12452 asoc->peer_req_out = peer_asked;
12455 asoc->stream_reset_outstanding++;
12460 asoc->stream_reset_outstanding++;
12465 asoc->stream_reset_outstanding++;
12469 asoc->stream_reset_outstanding++;
12471 asoc->str_reset = chk;
12473 TAILQ_INSERT_TAIL(&asoc->control_send_queue,
12476 asoc->ctrl_queue_cnt++;
12707 struct sctp_association *asoc,
12719 * when you need to do something that may effect the stcb/asoc. The
12728 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_SENT) ||
12729 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_ACK_SENT) ||
12730 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) ||
12731 (asoc->state & SCTP_STATE_SHUTDOWN_PENDING)) {
12789 sp->auth_keyid = stcb->asoc.authinfo.active_keyid;
12791 if (sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.peer_auth_chunks)) {
12950 struct sctp_association *asoc;
12967 asoc = NULL;
13219 /* get an asoc/stcb struct */
13251 asoc = &stcb->asoc;
13252 SCTP_SET_STATE(asoc, SCTP_STATE_COOKIE_WAIT);
13253 (void)SCTP_GETTIME_TIMEVAL(&asoc->time_entered);
13276 asoc = &stcb->asoc;
13278 srcv = (struct sctp_sndrcvinfo *)&asoc->def_send;
13291 if (stcb->asoc.alternate) {
13292 net = stcb->asoc.alternate;
13294 net = stcb->asoc.primary_destination;
13299 atomic_add_int(&asoc->refcnt, 1);
13303 if (sndlen > asoc->smallest_mtu) {
13328 inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk));
13329 if ((SCTP_SB_LIMIT_SND(so) < (sndlen + inqueue_bytes + stcb->asoc.sb_send_resv)) ||
13330 (stcb->asoc.chunks_on_out_queue >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue))) {
13338 stcb->asoc.sb_send_resv += sndlen;
13342 atomic_add_int(&stcb->asoc.sb_send_resv, sndlen);
13345 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
13354 if (asoc->stream_reset_outstanding) {
13362 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_WAIT) ||
13363 (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED)) {
13371 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_SENT) ||
13372 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) ||
13373 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_ACK_SENT) ||
13374 (asoc->state & SCTP_STATE_SHUTDOWN_PENDING)) {
13401 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_WAIT) ||
13402 (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED)) {
13439 max_out = asoc->smallest_mtu - sizeof(struct sctp_paramhdr);
13479 atomic_add_int(&stcb->asoc.refcnt, -1);
13497 inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk));
13513 if (srcv->sinfo_stream >= asoc->streamoutcnt) {
13519 if (asoc->strmout == NULL) {
13560 ((stcb->asoc.chunks_on_out_queue+stcb->asoc.stream_queue_cnt) >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue))) {
13563 inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk));
13565 ((stcb->asoc.stream_queue_cnt+stcb->asoc.chunks_on_out_queue) >= SCTP_BASE_SYSCTL(sctp_max_chunks_on_queue))) {
13570 stcb->asoc.stream_queue_cnt,
13571 stcb->asoc.chunks_on_out_queue,
13574 sctp_log_block(SCTP_BLOCK_LOG_INTO_BLKA, asoc, sndlen);
13595 asoc, stcb->asoc.total_output_queue_size);
13597 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
13600 inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk));
13611 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
13637 if ((asoc->stream_locked) &&
13638 (asoc->stream_locked_on != srcv->sinfo_stream)) {
13646 strm = &stcb->asoc.strmout[srcv->sinfo_stream];
13649 sp = sctp_copy_it_in(stcb, asoc, srcv, uio, net, max_len, user_marks_eor, &error);
13656 asoc->stream_locked = 0;
13662 asoc->stream_locked = 1;
13663 asoc->stream_locked_on = srcv->sinfo_stream;
13667 atomic_add_int(&asoc->stream_queue_cnt, 1);
13672 stcb->asoc.ss_functions.sctp_ss_add_to_stream(stcb, asoc, strm, sp, 1);
13702 if (SCTP_SB_LIMIT_SND(so) > stcb->asoc.total_output_queue_size)
13703 max_len = SCTP_SB_LIMIT_SND(so) - stcb->asoc.total_output_queue_size;
13743 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
13748 if (stcb->asoc.state & SCTP_PCB_FLAGS_WAS_ABORTED) {
13800 if ((asoc->peer_supports_prsctp) && (asoc->sent_queue_cnt_removeable > 0)) {
13806 sctp_prune_prsctp(stcb, asoc, srcv, sndlen);
13807 inqueue_bytes = stcb->asoc.total_output_queue_size - (stcb->asoc.chunks_on_out_queue * sizeof(struct sctp_data_chunk));
13808 if (SCTP_SB_LIMIT_SND(so) > stcb->asoc.total_output_queue_size)
13829 if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) {
13834 SCTP_SET_STATE(asoc, SCTP_STATE_COOKIE_WAIT);
13839 (asoc->sctp_cmt_on_off == 0)) {
13842 } else if (asoc->ifp_had_enobuf) {
13847 asoc->ifp_had_enobuf = 0;
13849 un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) +
13850 (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk)));
13852 (stcb->asoc.total_flight > 0) &&
13853 (stcb->asoc.stream_queue_cnt < SCTP_MAX_DATA_BUNDLING) &&
13854 (un_sent < (int)(stcb->asoc.smallest_mtu - SCTP_MIN_OVERHEAD))) {
13878 sctp_misc_ints(SCTP_CWNDLOG_PRESEND, stcb->asoc.total_output_queue_size,
13879 stcb->asoc.total_flight,
13880 stcb->asoc.chunks_on_out_queue, stcb->asoc.total_flight_count);
13924 if (SCTP_SB_LIMIT_SND(so) <= (stcb->asoc.total_output_queue_size +
13930 asoc, uio->uio_resid);
13933 asoc, uio_resid(uio));
13937 asoc, uio->uio_resid);
13967 asoc, stcb->asoc.total_output_queue_size);
13971 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
13979 asoc->stream_locked = 1;
13980 asoc->stream_locked_on = srcv->sinfo_stream;
13984 asoc->stream_locked = 0;
13989 asoc->stream_locked = 0;
14032 if (TAILQ_EMPTY(&asoc->send_queue) &&
14033 TAILQ_EMPTY(&asoc->sent_queue) &&
14035 if (asoc->locked_on_sending) {
14039 if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) &&
14040 (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_RECEIVED) &&
14041 (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) {
14045 if (SCTP_GET_STATE(asoc) == SCTP_STATE_OPEN) {
14048 SCTP_SET_STATE(asoc, SCTP_STATE_SHUTDOWN_SENT);
14049 SCTP_CLEAR_SUBSTATE(asoc, SCTP_STATE_SHUTDOWN_PENDING);
14051 if (stcb->asoc.alternate) {
14052 netp = stcb->asoc.alternate;
14054 netp = stcb->asoc.primary_destination;
14060 asoc->primary_destination);
14073 if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) &&
14074 (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_RECEIVED) &&
14075 (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) {
14080 if (asoc->locked_on_sending) {
14083 sp = TAILQ_LAST(&asoc->locked_on_sending->outqueue, sctp_streamhead);
14086 asoc->state |= SCTP_STATE_PARTIAL_MSG_LEFT;
14089 asoc->state |= SCTP_STATE_SHUTDOWN_PENDING;
14090 if (TAILQ_EMPTY(&asoc->send_queue) &&
14091 TAILQ_EMPTY(&asoc->sent_queue) &&
14092 (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT)) {
14095 atomic_add_int(&stcb->asoc.refcnt, -1);
14106 asoc->primary_destination);
14112 if (!TAILQ_EMPTY(&stcb->asoc.control_send_queue)) {
14120 if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) {
14125 SCTP_SET_STATE(&stcb->asoc, SCTP_STATE_COOKIE_WAIT);
14130 (stcb->asoc.sctp_cmt_on_off == 0)) {
14133 } else if (asoc->ifp_had_enobuf) {
14138 asoc->ifp_had_enobuf = 0;
14140 un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) +
14141 (stcb->asoc.stream_queue_cnt * sizeof(struct sctp_data_chunk)));
14143 (stcb->asoc.total_flight > 0) &&
14144 (stcb->asoc.stream_queue_cnt < SCTP_MAX_DATA_BUNDLING) &&
14145 (un_sent < (int)(stcb->asoc.smallest_mtu - SCTP_MIN_OVERHEAD))) {
14167 sctp_misc_ints(SCTP_CWNDLOG_PRESEND, stcb->asoc.total_output_queue_size,
14168 stcb->asoc.total_flight,
14169 stcb->asoc.chunks_on_out_queue, stcb->asoc.total_flight_count);
14171 if ((queue_only == 0) && (nagle_applies == 0) && (stcb->asoc.peers_rwnd && un_sent)) {
14183 (stcb->asoc.peers_rwnd == 0) &&
14184 (stcb->asoc.total_flight == 0)) {
14199 frag_point = sctp_get_frag_point(stcb, &stcb->asoc);
14200 (void)sctp_med_chunk_output(inp, stcb, &stcb->asoc, &num_out,
14204 queue_only, stcb->asoc.peers_rwnd, un_sent,
14205 stcb->asoc.total_flight, stcb->asoc.chunks_on_out_queue,
14206 stcb->asoc.total_output_queue_size, error);
14215 atomic_subtract_int(&stcb->asoc.sb_send_resv, sndlen);
14224 atomic_add_int(&stcb->asoc.refcnt, -1);
14304 if (!stcb->asoc.peer_supports_auth) {
14308 if (!sctp_auth_is_required_chunk(chunk, stcb->asoc.peer_auth_chunks)) {
14325 sctp_get_hmac_digest_len(stcb->asoc.peer_hmac_id);
14327 auth->hmac_id = htons(stcb->asoc.peer_hmac_id);