Home | History | Annotate | Download | only in netinet

Lines Matching defs:asoc

92 		sctp_clog.x.sb.stcb_sbcc = stcb->asoc.sb_cc;
116 sctp_clog.x.close.state = (uint16_t)stcb->asoc.state;
180 sctp_clog.x.nagle.total_flight = stcb->asoc.total_flight;
181 sctp_clog.x.nagle.total_in_queue = stcb->asoc.total_output_queue_size;
182 sctp_clog.x.nagle.count_in_queue = stcb->asoc.chunks_on_out_queue;
183 sctp_clog.x.nagle.count_in_flight = stcb->asoc.total_flight_count;
324 if (stcb->asoc.send_queue_cnt > 255)
327 sctp_clog.x.cwnd.cnt_in_send = stcb->asoc.send_queue_cnt;
328 if (stcb->asoc.stream_queue_cnt > 255)
331 sctp_clog.x.cwnd.cnt_in_str = stcb->asoc.stream_queue_cnt;
341 sctp_clog.x.cwnd.meets_pseudo_cumack = stcb->asoc.peers_rwnd;
419 if (stcb->asoc.send_queue_cnt > 255)
422 sctp_clog.x.cwnd.cnt_in_send = stcb->asoc.send_queue_cnt;
423 if (stcb->asoc.stream_queue_cnt > 255)
426 sctp_clog.x.cwnd.cnt_in_str = stcb->asoc.stream_queue_cnt;
516 sctp_clog.x.wake.flight = stcb->asoc.total_flight_count;
517 sctp_clog.x.wake.send_q = stcb->asoc.send_queue_cnt;
518 sctp_clog.x.wake.sent_q = stcb->asoc.sent_queue_cnt;
520 if (stcb->asoc.stream_queue_cnt < 0xff)
521 sctp_clog.x.wake.stream_qcnt = (uint8_t) stcb->asoc.stream_queue_cnt;
525 if (stcb->asoc.chunks_on_out_queue < 0xff)
526 sctp_clog.x.wake.chunks_on_oque = (uint8_t) stcb->asoc.chunks_on_out_queue;
557 sctp_log_block(uint8_t from, struct sctp_association *asoc, int sendlen)
562 sctp_clog.x.blk.onsb = asoc->total_output_queue_size;
563 sctp_clog.x.blk.send_sent_qcnt = (uint16_t) (asoc->send_queue_cnt + asoc->sent_queue_cnt);
564 sctp_clog.x.blk.peer_rwnd = asoc->peers_rwnd;
565 sctp_clog.x.blk.stream_qcnt = (uint16_t) asoc->stream_queue_cnt;
566 sctp_clog.x.blk.chunks_on_oque = (uint16_t) asoc->chunks_on_out_queue;
567 sctp_clog.x.blk.flight_size = (uint16_t) (asoc->total_flight/1024);
673 (0x000000ff & stcb->asoc.sent_queue_retran_cnt);
681 TAILQ_FOREACH(chk, &stcb->asoc.sent_queue, sctp_next) {
689 if (resend_cnt != stcb->asoc.sent_queue_retran_cnt) {
696 SCTP_PRINTF("resend_cnt:%d asoc-tot:%d\n",
697 resend_cnt, stcb->asoc.sent_queue_retran_cnt);
699 stcb->asoc.sent_queue_retran_cnt = resend_cnt;
702 (0x000000ff & stcb->asoc.sent_queue_retran_cnt);
708 if (tot_out != stcb->asoc.total_flight) {
717 (int)stcb->asoc.total_flight);
718 stcb->asoc.total_flight = tot_out;
720 if (tot_book_cnt != stcb->asoc.total_flight_count) {
730 stcb->asoc.total_flight_count = tot_book_cnt;
733 TAILQ_FOREACH(lnet, &stcb->asoc.nets, sctp_next) {
736 if (tot_out != stcb->asoc.total_flight) {
745 stcb->asoc.total_flight, tot_out);
747 TAILQ_FOREACH(lnet, &stcb->asoc.nets, sctp_next) {
750 TAILQ_FOREACH(chk, &stcb->asoc.sent_queue, sctp_next) {
791 struct sctp_association *asoc;
794 asoc = &stcb->asoc;
796 (void)SCTP_OS_TIMER_STOP(&asoc->dack_timer.timer);
797 (void)SCTP_OS_TIMER_STOP(&asoc->strreset_timer.timer);
798 (void)SCTP_OS_TIMER_STOP(&asoc->asconf_timer.timer);
799 (void)SCTP_OS_TIMER_STOP(&asoc->autoclose_timer.timer);
800 (void)SCTP_OS_TIMER_STOP(&asoc->delayed_event_timer.timer);
801 TAILQ_FOREACH(net, &asoc->nets, sctp_next) {
953 struct sctp_association *asoc;
967 asoc = &stcb->asoc;
969 SCTP_SET_STATE(&stcb->asoc, SCTP_STATE_INUSE);
970 asoc->max_burst = inp->sctp_ep.max_burst;
971 asoc->fr_max_burst = inp->sctp_ep.fr_max_burst;
972 asoc->heart_beat_delay = TICKS_TO_MSEC(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT]);
973 asoc->cookie_life = inp->sctp_ep.def_cookie_life;
974 asoc->sctp_cmt_on_off = inp->sctp_cmt_on_off;
975 asoc->ecn_allowed = inp->sctp_ecn_enable;
976 asoc->sctp_nr_sack_on_off = (uint8_t)SCTP_BASE_SYSCTL(sctp_nr_sack_on_off);
977 asoc->sctp_cmt_pf = (uint8_t)0;
978 asoc->sctp_frag_point = inp->sctp_frag_point;
979 asoc->sctp_features = inp->sctp_features;
980 asoc->default_dscp = inp->sctp_ep.default_dscp;
983 asoc->default_flowlabel = inp->sctp_ep.default_flowlabel;
986 asoc->default_flowlabel = sctp_select_initial_TSN(&inp->sctp_ep);
987 asoc->default_flowlabel &= 0x000fffff;
988 asoc->default_flowlabel |= 0x80000000;
990 asoc->default_flowlabel = 0;
994 asoc->sb_send_resv = 0;
996 asoc->my_vtag = override_tag;
998 asoc->my_vtag = sctp_select_a_tag(inp, stcb->sctp_ep->sctp_lport, stcb->rport, 1);
1001 asoc->my_vtag_nonce = sctp_select_a_tag(inp, stcb->sctp_ep->sctp_lport, stcb->rport, 0);
1002 asoc->peer_vtag_nonce = sctp_select_a_tag(inp, stcb->sctp_ep->sctp_lport, stcb->rport, 0);
1003 asoc->vrf_id = vrf_id;
1006 asoc->tsn_in_at = 0;
1007 asoc->tsn_out_at = 0;
1008 asoc->tsn_in_wrapped = 0;
1009 asoc->tsn_out_wrapped = 0;
1010 asoc->cumack_log_at = 0;
1011 asoc->cumack_log_atsnt = 0;
1014 asoc->fs_index = 0;
1016 asoc->refcnt = 0;
1017 asoc->assoc_up_sent = 0;
1018 asoc->asconf_seq_out = asoc->str_reset_seq_out = asoc->init_seq_number = asoc->sending_seq =
1020 asoc->asconf_seq_out_acked = asoc->asconf_seq_out - 1;
1022 asoc->peer_supports_pktdrop = 1;
1023 asoc->peer_supports_nat = 0;
1024 asoc->sent_queue_retran_cnt = 0;
1027 asoc->last_net_cmt_send_started = NULL;
1030 asoc->last_acked_seq = asoc->init_seq_number - 1;
1031 asoc->advanced_peer_ack_point = asoc->last_acked_seq;
1032 asoc->asconf_seq_in = asoc->last_acked_seq;
1035 asoc->str_reset_seq_in = asoc->last_acked_seq + 1;
1037 asoc->initial_init_rto_max = inp->sctp_ep.initial_init_rto_max;
1038 asoc->initial_rto = inp->sctp_ep.initial_rto;
1040 asoc->max_init_times = inp->sctp_ep.max_init_times;
1041 asoc->max_send_times = inp->sctp_ep.max_send_times;
1042 asoc->def_net_failure = inp->sctp_ep.def_net_failure;
1043 asoc->def_net_pf_threshold = inp->sctp_ep.def_net_pf_threshold;
1044 asoc->free_chunk_cnt = 0;
1046 asoc->iam_blocking = 0;
1047 asoc->context = inp->sctp_context;
1048 asoc->local_strreset_support = inp->local_strreset_support;
1049 asoc->def_send = inp->def_send;
1050 asoc->delayed_ack = TICKS_TO_MSEC(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_RECV]);
1051 asoc->sack_freq = inp->sctp_ep.sctp_sack_freq;
1052 asoc->pr_sctp_cnt = 0;
1053 asoc->total_output_queue_size = 0;
1056 asoc->scope.ipv6_addr_legal = 1;
1058 asoc->scope.ipv4_addr_legal = 1;
1060 asoc->scope.ipv4_addr_legal = 0;
1063 asoc->scope.conn_addr_legal = 0;
1066 asoc->scope.ipv6_addr_legal = 0;
1069 asoc->scope.conn_addr_legal = 1;
1070 asoc->scope.ipv4_addr_legal = 0;
1072 asoc->scope.conn_addr_legal = 0;
1073 asoc->scope.ipv4_addr_legal = 1;
1076 asoc->scope.ipv4_addr_legal = 1;
1080 asoc->my_rwnd = max(SCTP_SB_LIMIT_RCV(inp->sctp_socket), SCTP_MINIMAL_RWND);
1081 asoc->peers_rwnd = SCTP_SB_LIMIT_RCV(inp->sctp_socket);
1083 asoc->smallest_mtu = inp->sctp_frag_point;
1084 asoc->minrto = inp->sctp_ep.sctp_minrto;
1085 asoc->maxrto = inp->sctp_ep.sctp_maxrto;
1087 asoc->locked_on_sending = NULL;
1088 asoc->stream_locked_on = 0;
1089 asoc->ecn_echo_cnt_onq = 0;
1090 asoc->stream_locked = 0;
1092 asoc->send_sack = 1;
1094 LIST_INIT(&asoc->sctp_restricted_addrs);
1096 TAILQ_INIT(&asoc->nets);
1097 TAILQ_INIT(&asoc->pending_reply_queue);
1098 TAILQ_INIT(&asoc->asconf_ack_sent);
1100 asoc->hb_random_idx = 4;
1102 asoc->sctp_autoclose_ticks = inp->sctp_ep.auto_close_time;
1104 stcb->asoc.congestion_control_module = inp->sctp_ep.sctp_default_cc_module;
1105 stcb->asoc.cc_functions = sctp_cc_functions[inp->sctp_ep.sctp_default_cc_module];
1107 stcb->asoc.stream_scheduling_module = inp->sctp_ep.sctp_default_ss_module;
1108 stcb->asoc.ss_functions = sctp_ss_functions[inp->sctp_ep.sctp_default_ss_module];
1114 asoc->strm_realoutsize = asoc->streamoutcnt = asoc->pre_open_streams =
1116 SCTP_MALLOC(asoc->strmout, struct sctp_stream_out *,
1117 asoc->streamoutcnt * sizeof(struct sctp_stream_out),
1119 if (asoc->strmout == NULL) {
1124 for (i = 0; i < asoc->streamoutcnt; i++) {
1133 asoc->strmout[i].next_sequence_send = 0x0;
1134 TAILQ_INIT(&asoc->strmout[i].outqueue);
1135 asoc->strmout[i].chunks_on_queues = 0;
1136 asoc->strmout[i].stream_no = i;
1137 asoc->strmout[i].last_msg_incomplete = 0;
1138 asoc->ss_functions.sctp_ss_init_stream(&asoc->strmout[i], NULL);
1140 asoc->ss_functions.sctp_ss_init(stcb, asoc, 0);
1143 asoc->mapping_array_size = SCTP_INITIAL_MAPPING_ARRAY;
1144 SCTP_MALLOC(asoc->mapping_array, uint8_t *, asoc->mapping_array_size,
1146 if (asoc->mapping_array == NULL) {
1147 SCTP_FREE(asoc->strmout, SCTP_M_STRMO);
1151 memset(asoc->mapping_array, 0, asoc->mapping_array_size);
1152 SCTP_MALLOC(asoc->nr_mapping_array, uint8_t *, asoc->mapping_array_size,
1154 if (asoc->nr_mapping_array == NULL) {
1155 SCTP_FREE(asoc->strmout, SCTP_M_STRMO);
1156 SCTP_FREE(asoc->mapping_array, SCTP_M_MAP);
1160 memset(asoc->nr_mapping_array, 0, asoc->mapping_array_size);
1163 TAILQ_INIT(&asoc->free_chunks);
1164 TAILQ_INIT(&asoc->control_send_queue);
1165 TAILQ_INIT(&asoc->asconf_send_queue);
1166 TAILQ_INIT(&asoc->send_queue);
1167 TAILQ_INIT(&asoc->sent_queue);
1168 TAILQ_INIT(&asoc->reasmqueue);
1169 TAILQ_INIT(&asoc->resetHead);
1170 asoc->max_inbound_streams = inp->sctp_ep.max_open_streams_intome;
1171 TAILQ_INIT(&asoc->asconf_queue);
1173 asoc->authinfo.random = NULL;
1174 asoc->authinfo.active_keyid = 0;
1175 asoc->authinfo.assoc_key = NULL;
1176 asoc->authinfo.assoc_keyid = 0;
1177 asoc->authinfo.recv_key = NULL;
1178 asoc->authinfo.recv_keyid = 0;
1179 LIST_INIT(&asoc->shared_keys);
1180 asoc->marked_retrans = 0;
1181 asoc->port = inp->sctp_ep.port;
1182 asoc->timoinit = 0;
1183 asoc->timodata = 0;
1184 asoc->timosack = 0;
1185 asoc->timoshutdown = 0;
1186 asoc->timoheartbeat = 0;
1187 asoc->timocookie = 0;
1188 asoc->timoshutdownack = 0;
1189 (void)SCTP_GETTIME_TIMEVAL(&asoc->start_time);
1190 asoc->discontinuity_time = asoc->start_time;
1198 sctp_print_mapping_array(struct sctp_association *asoc)
1203 asoc->mapping_array_size,
1204 asoc->mapping_array_base_tsn,
1205 asoc->cumulative_tsn,
1206 asoc->highest_tsn_inside_map,
1207 asoc->highest_tsn_inside_nr_map);
1208 for (limit = asoc->mapping_array_size; limit > 1; limit--) {
1209 if (asoc->mapping_array[limit - 1] != 0) {
1213 SCTP_PRINTF("Renegable mapping array (last %d entries are zero):\n", asoc->mapping_array_size - limit);
1215 SCTP_PRINTF("%2.2x%c", asoc->mapping_array[i], ((i + 1) % 16) ? ' ' : '\n');
1219 for (limit = asoc->mapping_array_size; limit > 1; limit--) {
1220 if (asoc->nr_mapping_array[limit - 1]) {
1224 SCTP_PRINTF("Non renegable mapping array (last %d entries are zero):\n", asoc->mapping_array_size - limit);
1226 SCTP_PRINTF("%2.2x%c", asoc->nr_mapping_array[i], ((i + 1) % 16) ? ' ': '\n');
1233 sctp_expand_mapping_array(struct sctp_association *asoc, uint32_t needed)
1239 new_size = asoc->mapping_array_size + ((needed+7)/8 + SCTP_MAPPING_ARRAY_INCR);
1255 memcpy(new_array1, asoc->mapping_array, asoc->mapping_array_size);
1256 memcpy(new_array2, asoc->nr_mapping_array, asoc->mapping_array_size);
1257 SCTP_FREE(asoc->mapping_array, SCTP_M_MAP);
1258 SCTP_FREE(asoc->nr_mapping_array, SCTP_M_MAP);
1259 asoc->mapping_array = new_array1;
1260 asoc->nr_mapping_array = new_array2;
1261 asoc->mapping_array_size = new_size;
1335 if (it->asoc_state && ((it->stcb->asoc.state & it->asoc_state) != it->asoc_state)) {
1344 atomic_add_int(&it->stcb->asoc.refcnt, 1);
1355 atomic_add_int(&it->stcb->asoc.refcnt, -1);
1380 atomic_add_int(&it->stcb->asoc.refcnt, -1);
1577 atomic_add_int(&stcb->asoc.refcnt, 1);
1578 if (stcb->asoc.state == 0) {
1579 atomic_add_int(&stcb->asoc.refcnt, -1);
1596 atomic_add_int(&stcb->asoc.refcnt, -1);
1607 atomic_add_int(&stcb->asoc.refcnt, -1);
1609 ((stcb->asoc.state == 0) ||
1610 (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED))) {
1665 stcb->asoc.timodata++;
1666 stcb->asoc.num_send_timers_up--;
1667 if (stcb->asoc.num_send_timers_up < 0) {
1668 stcb->asoc.num_send_timers_up = 0;
1681 if ((stcb->asoc.num_send_timers_up == 0) &&
1682 (stcb->asoc.sent_queue_cnt > 0)) {
1691 chk = TAILQ_FIRST(&stcb->asoc.sent_queue);
1701 stcb->asoc.timoinit++;
1714 stcb->asoc.timosack++;
1730 stcb->asoc.timoshutdown++;
1741 stcb->asoc.timoheartbeat++;
1764 stcb->asoc.timocookie++;
1819 stcb->asoc.timoshutdownack++;
1886 atomic_add_int(&stcb->asoc.refcnt, 1);
1890 atomic_subtract_int(&stcb->asoc.refcnt, 1);
1897 * free asoc, always unlocks (or destroy's) so prevent
1941 sctp_fix_ecn_echo(&stcb->asoc);
1999 rto_val = stcb->asoc.initial_rto;
2016 to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto);
2029 tmr = &stcb->asoc.dack_timer;
2030 to_ticks = MSEC_TO_TICKS(stcb->asoc.delayed_ack);
2038 to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto);
2061 to_ticks = stcb->asoc.initial_rto;
2094 to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto);
2115 tmr = &stcb->asoc.strreset_timer;
2153 to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto);
2168 tmr = &stcb->asoc.shut_guard_timer;
2179 to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto);
2183 tmr = &stcb->asoc.strreset_timer;
2194 to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto);
2198 tmr = &stcb->asoc.asconf_timer;
2204 to_ticks = MSEC_TO_TICKS(stcb->asoc.initial_rto);
2205 tmr = &stcb->asoc.delete_prim_timer;
2211 if (stcb->asoc.sctp_autoclose_ticks == 0) {
2218 to_ticks = stcb->asoc.sctp_autoclose_ticks;
2219 tmr = &stcb->asoc.autoclose_timer;
2241 stcb->asoc.num_send_timers_up++;
2299 tmr = &stcb->asoc.dack_timer;
2329 * Stop the asoc kill timer.
2334 tmr = &stcb->asoc.strreset_timer;
2361 tmr = &stcb->asoc.shut_guard_timer;
2367 tmr = &stcb->asoc.strreset_timer;
2373 tmr = &stcb->asoc.asconf_timer;
2379 tmr = &stcb->asoc.delete_prim_timer;
2385 tmr = &stcb->asoc.autoclose_timer;
2405 stcb->asoc.num_send_timers_up--;
2406 if (stcb->asoc.num_send_timers_up < 0) {
2407 stcb->asoc.num_send_timers_up = 0;
2432 struct sctp_association *asoc, uint32_t mtu)
2436 * the asoc MTU, going through ANY chunk+overhead larger than mtu to
2442 asoc->smallest_mtu = mtu;
2449 TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) {
2454 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) {
2469 struct sctp_association *asoc,
2498 if (stcb->asoc.use_precise_time) {
2509 if ((asoc->cc_functions.sctp_rtt_calculated) && (rtt_from_sack == SCTP_RTT_FROM_DATA)) {
2511 (*asoc->cc_functions.sctp_rtt_calculated)(stcb, net, &now);
2563 (stcb->asoc.sat_network_lockout == 0)) {
2564 stcb->asoc.sat_network = 1;
2565 } else if ((!first_measure) && stcb->asoc.sat_network) {
2566 stcb->asoc.sat_network = 0;
2567 stcb->asoc.sat_network_lockout = 1;
2570 if (new_rto < stcb->asoc.minrto) {
2571 new_rto = stcb->asoc.minrto;
2573 if (new_rto > stcb->asoc.maxrto) {
2574 new_rto = stcb->asoc.maxrto;
2750 sac->sac_outbound_streams = stcb->asoc.streamoutcnt;
2751 sac->sac_inbound_streams = stcb->asoc.streamincnt;
2756 if (stcb->asoc.peer_supports_prsctp) {
2759 if (stcb->asoc.peer_supports_auth) {
2762 if (stcb->asoc.peer_supports_asconf) {
2766 if (stcb->asoc.peer_supports_strreset) {
2776 control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination,
2777 0, 0, stcb->asoc.context, 0, 0, 0,
2802 if (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_WAIT) {
2810 if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_WAIT) ||
2811 (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_COOKIE_ECHOED)) {
2824 atomic_add_int(&stcb->asoc.refcnt, 1);
2828 atomic_subtract_int(&stcb->asoc.refcnt, 1);
2829 if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) {
2925 control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination,
2926 0, 0, stcb->asoc.context, 0, 0, 0,
3042 control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination,
3043 0, 0, stcb->asoc.context, 0, 0, 0,
3145 control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination,
3146 0, 0, stcb->asoc.context, 0, 0, 0,
3183 sai->sai_adaptation_ind = stcb->asoc.peers_adaptation;
3190 control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination,
3191 0, 0, stcb->asoc.context, 0, 0, 0,
3246 control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination,
3247 0, 0, stcb->asoc.context, 0, 0, 0,
3270 if (stcb->asoc.control_pdapi)
3271 TAILQ_INSERT_AFTER(&stcb->sctp_ep->read_queue, stcb->asoc.control_pdapi, control, next);
3283 atomic_add_int(&stcb->asoc.refcnt, 1);
3287 atomic_subtract_int(&stcb->asoc.refcnt, 1);
3321 atomic_add_int(&stcb->asoc.refcnt, 1);
3325 atomic_subtract_int(&stcb->asoc.refcnt, 1);
3326 if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) {
3355 control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination,
3356 0, 0, stcb->asoc.context, 0, 0, 0,
3406 control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination,
3407 0, 0, stcb->asoc.context, 0, 0, 0,
3436 if ((stcb->asoc.peer_req_out) && flag) {
3438 stcb->asoc.peer_req_out = 0;
3441 stcb->asoc.peer_req_out = 0;
3462 if (sctp_sbspace(&stcb->asoc, &stcb->sctp_socket->so_rcv) < SCTP_BUF_LEN(m_notify)) {
3468 control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination,
3469 0, 0, stcb->asoc.context, 0, 0, 0,
3518 if (sctp_sbspace(&stcb->asoc, &stcb->sctp_socket->so_rcv) < SCTP_BUF_LEN(m_notify)) {
3524 control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination,
3525 0, 0, stcb->asoc.context, 0, 0, 0,
3583 if (sctp_sbspace(&stcb->asoc, &stcb->sctp_socket->so_rcv) < SCTP_BUF_LEN(m_notify)) {
3589 control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination,
3590 0, 0, stcb->asoc.context, 0, 0, 0,
3646 control = sctp_build_readq_entry(stcb, stcb->asoc.primary_destination,
3647 0, 0, stcb->asoc.context, 0, 0, 0,
3675 (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) {
3693 if ((stcb->asoc.state & SCTP_STATE_COOKIE_WAIT) ||
3694 (stcb->asoc.state & SCTP_STATE_COOKIE_ECHOED)) {
3704 if (stcb->asoc.assoc_up_sent == 0) {
3706 stcb->asoc.assoc_up_sent = 1;
3708 if (stcb->asoc.adaptation_needed && (stcb->asoc.adaptation_sent == 0)) {
3711 if (stcb->asoc.peer_supports_auth == 0) {
3726 atomic_add_int(&stcb->asoc.refcnt, 1);
3730 atomic_subtract_int(&stcb->asoc.refcnt, 1);
3783 if (((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_WAIT) ||
3784 ((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_ECHOED)) {
3791 if (((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_WAIT) ||
3792 ((stcb->asoc.state & SCTP_STATE_MASK) == SCTP_STATE_COOKIE_ECHOED)) {
3800 if (stcb->asoc.peer_supports_auth == 0) {
3877 struct sctp_association *asoc;
3886 asoc = &stcb->asoc;
3887 if (asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) {
3900 (asoc->state & SCTP_STATE_CLOSED_SOCKET)) {
3908 TAILQ_FOREACH_SAFE(chk, &asoc->sent_queue, sctp_next, nchk) {
3909 TAILQ_REMOVE(&asoc->sent_queue, chk, sctp_next);
3910 asoc->sent_queue_cnt--;
3912 if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) {
3913 asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--;
3921 sctp_free_bufspace(stcb, asoc, chk, 1);
3933 TAILQ_FOREACH_SAFE(chk, &asoc->send_queue, sctp_next, nchk) {
3934 TAILQ_REMOVE(&asoc->send_queue, chk, sctp_next);
3935 asoc->send_queue_cnt--;
3936 if (asoc->strmout[chk->rec.data.stream_number].chunks_on_queues > 0) {
3937 asoc->strmout[chk->rec.data.stream_number].chunks_on_queues--;
3944 sctp_free_bufspace(stcb, asoc, chk, 1);
3955 for (i = 0; i < asoc->streamoutcnt; i++) {
3957 outs = &asoc->strmout[i];
3959 asoc->locked_on_sending = NULL;
3961 asoc->stream_queue_cnt--;
3963 sctp_free_spbufspace(stcb, asoc, sp);
4014 (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET)) {
4017 /* Tell them we lost the asoc */
4044 vtag = stcb->asoc.peer_vtag;
4047 vrf_id = stcb->asoc.vrf_id;
4048 stcb->asoc.state |= SCTP_STATE_WAS_ABORTED;
4059 atomic_add_int(&stcb->asoc.refcnt, 1);
4063 atomic_subtract_int(&stcb->asoc.refcnt, 1);
4066 if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) ||
4067 (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
4084 if ((stcb->asoc.tsn_in_at == 0) && (stcb->asoc.tsn_in_wrapped == 0)) {
4088 if (stcb->asoc.tsn_in_wrapped) {
4089 for (i = stcb->asoc.tsn_in_at; i < SCTP_TSN_LOG_SIZE; i++) {
4091 stcb->asoc.in_tsnlog[i].tsn,
4092 stcb->asoc.in_tsnlog[i].strm,
4093 stcb->asoc.in_tsnlog[i].seq,
4094 stcb->asoc.in_tsnlog[i].flgs,
4095 stcb->asoc.in_tsnlog[i].sz);
4098 if (stcb->asoc.tsn_in_at) {
4099 for (i = 0; i < stcb->asoc.tsn_in_at; i++) {
4101 stcb->asoc.in_tsnlog[i].tsn,
4102 stcb->asoc.in_tsnlog[i].strm,
4103 stcb->asoc.in_tsnlog[i].seq,
4104 stcb->asoc.in_tsnlog[i].flgs,
4105 stcb->asoc.in_tsnlog[i].sz);
4110 if ((stcb->asoc.tsn_out_at == 0) &&
4111 (stcb->asoc.tsn_out_wrapped == 0)) {
4114 if (stcb->asoc.tsn_out_wrapped) {
4115 for (i = stcb->asoc.tsn_out_at; i < SCTP_TSN_LOG_SIZE; i++) {
4117 stcb->asoc.out_tsnlog[i].tsn,
4118 stcb->asoc.out_tsnlog[i].strm,
4119 stcb->asoc.out_tsnlog[i].seq,
4120 stcb->asoc.out_tsnlog[i].flgs,
4121 stcb->asoc.out_tsnlog[i].sz);
4124 if (stcb->asoc.tsn_out_at) {
4125 for (i = 0; i < stcb->asoc.tsn_out_at; i++) {
4127 stcb->asoc.out_tsnlog[i].tsn,
4128 stcb->asoc.out_tsnlog[i].strm,
4129 stcb->asoc.out_tsnlog[i].seq,
4130 stcb->asoc.out_tsnlog[i].flgs,
4131 stcb->asoc.out_tsnlog[i].sz);
4181 stcb->asoc.state |= SCTP_STATE_WAS_ABORTED;
4190 if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) ||
4191 (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
4194 /* now free the asoc */
4200 atomic_add_int(&stcb->asoc.refcnt, 1);
4204 atomic_subtract_int(&stcb->asoc.refcnt, 1);
4753 atomic_add_int(&stcb->asoc.refcnt, 1);
4790 atomic_subtract_int(&stcb->asoc.refcnt, 1);
4814 atomic_add_int(&stcb->asoc.refcnt, 1);
4820 atomic_subtract_int(&stcb->asoc.refcnt, 1);
4940 if (stcb && (control == stcb->asoc.control_pdapi)) {
4941 stcb->asoc.control_pdapi = NULL;
5028 atomic_add_int(&stcb->asoc.refcnt, 1);
5032 atomic_subtract_int(&stcb->asoc.refcnt, 1);
5051 atomic_add_int(&stcb->asoc.refcnt, 1);
5057 atomic_subtract_int(&stcb->asoc.refcnt, 1);
5127 sctp_free_bufspace(struct sctp_tcb *stcb, struct sctp_association *asoc,
5133 asoc->chunks_on_out_queue -= chk_cnt;
5136 asoc->total_output_queue_size,
5141 if (asoc->total_output_queue_size >= tp1->book_size) {
5142 atomic_add_int(&asoc->total_output_queue_size, -tp1->book_size);
5144 asoc->total_output_queue_size = 0;
5192 sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1);
5193 stcb->asoc.peers_rwnd += tp1->send_size;
5194 stcb->asoc.peers_rwnd += SCTP_BASE_SYSCTL(sctp_peer_chunk_oh);
5206 stcb->asoc.sent_queue_cnt_removeable--;
5233 TAILQ_FOREACH_SAFE(tp1, &stcb->asoc.send_queue, sctp_next, tp2) {
5244 sctp_free_bufspace(stcb, &stcb->asoc, tp1, 1);
5261 TAILQ_REMOVE(&stcb->asoc.send_queue, tp1, sctp_next);
5263 TAILQ_INSERT_TAIL(&stcb->asoc.sent_queue, tp1,
5265 stcb->asoc.send_queue_cnt--;
5266 stcb->asoc.sent_queue_cnt++;
5275 strq = &stcb->asoc.strmout[stream];
5299 chk->asoc = &stcb->asoc;
5308 chk->whoTo = stcb->asoc.primary_destination;
5311 chk->rec.data.TSN_seq = atomic_fetchadd_int(&stcb->asoc.sending_seq, 1);
5313 chk->rec.data.TSN_seq = stcb->asoc.sending_seq++;
5315 stcb->asoc.pr_sctp_cnt++;
5316 TAILQ_INSERT_TAIL(&stcb->asoc.sent_queue, chk, sctp_next);
5317 stcb->asoc.sent_queue_cnt++;
5318 stcb->asoc.pr_sctp_cnt++;
5329 sctp_free_spbufspace(stcb, &stcb->asoc, sp);
5347 atomic_add_int(&stcb->asoc.refcnt, 1);
5351 atomic_subtract_int(&stcb->asoc.refcnt, 1);
5352 if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) {
5585 atomic_add_int(&stcb->asoc.refcnt, 1);
5587 if (stcb->asoc.state & (SCTP_STATE_ABOUT_TO_BE_FREED |
5608 rwnd = sctp_calc_rwnd(stcb, &stcb->asoc);
5609 if (rwnd >= stcb->asoc.my_last_reported_rwnd) {
5610 dif = rwnd - stcb->asoc.my_last_reported_rwnd;
5619 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
5628 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
5652 atomic_add_int(&stcb->asoc.refcnt, -1);
6013 (ctl->stcb->asoc.strmin[ctl->sinfo_stream].delivery_started == 0)))
6029 (ctl->stcb->asoc.strmin[ctl->sinfo_stream].delivery_started == 0)))) {
6072 (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED)) {
6090 atomic_add_int(&stcb->asoc.refcnt, 1);
6109 stcb->asoc.strmin[control->sinfo_stream].delivery_started = 1;
6155 sinfo->sinfo_cumtsn = stcb->asoc.cumulative_tsn;
6304 stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
6327 control->stcb->asoc.strmin[control->sinfo_stream].delivery_started = 0;
6391 atomic_subtract_int(&stcb->asoc.sb_cc, cp_len);
6584 control->stcb->asoc.strmin[control->sinfo_stream].delivery_started = 0;
6589 control->stcb->asoc.strmin[control->sinfo_stream].delivery_started = 0;
6637 control->stcb->asoc.strmin[control->sinfo_stream].delivery_started = 0;
6752 atomic_add_int(&stcb->asoc.refcnt, -1);
6769 stcb->asoc.my_rwnd,
7525 loopback_scope = stcb->asoc.scope.loopback_scope;
7527 ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope;
7528 ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal;
7531 local_scope = stcb->asoc.scope.local_scope;
7532 site_scope = stcb->asoc.scope.site_scope;
7533 ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal;
7536 conn_addr_legal = stcb->asoc.scope.conn_addr_legal;
7539 vrf = sctp_find_vrf(stcb->asoc.vrf_id);