Lines Matching refs:stcb
56 sctp_stop_all_cookie_timers(struct sctp_tcb *stcb) in sctp_stop_all_cookie_timers() argument
65 SCTP_TCB_LOCK_ASSERT(stcb); in sctp_stop_all_cookie_timers()
66 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_stop_all_cookie_timers()
69 stcb->sctp_ep, in sctp_stop_all_cookie_timers()
70 stcb, in sctp_stop_all_cookie_timers()
74 stcb->sctp_ep, in sctp_stop_all_cookie_timers()
75 stcb, in sctp_stop_all_cookie_timers()
86 struct sctp_tcb *stcb, struct sctp_nets *net, in sctp_handle_init() argument
94 (void *)stcb); in sctp_handle_init()
95 if (stcb == NULL) { in sctp_handle_init()
124 if ((stcb == NULL) && in sctp_handle_init()
149 if ((stcb != NULL) && in sctp_handle_init()
150 (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_ACK_SENT)) { in sctp_handle_init()
152 sctp_send_shutdown_ack(stcb, NULL); in sctp_handle_init()
153 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CONTROL_PROC, SCTP_SO_NOT_LOCKED); in sctp_handle_init()
156 sctp_send_initiate_ack(inp, stcb, net, m, iphlen, offset, in sctp_handle_init()
162 if (stcb == NULL) { in sctp_handle_init()
172 sctp_is_there_unsent_data(struct sctp_tcb *stcb, int so_locked) in sctp_is_there_unsent_data() argument
179 SCTP_TCB_LOCK_ASSERT(stcb); in sctp_is_there_unsent_data()
186 asoc = &stcb->asoc; in sctp_is_there_unsent_data()
188 if (!stcb->asoc.ss_functions.sctp_ss_is_empty(stcb, asoc)) { in sctp_is_there_unsent_data()
190 for (i = 0; i < stcb->asoc.streamoutcnt; i++) { in sctp_is_there_unsent_data()
192 sp = TAILQ_FIRST(&stcb->asoc.strmout[i].outqueue); in sctp_is_there_unsent_data()
212 atomic_subtract_int(&stcb->asoc.stream_queue_cnt, 1); in sctp_is_there_unsent_data()
213 TAILQ_REMOVE(&stcb->asoc.strmout[i].outqueue, sp, next); in sctp_is_there_unsent_data()
214 stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, &asoc->strmout[i], sp); in sctp_is_there_unsent_data()
223 sctp_free_a_strmoq(stcb, sp, so_locked); in sctp_is_there_unsent_data()
224 if (!TAILQ_EMPTY(&stcb->asoc.strmout[i].outqueue)) { in sctp_is_there_unsent_data()
239 sctp_process_init(struct sctp_init_chunk *cp, struct sctp_tcb *stcb) in sctp_process_init() argument
246 SCTP_TCB_LOCK_ASSERT(stcb); in sctp_process_init()
249 asoc = &stcb->asoc; in sctp_process_init()
261 sctp_log_cwnd(stcb, lnet, 0, SCTP_CWND_INITIALIZATION); in sctp_process_init()
285 sctp_free_bufspace(stcb, asoc, chk, 1); in sctp_process_init()
286 sctp_ulp_notify(SCTP_NOTIFY_UNSENT_DG_FAIL, stcb, in sctp_process_init()
293 sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); in sctp_process_init()
301 atomic_subtract_int(&stcb->asoc.stream_queue_cnt, 1); in sctp_process_init()
303 stcb->asoc.ss_functions.sctp_ss_remove_from_stream(stcb, asoc, outs, sp); in sctp_process_init()
305 stcb, 0, sp, SCTP_SO_NOT_LOCKED); in sctp_process_init()
315 sctp_free_a_strmoq(stcb, sp, SCTP_SO_NOT_LOCKED); in sctp_process_init()
347 sctp_clean_up_stream(stcb, &asoc->strmin[i].inqueue); in sctp_process_init()
348 sctp_clean_up_stream(stcb, &asoc->strmin[i].uno_inqueue); in sctp_process_init()
391 struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb, in sctp_process_init_ack() argument
412 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, in sctp_process_init_ack()
440 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, in sctp_process_init_ack()
447 asoc = &stcb->asoc; in sctp_process_init_ack()
450 if (sctp_process_init((struct sctp_init_chunk *)cp, stcb) < 0) { in sctp_process_init_ack()
456 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, in sctp_process_init_ack()
465 if ((retval = sctp_load_addresses_from_init(stcb, m, in sctp_process_init_ack()
467 initack_limit, src, dst, NULL, stcb->asoc.port)) < 0) { in sctp_process_init_ack()
476 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, in sctp_process_init_ack()
493 stcb->asoc.peer_hmac_id = sctp_negotiate_hmacid(stcb->asoc.peer_hmacs, in sctp_process_init_ack()
494 stcb->asoc.local_hmacs); in sctp_process_init_ack()
496 sctp_queue_op_err(stcb, op_err); in sctp_process_init_ack()
503 stcb->asoc.overall_error_count, in sctp_process_init_ack()
515 sctp_timer_stop(SCTP_TIMER_TYPE_INIT, stcb->sctp_ep, stcb, in sctp_process_init_ack()
520 sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, in sctp_process_init_ack()
523 stcb->asoc.overall_error_count = 0; in sctp_process_init_ack()
525 retval = sctp_send_cookie_echo(m, offset, initack_limit, stcb, net); in sctp_process_init_ack()
531 struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_handle_heartbeat_ack() argument
551 store.sin.sin_port = stcb->rport; in sctp_handle_heartbeat_ack()
564 store.sin6.sin6_port = stcb->rport; in sctp_handle_heartbeat_ack()
574 r_net = sctp_findnet(stcb, &store.sa); in sctp_handle_heartbeat_ack()
588 stcb->asoc.primary_destination = r_net; in sctp_handle_heartbeat_ack()
590 f_net = TAILQ_FIRST(&stcb->asoc.nets); in sctp_handle_heartbeat_ack()
598 TAILQ_REMOVE(&stcb->asoc.nets, r_net, sctp_next); in sctp_handle_heartbeat_ack()
599 TAILQ_INSERT_HEAD(&stcb->asoc.nets, r_net, sctp_next); in sctp_handle_heartbeat_ack()
604 stcb, 0, (void *)r_net, SCTP_SO_NOT_LOCKED); in sctp_handle_heartbeat_ack()
605 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, in sctp_handle_heartbeat_ack()
607 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, r_net); in sctp_handle_heartbeat_ack()
611 stcb->asoc.overall_error_count, in sctp_handle_heartbeat_ack()
616 stcb->asoc.overall_error_count = 0; in sctp_handle_heartbeat_ack()
623 sctp_calculate_rto(stcb, &stcb->asoc, r_net, &tv, in sctp_handle_heartbeat_ack()
627 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, in sctp_handle_heartbeat_ack()
632 stcb->asoc.cc_functions.sctp_cwnd_update_exit_pf(stcb, net); in sctp_handle_heartbeat_ack()
635 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, in sctp_handle_heartbeat_ack()
636 stcb, r_net, SCTP_FROM_SCTP_INPUT + SCTP_LOC_5); in sctp_handle_heartbeat_ack()
637 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, r_net); in sctp_handle_heartbeat_ack()
639 if (r_net == stcb->asoc.primary_destination) { in sctp_handle_heartbeat_ack()
640 if (stcb->asoc.alternate) { in sctp_handle_heartbeat_ack()
642 sctp_free_remote_addr(stcb->asoc.alternate); in sctp_handle_heartbeat_ack()
643 stcb->asoc.alternate = NULL; in sctp_handle_heartbeat_ack()
648 if ((sctp_is_mobility_feature_on(stcb->sctp_ep, in sctp_handle_heartbeat_ack()
650 sctp_is_mobility_feature_on(stcb->sctp_ep, in sctp_handle_heartbeat_ack()
652 sctp_is_mobility_feature_on(stcb->sctp_ep, in sctp_handle_heartbeat_ack()
655 stcb->sctp_ep, stcb, NULL, in sctp_handle_heartbeat_ack()
657 if (sctp_is_mobility_feature_on(stcb->sctp_ep, in sctp_handle_heartbeat_ack()
659 sctp_assoc_immediate_retrans(stcb, in sctp_handle_heartbeat_ack()
660 stcb->asoc.primary_destination); in sctp_handle_heartbeat_ack()
662 if (sctp_is_mobility_feature_on(stcb->sctp_ep, in sctp_handle_heartbeat_ack()
664 sctp_move_chunks_from_net(stcb, in sctp_handle_heartbeat_ack()
665 stcb->asoc.deleted_primary); in sctp_handle_heartbeat_ack()
667 sctp_delete_prim_timer(stcb->sctp_ep, stcb); in sctp_handle_heartbeat_ack()
673 sctp_handle_nat_colliding_state(struct sctp_tcb *stcb) in sctp_handle_nat_colliding_state() argument
682 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || in sctp_handle_nat_colliding_state()
683 (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { in sctp_handle_nat_colliding_state()
684 atomic_add_int(&stcb->asoc.refcnt, 1); in sctp_handle_nat_colliding_state()
685 SCTP_TCB_UNLOCK(stcb); in sctp_handle_nat_colliding_state()
687 SCTP_TCB_LOCK(stcb); in sctp_handle_nat_colliding_state()
688 atomic_subtract_int(&stcb->asoc.refcnt, 1); in sctp_handle_nat_colliding_state()
692 new_vtag = sctp_select_a_tag(stcb->sctp_ep, stcb->sctp_ep->sctp_lport, stcb->rport, 1); in sctp_handle_nat_colliding_state()
693 if (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) { in sctp_handle_nat_colliding_state()
695 LIST_REMOVE(stcb, sctp_asocs); in sctp_handle_nat_colliding_state()
696 stcb->asoc.my_vtag = new_vtag; in sctp_handle_nat_colliding_state()
697 …head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashaso… in sctp_handle_nat_colliding_state()
702 LIST_INSERT_HEAD(head, stcb, sctp_asocs); in sctp_handle_nat_colliding_state()
704 sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); in sctp_handle_nat_colliding_state()
712 LIST_REMOVE(stcb, sctp_asocs); in sctp_handle_nat_colliding_state()
713 SCTP_SET_STATE(stcb, SCTP_STATE_COOKIE_WAIT); in sctp_handle_nat_colliding_state()
714 sctp_stop_all_cookie_timers(stcb); in sctp_handle_nat_colliding_state()
715 sctp_toss_old_cookies(stcb, &stcb->asoc); in sctp_handle_nat_colliding_state()
716 stcb->asoc.my_vtag = new_vtag; in sctp_handle_nat_colliding_state()
717 …head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, SCTP_BASE_INFO(hashaso… in sctp_handle_nat_colliding_state()
722 LIST_INSERT_HEAD(head, stcb, sctp_asocs); in sctp_handle_nat_colliding_state()
724 sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); in sctp_handle_nat_colliding_state()
731 sctp_handle_nat_missing_state(struct sctp_tcb *stcb, in sctp_handle_nat_missing_state() argument
738 if (stcb->asoc.auth_supported == 0) { in sctp_handle_nat_missing_state()
742 sctp_asconf_send_nat_state_update(stcb, net); in sctp_handle_nat_missing_state()
749 struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_handle_abort() argument
755 if (stcb == NULL) in sctp_handle_abort()
771 if (sctp_handle_nat_colliding_state(stcb)) { in sctp_handle_abort()
777 if (sctp_handle_nat_missing_state(stcb, net)) { in sctp_handle_abort()
785 sctp_timer_stop(SCTP_TIMER_TYPE_RECV, stcb->sctp_ep, stcb, NULL, in sctp_handle_abort()
788 sctp_abort_notification(stcb, true, false, error, abort, SCTP_SO_NOT_LOCKED); in sctp_handle_abort()
791 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || in sctp_handle_abort()
792 (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_RECEIVED)) { in sctp_handle_abort()
796 sctp_print_out_track_log(stcb); in sctp_handle_abort()
798 (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, in sctp_handle_abort()
805 sctp_start_net_timers(struct sctp_tcb *stcb) in sctp_start_net_timers() argument
811 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_start_net_timers()
817 sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, stcb->sctp_ep, stcb, net); in sctp_start_net_timers()
818 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net); in sctp_start_net_timers()
821 sctp_send_hb(stcb, net, SCTP_SO_NOT_LOCKED); in sctp_start_net_timers()
826 sctp_chunk_output(stcb->sctp_ep, stcb, in sctp_start_net_timers()
833 sctp_check_data_from_peer(struct sctp_tcb *stcb, int *abort_flag) in sctp_check_data_from_peer() argument
841 asoc = &stcb->asoc; in sctp_check_data_from_peer()
859 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_INPUT + SCTP_LOC_9; in sctp_check_data_from_peer()
860 sctp_abort_an_association(stcb->sctp_ep, stcb, op_err, false, SCTP_SO_NOT_LOCKED); in sctp_check_data_from_peer()
866 struct sctp_tcb *stcb, struct sctp_nets *net, int *abort_flag) in sctp_handle_shutdown() argument
872 if (stcb == NULL) in sctp_handle_shutdown()
874 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || in sctp_handle_shutdown()
875 (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { in sctp_handle_shutdown()
882 old_state = SCTP_GET_STATE(stcb); in sctp_handle_shutdown()
883 sctp_update_acked(stcb, cp, abort_flag); in sctp_handle_shutdown()
887 sctp_check_data_from_peer(stcb, abort_flag); in sctp_handle_shutdown()
891 if (stcb->sctp_socket) { in sctp_handle_shutdown()
892 if ((SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_RECEIVED) && in sctp_handle_shutdown()
893 (SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_ACK_SENT) && in sctp_handle_shutdown()
894 (SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_SENT)) { in sctp_handle_shutdown()
895 SCTP_SET_STATE(stcb, SCTP_STATE_SHUTDOWN_RECEIVED); in sctp_handle_shutdown()
900 sctp_ulp_notify(SCTP_NOTIFY_PEER_SHUTDOWN, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); in sctp_handle_shutdown()
903 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); in sctp_handle_shutdown()
906 if (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_SENT) { in sctp_handle_shutdown()
911 sctp_timer_stop(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, in sctp_handle_shutdown()
915 some_on_streamwheel = sctp_is_there_unsent_data(stcb, SCTP_SO_NOT_LOCKED); in sctp_handle_shutdown()
917 if (!TAILQ_EMPTY(&stcb->asoc.send_queue) || in sctp_handle_shutdown()
918 !TAILQ_EMPTY(&stcb->asoc.sent_queue) || in sctp_handle_shutdown()
926 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || in sctp_handle_shutdown()
927 (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_RECEIVED)) { in sctp_handle_shutdown()
930 if (SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_ACK_SENT) { in sctp_handle_shutdown()
931 SCTP_SET_STATE(stcb, SCTP_STATE_SHUTDOWN_ACK_SENT); in sctp_handle_shutdown()
932 sctp_stop_timers_for_shutdown(stcb); in sctp_handle_shutdown()
933 sctp_send_shutdown_ack(stcb, net); in sctp_handle_shutdown()
935 stcb->sctp_ep, stcb, net); in sctp_handle_shutdown()
937 sctp_send_shutdown_ack(stcb, net); in sctp_handle_shutdown()
944 struct sctp_tcb *stcb, in sctp_handle_shutdown_ack() argument
951 if (stcb == NULL) { in sctp_handle_shutdown_ack()
956 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || in sctp_handle_shutdown_ack()
957 (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { in sctp_handle_shutdown_ack()
959 sctp_send_shutdown_complete(stcb, net, 1); in sctp_handle_shutdown_ack()
960 SCTP_TCB_UNLOCK(stcb); in sctp_handle_shutdown_ack()
963 if ((SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_SENT) && in sctp_handle_shutdown_ack()
964 (SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_ACK_SENT)) { in sctp_handle_shutdown_ack()
966 SCTP_TCB_UNLOCK(stcb); in sctp_handle_shutdown_ack()
969 sctp_check_data_from_peer(stcb, &abort_flag); in sctp_handle_shutdown_ack()
974 if (!TAILQ_EMPTY(&stcb->asoc.send_queue) || in sctp_handle_shutdown_ack()
975 !TAILQ_EMPTY(&stcb->asoc.sent_queue) || in sctp_handle_shutdown_ack()
976 sctp_is_there_unsent_data(stcb, SCTP_SO_NOT_LOCKED)) { in sctp_handle_shutdown_ack()
981 sctp_timer_stop(SCTP_TIMER_TYPE_SHUTDOWN, stcb->sctp_ep, stcb, net, in sctp_handle_shutdown_ack()
984 sctp_send_shutdown_complete(stcb, net, 0); in sctp_handle_shutdown_ack()
986 if (stcb->sctp_socket) { in sctp_handle_shutdown_ack()
987 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || in sctp_handle_shutdown_ack()
988 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { in sctp_handle_shutdown_ack()
989 SCTP_SB_CLEAR(stcb->sctp_socket->so_snd); in sctp_handle_shutdown_ack()
991 sctp_ulp_notify(SCTP_NOTIFY_ASSOC_DOWN, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); in sctp_handle_shutdown_ack()
995 (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, in sctp_handle_shutdown_ack()
1000 sctp_process_unrecog_chunk(struct sctp_tcb *stcb, uint8_t chunk_type) in sctp_process_unrecog_chunk() argument
1005 sctp_asconf_cleanup(stcb); in sctp_process_unrecog_chunk()
1009 stcb->asoc.prsctp_supported = 0; in sctp_process_unrecog_chunk()
1026 sctp_process_unrecog_param(struct sctp_tcb *stcb, uint16_t parameter_type) in sctp_process_unrecog_param() argument
1031 stcb->asoc.prsctp_supported = 0; in sctp_process_unrecog_param()
1037 stcb->asoc.peer_supports_nat = 0; in sctp_process_unrecog_param()
1042 stcb->asoc.asconf_supported = 0; in sctp_process_unrecog_param()
1049 stcb->asoc.asconf_supported = 0; in sctp_process_unrecog_param()
1061 struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t limit) in sctp_handle_error() argument
1069 asoc = &stcb->asoc; in sctp_handle_error()
1107 if (sctp_handle_nat_colliding_state(stcb)) { in sctp_handle_error()
1114 if (sctp_handle_nat_missing_state(stcb, net)) { in sctp_handle_error()
1124 (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { in sctp_handle_error()
1131 sctp_abort_notification(stcb, false, true, 0, NULL, SCTP_SO_NOT_LOCKED); in sctp_handle_error()
1132 (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, in sctp_handle_error()
1157 sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, in sctp_handle_error()
1162 sctp_toss_old_cookies(stcb, &stcb->asoc); in sctp_handle_error()
1163 sctp_stop_all_cookie_timers(stcb); in sctp_handle_error()
1164 SCTP_SET_STATE(stcb, SCTP_STATE_COOKIE_WAIT); in sctp_handle_error()
1166 sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); in sctp_handle_error()
1187 sctp_process_unrecog_chunk(stcb, unrec_chunk->ch.chunk_type); in sctp_handle_error()
1196 sctp_process_unrecog_param(stcb, ntohs(unrec_parameter->param_type)); in sctp_handle_error()
1239 sctp_ulp_notify(SCTP_NOTIFY_REMOTE_ERROR, stcb, code, ch, SCTP_SO_NOT_LOCKED); in sctp_handle_error()
1246 struct sctp_init_ack_chunk *cp, struct sctp_tcb *stcb, in sctp_handle_init_ack() argument
1257 if (stcb == NULL) { in sctp_handle_init_ack()
1263 if (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) { in sctp_handle_init_ack()
1272 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, in sctp_handle_init_ack()
1279 if (stcb->asoc.primary_destination->dest_state & in sctp_handle_init_ack()
1287 stcb->asoc.primary_destination->dest_state &= in sctp_handle_init_ack()
1290 stcb, 0, (void *)stcb->asoc.primary_destination, SCTP_SO_NOT_LOCKED); in sctp_handle_init_ack()
1292 if (sctp_process_init_ack(m, iphlen, offset, src, dst, sh, cp, stcb, in sctp_handle_init_ack()
1301 SCTP_SET_STATE(stcb, SCTP_STATE_COOKIE_ECHOED); in sctp_handle_init_ack()
1306 stcb->asoc.overall_error_count, in sctp_handle_init_ack()
1311 stcb->asoc.overall_error_count = 0; in sctp_handle_init_ack()
1312 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); in sctp_handle_init_ack()
1317 sctp_timer_start(SCTP_TIMER_TYPE_COOKIE, stcb->sctp_ep, in sctp_handle_init_ack()
1318 stcb, net); in sctp_handle_init_ack()
1350 struct sctp_inpcb *inp, struct sctp_tcb *stcb, struct sctp_nets **netp, in sctp_process_cookie_existing() argument
1376 asoc = &stcb->asoc; in sctp_process_cookie_existing()
1384 if (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_ACK_SENT) { in sctp_process_cookie_existing()
1386 sctp_send_shutdown_ack(stcb, stcb->asoc.primary_destination); in sctp_process_cookie_existing()
1393 SCTP_TCB_UNLOCK(stcb); in sctp_process_cookie_existing()
1408 SCTP_TCB_UNLOCK(stcb); in sctp_process_cookie_existing()
1412 SCTP_TCB_UNLOCK(stcb); in sctp_process_cookie_existing()
1425 SCTP_TCB_UNLOCK(stcb); in sctp_process_cookie_existing()
1429 SCTP_TCB_UNLOCK(stcb); in sctp_process_cookie_existing()
1455 SCTP_TCB_UNLOCK(stcb); in sctp_process_cookie_existing()
1458 switch (SCTP_GET_STATE(stcb)) { in sctp_process_cookie_existing()
1468 if (sctp_process_init(init_cp, stcb) < 0) { in sctp_process_cookie_existing()
1473 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, in sctp_process_cookie_existing()
1481 stcb, net, in sctp_process_cookie_existing()
1484 stcb, net, in sctp_process_cookie_existing()
1487 if (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED) in sctp_process_cookie_existing()
1492 SCTP_SET_STATE(stcb, SCTP_STATE_OPEN); in sctp_process_cookie_existing()
1494 sctp_stop_all_cookie_timers(stcb); in sctp_process_cookie_existing()
1495 if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || in sctp_process_cookie_existing()
1496 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) && in sctp_process_cookie_existing()
1504 sctp_pcb_add_flags(stcb->sctp_ep, SCTP_PCB_FLAGS_CONNECTED); in sctp_process_cookie_existing()
1505 soisconnected(stcb->sctp_socket); in sctp_process_cookie_existing()
1510 if (stcb->asoc.sctp_autoclose_ticks && in sctp_process_cookie_existing()
1513 inp, stcb, NULL); in sctp_process_cookie_existing()
1523 sctp_stop_all_cookie_timers(stcb); in sctp_process_cookie_existing()
1524 if ((retval = sctp_load_addresses_from_init(stcb, m, in sctp_process_cookie_existing()
1526 initack_offset, src, dst, init_src, stcb->asoc.port)) < 0) { in sctp_process_cookie_existing()
1534 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, in sctp_process_cookie_existing()
1541 sctp_toss_old_cookies(stcb, asoc); in sctp_process_cookie_existing()
1542 sctp_send_cookie_ack(stcb); in sctp_process_cookie_existing()
1545 return (stcb); in sctp_process_cookie_existing()
1557 SCTP_TCB_UNLOCK(stcb); in sctp_process_cookie_existing()
1564 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) && in sctp_process_cookie_existing()
1583 SCTP_TCB_UNLOCK(stcb); in sctp_process_cookie_existing()
1614 SCTP_TCB_UNLOCK(stcb); in sctp_process_cookie_existing()
1619 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net, in sctp_process_cookie_existing()
1621 sctp_stop_all_cookie_timers(stcb); in sctp_process_cookie_existing()
1627 if (stcb->asoc.sctp_autoclose_ticks && in sctp_process_cookie_existing()
1629 sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, in sctp_process_cookie_existing()
1647 TAILQ_FOREACH(chk, &stcb->asoc.sent_queue, sctp_next) { in sctp_process_cookie_existing()
1651 sctp_total_flight_decrease(stcb, chk); in sctp_process_cookie_existing()
1652 sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt); in sctp_process_cookie_existing()
1658 if (sctp_process_init(init_cp, stcb) < 0) { in sctp_process_cookie_existing()
1663 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, in sctp_process_cookie_existing()
1669 if ((retval = sctp_load_addresses_from_init(stcb, m, in sctp_process_cookie_existing()
1671 initack_offset, src, dst, init_src, stcb->asoc.port)) < 0) { in sctp_process_cookie_existing()
1679 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, in sctp_process_cookie_existing()
1685 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_WAIT) || in sctp_process_cookie_existing()
1686 (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { in sctp_process_cookie_existing()
1689 if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || in sctp_process_cookie_existing()
1690 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) && in sctp_process_cookie_existing()
1692 sctp_pcb_add_flags(stcb->sctp_ep, SCTP_PCB_FLAGS_CONNECTED); in sctp_process_cookie_existing()
1693 soisconnected(stcb->sctp_socket); in sctp_process_cookie_existing()
1695 if (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED) in sctp_process_cookie_existing()
1700 } else if (SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) { in sctp_process_cookie_existing()
1705 SCTP_SET_STATE(stcb, SCTP_STATE_OPEN); in sctp_process_cookie_existing()
1706 sctp_stop_all_cookie_timers(stcb); in sctp_process_cookie_existing()
1707 sctp_toss_old_cookies(stcb, asoc); in sctp_process_cookie_existing()
1708 sctp_send_cookie_ack(stcb); in sctp_process_cookie_existing()
1717 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_COOKIE_ACK, SCTP_SO_NOT_LOCKED); in sctp_process_cookie_existing()
1722 return (stcb); in sctp_process_cookie_existing()
1746 SCTP_TCB_UNLOCK(stcb); in sctp_process_cookie_existing()
1756 sctp_stop_association_timers(stcb, false); in sctp_process_cookie_existing()
1759 atomic_add_int(&stcb->asoc.refcnt, 1); in sctp_process_cookie_existing()
1760 if ((SCTP_GET_STATE(stcb) != SCTP_STATE_OPEN) && in sctp_process_cookie_existing()
1761 (SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_RECEIVED) && in sctp_process_cookie_existing()
1762 (SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_SENT)) { in sctp_process_cookie_existing()
1765 if (SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) { in sctp_process_cookie_existing()
1767 } else if (SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_SENT) { in sctp_process_cookie_existing()
1771 SCTP_SET_STATE(stcb, SCTP_STATE_OPEN); in sctp_process_cookie_existing()
1773 } else if (SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_SENT) { in sctp_process_cookie_existing()
1775 SCTP_SET_STATE(stcb, SCTP_STATE_OPEN); in sctp_process_cookie_existing()
1799 SCTP_TCB_UNLOCK(stcb); in sctp_process_cookie_existing()
1801 SCTP_INP_WLOCK(stcb->sctp_ep); in sctp_process_cookie_existing()
1802 SCTP_TCB_LOCK(stcb); in sctp_process_cookie_existing()
1803 atomic_subtract_int(&stcb->asoc.refcnt, 1); in sctp_process_cookie_existing()
1805 sctp_report_all_outbound(stcb, 0, SCTP_SO_LOCKED); in sctp_process_cookie_existing()
1806 for (i = 0; i < stcb->asoc.streamoutcnt; i++) { in sctp_process_cookie_existing()
1807 stcb->asoc.strmout[i].chunks_on_queues = 0; in sctp_process_cookie_existing()
1817 stcb->asoc.strmout[i].next_mid_ordered = 0; in sctp_process_cookie_existing()
1818 stcb->asoc.strmout[i].next_mid_unordered = 0; in sctp_process_cookie_existing()
1819 stcb->asoc.strmout[i].sid = i; in sctp_process_cookie_existing()
1820 stcb->asoc.strmout[i].last_msg_incomplete = 0; in sctp_process_cookie_existing()
1834 sq->stcb = NULL; in sctp_process_cookie_existing()
1835 sctp_free_a_readq(stcb, sq); in sctp_process_cookie_existing()
1844 sctp_auth_key_release(stcb, chk->auth_keyid, SCTP_SO_LOCKED); in sctp_process_cookie_existing()
1859 sctp_auth_key_release(stcb, chk->auth_keyid, SCTP_SO_LOCKED); in sctp_process_cookie_existing()
1882 LIST_REMOVE(stcb, sctp_asocs); in sctp_process_cookie_existing()
1884 head = &SCTP_BASE_INFO(sctp_asochash)[SCTP_PCBHASH_ASOC(stcb->asoc.my_vtag, in sctp_process_cookie_existing()
1890 LIST_INSERT_HEAD(head, stcb, sctp_asocs); in sctp_process_cookie_existing()
1892 SCTP_INP_WUNLOCK(stcb->sctp_ep); in sctp_process_cookie_existing()
1897 if (sctp_process_init(init_cp, stcb) < 0) { in sctp_process_cookie_existing()
1902 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, in sctp_process_cookie_existing()
1914 if ((retval = sctp_load_addresses_from_init(stcb, m, in sctp_process_cookie_existing()
1916 initack_offset, src, dst, init_src, stcb->asoc.port)) < 0) { in sctp_process_cookie_existing()
1924 sctp_abort_association(stcb->sctp_ep, stcb, m, iphlen, in sctp_process_cookie_existing()
1931 sctp_send_cookie_ack(stcb); in sctp_process_cookie_existing()
1936 sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, NULL); in sctp_process_cookie_existing()
1938 return (stcb); in sctp_process_cookie_existing()
1943 SCTP_TCB_UNLOCK(stcb); in sctp_process_cookie_existing()
1964 struct sctp_tcb *stcb; in sctp_process_cookie_new() local
2027 stcb = sctp_aloc_assoc(inp, init_src, &error, in sctp_process_cookie_new()
2034 if (stcb == NULL) { in sctp_process_cookie_new()
2047 asoc = &stcb->asoc; in sctp_process_cookie_new()
2068 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, in sctp_process_cookie_new()
2077 if (sctp_process_init(init_cp, stcb) < 0) { in sctp_process_cookie_new()
2078 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, in sctp_process_cookie_new()
2083 if (sctp_load_addresses_from_init(stcb, m, in sctp_process_cookie_new()
2086 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, in sctp_process_cookie_new()
2094 sctp_auth_get_cookie_params(stcb, m, in sctp_process_cookie_new()
2105 if ((auth == NULL) || sctp_handle_auth(stcb, auth, m, auth_offset)) { in sctp_process_cookie_new()
2109 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, in sctp_process_cookie_new()
2114 stcb->asoc.authenticated = 1; in sctp_process_cookie_new()
2150 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, in sctp_process_cookie_new()
2157 SCTP_SET_STATE(stcb, SCTP_STATE_OPEN); in sctp_process_cookie_new()
2158 sctp_stop_all_cookie_timers(stcb); in sctp_process_cookie_new()
2164 if (((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || in sctp_process_cookie_new()
2165 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) && in sctp_process_cookie_new()
2177 sctp_pcb_add_flags(stcb->sctp_ep, SCTP_PCB_FLAGS_CONNECTED); in sctp_process_cookie_new()
2178 soisconnected(stcb->sctp_socket); in sctp_process_cookie_new()
2179 } else if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && in sctp_process_cookie_new()
2188 if (stcb->asoc.sctp_autoclose_ticks && in sctp_process_cookie_new()
2190 sctp_timer_start(SCTP_TIMER_TYPE_AUTOCLOSE, inp, stcb, NULL); in sctp_process_cookie_new()
2192 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); in sctp_process_cookie_new()
2193 *netp = sctp_findnet(stcb, init_src); in sctp_process_cookie_new()
2202 sctp_send_cookie_ack(stcb); in sctp_process_cookie_new()
2208 sctp_check_address_list(stcb, m, in sctp_process_cookie_new()
2214 return (stcb); in sctp_process_cookie_new()
2238 struct sctp_inpcb **inp_p, struct sctp_tcb **stcb, struct sctp_nets **netp, in sctp_handle_cookie_echo() argument
2245 struct sctp_tcb *l_stcb = *stcb; in sctp_handle_cookie_echo()
2488 if (*stcb == NULL) { in sctp_handle_cookie_echo()
2490 *stcb = sctp_findassociation_ep_addr(inp_p, to, netp, dst, NULL); in sctp_handle_cookie_echo()
2491 if (*stcb == NULL) { in sctp_handle_cookie_echo()
2510 *locked_tcb = *stcb; in sctp_handle_cookie_echo()
2519 SCTP_INP_INCR_REF((*stcb)->sctp_ep); in sctp_handle_cookie_echo()
2520 if ((*stcb)->sctp_ep != l_inp) { in sctp_handle_cookie_echo()
2522 (void *)(*stcb)->sctp_ep, (void *)l_inp); in sctp_handle_cookie_echo()
2529 if (*stcb == NULL) { in sctp_handle_cookie_echo()
2531 *stcb = sctp_process_cookie_new(m, iphlen, offset, src, dst, sh, in sctp_handle_cookie_echo()
2540 *stcb = sctp_process_cookie_existing(m, iphlen, offset, in sctp_handle_cookie_echo()
2542 cookie, cookie_len, *inp_p, *stcb, netp, to, in sctp_handle_cookie_echo()
2546 if (*stcb == NULL) { in sctp_handle_cookie_echo()
2551 if (*stcb == NULL) { in sctp_handle_cookie_echo()
2563 netl = sctp_findnet(*stcb, to); in sctp_handle_cookie_echo()
2569 if (sctp_add_remote_addr(*stcb, to, NULL, port, in sctp_handle_cookie_echo()
2573 netl = sctp_findnet(*stcb, to); in sctp_handle_cookie_echo()
2578 (void)sctp_set_primary_addr((*stcb), (struct sockaddr *)NULL, in sctp_handle_cookie_echo()
2583 sctp_start_net_timers(*stcb); in sctp_handle_cookie_echo()
2600 sctp_ulp_notify(notification, *stcb, 0, NULL, SCTP_SO_NOT_LOCKED); in sctp_handle_cookie_echo()
2603 (*stcb), 0, (void *)netl, SCTP_SO_NOT_LOCKED); in sctp_handle_cookie_echo()
2608 atomic_add_int(&(*stcb)->asoc.refcnt, 1); in sctp_handle_cookie_echo()
2609 SCTP_TCB_UNLOCK((*stcb)); in sctp_handle_cookie_echo()
2614 SCTP_TCB_LOCK((*stcb)); in sctp_handle_cookie_echo()
2615 atomic_subtract_int(&(*stcb)->asoc.refcnt, 1); in sctp_handle_cookie_echo()
2627 (void)sctp_free_assoc(*inp_p, *stcb, SCTP_NORMAL_PROC, in sctp_handle_cookie_echo()
2683 if (*stcb) { in sctp_handle_cookie_echo()
2684 SCTP_ADD_SUBSTATE(*stcb, SCTP_STATE_IN_ACCEPT_QUEUE); in sctp_handle_cookie_echo()
2686 sctp_move_pcb_and_assoc(*inp_p, inp, *stcb); in sctp_handle_cookie_echo()
2688 atomic_add_int(&(*stcb)->asoc.refcnt, 1); in sctp_handle_cookie_echo()
2689 SCTP_TCB_UNLOCK((*stcb)); in sctp_handle_cookie_echo()
2691 sctp_pull_off_control_to_new_inp((*inp_p), inp, *stcb, in sctp_handle_cookie_echo()
2693 SCTP_TCB_LOCK((*stcb)); in sctp_handle_cookie_echo()
2694 atomic_subtract_int(&(*stcb)->asoc.refcnt, 1); in sctp_handle_cookie_echo()
2713 sctp_ulp_notify(notification, *stcb, 0, NULL, SCTP_SO_NOT_LOCKED); in sctp_handle_cookie_echo()
2716 (*stcb), 0, (void *)netl, SCTP_SO_NOT_LOCKED); in sctp_handle_cookie_echo()
2728 sctp_ulp_notify(notification, *stcb, 0, NULL, SCTP_SO_NOT_LOCKED); in sctp_handle_cookie_echo()
2732 (*stcb), 0, (void *)netl, SCTP_SO_NOT_LOCKED); in sctp_handle_cookie_echo()
2739 struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_handle_cookie_ack() argument
2747 if ((stcb == NULL) || (net == NULL)) { in sctp_handle_cookie_ack()
2751 asoc = &stcb->asoc; in sctp_handle_cookie_ack()
2759 sctp_stop_all_cookie_timers(stcb); in sctp_handle_cookie_ack()
2760 sctp_toss_old_cookies(stcb, asoc); in sctp_handle_cookie_ack()
2762 if (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED) { in sctp_handle_cookie_ack()
2765 SCTP_SET_STATE(stcb, SCTP_STATE_OPEN); in sctp_handle_cookie_ack()
2766 sctp_start_net_timers(stcb); in sctp_handle_cookie_ack()
2771 sctp_calculate_rto(stcb, asoc, net, &asoc->time_entered, in sctp_handle_cookie_ack()
2781 sctp_ulp_notify(SCTP_NOTIFY_ASSOC_UP, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); in sctp_handle_cookie_ack()
2782 if ((stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || in sctp_handle_cookie_ack()
2783 (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { in sctp_handle_cookie_ack()
2784 sctp_pcb_add_flags(stcb->sctp_ep, SCTP_PCB_FLAGS_CONNECTED); in sctp_handle_cookie_ack()
2785 if ((stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) == 0) { in sctp_handle_cookie_ack()
2786 soisconnected(stcb->sctp_socket); in sctp_handle_cookie_ack()
2795 SCTP_SET_STATE(stcb, SCTP_STATE_SHUTDOWN_SENT); in sctp_handle_cookie_ack()
2796 sctp_stop_timers_for_shutdown(stcb); in sctp_handle_cookie_ack()
2797 sctp_send_shutdown(stcb, net); in sctp_handle_cookie_ack()
2799 stcb->sctp_ep, stcb, net); in sctp_handle_cookie_ack()
2801 stcb->sctp_ep, stcb, NULL); in sctp_handle_cookie_ack()
2802 sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_LOCKED); in sctp_handle_cookie_ack()
2805 if (stcb->asoc.state & SCTP_STATE_CLOSED_SOCKET) { in sctp_handle_cookie_ack()
2813 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, in sctp_handle_cookie_ack()
2814 stcb, net); in sctp_handle_cookie_ack()
2816 if (stcb->asoc.sctp_autoclose_ticks && in sctp_handle_cookie_ack()
2817 sctp_is_feature_on(stcb->sctp_ep, SCTP_PCB_FLAGS_AUTOCLOSE)) { in sctp_handle_cookie_ack()
2819 stcb->sctp_ep, stcb, NULL); in sctp_handle_cookie_ack()
2826 if ((sctp_is_feature_on(stcb->sctp_ep, SCTP_PCB_FLAGS_DO_ASCONF)) && in sctp_handle_cookie_ack()
2827 (stcb->asoc.asconf_supported == 1) && in sctp_handle_cookie_ack()
2828 (!TAILQ_EMPTY(&stcb->asoc.asconf_queue))) { in sctp_handle_cookie_ack()
2831 stcb->sctp_ep, stcb, in sctp_handle_cookie_ack()
2832 stcb->asoc.primary_destination); in sctp_handle_cookie_ack()
2834 sctp_send_asconf(stcb, stcb->asoc.primary_destination, in sctp_handle_cookie_ack()
2847 sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, chk->whoTo); in sctp_handle_cookie_ack()
2853 struct sctp_tcb *stcb) in sctp_handle_ecn_echo() argument
2873 lchk = TAILQ_LAST(&stcb->asoc.send_queue, sctpchunk_listhead); in sctp_handle_ecn_echo()
2875 window_data_tsn = stcb->asoc.sending_seq - 1; in sctp_handle_ecn_echo()
2882 TAILQ_FOREACH(lchk, &stcb->asoc.sent_queue, sctp_next) { in sctp_handle_ecn_echo()
2898 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) { in sctp_handle_ecn_echo()
2910 net = TAILQ_FIRST(&stcb->asoc.nets); in sctp_handle_ecn_echo()
2928 stcb->asoc.cc_functions.sctp_cwnd_update_after_ecn_echo(stcb, net, 0, pkt_cnt); in sctp_handle_ecn_echo()
2958 stcb->asoc.cc_functions.sctp_cwnd_update_after_ecn_echo(stcb, net, 1, cnt); in sctp_handle_ecn_echo()
2967 sctp_send_cwr(stcb, net, net->last_cwr_tsn, override_bit); in sctp_handle_ecn_echo()
2971 sctp_handle_ecn_cwr(struct sctp_cwr_chunk *cp, struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_handle_ecn_cwr() argument
2985 TAILQ_FOREACH_SAFE(chk, &stcb->asoc.control_send_queue, sctp_next, nchk) { in sctp_handle_ecn_cwr()
2996 stcb->asoc.ecn_echo_cnt_onq--; in sctp_handle_ecn_cwr()
2997 TAILQ_REMOVE(&stcb->asoc.control_send_queue, chk, in sctp_handle_ecn_cwr()
2999 stcb->asoc.ctrl_queue_cnt--; in sctp_handle_ecn_cwr()
3002 sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); in sctp_handle_ecn_cwr()
3012 struct sctp_tcb *stcb, struct sctp_nets *net) in sctp_handle_shutdown_complete() argument
3017 if (stcb == NULL) in sctp_handle_shutdown_complete()
3021 if (SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_ACK_SENT) { in sctp_handle_shutdown_complete()
3025 SCTP_TCB_UNLOCK(stcb); in sctp_handle_shutdown_complete()
3029 if (stcb->sctp_socket) { in sctp_handle_shutdown_complete()
3030 sctp_ulp_notify(SCTP_NOTIFY_ASSOC_DOWN, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); in sctp_handle_shutdown_complete()
3033 if (!TAILQ_EMPTY(&stcb->asoc.send_queue) || in sctp_handle_shutdown_complete()
3034 !TAILQ_EMPTY(&stcb->asoc.sent_queue) || in sctp_handle_shutdown_complete()
3035 sctp_is_there_unsent_data(stcb, SCTP_SO_NOT_LOCKED)) { in sctp_handle_shutdown_complete()
3040 sctp_timer_stop(SCTP_TIMER_TYPE_SHUTDOWNACK, stcb->sctp_ep, stcb, net, in sctp_handle_shutdown_complete()
3046 (void)sctp_free_assoc(stcb->sctp_ep, stcb, SCTP_NORMAL_PROC, in sctp_handle_shutdown_complete()
3052 process_chunk_drop(struct sctp_tcb *stcb, struct sctp_chunk_desc *desc, in process_chunk_drop() argument
3064 TAILQ_FOREACH(tp1, &stcb->asoc.sent_queue, sctp_next) { in process_chunk_drop()
3081 TAILQ_FOREACH(tp1, &stcb->asoc.sent_queue, sctp_next) { in process_chunk_drop()
3096 if ((stcb->asoc.peers_rwnd == 0) && in process_chunk_drop()
3101 if (stcb->asoc.peers_rwnd == 0 && in process_chunk_drop()
3107 SCTP_DATA_CHUNK_OVERHEAD(stcb) + SCTP_NUM_DB_TO_VERIFY) { in process_chunk_drop()
3112 if (memcmp(mtod(tp1->data, caddr_t)+SCTP_DATA_CHUNK_OVERHEAD(stcb), in process_chunk_drop()
3130 sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt); in process_chunk_drop()
3141 if (TAILQ_EMPTY(&stcb->asoc.send_queue)) { in process_chunk_drop()
3142 tp1->rec.data.fast_retran_tsn = stcb->asoc.sending_seq; in process_chunk_drop()
3144 tp1->rec.data.fast_retran_tsn = (TAILQ_FIRST(&stcb->asoc.send_queue))->rec.data.tsn; in process_chunk_drop()
3148 sctp_timer_stop(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, in process_chunk_drop()
3149 stcb, tp1->whoTo, in process_chunk_drop()
3151 sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, in process_chunk_drop()
3152 stcb, tp1->whoTo); in process_chunk_drop()
3159 (uint32_t)(uintptr_t)stcb, in process_chunk_drop()
3164 sctp_total_flight_decrease(stcb, tp1); in process_chunk_drop()
3172 TAILQ_FOREACH(tp1, &stcb->asoc.sent_queue, sctp_next) { in process_chunk_drop()
3176 TAILQ_FOREACH(tp1, &stcb->asoc.control_send_queue, in process_chunk_drop()
3181 if (audit != stcb->asoc.sent_queue_retran_cnt) { in process_chunk_drop()
3183 audit, stcb->asoc.sent_queue_retran_cnt); in process_chunk_drop()
3185 stcb->asoc.sent_queue_retran_cnt = audit; in process_chunk_drop()
3195 TAILQ_FOREACH(asconf, &stcb->asoc.control_send_queue, in process_chunk_drop()
3203 sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt); in process_chunk_drop()
3211 stcb->asoc.dropped_special_cnt++; in process_chunk_drop()
3212 if (stcb->asoc.dropped_special_cnt < SCTP_RETRY_DROPPED_THRESH) { in process_chunk_drop()
3217 sctp_timer_stop(SCTP_TIMER_TYPE_INIT, stcb->sctp_ep, in process_chunk_drop()
3218 stcb, net, in process_chunk_drop()
3220 sctp_send_initiate(stcb->sctp_ep, stcb, SCTP_SO_NOT_LOCKED); in process_chunk_drop()
3226 sctp_send_sack(stcb, SCTP_SO_NOT_LOCKED); in process_chunk_drop()
3230 if ((stcb->asoc.overall_error_count + 3) < stcb->asoc.max_send_times) { in process_chunk_drop()
3235 sctp_send_hb(stcb, net, SCTP_SO_NOT_LOCKED); in process_chunk_drop()
3239 sctp_send_shutdown(stcb, net); in process_chunk_drop()
3242 sctp_send_shutdown_ack(stcb, net); in process_chunk_drop()
3249 TAILQ_FOREACH(cookie, &stcb->asoc.control_send_queue, in process_chunk_drop()
3257 sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt); in process_chunk_drop()
3259 sctp_stop_all_cookie_timers(stcb); in process_chunk_drop()
3264 sctp_send_cookie_ack(stcb); in process_chunk_drop()
3268 sctp_send_asconf_ack(stcb); in process_chunk_drop()
3272 send_forward_tsn(stcb, &stcb->asoc); in process_chunk_drop()
3290 sctp_reset_in_stream(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t *list) in sctp_reset_in_stream() argument
3303 if (temp >= stcb->asoc.streamincnt) { in sctp_reset_in_stream()
3306 stcb->asoc.strmin[temp].last_mid_delivered = 0xffffffff; in sctp_reset_in_stream()
3310 for (i = 0; i < stcb->asoc.streamincnt; i++) { in sctp_reset_in_stream()
3311 stcb->asoc.strmin[i].last_mid_delivered = 0xffffffff; in sctp_reset_in_stream()
3314 …sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_RECV, stcb, number_entries, (void *)list, SCTP_SO_NOT_LOCKED… in sctp_reset_in_stream()
3318 sctp_reset_out_streams(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t *list) in sctp_reset_out_streams() argument
3326 if (temp >= stcb->asoc.streamoutcnt) { in sctp_reset_out_streams()
3330 stcb->asoc.strmout[temp].next_mid_ordered = 0; in sctp_reset_out_streams()
3331 stcb->asoc.strmout[temp].next_mid_unordered = 0; in sctp_reset_out_streams()
3334 for (i = 0; i < stcb->asoc.streamoutcnt; i++) { in sctp_reset_out_streams()
3335 stcb->asoc.strmout[i].next_mid_ordered = 0; in sctp_reset_out_streams()
3336 stcb->asoc.strmout[i].next_mid_unordered = 0; in sctp_reset_out_streams()
3339 …sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_SEND, stcb, number_entries, (void *)list, SCTP_SO_NOT_LOCKED… in sctp_reset_out_streams()
3343 sctp_reset_clear_pending(struct sctp_tcb *stcb, uint32_t number_entries, uint16_t *list) in sctp_reset_clear_pending() argument
3351 if (temp >= stcb->asoc.streamoutcnt) { in sctp_reset_clear_pending()
3355 stcb->asoc.strmout[temp].state = SCTP_STREAM_OPEN; in sctp_reset_clear_pending()
3358 for (i = 0; i < stcb->asoc.streamoutcnt; i++) { in sctp_reset_clear_pending()
3359 stcb->asoc.strmout[i].state = SCTP_STREAM_OPEN; in sctp_reset_clear_pending()
3365 sctp_find_stream_reset(struct sctp_tcb *stcb, uint32_t seq, struct sctp_tmit_chunk **bchk) in sctp_find_stream_reset() argument
3373 asoc = &stcb->asoc; in sctp_find_stream_reset()
3407 sctp_clean_up_stream_reset(struct sctp_tcb *stcb) in sctp_clean_up_stream_reset() argument
3412 asoc = &stcb->asoc; in sctp_clean_up_stream_reset()
3418 sctp_timer_stop(SCTP_TIMER_TYPE_STRRESET, stcb->sctp_ep, stcb, in sctp_clean_up_stream_reset()
3426 sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); in sctp_clean_up_stream_reset()
3430 sctp_handle_stream_reset_response(struct sctp_tcb *stcb, in sctp_handle_stream_reset_response() argument
3436 struct sctp_association *asoc = &stcb->asoc; in sctp_handle_stream_reset_response()
3447 if (seq == stcb->asoc.str_reset_seq_out) { in sctp_handle_stream_reset_response()
3448 req_param = sctp_find_stream_reset(stcb, seq, &chk); in sctp_handle_stream_reset_response()
3450 stcb->asoc.str_reset_seq_out++; in sctp_handle_stream_reset_response()
3463 sctp_reset_out_streams(stcb, number_entries, req_out_param->list_of_streams); in sctp_handle_stream_reset_response()
3465 …sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_OUT, stcb, number_entries, req_out_param->list_of_str… in sctp_handle_stream_reset_response()
3472 stcb->asoc.str_reset_seq_out--; in sctp_handle_stream_reset_response()
3476 …sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_OUT, stcb, number_entries, req_out_param->list_of_str… in sctp_handle_stream_reset_response()
3479 sctp_reset_clear_pending(stcb, number_entries, req_out_param->list_of_streams); in sctp_handle_stream_reset_response()
3487 sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_DENIED_IN, stcb, in sctp_handle_stream_reset_response()
3490 sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_FAILED_IN, stcb, in sctp_handle_stream_reset_response()
3497 num_stream = stcb->asoc.strm_pending_add_size; in sctp_handle_stream_reset_response()
3498 if (num_stream > (stcb->asoc.strm_realoutsize - stcb->asoc.streamoutcnt)) { in sctp_handle_stream_reset_response()
3500 num_stream = stcb->asoc.strm_realoutsize - stcb->asoc.streamoutcnt; in sctp_handle_stream_reset_response()
3502 stcb->asoc.strm_pending_add_size = 0; in sctp_handle_stream_reset_response()
3513 sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_ADD, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); in sctp_handle_stream_reset_response()
3515 …sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_ADD, stcb, SCTP_STREAM_CHANGE_DENIED, NULL, SCTP_SO_NOT_LOCK… in sctp_handle_stream_reset_response()
3517 …sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_ADD, stcb, SCTP_STREAM_CHANGE_FAILED, NULL, SCTP_SO_NOT_LOCK… in sctp_handle_stream_reset_response()
3523 …sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_ADD, stcb, SCTP_STREAM_CHANGE_DENIED, NULL, SCTP_SO_NOT_LOCK… in sctp_handle_stream_reset_response()
3525 …sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_ADD, stcb, SCTP_STREAM_CHANGE_DENIED, NULL, SCTP_SO_NOT_LOCK… in sctp_handle_stream_reset_response()
3550 sctp_handle_forward_tsn(stcb, &fwdtsn, &abort_flag, NULL, 0); in sctp_handle_stream_reset_response()
3554 stcb->asoc.highest_tsn_inside_map = (ntohl(resp->senders_next_tsn) - 1); in sctp_handle_stream_reset_response()
3559 stcb->asoc.tsn_last_delivered = stcb->asoc.cumulative_tsn = stcb->asoc.highest_tsn_inside_map; in sctp_handle_stream_reset_response()
3560 stcb->asoc.mapping_array_base_tsn = ntohl(resp->senders_next_tsn); in sctp_handle_stream_reset_response()
3561 memset(stcb->asoc.mapping_array, 0, stcb->asoc.mapping_array_size); in sctp_handle_stream_reset_response()
3563 stcb->asoc.highest_tsn_inside_nr_map = stcb->asoc.highest_tsn_inside_map; in sctp_handle_stream_reset_response()
3564 memset(stcb->asoc.nr_mapping_array, 0, stcb->asoc.mapping_array_size); in sctp_handle_stream_reset_response()
3566 stcb->asoc.sending_seq = ntohl(resp->receivers_next_tsn); in sctp_handle_stream_reset_response()
3567 stcb->asoc.last_acked_seq = stcb->asoc.cumulative_tsn; in sctp_handle_stream_reset_response()
3569 sctp_reset_out_streams(stcb, 0, (uint16_t *)NULL); in sctp_handle_stream_reset_response()
3570 sctp_reset_in_stream(stcb, 0, (uint16_t *)NULL); in sctp_handle_stream_reset_response()
3571 sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_TSN, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); in sctp_handle_stream_reset_response()
3573 …sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_TSN, stcb, SCTP_ASSOC_RESET_DENIED, NULL, SCTP_SO_NOT_LOCKED… in sctp_handle_stream_reset_response()
3575 …sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_TSN, stcb, SCTP_ASSOC_RESET_FAILED, NULL, SCTP_SO_NOT_LOCKED… in sctp_handle_stream_reset_response()
3580 sctp_clean_up_stream_reset(stcb); in sctp_handle_stream_reset_response()
3585 sctp_send_stream_reset_out_if_possible(stcb, SCTP_SO_NOT_LOCKED); in sctp_handle_stream_reset_response()
3591 sctp_handle_str_reset_request_in(struct sctp_tcb *stcb, in sctp_handle_str_reset_request_in() argument
3604 struct sctp_association *asoc = &stcb->asoc; in sctp_handle_str_reset_request_in()
3614 } else if (stcb->asoc.stream_reset_out_is_outstanding == 0) { in sctp_handle_str_reset_request_in()
3620 if (temp >= stcb->asoc.streamoutcnt) { in sctp_handle_str_reset_request_in()
3627 if (stcb->asoc.strmout[req->list_of_streams[i]].state == SCTP_STREAM_OPEN) { in sctp_handle_str_reset_request_in()
3628 stcb->asoc.strmout[req->list_of_streams[i]].state = SCTP_STREAM_RESET_PENDING; in sctp_handle_str_reset_request_in()
3633 for (i = 0; i < stcb->asoc.streamoutcnt; i++) { in sctp_handle_str_reset_request_in()
3634 if (stcb->asoc.strmout[i].state == SCTP_STREAM_OPEN) in sctp_handle_str_reset_request_in()
3635 stcb->asoc.strmout[i].state = SCTP_STREAM_RESET_PENDING; in sctp_handle_str_reset_request_in()
3653 sctp_send_stream_reset_out_if_possible(stcb, SCTP_SO_NOT_LOCKED); in sctp_handle_str_reset_request_in()
3657 sctp_handle_str_reset_request_tsn(struct sctp_tcb *stcb, in sctp_handle_str_reset_request_tsn() argument
3668 struct sctp_association *asoc = &stcb->asoc; in sctp_handle_str_reset_request_tsn()
3674 asoc->last_reset_action[1] = stcb->asoc.last_reset_action[0]; in sctp_handle_str_reset_request_tsn()
3681 fwdtsn.new_cumulative_tsn = htonl(stcb->asoc.highest_tsn_inside_map + 1); in sctp_handle_str_reset_request_tsn()
3682 sctp_handle_forward_tsn(stcb, &fwdtsn, &abort_flag, NULL, 0); in sctp_handle_str_reset_request_tsn()
3701 sctp_reset_out_streams(stcb, 0, (uint16_t *)NULL); in sctp_handle_str_reset_request_tsn()
3702 sctp_reset_in_stream(stcb, 0, (uint16_t *)NULL); in sctp_handle_str_reset_request_tsn()
3704 sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_TSN, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); in sctp_handle_str_reset_request_tsn()
3722 sctp_handle_str_reset_request_out(struct sctp_tcb *stcb, in sctp_handle_str_reset_request_out() argument
3728 struct sctp_association *asoc = &stcb->asoc; in sctp_handle_str_reset_request_out()
3753 sctp_reset_in_stream(stcb, number_entries, req->list_of_streams); in sctp_handle_str_reset_request_out()
3799 sctp_handle_str_reset_add_strm(struct sctp_tcb *stcb, struct sctp_tmit_chunk *chk, in sctp_handle_str_reset_add_strm() argument
3808 struct sctp_association *asoc = &stcb->asoc; in sctp_handle_str_reset_add_strm()
3816 num_stream += stcb->asoc.streamincnt; in sctp_handle_str_reset_add_strm()
3817 stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; in sctp_handle_str_reset_add_strm()
3820 } else if ((num_stream > stcb->asoc.max_inbound_streams) || in sctp_handle_str_reset_add_strm()
3824 stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; in sctp_handle_str_reset_add_strm()
3830 oldstrm = stcb->asoc.strmin; in sctp_handle_str_reset_add_strm()
3831 SCTP_MALLOC(stcb->asoc.strmin, struct sctp_stream_in *, in sctp_handle_str_reset_add_strm()
3834 if (stcb->asoc.strmin == NULL) { in sctp_handle_str_reset_add_strm()
3835 stcb->asoc.strmin = oldstrm; in sctp_handle_str_reset_add_strm()
3839 for (i = 0; i < stcb->asoc.streamincnt; i++) { in sctp_handle_str_reset_add_strm()
3840 TAILQ_INIT(&stcb->asoc.strmin[i].inqueue); in sctp_handle_str_reset_add_strm()
3841 TAILQ_INIT(&stcb->asoc.strmin[i].uno_inqueue); in sctp_handle_str_reset_add_strm()
3842 stcb->asoc.strmin[i].sid = i; in sctp_handle_str_reset_add_strm()
3843 stcb->asoc.strmin[i].last_mid_delivered = oldstrm[i].last_mid_delivered; in sctp_handle_str_reset_add_strm()
3844 stcb->asoc.strmin[i].delivery_started = oldstrm[i].delivery_started; in sctp_handle_str_reset_add_strm()
3845 stcb->asoc.strmin[i].pd_api_started = oldstrm[i].pd_api_started; in sctp_handle_str_reset_add_strm()
3849 TAILQ_INSERT_TAIL(&stcb->asoc.strmin[i].inqueue, ctl, next_instrm); in sctp_handle_str_reset_add_strm()
3853 TAILQ_INSERT_TAIL(&stcb->asoc.strmin[i].uno_inqueue, ctl, next_instrm); in sctp_handle_str_reset_add_strm()
3857 for (i = stcb->asoc.streamincnt; i < num_stream; i++) { in sctp_handle_str_reset_add_strm()
3858 TAILQ_INIT(&stcb->asoc.strmin[i].inqueue); in sctp_handle_str_reset_add_strm()
3859 TAILQ_INIT(&stcb->asoc.strmin[i].uno_inqueue); in sctp_handle_str_reset_add_strm()
3860 stcb->asoc.strmin[i].sid = i; in sctp_handle_str_reset_add_strm()
3861 stcb->asoc.strmin[i].last_mid_delivered = 0xffffffff; in sctp_handle_str_reset_add_strm()
3862 stcb->asoc.strmin[i].pd_api_started = 0; in sctp_handle_str_reset_add_strm()
3863 stcb->asoc.strmin[i].delivery_started = 0; in sctp_handle_str_reset_add_strm()
3867 stcb->asoc.streamincnt = num_stream; in sctp_handle_str_reset_add_strm()
3868 stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; in sctp_handle_str_reset_add_strm()
3869 sctp_ulp_notify(SCTP_NOTIFY_STR_RESET_ADD, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); in sctp_handle_str_reset_add_strm()
3891 sctp_handle_str_reset_add_out_strm(struct sctp_tcb *stcb, struct sctp_tmit_chunk *chk, in sctp_handle_str_reset_add_out_strm() argument
3900 struct sctp_association *asoc = &stcb->asoc; in sctp_handle_str_reset_add_out_strm()
3907 stcb->asoc.last_reset_action[1] = stcb->asoc.last_reset_action[0]; in sctp_handle_str_reset_add_out_strm()
3910 } else if (stcb->asoc.stream_reset_outstanding) { in sctp_handle_str_reset_add_out_strm()
3912 stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_ERR_IN_PROGRESS; in sctp_handle_str_reset_add_out_strm()
3917 mychk = stcb->asoc.streamoutcnt; in sctp_handle_str_reset_add_out_strm()
3920 stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_PERFORMED; in sctp_handle_str_reset_add_out_strm()
3921 if (sctp_send_str_reset_req(stcb, 0, NULL, 0, 0, 1, num_stream, 0, 1)) { in sctp_handle_str_reset_add_out_strm()
3922 stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; in sctp_handle_str_reset_add_out_strm()
3925 stcb->asoc.last_reset_action[0] = SCTP_STREAM_RESET_RESULT_DENIED; in sctp_handle_str_reset_add_out_strm()
3928 sctp_add_stream_reset_result(chk, seq, stcb->asoc.last_reset_action[0]); in sctp_handle_str_reset_add_out_strm()
3951 sctp_handle_stream_reset(struct sctp_tcb *stcb, struct mbuf *m, int offset, in sctp_handle_stream_reset() argument
3970 sctp_alloc_a_chunk(stcb, chk); in sctp_handle_stream_reset()
3978 chk->asoc = &stcb->asoc; in sctp_handle_stream_reset()
3989 sctp_free_a_chunk(stcb, chk, SCTP_SO_NOT_LOCKED); in sctp_handle_stream_reset()
4042 if (stcb->asoc.stream_reset_outstanding) { in sctp_handle_stream_reset()
4044 if (seq == stcb->asoc.str_reset_seq_out) { in sctp_handle_stream_reset()
4046 (void)sctp_handle_stream_reset_response(stcb, seq, SCTP_STREAM_RESET_RESULT_PERFORMED, NULL); in sctp_handle_stream_reset()
4049 sctp_handle_str_reset_request_out(stcb, chk, req_out, trunc); in sctp_handle_stream_reset()
4058 sctp_handle_str_reset_add_strm(stcb, chk, str_add); in sctp_handle_stream_reset()
4067 sctp_handle_str_reset_add_out_strm(stcb, chk, str_add); in sctp_handle_stream_reset()
4073 sctp_handle_str_reset_request_in(stcb, chk, req_in, trunc); in sctp_handle_stream_reset()
4079 if (sctp_handle_str_reset_request_tsn(stcb, chk, req_tsn)) { in sctp_handle_stream_reset()
4095 if (sctp_handle_stream_reset_response(stcb, seq, result, resp)) { in sctp_handle_stream_reset()
4114 TAILQ_INSERT_TAIL(&stcb->asoc.control_send_queue, in sctp_handle_stream_reset()
4117 stcb->asoc.ctrl_queue_cnt++; in sctp_handle_stream_reset()
4129 struct sctp_tcb *stcb, struct sctp_nets *net, uint32_t limit) in sctp_handle_packet_dropped() argument
4180 if (stcb->asoc.idata_supported) { in sctp_handle_packet_dropped()
4207 if (!stcb->asoc.idata_supported) { in sctp_handle_packet_dropped()
4240 if (process_chunk_drop(stcb, &desc, net, pktdrp_flags)) { in sctp_handle_packet_dropped()
4264 stcb->asoc.peers_rwnd = 0; in sctp_handle_packet_dropped()
4266 if (a_rwnd > stcb->asoc.total_flight) { in sctp_handle_packet_dropped()
4267 stcb->asoc.peers_rwnd = in sctp_handle_packet_dropped()
4268 a_rwnd - stcb->asoc.total_flight; in sctp_handle_packet_dropped()
4270 stcb->asoc.peers_rwnd = 0; in sctp_handle_packet_dropped()
4272 if (stcb->asoc.peers_rwnd < in sctp_handle_packet_dropped()
4273 stcb->sctp_ep->sctp_ep.sctp_sws_sender) { in sctp_handle_packet_dropped()
4275 stcb->asoc.peers_rwnd = 0; in sctp_handle_packet_dropped()
4285 (stcb->asoc.sat_t3_loss_recovery == 0) && in sctp_handle_packet_dropped()
4286 (stcb->asoc.sat_network)) { in sctp_handle_packet_dropped()
4292 stcb->asoc.cc_functions.sctp_cwnd_update_after_packet_dropped(stcb, in sctp_handle_packet_dropped()
4313 struct sctp_tcb *stcb, struct sctp_nets **netp, int *fwd_tsn_seen, in sctp_process_control() argument
4340 iphlen, *offset, length, (void *)stcb); in sctp_process_control()
4342 if (stcb) { in sctp_process_control()
4343 SCTP_TCB_LOCK_ASSERT(stcb); in sctp_process_control()
4350 return (stcb); in sctp_process_control()
4363 if (stcb != NULL) { in sctp_process_control()
4364 SCTP_TCB_UNLOCK(stcb); in sctp_process_control()
4375 (stcb == NULL) && in sctp_process_control()
4395 return (stcb); in sctp_process_control()
4404 if (ch->chunk_type == SCTP_ASCONF && stcb == NULL) { in sctp_process_control()
4416 stcb = sctp_findassociation_ep_asconf(m, in sctp_process_control()
4420 if (stcb != NULL) in sctp_process_control()
4426 if (stcb == NULL) { in sctp_process_control()
4435 if (auth_skipped && (stcb != NULL)) { in sctp_process_control()
4445 if ((auth == NULL) || sctp_handle_auth(stcb, auth, m, in sctp_process_control()
4449 return (stcb); in sctp_process_control()
4452 stcb->asoc.authenticated = 1; in sctp_process_control()
4456 if (stcb == NULL) { in sctp_process_control()
4467 asoc = &stcb->asoc; in sctp_process_control()
4482 if (stcb != NULL) { in sctp_process_control()
4483 SCTP_TCB_UNLOCK(stcb); in sctp_process_control()
4495 if (stcb != NULL) { in sctp_process_control()
4496 SCTP_TCB_UNLOCK(stcb); in sctp_process_control()
4509 (SCTP_GET_STATE(stcb) == SCTP_STATE_COOKIE_ECHOED)) { in sctp_process_control()
4511 sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb, in sctp_process_control()
4521 SCTP_LTRACE_CHK(inp, stcb, ch->chunk_type, chk_length); in sctp_process_control()
4525 return (stcb); in sctp_process_control()
4549 return (stcb); in sctp_process_control()
4554 if (stcb != NULL) { in sctp_process_control()
4562 stcb->asoc.last_control_chunk_from = *netp; in sctp_process_control()
4570 if ((stcb != NULL) && in sctp_process_control()
4571 sctp_auth_is_required_chunk(ch->chunk_type, stcb->asoc.local_auth_chunks) && in sctp_process_control()
4572 !stcb->asoc.authenticated) { in sctp_process_control()
4588 return (stcb); in sctp_process_control()
4597 if (stcb != NULL) { in sctp_process_control()
4598 SCTP_TCB_UNLOCK(stcb); in sctp_process_control()
4604 stcb, *netp, in sctp_process_control()
4608 if (stcb != NULL) { in sctp_process_control()
4609 SCTP_TCB_UNLOCK(stcb); in sctp_process_control()
4619 if ((stcb != NULL) && (stcb->asoc.total_output_queue_size)) { in sctp_process_control()
4623 if (stcb != NULL) { in sctp_process_control()
4624 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, in sctp_process_control()
4634 return (stcb); in sctp_process_control()
4640 stcb, *netp, in sctp_process_control()
4655 if ((stcb != NULL) && (ret == 0)) { in sctp_process_control()
4656 sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_CONTROL_PROC, SCTP_SO_NOT_LOCKED); in sctp_process_control()
4658 return (stcb); in sctp_process_control()
4672 if (stcb == NULL) { in sctp_process_control()
4683 if (stcb->asoc.nrsack_supported == 0) { in sctp_process_control()
4691 if (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_ACK_SENT) { in sctp_process_control()
4738 stcb->asoc.seen_a_sack_this_pkt = 1; in sctp_process_control()
4739 if ((stcb->asoc.pr_sctp_cnt == 0) && in sctp_process_control()
4741 SCTP_TSN_GE(cum_ack, stcb->asoc.last_acked_seq) && in sctp_process_control()
4742 (stcb->asoc.saw_sack_with_frags == 0) && in sctp_process_control()
4743 (stcb->asoc.saw_sack_with_nr_frags == 0) && in sctp_process_control()
4744 (!TAILQ_EMPTY(&stcb->asoc.sent_queue))) { in sctp_process_control()
4754 sctp_express_handle_sack(stcb, cum_ack, a_rwnd, in sctp_process_control()
4758 sctp_handle_sack(m, offset_seg, offset_dup, stcb, in sctp_process_control()
4768 if (TAILQ_EMPTY(&stcb->asoc.send_queue) && in sctp_process_control()
4769 TAILQ_EMPTY(&stcb->asoc.sent_queue) && in sctp_process_control()
4770 (stcb->asoc.stream_queue_cnt == 0)) { in sctp_process_control()
4771 sctp_ulp_notify(SCTP_NOTIFY_SENDER_DRY, stcb, 0, NULL, SCTP_SO_NOT_LOCKED); in sctp_process_control()
4777 if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { in sctp_process_control()
4779 sctp_send_heartbeat_ack(stcb, m, *offset, in sctp_process_control()
4785 if ((stcb == NULL) || (chk_length != sizeof(struct sctp_heartbeat_chunk))) { in sctp_process_control()
4792 stcb, *netp); in sctp_process_control()
4797 (void *)stcb); in sctp_process_control()
4799 if ((stcb != NULL) && (netp != NULL) && (*netp != NULL)) { in sctp_process_control()
4800 if (sctp_handle_abort((struct sctp_abort_chunk *)ch, stcb, *netp)) { in sctp_process_control()
4803 return (stcb); in sctp_process_control()
4811 (void *)stcb); in sctp_process_control()
4812 if ((stcb == NULL) || (chk_length != sizeof(struct sctp_shutdown_chunk))) { in sctp_process_control()
4818 stcb, *netp, &abort_flag); in sctp_process_control()
4826 SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN_ACK, stcb %p\n", (void *)stcb); in sctp_process_control()
4828 (stcb != NULL) && (netp != NULL) && (*netp != NULL)) { in sctp_process_control()
4829 sctp_handle_shutdown_ack((struct sctp_shutdown_ack_chunk *)ch, stcb, *netp); in sctp_process_control()
4836 if ((stcb != NULL) && (netp != NULL) && (*netp != NULL) && in sctp_process_control()
4837 sctp_handle_error(ch, stcb, *netp, contiguous) < 0) { in sctp_process_control()
4844 "SCTP_COOKIE_ECHO, stcb %p\n", (void *)stcb); in sctp_process_control()
4845 if ((stcb != NULL) && (stcb->asoc.total_output_queue_size > 0)) { in sctp_process_control()
4851 if (stcb != NULL) { in sctp_process_control()
4852 SCTP_TCB_UNLOCK(stcb); in sctp_process_control()
4875 if ((stcb == NULL) && in sctp_process_control()
4882 sctp_abort_association(inp, stcb, m, iphlen, in sctp_process_control()
4899 if (stcb) { in sctp_process_control()
4912 locked_stcb = stcb; in sctp_process_control()
4919 &inp, &stcb, netp, in sctp_process_control()
4928 if ((locked_stcb != NULL) && (locked_stcb != stcb)) { in sctp_process_control()
4931 if (stcb != NULL) { in sctp_process_control()
4932 SCTP_TCB_LOCK_ASSERT(stcb); in sctp_process_control()
4941 if (stcb != NULL) { in sctp_process_control()
4942 SCTP_TCB_UNLOCK(stcb); in sctp_process_control()
4955 TAILQ_FOREACH(chk, &stcb->asoc.sent_queue, sctp_next) { in sctp_process_control()
4961 sctp_timer_start(SCTP_TIMER_TYPE_SEND, stcb->sctp_ep, stcb, chk->whoTo); in sctp_process_control()
4966 SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_COOKIE_ACK, stcb %p\n", (void *)stcb); in sctp_process_control()
4967 if ((stcb == NULL) || chk_length != sizeof(struct sctp_cookie_ack_chunk)) { in sctp_process_control()
4972 if ((stcb) && (stcb->asoc.total_output_queue_size)) { in sctp_process_control()
4974 } else if (stcb) { in sctp_process_control()
4975 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, in sctp_process_control()
4982 sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb, *netp); in sctp_process_control()
4987 if (stcb == NULL) { in sctp_process_control()
4990 if (stcb->asoc.ecn_supported == 0) { in sctp_process_control()
4997 sctp_handle_ecn_echo((struct sctp_ecne_chunk *)ch, stcb); in sctp_process_control()
5002 if (stcb == NULL) { in sctp_process_control()
5005 if (stcb->asoc.ecn_supported == 0) { in sctp_process_control()
5011 sctp_handle_ecn_cwr((struct sctp_cwr_chunk *)ch, stcb, *netp); in sctp_process_control()
5014 SCTPDBG(SCTP_DEBUG_INPUT3, "SCTP_SHUTDOWN_COMPLETE, stcb %p\n", (void *)stcb); in sctp_process_control()
5019 return (stcb); in sctp_process_control()
5022 (stcb != NULL) && (netp != NULL) && (*netp != NULL)) { in sctp_process_control()
5024 stcb, *netp); in sctp_process_control()
5031 if (stcb != NULL) { in sctp_process_control()
5032 if (stcb->asoc.asconf_supported == 0) { in sctp_process_control()
5036 (struct sctp_asconf_chunk *)ch, stcb, asconf_cnt == 0); in sctp_process_control()
5042 if (stcb == NULL) { in sctp_process_control()
5045 if (stcb->asoc.asconf_supported == 0) { in sctp_process_control()
5055 stcb->asoc.overall_error_count, in sctp_process_control()
5060 stcb->asoc.overall_error_count = 0; in sctp_process_control()
5062 (struct sctp_asconf_ack_chunk *)ch, stcb, *netp, &abort_no_unlock); in sctp_process_control()
5071 if (stcb == NULL) { in sctp_process_control()
5074 if (stcb->asoc.prsctp_supported == 0) { in sctp_process_control()
5080 if (((stcb->asoc.idata_supported == 1) && (ch->chunk_type == SCTP_FORWARD_CUM_TSN)) || in sctp_process_control()
5081 ((stcb->asoc.idata_supported == 0) && (ch->chunk_type == SCTP_IFORWARD_CUM_TSN))) { in sctp_process_control()
5088 sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_NOT_LOCKED); in sctp_process_control()
5095 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, in sctp_process_control()
5103 stcb->asoc.last_data_chunk_from = stcb->asoc.last_control_chunk_from; in sctp_process_control()
5105 sctp_handle_forward_tsn(stcb, in sctp_process_control()
5114 if (stcb == NULL) { in sctp_process_control()
5117 if (stcb->asoc.reconfig_supported == 0) { in sctp_process_control()
5123 if (sctp_handle_stream_reset(stcb, m, *offset, ch)) { in sctp_process_control()
5131 if (stcb == NULL) { in sctp_process_control()
5134 if (stcb->asoc.pktdrop_supported == 0) { in sctp_process_control()
5142 stcb, *netp, in sctp_process_control()
5148 if (stcb == NULL) { in sctp_process_control()
5158 if (stcb->asoc.auth_supported == 0) { in sctp_process_control()
5166 return (stcb); in sctp_process_control()
5173 if (sctp_handle_auth(stcb, (struct sctp_auth_chunk *)ch, m, *offset)) { in sctp_process_control()
5176 return (stcb); in sctp_process_control()
5179 stcb->asoc.authenticated = 1; in sctp_process_control()
5187 (stcb != NULL) && in sctp_process_control()
5188 (SCTP_GET_STATE(stcb) != SCTP_STATE_EMPTY) && in sctp_process_control()
5189 (SCTP_GET_STATE(stcb) != SCTP_STATE_INUSE) && in sctp_process_control()
5190 (SCTP_GET_STATE(stcb) != SCTP_STATE_COOKIE_WAIT)) { in sctp_process_control()
5209 sctp_queue_op_err(stcb, op_err); in sctp_process_control()
5218 return (stcb); in sctp_process_control()
5234 return (stcb); in sctp_process_control()
5238 if ((asconf_cnt > 0) && (stcb != NULL)) { in sctp_process_control()
5239 sctp_send_asconf_ack(stcb); in sctp_process_control()
5241 return (stcb); in sctp_process_control()
5259 struct sctp_tcb *stcb = NULL; in sctp_common_input_processing() local
5271 sctp_auditing(0, inp, stcb, net); in sctp_common_input_processing()
5309 KASSERT(stcb == NULL, in sctp_common_input_processing()
5310 ("stcb is %p", stcb)); in sctp_common_input_processing()
5315 stcb = sctp_findassociation_addr(m, offset, src, dst, in sctp_common_input_processing()
5329 if (stcb->asoc.smallest_mtu > net->mtu) { in sctp_common_input_processing()
5330 sctp_pathmtu_adjustment(stcb, net->mtu, true); in sctp_common_input_processing()
5347 SCTP_PROBE5(receive, NULL, stcb, m, stcb, sh); in sctp_common_input_processing()
5348 if ((inp != NULL) && (stcb != NULL)) { in sctp_common_input_processing()
5349 if (stcb->asoc.pktdrop_supported) { in sctp_common_input_processing()
5350 sctp_send_packet_dropped(stcb, net, m, length, iphlen, 1); in sctp_common_input_processing()
5351 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_INPUT_ERROR, SCTP_SO_NOT_LOCKED); in sctp_common_input_processing()
5353 } else if ((inp != NULL) && (stcb == NULL)) { in sctp_common_input_processing()
5366 stcb = sctp_findassociation_addr(m, offset, src, dst, in sctp_common_input_processing()
5369 if (stcb == NULL) { in sctp_common_input_processing()
5372 if (stcb->asoc.rcv_edmid == SCTP_EDMID_NONE) { in sctp_common_input_processing()
5375 KASSERT(stcb->asoc.rcv_edmid == SCTP_EDMID_LOWER_LAYER_DTLS, in sctp_common_input_processing()
5376 ("Unexpected EDMID %u", stcb->asoc.rcv_edmid)); in sctp_common_input_processing()
5384 if ((stcb == NULL) && (inp != NULL)) { in sctp_common_input_processing()
5390 stcb = sctp_findassociation_addr(m, offset, src, dst, in sctp_common_input_processing()
5399 if (stcb->asoc.smallest_mtu > net->mtu) { in sctp_common_input_processing()
5400 sctp_pathmtu_adjustment(stcb, net->mtu, true); in sctp_common_input_processing()
5416 SCTP_PROBE5(receive, NULL, stcb, m, stcb, sh); in sctp_common_input_processing()
5444 } else if (stcb == NULL) { in sctp_common_input_processing()
5448 (void *)m, iphlen, offset, length, (void *)stcb); in sctp_common_input_processing()
5449 if (stcb) { in sctp_common_input_processing()
5451 stcb->asoc.authenticated = 0; in sctp_common_input_processing()
5452 stcb->asoc.seen_a_sack_this_pkt = 0; in sctp_common_input_processing()
5454 (void *)stcb, stcb->asoc.state); in sctp_common_input_processing()
5456 if ((stcb->asoc.state & SCTP_STATE_WAS_ABORTED) || in sctp_common_input_processing()
5457 (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED)) { in sctp_common_input_processing()
5464 SCTP_TCB_UNLOCK(stcb); in sctp_common_input_processing()
5465 stcb = NULL; in sctp_common_input_processing()
5466 SCTP_PROBE5(receive, NULL, stcb, m, stcb, sh); in sctp_common_input_processing()
5479 stcb = sctp_process_control(m, iphlen, &offset, length, in sctp_common_input_processing()
5481 inp, stcb, &net, &fwd_tsn_seen, in sctp_common_input_processing()
5484 if (stcb) { in sctp_common_input_processing()
5489 inp = stcb->sctp_ep; in sctp_common_input_processing()
5496 if (stcb->asoc.smallest_mtu > net->mtu) { in sctp_common_input_processing()
5497 sctp_pathmtu_adjustment(stcb, net->mtu, true); in sctp_common_input_processing()
5519 if ((stcb != NULL) && in sctp_common_input_processing()
5520 sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.local_auth_chunks)) { in sctp_common_input_processing()
5522 SCTP_PROBE5(receive, NULL, stcb, m, stcb, sh); in sctp_common_input_processing()
5526 if (stcb == NULL) { in sctp_common_input_processing()
5537 if (stcb->asoc.my_vtag != ntohl(sh->v_tag)) { in sctp_common_input_processing()
5539 SCTP_PROBE5(receive, NULL, stcb, m, stcb, sh); in sctp_common_input_processing()
5545 SCTP_PROBE5(receive, NULL, stcb, m, stcb, sh); in sctp_common_input_processing()
5546 if (stcb == NULL) { in sctp_common_input_processing()
5565 (stcb != NULL) && in sctp_common_input_processing()
5566 sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.local_auth_chunks) && in sctp_common_input_processing()
5567 !stcb->asoc.authenticated) { in sctp_common_input_processing()
5582 switch (SCTP_GET_STATE(stcb)) { in sctp_common_input_processing()
5589 sctp_handle_cookie_ack((struct sctp_cookie_ack_chunk *)ch, stcb, net); in sctp_common_input_processing()
5618 inp, stcb, net, &high_tsn); in sctp_common_input_processing()
5624 stcb = NULL; in sctp_common_input_processing()
5638 (stcb->asoc.ecn_supported == 1) && in sctp_common_input_processing()
5641 sctp_send_ecn_echo(stcb, net, high_tsn); in sctp_common_input_processing()
5648 if (SCTP_TSN_GT(stcb->asoc.highest_tsn_inside_nr_map, stcb->asoc.highest_tsn_inside_map)) { in sctp_common_input_processing()
5649 highest_tsn = stcb->asoc.highest_tsn_inside_nr_map; in sctp_common_input_processing()
5651 highest_tsn = stcb->asoc.highest_tsn_inside_map; in sctp_common_input_processing()
5653 was_a_gap = SCTP_TSN_GT(highest_tsn, stcb->asoc.cumulative_tsn); in sctp_common_input_processing()
5654 stcb->asoc.send_sack = 1; in sctp_common_input_processing()
5655 sctp_sack_check(stcb, was_a_gap); in sctp_common_input_processing()
5657 stcb->asoc.send_sack = 1; in sctp_common_input_processing()
5663 sctp_auditing(1, inp, stcb, net); in sctp_common_input_processing()
5667 stcb->asoc.peers_rwnd, in sctp_common_input_processing()
5668 TAILQ_EMPTY(&stcb->asoc.control_send_queue), in sctp_common_input_processing()
5669 stcb->asoc.total_flight); in sctp_common_input_processing()
5670 un_sent = (stcb->asoc.total_output_queue_size - stcb->asoc.total_flight); in sctp_common_input_processing()
5671 if (!TAILQ_EMPTY(&stcb->asoc.control_send_queue)) { in sctp_common_input_processing()
5672 cnt_ctrl_ready = stcb->asoc.ctrl_queue_cnt - stcb->asoc.ecn_echo_cnt_onq; in sctp_common_input_processing()
5674 if (!TAILQ_EMPTY(&stcb->asoc.asconf_send_queue) || in sctp_common_input_processing()
5676 stcb->asoc.trigger_reset || in sctp_common_input_processing()
5678 (stcb->asoc.peers_rwnd > 0 || stcb->asoc.total_flight == 0))) { in sctp_common_input_processing()
5680 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CONTROL_PROC, SCTP_SO_NOT_LOCKED); in sctp_common_input_processing()
5685 sctp_auditing(2, inp, stcb, net); in sctp_common_input_processing()
5688 if (stcb != NULL) { in sctp_common_input_processing()
5689 SCTP_TCB_UNLOCK(stcb); in sctp_common_input_processing()