Lines Matching defs:asoc
461 LIST_FOREACH(laddr, &stcb->asoc.sctp_local_addr_list, sctp_nxt_addr) {
469 LIST_FOREACH(laddr, &stcb->asoc.sctp_local_addr_list, sctp_nxt_addr) {
682 starting_point = stcb->asoc.last_used_address;
684 if (stcb->asoc.last_used_address == NULL) {
686 stcb->asoc.last_used_address = LIST_FIRST(&inp->sctp_addr_list);
689 for (laddr = stcb->asoc.last_used_address; laddr;
707 stcb->asoc.last_used_address = NULL;
711 stcb->asoc.last_used_address = starting_point;
714 if (stcb->asoc.last_used_address == NULL) {
716 stcb->asoc.last_used_address = LIST_FIRST(&inp->sctp_addr_list);
719 for (laddr = stcb->asoc.last_used_address; laddr;
736 stcb->asoc.last_used_address = NULL;
752 LIST_FOREACH(laddr, &stcb->asoc.sctp_local_addr_list,
776 LIST_FOREACH(laddr, &stcb->asoc.sctp_local_addr_list,
800 LIST_FOREACH(laddr, &stcb->asoc.sctp_local_addr_list,
813 LIST_FOREACH(laddr, &stcb->asoc.sctp_local_addr_list,
1151 ipv4_scope = stcb->asoc.ipv4_local_scope;
1152 loopscope = stcb->asoc.loopback_scope;
1325 starting_point = stcb->asoc.last_used_address;
1328 if (stcb->asoc.last_used_address == NULL) {
1330 stcb->asoc.last_used_address = LIST_FIRST(&inp->sctp_addr_list);
1333 for (laddr = stcb->asoc.last_used_address; laddr;
1363 stcb->asoc.last_used_address = NULL;
1367 stcb->asoc.last_used_address = starting_point;
1370 if (stcb->asoc.last_used_address == NULL) {
1372 stcb->asoc.last_used_address = LIST_FIRST(&inp->sctp_addr_list);
1375 for (laddr = stcb->asoc.last_used_address; laddr;
1391 stcb->asoc.last_used_address = NULL;
1401 LIST_FOREACH(laddr, &stcb->asoc.sctp_local_addr_list,
1425 LIST_FOREACH(laddr, &stcb->asoc.sctp_local_addr_list,
1451 LIST_FOREACH(laddr, &stcb->asoc.sctp_local_addr_list,
1984 /* we can't have a non-asoc address since we have no association */
2022 if (stcb->asoc.peer_supports_ecn_nonce == 0) {
2030 if (((stcb->asoc.hb_random_idx == 3) &&
2031 (stcb->asoc.hb_ect_randombit > 7)) ||
2032 (stcb->asoc.hb_random_idx > 3)) {
2035 memcpy(stcb->asoc.hb_random_values, &rndval,
2036 sizeof(stcb->asoc.hb_random_values));
2037 this_random = stcb->asoc.hb_random_values[0];
2038 stcb->asoc.hb_random_idx = 0;
2039 stcb->asoc.hb_ect_randombit = 0;
2041 if (stcb->asoc.hb_ect_randombit > 7) {
2042 stcb->asoc.hb_ect_randombit = 0;
2043 stcb->asoc.hb_random_idx++;
2045 this_random = stcb->asoc.hb_random_values[stcb->asoc.hb_random_idx];
2047 if ((this_random >> stcb->asoc.hb_ect_randombit) & 0x01) {
2051 stcb->asoc.hb_ect_randombit++;
2054 stcb->asoc.hb_ect_randombit++;
2110 (stcb->asoc.loopback_scope)) {
2138 if ((stcb->asoc.ecn_allowed) && ecn_ok) {
2216 if (net == stcb->asoc.primary_destination) {
2264 /* PMTU check versus smallest asoc MTU goes here */
2267 (stcb->asoc.smallest_mtu > rt->rt_rmx.rmx_mtu)) {
2268 sctp_mtu_size_reset(inp, &stcb->asoc,
2332 if ((stcb->asoc.ecn_allowed) && ecn_ok) {
2340 /* we could get no asoc if it is a O-O-T-B packet */
2395 if (net == stcb->asoc.primary_destination) {
2464 /* PMTU check versus smallest asoc MTU goes here */
2472 (stcb->asoc.smallest_mtu > rt->rt_rmx.rmx_mtu)) {
2474 &stcb->asoc,
2480 (stcb->asoc.smallest_mtu > ifp->if_mtu)) {
2482 &stcb->asoc,
2581 net = stcb->asoc.primary_destination;
2583 net = TAILQ_FIRST(&stcb->asoc.nets);
2643 initm->msg.init.initiate_tag = htonl(stcb->asoc.my_vtag);
2648 initm->msg.init.num_outbound_streams = htons(stcb->asoc.pre_open_streams);
2649 initm->msg.init.num_inbound_streams = htons(stcb->asoc.max_inbound_streams);
2650 initm->msg.init.initial_tsn = htonl(stcb->asoc.init_seq_number);
2679 if (stcb->asoc.cookie_preserve_req) {
2685 cookie_preserve->time = htonl(stcb->asoc.cookie_preserve_req);
2689 stcb->asoc.cookie_preserve_req = 0;
2745 if ((stcb->asoc.loopback_scope == 0) &&
2755 stcb->asoc.ipv4_addr_legal,
2756 stcb->asoc.ipv6_addr_legal,
2757 stcb->asoc.loopback_scope,
2758 stcb->asoc.ipv4_local_scope,
2759 stcb->asoc.local_scope,
2760 stcb->asoc.site_scope) == 0) {
2771 if ((stcb->asoc.loopback_scope == 0) &&
2781 stcb->asoc.ipv4_addr_legal,
2782 stcb->asoc.ipv6_addr_legal,
2783 stcb->asoc.loopback_scope,
2784 stcb->asoc.ipv4_local_scope,
2785 stcb->asoc.local_scope,
2786 stcb->asoc.site_scope) == 0) {
2806 stcb->asoc.ipv4_addr_legal,
2807 stcb->asoc.ipv6_addr_legal,
2808 stcb->asoc.loopback_scope,
2809 stcb->asoc.ipv4_local_scope,
2810 stcb->asoc.local_scope,
2811 stcb->asoc.site_scope) == 0) {
2831 stcb->asoc.ipv4_addr_legal,
2832 stcb->asoc.ipv6_addr_legal,
2833 stcb->asoc.loopback_scope,
2834 stcb->asoc.ipv4_local_scope,
2835 stcb->asoc.local_scope,
2836 stcb->asoc.site_scope) == 0) {
3097 sctp_are_there_new_addresses(struct sctp_association *asoc,
3143 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3205 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
3249 struct sctp_association *asoc;
3271 asoc = &stcb->asoc;
3273 asoc = NULL;
3276 if ((asoc != NULL) &&
3277 (SCTP_GET_STATE(asoc) != SCTP_STATE_COOKIE_WAIT) &&
3278 (sctp_are_there_new_addresses(asoc, init_pkt, iphlen, offset))) {
3317 if (asoc != NULL) {
3320 if (asoc->my_vtag_nonce == 0)
3321 asoc->my_vtag_nonce = sctp_select_a_tag(inp);
3322 stc.tie_tag_my_vtag = asoc->my_vtag_nonce;
3324 if (asoc->peer_vtag_nonce == 0)
3325 asoc->peer_vtag_nonce = sctp_select_a_tag(inp);
3326 stc.tie_tag_peer_vtag = asoc->peer_vtag_nonce;
3328 stc.cookie_life = asoc->cookie_life;
3329 net = asoc->primary_destination;
3516 stc.loopback_scope = asoc->loopback_scope;
3517 stc.ipv4_scope = asoc->ipv4_local_scope;
3518 stc.site_scope = asoc->site_scope;
3519 stc.local_scope = asoc->local_scope;
3520 TAILQ_FOREACH(lnet, &asoc->nets, sctp_next) {
3590 if ((asoc != NULL) &&
3591 ((SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_WAIT) ||
3592 (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED))) {
3594 initackm_out->msg.init.initiate_tag = htonl(asoc->my_vtag);
3595 initackm_out->msg.init.initial_tsn = htonl(asoc->init_seq_number);
3609 if (asoc != NULL) {
3610 if (asoc->streamoutcnt > inp->sctp_ep.pre_open_stream_count) {
3611 i_want = asoc->streamoutcnt;
3870 sctp_insert_on_wheel(struct sctp_association *asoc,
3874 stre = TAILQ_FIRST(&asoc->out_wheel);
3877 TAILQ_INSERT_HEAD(&asoc->out_wheel, strq, next_spoke);
3890 TAILQ_INSERT_AFTER(&asoc->out_wheel, stre, strq,
3897 sctp_remove_from_wheel(struct sctp_association *asoc,
3901 TAILQ_REMOVE(&asoc->out_wheel, strq, next_spoke);
3909 struct sctp_association *asoc,
3916 if ((asoc->peer_supports_prsctp) && (asoc->sent_queue_cnt_removeable > 0)) {
3917 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
3952 &asoc->sent_queue);
3962 chk = TAILQ_FIRST(&asoc->send_queue);
3978 &asoc->send_queue);
3989 } /* if enabled in asoc */
4001 if ((stcb->asoc.peer_supports_prsctp) &&
4048 if (stcb->asoc.primary_destination)
4049 template->whoTo = stcb->asoc.primary_destination;
4064 if (stcb->asoc.peer_supports_prsctp) {
4080 template->asoc = &stcb->asoc;
4086 struct sctp_association *asoc)
4101 if (stcb->sctp_ep->sctp_frag_point > asoc->smallest_mtu)
4102 siz = asoc->smallest_mtu - ovh;
4129 struct sctp_association *asoc;
4154 asoc = &stcb->asoc;
4156 if ((SCTP_GET_STATE(asoc) != SCTP_STATE_COOKIE_WAIT) &&
4157 (SCTP_GET_STATE(asoc) != SCTP_STATE_COOKIE_ECHOED)) {
4185 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_SENT) ||
4186 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_ACK_SENT) ||
4187 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) ||
4188 (asoc->state & SCTP_STATE_SHUTDOWN_PENDING)) {
4194 if (srcv->sinfo_stream >= asoc->streamoutcnt) {
4199 if (asoc->strmout == NULL) {
4209 strq = &asoc->strmout[srcv->sinfo_stream];
4244 (dataout + asoc->total_output_queue_size)) ||
4245 (asoc->chunks_on_out_queue > sctp_max_chunks_on_queue) ||
4246 (asoc->total_output_mbuf_queue_size >
4250 if (asoc->peer_supports_prsctp) {
4251 sctp_prune_prsctp(stcb, asoc, srcv, dataout);
4254 (dataout + asoc->total_output_queue_size)) ||
4255 (asoc->chunks_on_out_queue > sctp_max_chunks_on_queue) ||
4256 (asoc->total_output_mbuf_queue_size >
4328 * smallest mtu of the asoc
4330 siz = sctp_get_frag_point(stcb, asoc);
4345 asoc->chunks_on_out_queue++;
4365 asoc->stream_queue_cnt++;
4373 sctp_insert_on_wheel(asoc, strq);
4425 asoc->chunks_on_out_queue--;
4436 asoc->chunks_on_out_queue++;
4464 asoc->sent_queue_cnt_removeable++;
4493 asoc->stream_queue_cnt++;
4503 sctp_insert_on_wheel(asoc, strq);
4506 /* has a SHUTDOWN been (also) requested by the user on this asoc? */
4514 if (!TAILQ_EMPTY(&asoc->out_wheel)) {
4517 TAILQ_FOREACH(outs, &asoc->out_wheel, next_spoke) {
4525 if (TAILQ_EMPTY(&asoc->send_queue) &&
4526 TAILQ_EMPTY(&asoc->sent_queue) &&
4529 if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) &&
4530 (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) {
4540 sctp_send_shutdown(stcb, stcb->asoc.primary_destination);
4541 asoc->state = SCTP_STATE_SHUTDOWN_SENT;
4543 asoc->primary_destination);
4545 asoc->primary_destination);
4552 asoc->state |= SCTP_STATE_SHUTDOWN_PENDING;
4557 asoc->total_output_queue_size,
4559 asoc->total_output_mbuf_queue_size,
4562 asoc->total_output_queue_size += dataout;
4563 asoc->total_output_mbuf_queue_size += mbcnt;
4573 (int)asoc->total_output_queue_size,
4574 (int)asoc->total_output_mbuf_queue_size);
4675 ret = sctp_msg_append(stcb, stcb->asoc.primary_destination, m, &ca->sndrcv, 0);
4828 sctp_toss_old_cookies(struct sctp_association *asoc)
4831 chk = TAILQ_FIRST(&asoc->control_send_queue);
4835 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next);
4838 asoc->ctrl_queue_cnt--;
4855 struct sctp_association *asoc;
4858 asoc = &stcb->asoc;
4859 for (chk = TAILQ_FIRST(&asoc->control_send_queue); chk != NULL;
4865 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next);
4868 asoc->ctrl_queue_cnt--;
4884 struct sctp_association *asoc,
4901 TAILQ_REMOVE(&asoc->send_queue,
4905 TAILQ_INSERT_TAIL(&asoc->sent_queue,
4909 asoc->sent_queue_cnt++;
4910 asoc->send_queue_cnt--;
4911 if ((asoc->peers_rwnd <= 0) &&
4912 (asoc->total_flight == 0) &&
4931 asoc->total_flight += data_list[i]->book_size;
4932 asoc->total_flight_count++;
4935 asoc->peers_rwnd , data_list[i]->send_size, sctp_peer_chunk_oh);
4937 asoc->peers_rwnd = sctp_sbspace_sub(asoc->peers_rwnd,
4939 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
4941 asoc->peers_rwnd = 0;
4947 sctp_clean_up_ctl(struct sctp_association *asoc)
4950 for (chk = TAILQ_FIRST(&asoc->control_send_queue);
4965 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next);
4968 asoc->ctrl_queue_cnt--;
4992 struct sctp_association *asoc;
5001 asoc = &stcb->asoc;
5022 asoc->total_output_queue_size,
5024 asoc->total_output_mbuf_queue_size,
5027 stcb->asoc.total_output_mbuf_queue_size += MSIZE;
5058 asoc->stream_queue_cnt--;
5100 TAILQ_INSERT_TAIL(&asoc->send_queue, chk, sctp_next);
5101 asoc->send_queue_cnt++;
5103 chk->rec.data.TSN_seq = asoc->sending_seq++;
5127 struct sctp_association *asoc;
5133 asoc = &stcb->asoc;
5145 if (asoc->last_out_stream == NULL) {
5146 strq = asoc->last_out_stream = TAILQ_FIRST(&asoc->out_wheel);
5147 if (asoc->last_out_stream == NULL) {
5153 strq = TAILQ_NEXT(asoc->last_out_stream, next_spoke);
5156 asoc->last_out_stream = TAILQ_FIRST(&asoc->out_wheel);
5162 strq = TAILQ_FIRST(&asoc->out_wheel);
5174 strq = TAILQ_FIRST(&asoc->out_wheel);
5183 sctp_remove_from_wheel(asoc, strq);
5184 if (strq == asoc->last_out_stream) {
5186 asoc->last_out_stream = NULL;
5201 asoc->last_out_stream = strq;
5217 sctp_fix_ecn_echo(struct sctp_association *asoc)
5220 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
5229 struct sctp_association *asoc,
5243 TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) {
5259 struct sctp_association *asoc,
5309 if (TAILQ_EMPTY(&asoc->control_send_queue) &&
5310 TAILQ_EMPTY(&asoc->send_queue) &&
5311 TAILQ_EMPTY(&asoc->out_wheel)) {
5319 if (asoc->peers_rwnd <= 0) {
5323 if (asoc->total_flight > 0) {
5333 (int)asoc->total_flight, (int)asoc->peers_rwnd);
5336 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
5367 TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) {
5372 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
5376 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
5388 if ((TAILQ_FIRST(&asoc->send_queue) != NULL) &&
5391 if (callout_pending(&stcb->asoc.dack_timer.timer)) {
5400 if ((TAILQ_FIRST(&asoc->control_send_queue) == NULL) &&
5401 (TAILQ_FIRST(&asoc->send_queue) == NULL)) {
5404 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
5441 if (mtu > asoc->peers_rwnd) {
5442 if (asoc->total_flight > 0) {
5444 r_mtu = asoc->peers_rwnd;
5463 for (chk = TAILQ_FIRST(&asoc->control_send_queue);
5536 if (callout_pending(&stcb->asoc.dack_timer.timer)) {
5598 shdr->v_tag = htonl(stcb->asoc.peer_vtag);
5606 asoc->ifp_had_enobuf = 1;
5646 sctp_move_to_an_alt(stcb, asoc, net);
5648 sctp_clean_up_ctl (asoc);
5651 asoc->ifp_had_enobuf = 0;
5696 if (((asoc->state & SCTP_STATE_OPEN) == SCTP_STATE_OPEN) ||
5698 for (chk = TAILQ_FIRST(&asoc->send_queue); chk; chk = nchk) {
5753 ((chk->flags & CHUNK_FLAGS_FRAGMENT_OK) && (chk->send_size <= asoc->peers_rwnd))) {
5807 } /* if asoc.state OPEN */
5877 shdr->v_tag = htonl(stcb->asoc.peer_vtag);
5885 asoc->ifp_had_enobuf = 1;
5924 sctp_move_to_an_alt(stcb, asoc, net);
5926 sctp_clean_up_ctl (asoc);
5929 asoc->ifp_had_enobuf = 0;
5954 sctp_clean_up_datalist(stcb, asoc, data_list, bundle_at, net);
5967 sctp_clean_up_ctl (asoc);
6012 chk->asoc = &stcb->asoc;
6014 chk->whoTo = chk->asoc->primary_destination;
6020 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue,
6023 chk->asoc->ctrl_queue_cnt++;
6106 chk->asoc = &stcb->asoc;
6108 chk->whoTo = chk->asoc->primary_destination;
6110 TAILQ_INSERT_HEAD(&chk->asoc->control_send_queue, chk, sctp_next);
6111 chk->asoc->ctrl_queue_cnt++;
6176 chk->asoc = &stcb->asoc;
6180 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
6181 chk->asoc->ctrl_queue_cnt++;
6212 chk->asoc = &stcb->asoc;
6214 if (chk->asoc->last_control_chunk_from != NULL) {
6215 chk->whoTo = chk->asoc->last_control_chunk_from;
6217 chk->whoTo = chk->asoc->primary_destination;
6226 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
6227 chk->asoc->ctrl_queue_cnt++;
6261 chk->asoc = &stcb->asoc;
6272 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
6273 chk->asoc->ctrl_queue_cnt++;
6306 chk->asoc = &stcb->asoc;
6315 shutdown_cp->cumulative_tsn_ack = htonl(stcb->asoc.cumulative_tsn);
6318 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
6319 chk->asoc->ctrl_queue_cnt++;
6359 chk->asoc = &stcb->asoc;
6360 chk->whoTo = chk->asoc->primary_destination;
6362 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
6363 chk->asoc->ctrl_queue_cnt++;
6378 if (stcb->asoc.last_asconf_ack_sent == NULL) {
6387 if (stcb->asoc.last_asconf_ack_sent->m_flags & M_PKTHDR) {
6388 m_ack = m_copypacket(stcb->asoc.last_asconf_ack_sent, M_DONTWAIT);
6391 m_ack = m_copym(stcb->asoc.last_asconf_ack_sent, 0, M_COPYALL, M_DONTWAIT);
6393 m_ack = m_copy(stcb->asoc.last_asconf_ack_sent, 0, M_COPYALL);
6412 if (stcb->asoc.used_alt_asconfack > 2) {
6417 chk->whoTo = sctp_find_alternate_net(stcb, stcb->asoc.last_control_chunk_from);
6418 stcb->asoc.used_alt_asconfack++;
6422 if (stcb->asoc.last_control_chunk_from == NULL)
6423 chk->whoTo = stcb->asoc.primary_destination;
6425 chk->whoTo = stcb->asoc.last_control_chunk_from;
6426 stcb->asoc.used_alt_asconfack = 0;
6430 if (stcb->asoc.last_control_chunk_from == NULL)
6431 chk->whoTo = stcb->asoc.primary_destination;
6433 chk->whoTo = stcb->asoc.last_control_chunk_from;
6434 stcb->asoc.used_alt_asconfack = 0;
6442 chk->asoc = &stcb->asoc;
6444 TAILQ_INSERT_TAIL(&chk->asoc->control_send_queue, chk, sctp_next);
6445 chk->asoc->ctrl_queue_cnt++;
6453 struct sctp_association *asoc,
6489 if (TAILQ_EMPTY(&asoc->sent_queue)) {
6493 asoc->sent_queue_retran_cnt);
6496 asoc->sent_queue_cnt = 0;
6497 asoc->sent_queue_cnt_removeable = 0;
6499 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
6556 shdr->v_tag = htonl(stcb->asoc.peer_vtag);
6573 sctp_ucount_decr(asoc->sent_queue_retran_cnt);
6578 sctp_clean_up_ctl (asoc);
6585 if (TAILQ_EMPTY(&asoc->sent_queue)) {
6591 asoc->sent_queue_retran_cnt);
6594 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED) ||
6595 (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_WAIT)) {
6604 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
6618 if ((asoc->peers_rwnd < mtu) && (asoc->total_flight > 0)) {
6621 tsn = asoc->last_acked_seq + 1;
6633 (int)asoc->peers_rwnd,
6634 (int)asoc->total_flight);
6641 if (asoc->peers_rwnd < mtu) {
6678 if (one_chunk && (asoc->total_flight <= 0)) {
6747 shdr->v_tag = htonl(stcb->asoc.peer_vtag);
6770 SCTP_GETTIME_TIMEVAL(&asoc->time_last_sent);
6771 *now = asoc->time_last_sent;
6774 asoc->time_last_sent = *now;
6784 sctp_ucount_decr(asoc->sent_queue_retran_cnt);
6786 data_list[i]->sent_rcv_time = asoc->time_last_sent;
6788 asoc->total_flight += data_list[i]->book_size;
6789 asoc->total_flight_count++;
6793 asoc->peers_rwnd , data_list[i]->send_size, sctp_peer_chunk_oh);
6795 asoc->peers_rwnd = sctp_sbspace_sub(asoc->peers_rwnd,
6797 if (asoc->peers_rwnd < stcb->sctp_ep->sctp_ep.sctp_sws_sender) {
6799 asoc->peers_rwnd = 0;
6805 if ((data_list[i] == TAILQ_FIRST(&asoc->sent_queue)) &&
6827 if (asoc->sent_queue_retran_cnt <= 0) {
6829 asoc->sent_queue_retran_cnt = 0;
6846 struct sctp_association *asoc,
6851 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
6863 sctp_timer_start(SCTP_TIMER_TYPE_SEND, inp, stcb, asoc->primary_destination);
6885 struct sctp_association *asoc;
6891 asoc = &stcb->asoc;
6898 printf("in co - retran count:%d\n", asoc->sent_queue_retran_cnt);
6901 while (asoc->sent_queue_retran_cnt) {
6905 ret = sctp_chunk_retransmission(inp, stcb, asoc, &num_out, &now, &now_filled);
6918 (void)sctp_med_chunk_output(inp, stcb, asoc, &num_out, &reason_code, 1,
6929 return (sctp_timer_validation(inp, stcb, asoc, ret));
6957 (void)sctp_med_chunk_output(inp, stcb, asoc, &num_out, &reason_code, 1, &cwnd_full, from_where,
6970 burst_limit = asoc->max_burst;
6971 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
6981 sctp_move_to_an_alt(stcb, asoc, net);
6984 if ((asoc->sat_network) || (net->addr_is_local)) {
6985 burst_limit = asoc->max_burst * SCTP_SAT_NETWORK_BURST_INCR;
6990 printf("examined net:%p burst limit:%d\n", net, asoc->max_burst);
7018 error = sctp_med_chunk_output(inp, stcb, asoc, &num_out,
7028 sctp_log_maxburst(asoc->primary_destination, error , burst_cnt, SCTP_MAX_BURST_ERROR_STOP);
7047 asoc->burst_limit_applied = 1;
7049 sctp_log_maxburst(asoc->primary_destination, 0 , burst_cnt, SCTP_MAX_BURST_APPLIED);
7052 asoc->burst_limit_applied = 0;
7063 if (asoc->stream_queue_cnt > 0) {
7068 if (asoc->send_queue_cnt > 0) {
7079 sctp_fix_ecn_echo(asoc);
7091 struct sctp_association *asoc;
7102 asoc = NULL;
7183 net = stcb->asoc.primary_destination;
7200 net = stcb->asoc.primary_destination;
7227 net = stcb->asoc.primary_destination;
7231 net = stcb->asoc.primary_destination;
7311 asoc = &stcb->asoc;
7312 asoc->state = SCTP_STATE_COOKIE_WAIT;
7313 SCTP_GETTIME_TIMEVAL(&asoc->time_entered);
7322 asoc->max_init_times = initm.sinit_max_attempts;
7324 asoc->pre_open_streams = initm.sinit_num_ostreams;
7326 asoc->max_inbound_streams = initm.sinit_max_instreams;
7328 asoc->initial_init_rto_max = initm.sinit_max_init_timeo;
7330 if (asoc->streamoutcnt < asoc->pre_open_streams) {
7335 asoc->streamoutcnt, asoc->pre_open_streams);
7338 free(asoc->strmout, M_PCB);
7339 asoc->strmout = NULL;
7340 asoc->streamoutcnt = asoc->pre_open_streams;
7341 asoc->strmout = malloc(asoc->streamoutcnt *
7344 for (i = 0; i < asoc->streamoutcnt; i++) {
7356 asoc->strmout[i].next_sequence_sent = 0x0;
7357 TAILQ_INIT(&asoc->strmout[i].outqueue);
7358 asoc->strmout[i].stream_no = i;
7359 asoc->strmout[i].next_spoke.tqe_next = 0;
7360 asoc->strmout[i].next_spoke.tqe_prev = 0;
7371 net = stcb->asoc.primary_destination;
7377 asoc = &stcb->asoc;
7378 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_WAIT) ||
7379 (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED)) {
7382 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_SENT) ||
7383 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) ||
7384 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_ACK_SENT) ||
7385 (asoc->state & SCTP_STATE_SHUTDOWN_PENDING)) {
7413 srcv = stcb->asoc.def_send;
7434 net = stcb->asoc.primary_destination;
7443 } else if (asoc->ifp_had_enobuf) {
7447 un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) +
7448 ((stcb->asoc.chunks_on_out_queue - stcb->asoc.total_flight_count) * sizeof(struct sctp_data_chunk)) +
7452 (stcb->asoc.total_flight > 0) &&
7453 (un_sent < (int)stcb->asoc.smallest_mtu)
7466 if ((queue_only == 0) && stcb->asoc.peers_rwnd) {
7487 printf("USR Send complete qo:%d prw:%d\n", queue_only, stcb->asoc.peers_rwnd);
7496 struct sctp_association *asoc)
7501 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
7507 if (chk->whoTo != asoc->primary_destination) {
7509 chk->whoTo = asoc->primary_destination;
7523 chk->asoc = asoc;
7538 chk->whoTo = asoc->primary_destination;
7540 TAILQ_INSERT_TAIL(&asoc->control_send_queue, chk, sctp_next);
7541 asoc->ctrl_queue_cnt++;
7553 TAILQ_FOREACH(at, &asoc->sent_queue, sctp_next) {
7580 if (cnt_of_space > (asoc->smallest_mtu-ovh)) {
7582 cnt_of_space = asoc->smallest_mtu - ovh;
7594 at = TAILQ_FIRST(&asoc->sent_queue);
7601 asoc->advanced_peer_ack_point = last->rec.data.TSN_seq;
7610 fwdtsn->new_cumulative_tsn = htonl(asoc->advanced_peer_ack_point);
7631 at = TAILQ_FIRST(&asoc->sent_queue);
7658 struct sctp_association *asoc;
7670 asoc = &stcb->asoc;
7671 if (asoc->last_data_chunk_from == NULL) {
7675 sctp_set_rwnd(stcb, asoc);
7676 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
7679 TAILQ_REMOVE(&asoc->control_send_queue, chk, sctp_next);
7680 asoc->ctrl_queue_cnt++;
7703 a_chk->asoc = asoc;
7707 m_size = (asoc->mapping_array_size << 3);
7709 if ((asoc->numduptsns) ||
7710 (asoc->last_data_chunk_from->dest_state & SCTP_ADDR_NOT_REACHABLE)
7714 * than asoc->last_data_chunk_from
7716 if ((!(asoc->last_data_chunk_from->dest_state &
7718 (asoc->used_alt_onsack > 2)) {
7722 asoc->used_alt_onsack++;
7723 a_chk->whoTo = sctp_find_alternate_net(stcb, asoc->last_data_chunk_from);
7727 a_chk->whoTo = asoc->last_data_chunk_from;
7728 asoc->used_alt_onsack = 0;
7735 if (asoc->last_data_chunk_from == NULL) {
7739 asoc->used_alt_onsack = 0;
7740 a_chk->whoTo = asoc->last_data_chunk_from;
7769 if (asoc->highest_tsn_inside_map == asoc->cumulative_tsn) {
7779 if (asoc->highest_tsn_inside_map >= asoc->mapping_array_base_tsn) {
7780 maxi = (asoc->highest_tsn_inside_map - asoc->mapping_array_base_tsn);
7782 maxi = (asoc->highest_tsn_inside_map + (MAX_TSN - asoc->mapping_array_base_tsn) + 1);
7790 asoc->highest_tsn_inside_map,
7791 asoc->mapping_array_base_tsn,
7792 asoc->cumulative_tsn
7798 if (asoc->cumulative_tsn >= asoc->mapping_array_base_tsn) {
7799 start = (asoc->cumulative_tsn - asoc->mapping_array_base_tsn);
7813 if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, i) == 0) {
7817 if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, i)) {
7829 if (compare_with_wrap(asoc->cumulative_tsn, asoc->highest_tsn_inside_map, MAX_TSN)) {
7830 asoc->highest_tsn_inside_map = asoc->cumulative_tsn;
7832 sctp_log_map(0, 4, asoc->highest_tsn_inside_map, SCTP_MAP_SLIDE_RESULT);
7841 (asoc->numduptsns * sizeof(int32_t))
7843 if (space > (asoc->smallest_mtu-SCTP_MAX_OVERHEAD)) {
7846 calc = (asoc->smallest_mtu - SCTP_MAX_OVERHEAD);
7851 asoc->numduptsns = (fit - num_gap_blocks);
7855 asoc->numduptsns = 0;
7860 (asoc->numduptsns * sizeof(int32_t))
7893 sack->ch.chunk_flags = asoc->receiver_nonce_sum & SCTP_SACK_NONCE_SUM;
7894 sack->sack.cum_tsn_ack = htonl(asoc->cumulative_tsn);
7895 sack->sack.a_rwnd = htonl(asoc->my_rwnd);
7896 asoc->my_last_reported_rwnd = asoc->my_rwnd;
7898 sack->sack.num_dup_tsns = htons(asoc->numduptsns);
7902 (asoc->numduptsns * sizeof(int32_t)));
7917 if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, i) == 0) {
7924 if (SCTP_IS_TSN_PRESENT(asoc->mapping_array, i)) {
7939 if (asoc->numduptsns) {
7941 for (i = 0; i < asoc->numduptsns; i++) {
7942 *dup = htonl(asoc->dup_tsns[i]);
7945 asoc->numduptsns = 0;
7950 TAILQ_INSERT_TAIL(&asoc->control_send_queue, a_chk, sctp_next);
7951 asoc->ctrl_queue_cnt++;
7987 abort_m->sh.v_tag = htonl(stcb->asoc.peer_vtag);
7992 stcb->asoc.primary_destination,
7993 rtcache_getdst(&stcb->asoc.primary_destination->ro),
8019 comp_cp->sh.v_tag = htonl(stcb->asoc.peer_vtag);
8160 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
8264 if (stcb->asoc.state == 0) {
8321 chk->asoc = &stcb->asoc;
8384 stcb->asoc.max_send_times)) {
8408 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next);
8409 stcb->asoc.ctrl_queue_cnt++;
8428 struct sctp_association *asoc;
8431 asoc = &stcb->asoc;
8432 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
8449 chk->asoc = &stcb->asoc;
8472 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next);
8473 asoc->ctrl_queue_cnt++;
8480 struct sctp_association *asoc;
8489 asoc = &stcb->asoc;
8490 if (asoc->peer_supports_pktdrop == 0) {
8524 chk->asoc = &stcb->asoc;
8552 small_one = asoc->smallest_mtu;
8582 chk->whoTo = asoc->primary_destination;
8593 drp->current_onq = htonl(asoc->size_on_delivery_queue +
8594 asoc->size_on_reasm_queue +
8595 asoc->size_on_all_streams +
8596 asoc->my_rwnd_control_len +
8601 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next);
8602 asoc->ctrl_queue_cnt++;
8608 struct sctp_association *asoc;
8612 asoc = &stcb->asoc;
8613 TAILQ_FOREACH(chk, &asoc->control_send_queue, sctp_next) {
8632 chk->asoc = &stcb->asoc;
8655 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, chk, sctp_next);
8656 asoc->ctrl_queue_cnt++;
8665 for (i=0; i<stcb->asoc.streamoutcnt; i++) {
8666 stcb->asoc.strmout[i].next_sequence_sent = 0;
8670 if (list[i] >= stcb->asoc.streamoutcnt) {
8674 stcb->asoc.strmout[(list[i])].next_sequence_sent = 0;
8684 struct sctp_association *asoc;
8692 asoc = &stcb->asoc;
8705 chk->asoc = &stcb->asoc;
8740 chk->whoTo = asoc->primary_destination;
8783 if (asoc->str_reset_seq_in == seq) {
8785 asoc->str_reset_seq_in++;
8786 strack->sr_resp.reset_at_tsn = htonl(asoc->sending_seq);
8787 asoc->str_reset_sending_seq = asoc->sending_seq;
8807 strack->sr_resp.reset_at_tsn = htonl(asoc->str_reset_sending_seq);
8809 strack->sr_resp.cumulative_tsn = htonl(asoc->cumulative_tsn);
8810 TAILQ_INSERT_TAIL(&asoc->control_send_queue,
8813 asoc->ctrl_queue_cnt++;
8834 struct sctp_association *asoc;
8839 asoc = &stcb->asoc;
8840 if (asoc->stream_reset_outstanding) {
8859 chk->asoc = &stcb->asoc;
8893 chk->whoTo = asoc->primary_destination;
8930 strreq->sr_req.reset_req_seq = htonl(asoc->str_reset_seq_out);
8938 TAILQ_INSERT_TAIL(&asoc->control_send_queue,
8941 asoc->ctrl_queue_cnt++;
8943 asoc->stream_reset_outstanding = 1;
9273 struct sctp_association *asoc,
9283 * that may effect the stcb/asoc. The sb is
9322 (sndlen + asoc->total_output_queue_size)) ||
9323 (asoc->chunks_on_out_queue > sctp_max_chunks_on_queue) ||
9324 (asoc->total_output_mbuf_queue_size >
9328 if (asoc->peer_supports_prsctp) {
9329 sctp_prune_prsctp(stcb, asoc, srcv, sndlen);
9339 (sndlen + asoc->total_output_queue_size)) ||
9340 (asoc->chunks_on_out_queue >
9342 (asoc->total_output_mbuf_queue_size >
9358 so, asoc);
9377 so, asoc);
9381 * if our asoc was killed, the free code
9414 if (asoc->peer_supports_prsctp) {
9415 sctp_prune_prsctp(stcb, asoc, srcv, sndlen);
9428 if ((SCTP_GET_STATE(asoc) != SCTP_STATE_COOKIE_WAIT) &&
9429 (SCTP_GET_STATE(asoc) != SCTP_STATE_COOKIE_ECHOED)) {
9484 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_SENT) ||
9485 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_ACK_SENT) ||
9486 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) ||
9487 (asoc->state & SCTP_STATE_SHUTDOWN_PENDING)) {
9493 if (srcv->sinfo_stream >= asoc->streamoutcnt) {
9498 if (asoc->strmout == NULL) {
9520 my_vtag = asoc->my_vtag;
9521 strq = &asoc->strmout[srcv->sinfo_stream];
9523 frag_size = sctp_get_frag_point(stcb, asoc);
9538 asoc->chunks_on_out_queue++;
9568 asoc->sent_queue_cnt_removeable++;
9571 if ((asoc->state == 0) ||
9572 (my_vtag != asoc->my_vtag) ||
9580 asoc->stream_queue_cnt++;
9588 sctp_insert_on_wheel(asoc, strq);
9624 asoc->chunks_on_out_queue++;
9646 asoc->sent_queue_cnt_removeable++;
9667 if ((asoc->state == 0) ||
9668 (my_vtag != asoc->my_vtag) ||
9680 asoc->stream_queue_cnt++;
9690 sctp_insert_on_wheel(asoc, strq);
9703 asoc->chunks_on_out_queue--;
9716 asoc->total_output_queue_size,
9718 asoc->total_output_mbuf_queue_size,
9722 asoc->total_output_queue_size += dataout;
9723 asoc->total_output_mbuf_queue_size += mbcnt;
9734 if (!TAILQ_EMPTY(&asoc->out_wheel)) {
9737 TAILQ_FOREACH(outs, &asoc->out_wheel, next_spoke) {
9744 if (TAILQ_EMPTY(&asoc->send_queue) &&
9745 TAILQ_EMPTY(&asoc->sent_queue) &&
9748 if ((SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_SENT) &&
9749 (SCTP_GET_STATE(asoc) != SCTP_STATE_SHUTDOWN_ACK_SENT)) {
9759 sctp_send_shutdown(stcb, stcb->asoc.primary_destination);
9760 asoc->state = SCTP_STATE_SHUTDOWN_SENT;
9762 asoc->primary_destination);
9764 asoc->primary_destination);
9776 asoc->state |= SCTP_STATE_SHUTDOWN_PENDING;
9782 (int)asoc->total_output_queue_size,
9783 (int)asoc->total_output_mbuf_queue_size);
9810 struct sctp_association *asoc;
9817 asoc = NULL;
9858 net = stcb->asoc.primary_destination;
9931 /* User asks to abort a non-existent asoc */
9936 /* get an asoc/stcb struct */
9951 asoc = &stcb->asoc;
9952 asoc->state = SCTP_STATE_COOKIE_WAIT;
9953 SCTP_GETTIME_TIMEVAL(&asoc->time_entered);
9961 asoc->max_init_times = initm.sinit_max_attempts;
9963 asoc->pre_open_streams = initm.sinit_num_ostreams;
9965 asoc->max_inbound_streams = initm.sinit_max_instreams;
9967 asoc->initial_init_rto_max = initm.sinit_max_init_timeo;
9968 if (asoc->streamoutcnt < asoc->pre_open_streams) {
9973 asoc->streamoutcnt, asoc->pre_open_streams);
9976 free(asoc->strmout, M_PCB);
9977 asoc->strmout = NULL;
9978 asoc->streamoutcnt = asoc->pre_open_streams;
9981 asoc->strmout = malloc(
9982 asoc->streamoutcnt *
9985 for (i = 0; i < asoc->streamoutcnt; i++) {
9997 asoc->strmout[i].next_sequence_sent = 0x0;
9998 TAILQ_INIT(&asoc->strmout[i].outqueue);
9999 asoc->strmout[i].stream_no = i;
10000 asoc->strmout[i].next_spoke.tqe_next = 0;
10001 asoc->strmout[i].next_spoke.tqe_prev = 0;
10016 net = stcb->asoc.primary_destination;
10017 asoc = &stcb->asoc;
10019 asoc = &stcb->asoc;
10025 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_WAIT) ||
10026 (SCTP_GET_STATE(asoc) == SCTP_STATE_COOKIE_ECHOED)) {
10030 /* Grab the default stuff from the asoc */
10031 srcv = stcb->asoc.def_send;
10037 if ((SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_SENT) ||
10038 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_RECEIVED) ||
10039 (SCTP_GET_STATE(asoc) == SCTP_STATE_SHUTDOWN_ACK_SENT) ||
10040 (asoc->state & SCTP_STATE_SHUTDOWN_PENDING)) {
10061 net = stcb->asoc.primary_destination;
10078 error = sctp_copy_it_in(inp, stcb, asoc, net, &srcv, uio, flags);
10102 } else if (asoc->ifp_had_enobuf) {
10106 un_sent = ((stcb->asoc.total_output_queue_size - stcb->asoc.total_flight) +
10107 ((stcb->asoc.chunks_on_out_queue - stcb->asoc.total_flight_count) * sizeof(struct sctp_data_chunk)) +
10111 (stcb->asoc.total_flight > 0) &&
10112 (un_sent < (int)stcb->asoc.smallest_mtu)) {
10130 if ((SCTP_GET_STATE(asoc) != SCTP_STATE_COOKIE_WAIT) ||
10131 (SCTP_GET_STATE(asoc) != SCTP_STATE_COOKIE_ECHOED)) {
10140 if ((queue_only == 0) && (stcb->asoc.peers_rwnd && un_sent)) {
10152 (stcb->asoc.peers_rwnd == 0) &&
10153 (stcb->asoc.total_flight == 0)) {
10161 } else if (!TAILQ_EMPTY(&stcb->asoc.control_send_queue)) {
10165 sctp_med_chunk_output(inp, stcb, &stcb->asoc, &num_out,
10172 queue_only, stcb->asoc.peers_rwnd, un_sent,
10173 stcb->asoc.total_flight, stcb->asoc.chunks_on_out_queue,
10174 stcb->asoc.total_output_queue_size);