Lines Matching refs:stcb
106 sctp_pathmtu_adjustment(struct sctp_tcb *stcb, uint32_t mtu, bool resend) in sctp_pathmtu_adjustment() argument
112 asoc = &stcb->asoc; in sctp_pathmtu_adjustment()
117 if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { in sctp_pathmtu_adjustment()
148 sctp_total_flight_decrease(stcb, chk); in sctp_pathmtu_adjustment()
172 struct sctp_tcb *stcb, in sctp_notify() argument
183 SCTP_TCB_UNLOCK(stcb); in sctp_notify()
200 stcb, 0, in sctp_notify()
203 SCTP_TCB_UNLOCK(stcb); in sctp_notify()
207 sctp_abort_notification(stcb, true, false, 0, NULL, SCTP_SO_NOT_LOCKED); in sctp_notify()
208 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, in sctp_notify()
213 SCTP_TCB_UNLOCK(stcb); in sctp_notify()
228 sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net, in sctp_notify()
246 if (stcb->asoc.smallest_mtu > next_mtu) { in sctp_notify()
247 sctp_pathmtu_adjustment(stcb, next_mtu, true); in sctp_notify()
251 sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net); in sctp_notify()
253 SCTP_TCB_UNLOCK(stcb); in sctp_notify()
255 SCTP_TCB_UNLOCK(stcb); in sctp_notify()
265 struct sctp_tcb *stcb; in sctp_ctlinput() local
293 stcb = sctp_findassociation_addr_sa((struct sockaddr *)&dst, in sctp_ctlinput()
297 if ((stcb != NULL) && in sctp_ctlinput()
307 if (ntohl(sh->v_tag) != stcb->asoc.peer_vtag) { in sctp_ctlinput()
308 SCTP_TCB_UNLOCK(stcb); in sctp_ctlinput()
322 (ntohl(ch->init.initiate_tag) != stcb->asoc.my_vtag)) { in sctp_ctlinput()
323 SCTP_TCB_UNLOCK(stcb); in sctp_ctlinput()
327 SCTP_TCB_UNLOCK(stcb); in sctp_ctlinput()
331 sctp_notify(inp, stcb, net, in sctp_ctlinput()
337 if ((stcb == NULL) && (inp != NULL)) { in sctp_ctlinput()
343 if (stcb) { in sctp_ctlinput()
344 SCTP_TCB_UNLOCK(stcb); in sctp_ctlinput()
357 struct sctp_tcb *stcb; in sctp_getcred() local
374 stcb = sctp_findassociation_addr_sa(sintosa(&addrs[1]), in sctp_getcred()
377 if (stcb == NULL || inp == NULL || inp->sctp_socket == NULL) { in sctp_getcred()
378 if ((inp != NULL) && (stcb == NULL)) { in sctp_getcred()
389 SCTP_TCB_UNLOCK(stcb); in sctp_getcred()
657 struct sctp_tcb *stcb; in sctp_disconnect() local
668 stcb = LIST_FIRST(&inp->sctp_asoc_list); in sctp_disconnect()
669 if (stcb == NULL) { in sctp_disconnect()
674 SCTP_TCB_LOCK(stcb); in sctp_disconnect()
675 asoc = &stcb->asoc; in sctp_disconnect()
678 SCTP_TCB_UNLOCK(stcb); in sctp_disconnect()
685 if (SCTP_GET_STATE(stcb) != SCTP_STATE_COOKIE_WAIT) { in sctp_disconnect()
690 sctp_send_abort_tcb(stcb, op_err, SCTP_SO_LOCKED); in sctp_disconnect()
694 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || in sctp_disconnect()
695 (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_RECEIVED)) { in sctp_disconnect()
698 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, in sctp_disconnect()
708 if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { in sctp_disconnect()
711 if ((SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_SENT) && in sctp_disconnect()
712 (SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_ACK_SENT)) { in sctp_disconnect()
716 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || in sctp_disconnect()
717 (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_RECEIVED)) { in sctp_disconnect()
720 SCTP_SET_STATE(stcb, SCTP_STATE_SHUTDOWN_SENT); in sctp_disconnect()
721 sctp_stop_timers_for_shutdown(stcb); in sctp_disconnect()
722 if (stcb->asoc.alternate) { in sctp_disconnect()
723 netp = stcb->asoc.alternate; in sctp_disconnect()
725 netp = stcb->asoc.primary_destination; in sctp_disconnect()
727 sctp_send_shutdown(stcb, netp); in sctp_disconnect()
729 stcb->sctp_ep, stcb, netp); in sctp_disconnect()
731 stcb->sctp_ep, stcb, NULL); in sctp_disconnect()
732 sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_CLOSING, SCTP_SO_LOCKED); in sctp_disconnect()
744 SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_SHUTDOWN_PENDING); in sctp_disconnect()
745 if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { in sctp_disconnect()
746 SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_PARTIAL_MSG_LEFT); in sctp_disconnect()
755 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_4; in sctp_disconnect()
756 sctp_send_abort_tcb(stcb, op_err, SCTP_SO_LOCKED); in sctp_disconnect()
758 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || in sctp_disconnect()
759 (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_RECEIVED)) { in sctp_disconnect()
763 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, in sctp_disconnect()
768 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CLOSING, SCTP_SO_LOCKED); in sctp_disconnect()
773 SCTP_TCB_UNLOCK(stcb); in sctp_disconnect()
783 struct sctp_tcb *stcb; in sctp_shutdown() local
822 stcb = LIST_FIRST(&inp->sctp_asoc_list); in sctp_shutdown()
823 if (stcb != NULL) { in sctp_shutdown()
824 SCTP_TCB_LOCK(stcb); in sctp_shutdown()
836 sctp_sbfree(control, control->stcb, in sctp_shutdown()
845 sctp_free_a_readq(stcb, control); in sctp_shutdown()
847 if (stcb != NULL) { in sctp_shutdown()
848 stcb->asoc.size_on_all_streams += in sctp_shutdown()
855 if (need_to_abort && (stcb != NULL)) { in sctp_shutdown()
862 sctp_abort_an_association(inp, stcb, op_err, false, in sctp_shutdown()
869 if (stcb != NULL) { in sctp_shutdown()
870 SCTP_TCB_UNLOCK(stcb); in sctp_shutdown()
885 stcb = LIST_FIRST(&inp->sctp_asoc_list); in sctp_shutdown()
886 if (stcb == NULL) { in sctp_shutdown()
895 SCTP_TCB_LOCK(stcb); in sctp_shutdown()
896 asoc = &stcb->asoc; in sctp_shutdown()
898 SCTP_TCB_UNLOCK(stcb); in sctp_shutdown()
902 if ((SCTP_GET_STATE(stcb) != SCTP_STATE_COOKIE_WAIT) && in sctp_shutdown()
903 (SCTP_GET_STATE(stcb) != SCTP_STATE_COOKIE_ECHOED) && in sctp_shutdown()
904 (SCTP_GET_STATE(stcb) != SCTP_STATE_OPEN)) { in sctp_shutdown()
909 SCTP_TCB_UNLOCK(stcb); in sctp_shutdown()
914 if (stcb->asoc.alternate) { in sctp_shutdown()
915 netp = stcb->asoc.alternate; in sctp_shutdown()
917 netp = stcb->asoc.primary_destination; in sctp_shutdown()
919 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) && in sctp_shutdown()
923 if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { in sctp_shutdown()
928 SCTP_SET_STATE(stcb, SCTP_STATE_SHUTDOWN_SENT); in sctp_shutdown()
929 sctp_stop_timers_for_shutdown(stcb); in sctp_shutdown()
930 sctp_send_shutdown(stcb, netp); in sctp_shutdown()
932 stcb->sctp_ep, stcb, netp); in sctp_shutdown()
934 stcb->sctp_ep, stcb, NULL); in sctp_shutdown()
940 SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_SHUTDOWN_PENDING); in sctp_shutdown()
941 if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { in sctp_shutdown()
942 SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_PARTIAL_MSG_LEFT); in sctp_shutdown()
951 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6; in sctp_shutdown()
953 sctp_abort_an_association(stcb->sctp_ep, stcb, in sctp_shutdown()
963 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CLOSING, SCTP_SO_LOCKED); in sctp_shutdown()
964 SCTP_TCB_UNLOCK(stcb); in sctp_shutdown()
993 struct sctp_tcb *stcb, in sctp_fill_up_addresses_vrf() argument
1015 if (stcb) { in sctp_fill_up_addresses_vrf()
1017 loopback_scope = stcb->asoc.scope.loopback_scope; in sctp_fill_up_addresses_vrf()
1019 ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope; in sctp_fill_up_addresses_vrf()
1020 ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal; in sctp_fill_up_addresses_vrf()
1023 local_scope = stcb->asoc.scope.local_scope; in sctp_fill_up_addresses_vrf()
1024 site_scope = stcb->asoc.scope.site_scope; in sctp_fill_up_addresses_vrf()
1025 ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal; in sctp_fill_up_addresses_vrf()
1069 if (stcb) { in sctp_fill_up_addresses_vrf()
1078 if (sctp_is_addr_restricted(stcb, in sctp_fill_up_addresses_vrf()
1194 if (stcb) { in sctp_fill_up_addresses_vrf()
1195 if (sctp_is_addr_restricted(stcb, laddr->ifa)) { in sctp_fill_up_addresses_vrf()
1229 struct sctp_tcb *stcb, in sctp_fill_up_addresses() argument
1237 size = sctp_fill_up_addresses_vrf(inp, stcb, limit, addr, in sctp_fill_up_addresses()
1340 struct sctp_tcb *stcb = NULL; in sctp_do_connect_x() local
1351 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EADDRINUSE); in sctp_do_connect_x()
1357 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); in sctp_do_connect_x()
1363 stcb = LIST_FIRST(&inp->sctp_asoc_list); in sctp_do_connect_x()
1366 if (stcb) { in sctp_do_connect_x()
1367 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY); in sctp_do_connect_x()
1375 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EFAULT); in sctp_do_connect_x()
1403 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); in sctp_do_connect_x()
1421 stcb = sctp_aloc_assoc_connected(inp, sa, &error, 0, 0, vrf_id, in sctp_do_connect_x()
1426 if (stcb == NULL) { in sctp_do_connect_x()
1430 SCTP_SET_STATE(stcb, SCTP_STATE_COOKIE_WAIT); in sctp_do_connect_x()
1448 sctp_connectx_helper_add(stcb, sa, (totaddr - 1), &error); in sctp_do_connect_x()
1454 *a_id = sctp_get_associd(stcb); in sctp_do_connect_x()
1458 stcb->asoc.delayed_connection = 1; in sctp_do_connect_x()
1459 sctp_timer_start(SCTP_TIMER_TYPE_INIT, inp, stcb, stcb->asoc.primary_destination); in sctp_do_connect_x()
1461 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); in sctp_do_connect_x()
1462 sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED); in sctp_do_connect_x()
1464 SCTP_TCB_UNLOCK(stcb); in sctp_do_connect_x()
1473 #define SCTP_FIND_STCB(inp, stcb, assoc_id) { \ argument
1477 stcb = LIST_FIRST(&inp->sctp_asoc_list); \
1478 if (stcb) { \
1479 SCTP_TCB_LOCK(stcb); \
1483 stcb = sctp_findassociation_ep_asocid(inp, assoc_id, 1); \
1484 if (stcb == NULL) { \
1490 stcb = NULL; \
1510 struct sctp_tcb *stcb = NULL; local
1642 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1644 if (stcb) {
1645 av->assoc_value = stcb->asoc.idata_supported;
1646 SCTP_TCB_UNLOCK(stcb);
1674 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1675 if (stcb) {
1676 av->assoc_value = stcb->asoc.sctp_cmt_on_off;
1677 SCTP_TCB_UNLOCK(stcb);
1701 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1702 if (stcb) {
1703 av->assoc_value = stcb->asoc.congestion_control_module;
1704 SCTP_TCB_UNLOCK(stcb);
1728 SCTP_FIND_STCB(inp, stcb, cc_opt->aid_value.assoc_id);
1729 if (stcb == NULL) {
1732 if (stcb->asoc.cc_functions.sctp_cwnd_socket_option == NULL) {
1735 error = (*stcb->asoc.cc_functions.sctp_cwnd_socket_option) (stcb, 0, cc_opt);
1738 SCTP_TCB_UNLOCK(stcb);
1747 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1748 if (stcb) {
1749 av->assoc_value = stcb->asoc.stream_scheduling_module;
1750 SCTP_TCB_UNLOCK(stcb);
1774 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1775 if (stcb) {
1776 if ((av->stream_id >= stcb->asoc.streamoutcnt) ||
1777 … (stcb->asoc.ss_functions.sctp_ss_get_value(stcb, &stcb->asoc, &stcb->asoc.strmout[av->stream_id],
1784 SCTP_TCB_UNLOCK(stcb);
1834 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
1859 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
1861 ids->gaids_assoc_id[at++] = sctp_get_associd(stcb);
1885 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1887 if (stcb) {
1888 av->assoc_value = stcb->asoc.context;
1889 SCTP_TCB_UNLOCK(stcb);
1922 SCTP_FIND_STCB(inp, stcb, id->assoc_id);
1923 if (stcb == NULL) {
1927 id->assoc_value = stcb->asoc.vrf_id;
1928 SCTP_TCB_UNLOCK(stcb);
1944 SCTP_FIND_STCB(inp, stcb, gnv->gn_assoc_id);
1946 if (stcb) {
1947 gnv->gn_peers_tag = stcb->asoc.peer_vtag;
1948 gnv->gn_local_tag = stcb->asoc.my_vtag;
1949 SCTP_TCB_UNLOCK(stcb);
1962 SCTP_FIND_STCB(inp, stcb, sack->sack_assoc_id);
1963 if (stcb) {
1964 sack->sack_delay = stcb->asoc.delayed_ack;
1965 sack->sack_freq = stcb->asoc.sack_freq;
1966 SCTP_TCB_UNLOCK(stcb);
1991 SCTP_FIND_STCB(inp, stcb, ss->ss_assoc_id);
1993 if (stcb) {
1994 ss->ss_total_sndbuf = stcb->asoc.total_output_queue_size;
1995 ss->ss_total_recv_buf = (stcb->asoc.size_on_reasm_queue +
1996 stcb->asoc.size_on_all_streams);
1997 SCTP_TCB_UNLOCK(stcb);
2010 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
2012 if (stcb) {
2013 av->assoc_value = stcb->asoc.max_burst;
2014 SCTP_TCB_UNLOCK(stcb);
2038 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
2040 if (stcb) {
2041 av->assoc_value = stcb->asoc.sctp_frag_point;
2042 SCTP_TCB_UNLOCK(stcb);
2149 SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t)*value);
2151 if (stcb != NULL) {
2154 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
2178 SCTP_TCB_UNLOCK(stcb);
2204 SCTP_FIND_STCB(inp, stcb, saddr->sget_assoc_id);
2206 if (stcb != NULL) {
2211 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
2254 ((struct sockaddr_in *)addr)->sin_port = stcb->rport;
2260 SCTP_TCB_UNLOCK(stcb);
2278 SCTP_FIND_STCB(inp, stcb, saddr->sget_assoc_id);
2286 actual = sctp_fill_up_addresses(inp, stcb, limit, &saddr->addr[0].sa);
2289 if (stcb != NULL) {
2290 SCTP_TCB_UNLOCK(stcb);
2304 SCTP_FIND_STCB(inp, stcb, paddrp->spp_assoc_id);
2323 if (stcb != NULL) {
2324 net = sctp_findnet(stcb, addr);
2335 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
2336 if (stcb == NULL) {
2340 if ((stcb != NULL) && (net == NULL)) {
2348 SCTP_TCB_UNLOCK(stcb);
2361 SCTP_TCB_UNLOCK(stcb);
2369 SCTP_TCB_UNLOCK(stcb);
2375 if (stcb != NULL) {
2424 paddrp->spp_pathmaxrxt = stcb->asoc.def_net_failure;
2425 paddrp->spp_pathmtu = stcb->asoc.default_mtu;
2426 if (stcb->asoc.default_dscp & 0x01) {
2427 paddrp->spp_dscp = stcb->asoc.default_dscp & 0xfc;
2431 if (stcb->asoc.default_flowlabel & 0x80000000) {
2432 paddrp->spp_ipv6_flowlabel = stcb->asoc.default_flowlabel & 0x000fffff;
2437 if (sctp_stcb_is_feature_on(inp, stcb, SCTP_PCB_FLAGS_DONOT_HEARTBEAT)) {
2442 if (sctp_stcb_is_feature_on(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD)) {
2447 paddrp->spp_hbinterval = stcb->asoc.heart_beat_delay;
2449 paddrp->spp_assoc_id = sctp_get_associd(stcb);
2450 SCTP_TCB_UNLOCK(stcb);
2506 SCTP_FIND_STCB(inp, stcb, paddri->spinfo_assoc_id);
2525 if (stcb != NULL) {
2526 net = sctp_findnet(stcb, addr);
2537 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
2538 if (stcb == NULL) {
2543 if ((stcb != NULL) && (net != NULL)) {
2557 paddri->spinfo_assoc_id = sctp_get_associd(stcb);
2573 SCTP_TCB_UNLOCK(stcb);
2576 if (stcb != NULL) {
2577 SCTP_TCB_UNLOCK(stcb);
2599 SCTP_FIND_STCB(inp, stcb, sstat->sstat_assoc_id);
2601 if (stcb == NULL) {
2606 sstat->sstat_state = sctp_map_assoc_state(stcb->asoc.state);
2607 sstat->sstat_assoc_id = sctp_get_associd(stcb);
2608 sstat->sstat_rwnd = stcb->asoc.peers_rwnd;
2609 sstat->sstat_unackdata = stcb->asoc.sent_queue_cnt;
2614 sstat->sstat_penddata = (stcb->asoc.cnt_on_reasm_queue +
2615 stcb->asoc.cnt_on_all_streams);
2616 sstat->sstat_instrms = stcb->asoc.streamincnt;
2617 sstat->sstat_outstrms = stcb->asoc.streamoutcnt;
2618 sstat->sstat_fragmentation_point = sctp_get_frag_point(stcb);
2619 net = stcb->asoc.primary_destination;
2624 ((struct sockaddr_in *)&sstat->sstat_primary.spinfo_address)->sin_port = stcb->rport;
2644 switch (stcb->asoc.primary_destination->ro._l_addr.sa.sa_family) {
2661 sstat->sstat_primary.spinfo_assoc_id = sctp_get_associd(stcb);
2662 SCTP_TCB_UNLOCK(stcb);
2671 SCTP_FIND_STCB(inp, stcb, srto->srto_assoc_id);
2673 if (stcb) {
2674 srto->srto_initial = stcb->asoc.initial_rto;
2675 srto->srto_max = stcb->asoc.maxrto;
2676 srto->srto_min = stcb->asoc.minrto;
2677 SCTP_TCB_UNLOCK(stcb);
2703 SCTP_FIND_STCB(inp, stcb, stimo->stimo_assoc_id);
2705 if (stcb) {
2706 stimo->stimo_init = stcb->asoc.timoinit;
2707 stimo->stimo_data = stcb->asoc.timodata;
2708 stimo->stimo_sack = stcb->asoc.timosack;
2709 stimo->stimo_shutdown = stcb->asoc.timoshutdown;
2710 stimo->stimo_heartbeat = stcb->asoc.timoheartbeat;
2711 stimo->stimo_cookie = stcb->asoc.timocookie;
2712 stimo->stimo_shutdownack = stcb->asoc.timoshutdownack;
2713 SCTP_TCB_UNLOCK(stcb);
2726 SCTP_FIND_STCB(inp, stcb, sasoc->sasoc_assoc_id);
2728 if (stcb) {
2729 sasoc->sasoc_cookie_life = sctp_ticks_to_msecs(stcb->asoc.cookie_life);
2730 sasoc->sasoc_asocmaxrxt = stcb->asoc.max_send_times;
2731 sasoc->sasoc_number_peer_destinations = stcb->asoc.numnets;
2732 sasoc->sasoc_peer_rwnd = stcb->asoc.peers_rwnd;
2733 sasoc->sasoc_local_rwnd = stcb->asoc.my_rwnd;
2734 SCTP_TCB_UNLOCK(stcb);
2762 SCTP_FIND_STCB(inp, stcb, s_info->sinfo_assoc_id);
2764 if (stcb) {
2765 memcpy(s_info, &stcb->asoc.def_send, sizeof(stcb->asoc.def_send));
2766 SCTP_TCB_UNLOCK(stcb);
2805 SCTP_FIND_STCB(inp, stcb, ssp->ssp_assoc_id);
2807 if (stcb) {
2810 addr = &stcb->asoc.primary_destination->ro._l_addr;
2834 SCTP_TCB_UNLOCK(stcb);
2882 SCTP_FIND_STCB(inp, stcb, scact->scact_assoc_id);
2884 if (stcb) {
2886 scact->scact_keynumber = stcb->asoc.authinfo.active_keyid;
2887 SCTP_TCB_UNLOCK(stcb);
2914 SCTP_FIND_STCB(inp, stcb, sac->gauth_assoc_id);
2916 if (stcb) {
2918 chklist = stcb->asoc.local_auth_chunks;
2930 SCTP_TCB_UNLOCK(stcb);
2965 SCTP_FIND_STCB(inp, stcb, sac->gauth_assoc_id);
2967 if (stcb) {
2969 chklist = stcb->asoc.peer_auth_chunks;
2981 SCTP_TCB_UNLOCK(stcb);
2994 SCTP_FIND_STCB(inp, stcb, event->se_assoc_id);
3048 if (stcb) {
3049 event->se_on = sctp_stcb_is_feature_on(inp, stcb, event_type);
3064 if (stcb != NULL) {
3065 SCTP_TCB_UNLOCK(stcb);
3099 SCTP_FIND_STCB(inp, stcb, info->snd_assoc_id);
3101 if (stcb) {
3102 info->snd_sid = stcb->asoc.def_send.sinfo_stream;
3103 info->snd_flags = stcb->asoc.def_send.sinfo_flags;
3105 info->snd_ppid = stcb->asoc.def_send.sinfo_ppid;
3106 info->snd_context = stcb->asoc.def_send.sinfo_context;
3107 SCTP_TCB_UNLOCK(stcb);
3135 SCTP_FIND_STCB(inp, stcb, info->pr_assoc_id);
3137 if (stcb) {
3138 info->pr_policy = PR_SCTP_POLICY(stcb->asoc.def_send.sinfo_flags);
3139 info->pr_value = stcb->asoc.def_send.sinfo_timetolive;
3140 SCTP_TCB_UNLOCK(stcb);
3170 SCTP_FIND_STCB(inp, stcb, thlds->spt_assoc_id);
3189 if (stcb != NULL) {
3190 net = sctp_findnet(stcb, addr);
3201 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
3202 if (stcb == NULL) {
3206 if ((stcb != NULL) && (net == NULL)) {
3214 SCTP_TCB_UNLOCK(stcb);
3227 SCTP_TCB_UNLOCK(stcb);
3235 SCTP_TCB_UNLOCK(stcb);
3241 if (stcb != NULL) {
3247 thlds->spt_pathmaxrxt = stcb->asoc.def_net_failure;
3248 thlds->spt_pathpfthld = stcb->asoc.def_net_pf_threshold;
3251 thlds->spt_assoc_id = sctp_get_associd(stcb);
3252 SCTP_TCB_UNLOCK(stcb);
3284 SCTP_FIND_STCB(inp, stcb, encaps->sue_assoc_id);
3303 if (stcb) {
3304 net = sctp_findnet(stcb, addr);
3315 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
3316 if (stcb == NULL) {
3320 if ((stcb != NULL) && (net == NULL)) {
3328 SCTP_TCB_UNLOCK(stcb);
3341 SCTP_TCB_UNLOCK(stcb);
3349 SCTP_TCB_UNLOCK(stcb);
3355 if (stcb != NULL) {
3359 encaps->sue_port = stcb->asoc.port;
3361 SCTP_TCB_UNLOCK(stcb);
3385 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3387 if (stcb) {
3388 av->assoc_value = stcb->asoc.ecn_supported;
3389 SCTP_TCB_UNLOCK(stcb);
3413 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3415 if (stcb) {
3416 av->assoc_value = stcb->asoc.prsctp_supported;
3417 SCTP_TCB_UNLOCK(stcb);
3441 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3443 if (stcb) {
3444 av->assoc_value = stcb->asoc.auth_supported;
3445 SCTP_TCB_UNLOCK(stcb);
3469 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3471 if (stcb) {
3472 av->assoc_value = stcb->asoc.asconf_supported;
3473 SCTP_TCB_UNLOCK(stcb);
3497 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3499 if (stcb) {
3500 av->assoc_value = stcb->asoc.reconfig_supported;
3501 SCTP_TCB_UNLOCK(stcb);
3525 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3527 if (stcb) {
3528 av->assoc_value = stcb->asoc.nrsack_supported;
3529 SCTP_TCB_UNLOCK(stcb);
3553 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3555 if (stcb) {
3556 av->assoc_value = stcb->asoc.pktdrop_supported;
3557 SCTP_TCB_UNLOCK(stcb);
3581 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3583 if (stcb) {
3584 av->assoc_value = (uint32_t)stcb->asoc.local_strreset_support;
3585 SCTP_TCB_UNLOCK(stcb);
3611 SCTP_FIND_STCB(inp, stcb, sprstat->sprstat_assoc_id);
3616 if ((stcb != NULL) &&
3617 (sid < stcb->asoc.streamoutcnt) &&
3622 sprstat->sprstat_abandoned_unsent = stcb->asoc.strmout[sid].abandoned_unsent[0];
3623 sprstat->sprstat_abandoned_sent = stcb->asoc.strmout[sid].abandoned_sent[0];
3625 sprstat->sprstat_abandoned_unsent = stcb->asoc.strmout[sid].abandoned_unsent[policy];
3626 sprstat->sprstat_abandoned_sent = stcb->asoc.strmout[sid].abandoned_sent[policy];
3629 if ((stcb != NULL) &&
3630 (sid < stcb->asoc.streamoutcnt) &&
3632 sprstat->sprstat_abandoned_unsent = stcb->asoc.strmout[sid].abandoned_unsent[0];
3633 sprstat->sprstat_abandoned_sent = stcb->asoc.strmout[sid].abandoned_sent[0];
3639 if (stcb != NULL) {
3640 SCTP_TCB_UNLOCK(stcb);
3653 SCTP_FIND_STCB(inp, stcb, sprstat->sprstat_assoc_id);
3656 if ((stcb != NULL) &&
3661 sprstat->sprstat_abandoned_unsent = stcb->asoc.abandoned_unsent[0];
3662 sprstat->sprstat_abandoned_sent = stcb->asoc.abandoned_sent[0];
3664 sprstat->sprstat_abandoned_unsent = stcb->asoc.abandoned_unsent[policy];
3665 sprstat->sprstat_abandoned_sent = stcb->asoc.abandoned_sent[policy];
3671 if (stcb != NULL) {
3672 SCTP_TCB_UNLOCK(stcb);
3684 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3686 if (stcb) {
3687 av->assoc_value = stcb->asoc.max_cwnd;
3688 SCTP_TCB_UNLOCK(stcb);
3724 struct sctp_tcb *stcb = NULL; local
3873 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3875 if (stcb) {
3878 SCTP_TCB_UNLOCK(stcb);
3920 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3921 if (stcb) {
3922 stcb->asoc.sctp_cmt_on_off = av->assoc_value;
3923 SCTP_TCB_UNLOCK(stcb);
3938 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
3939 SCTP_TCB_LOCK(stcb);
3940 stcb->asoc.sctp_cmt_on_off = av->assoc_value;
3941 SCTP_TCB_UNLOCK(stcb);
3965 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3966 if (stcb) {
3967 stcb->asoc.cc_functions = sctp_cc_functions[av->assoc_value];
3968 stcb->asoc.congestion_control_module = av->assoc_value;
3969 if (stcb->asoc.cc_functions.sctp_set_initial_cc_param != NULL) {
3970 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
3971 stcb->asoc.cc_functions.sctp_set_initial_cc_param(stcb, net);
3974 SCTP_TCB_UNLOCK(stcb);
3989 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
3990 SCTP_TCB_LOCK(stcb);
3991 stcb->asoc.cc_functions = sctp_cc_functions[av->assoc_value];
3992 stcb->asoc.congestion_control_module = av->assoc_value;
3993 if (stcb->asoc.cc_functions.sctp_set_initial_cc_param != NULL) {
3994 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
3995 stcb->asoc.cc_functions.sctp_set_initial_cc_param(stcb, net);
3998 SCTP_TCB_UNLOCK(stcb);
4010 SCTP_FIND_STCB(inp, stcb, cc_opt->aid_value.assoc_id);
4011 if (stcb == NULL) {
4015 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4016 SCTP_TCB_LOCK(stcb);
4017 if (stcb->asoc.cc_functions.sctp_cwnd_socket_option) {
4018 (*stcb->asoc.cc_functions.sctp_cwnd_socket_option) (stcb, 1, cc_opt);
4020 SCTP_TCB_UNLOCK(stcb);
4027 if (stcb->asoc.cc_functions.sctp_cwnd_socket_option == NULL) {
4030 error = (*stcb->asoc.cc_functions.sctp_cwnd_socket_option) (stcb, 1,
4033 SCTP_TCB_UNLOCK(stcb);
4052 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4053 if (stcb) {
4054 stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, true);
4055 stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value];
4056 stcb->asoc.stream_scheduling_module = av->assoc_value;
4057 stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc);
4058 SCTP_TCB_UNLOCK(stcb);
4073 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4074 SCTP_TCB_LOCK(stcb);
4075 stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, true);
4076 stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value];
4077 stcb->asoc.stream_scheduling_module = av->assoc_value;
4078 stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc);
4079 SCTP_TCB_UNLOCK(stcb);
4091 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4092 if (stcb) {
4093 if ((av->stream_id >= stcb->asoc.streamoutcnt) ||
4094 … (stcb->asoc.ss_functions.sctp_ss_set_value(stcb, &stcb->asoc, &stcb->asoc.strmout[av->stream_id],
4099 SCTP_TCB_UNLOCK(stcb);
4104 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4105 SCTP_TCB_LOCK(stcb);
4106 if (av->stream_id < stcb->asoc.streamoutcnt) {
4107 stcb->asoc.ss_functions.sctp_ss_set_value(stcb,
4108 &stcb->asoc,
4109 &stcb->asoc.strmout[av->stream_id],
4112 SCTP_TCB_UNLOCK(stcb);
4135 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4137 if (stcb) {
4138 stcb->asoc.context = av->assoc_value;
4139 SCTP_TCB_UNLOCK(stcb);
4154 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4155 SCTP_TCB_LOCK(stcb);
4156 stcb->asoc.context = av->assoc_value;
4157 SCTP_TCB_UNLOCK(stcb);
4194 SCTP_FIND_STCB(inp, stcb, sack->sack_assoc_id);
4198 if (stcb != NULL) {
4199 SCTP_TCB_UNLOCK(stcb);
4204 if (stcb) {
4206 stcb->asoc.delayed_ack = sack->sack_delay;
4209 stcb->asoc.sack_freq = sack->sack_freq;
4211 SCTP_TCB_UNLOCK(stcb);
4231 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4232 SCTP_TCB_LOCK(stcb);
4234 stcb->asoc.delayed_ack = sack->sack_delay;
4237 stcb->asoc.sack_freq = sack->sack_freq;
4239 SCTP_TCB_UNLOCK(stcb);
4282 SCTP_FIND_STCB(inp, stcb, sca->sca_assoc_id);
4284 if (stcb) {
4285 shared_keys = &stcb->asoc.shared_keys;
4287 sctp_clear_cachedkeys(stcb, sca->sca_keynumber);
4297 SCTP_TCB_UNLOCK(stcb);
4306 SCTP_TCB_UNLOCK(stcb);
4312 SCTP_TCB_UNLOCK(stcb);
4356 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4357 SCTP_TCB_LOCK(stcb);
4358 shared_keys = &stcb->asoc.shared_keys;
4363 sctp_clear_cachedkeys(stcb, sca->sca_keynumber);
4371 SCTP_TCB_UNLOCK(stcb);
4378 SCTP_TCB_UNLOCK(stcb);
4384 SCTP_TCB_UNLOCK(stcb);
4449 SCTP_FIND_STCB(inp, stcb, scact->scact_assoc_id);
4452 if (stcb) {
4454 if (sctp_auth_setactivekey(stcb,
4461 SCTP_TCB_UNLOCK(stcb);
4479 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4480 SCTP_TCB_LOCK(stcb);
4481 sctp_auth_setactivekey(stcb, scact->scact_keynumber);
4482 SCTP_TCB_UNLOCK(stcb);
4494 SCTP_FIND_STCB(inp, stcb, scdel->scact_assoc_id);
4497 if (stcb) {
4498 if (sctp_delete_sharedkey(stcb, scdel->scact_keynumber)) {
4502 SCTP_TCB_UNLOCK(stcb);
4520 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4521 SCTP_TCB_LOCK(stcb);
4522 sctp_delete_sharedkey(stcb, scdel->scact_keynumber);
4523 SCTP_TCB_UNLOCK(stcb);
4535 SCTP_FIND_STCB(inp, stcb, keyid->scact_assoc_id);
4538 if (stcb) {
4539 if (sctp_deact_sharedkey(stcb, keyid->scact_keynumber)) {
4543 SCTP_TCB_UNLOCK(stcb);
4561 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4562 SCTP_TCB_LOCK(stcb);
4563 sctp_deact_sharedkey(stcb, keyid->scact_keynumber);
4564 SCTP_TCB_UNLOCK(stcb);
4581 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4582 if (stcb) {
4583 stcb->asoc.local_strreset_support = (uint8_t)av->assoc_value;
4584 SCTP_TCB_UNLOCK(stcb);
4599 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4600 SCTP_TCB_LOCK(stcb);
4601 stcb->asoc.local_strreset_support = (uint8_t)av->assoc_value;
4602 SCTP_TCB_UNLOCK(stcb);
4616 SCTP_FIND_STCB(inp, stcb, strrst->srs_assoc_id);
4617 if (stcb == NULL) {
4622 if (stcb->asoc.reconfig_supported == 0) {
4628 SCTP_TCB_UNLOCK(stcb);
4631 if (SCTP_GET_STATE(stcb) != SCTP_STATE_OPEN) {
4634 SCTP_TCB_UNLOCK(stcb);
4640 SCTP_TCB_UNLOCK(stcb);
4645 if (stcb->asoc.stream_reset_outstanding) {
4648 SCTP_TCB_UNLOCK(stcb);
4658 SCTP_TCB_UNLOCK(stcb);
4664 SCTP_TCB_UNLOCK(stcb);
4669 (strrst->srs_stream_list[i] >= stcb->asoc.streamincnt)) {
4675 (strrst->srs_stream_list[i] >= stcb->asoc.streamoutcnt)) {
4682 SCTP_TCB_UNLOCK(stcb);
4692 if (stcb->asoc.strmout[strm].state == SCTP_STREAM_OPEN) {
4693 stcb->asoc.strmout[strm].state = SCTP_STREAM_RESET_PENDING;
4699 for (i = 0, cnt = 0; i < stcb->asoc.streamoutcnt; i++) {
4700 if (stcb->asoc.strmout[i].state == SCTP_STREAM_OPEN) {
4701 stcb->asoc.strmout[i].state = SCTP_STREAM_RESET_PENDING;
4708 error = sctp_send_str_reset_req(stcb, strrst->srs_number_streams,
4712 error = sctp_send_stream_reset_out_if_possible(stcb, SCTP_SO_LOCKED);
4715 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED);
4725 SCTP_TCB_UNLOCK(stcb);
4736 SCTP_FIND_STCB(inp, stcb, stradd->sas_assoc_id);
4737 if (stcb == NULL) {
4742 if (stcb->asoc.reconfig_supported == 0) {
4748 SCTP_TCB_UNLOCK(stcb);
4751 if (SCTP_GET_STATE(stcb) != SCTP_STATE_OPEN) {
4754 SCTP_TCB_UNLOCK(stcb);
4757 if (stcb->asoc.stream_reset_outstanding) {
4760 SCTP_TCB_UNLOCK(stcb);
4772 if ((((int)add_o_strmcnt) + ((int)stcb->asoc.streamoutcnt)) > 0x0000ffff) {
4788 cnt += stcb->asoc.streamincnt;
4794 if (cnt > (int)stcb->asoc.max_inbound_streams) {
4800 error = sctp_send_str_reset_req(stcb, 0, NULL, 0, 0, addstream, add_o_strmcnt, add_i_strmcnt, 0);
4801 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED);
4803 SCTP_TCB_UNLOCK(stcb);
4812 SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t)*value);
4813 if (stcb == NULL) {
4818 if (stcb->asoc.reconfig_supported == 0) {
4824 SCTP_TCB_UNLOCK(stcb);
4827 if (SCTP_GET_STATE(stcb) != SCTP_STATE_OPEN) {
4830 SCTP_TCB_UNLOCK(stcb);
4833 if (stcb->asoc.stream_reset_outstanding) {
4836 SCTP_TCB_UNLOCK(stcb);
4843 if (!TAILQ_EMPTY(&stcb->asoc.send_queue) ||
4844 !TAILQ_EMPTY(&stcb->asoc.sent_queue)) {
4848 SCTP_TCB_UNLOCK(stcb);
4852 for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
4853 if (!TAILQ_EMPTY(&stcb->asoc.strmout[i].outqueue)) {
4857 error = sctp_send_str_reset_req(stcb, 0, NULL, 0, 1, 0, 0, 0, 0);
4858 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED);
4859 SCTP_TCB_UNLOCK(stcb);
4888 stcb = LIST_FIRST(&inp->sctp_asoc_list);
4889 if (stcb) {
4890 SCTP_TCB_LOCK(stcb);
4902 stcb = sctp_findassociation_ep_addr(&inp, sa, NULL, NULL, NULL);
4903 if (stcb == NULL) {
4908 if (stcb == NULL) {
4913 if (stcb->asoc.delayed_connection == 1) {
4914 stcb->asoc.delayed_connection = 0;
4915 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
4916 sctp_timer_stop(SCTP_TIMER_TYPE_INIT, inp, stcb,
4917 stcb->asoc.primary_destination,
4919 sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED);
4928 SCTP_TCB_UNLOCK(stcb);
4936 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4938 if (stcb) {
4939 stcb->asoc.max_burst = av->assoc_value;
4940 SCTP_TCB_UNLOCK(stcb);
4955 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4956 SCTP_TCB_LOCK(stcb);
4957 stcb->asoc.max_burst = av->assoc_value;
4958 SCTP_TCB_UNLOCK(stcb);
4970 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4972 if (stcb) {
4973 stcb->asoc.sctp_frag_point = av->assoc_value;
4974 SCTP_TCB_UNLOCK(stcb);
5063 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
5064 SCTP_TCB_LOCK(stcb);
5066 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVASSOCEVNT);
5068 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVASSOCEVNT);
5071 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVPADDREVNT);
5073 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVPADDREVNT);
5076 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT);
5078 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT);
5081 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVPEERERR);
5083 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVPEERERR);
5086 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT);
5088 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT);
5091 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_PDAPIEVNT);
5093 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_PDAPIEVNT);
5096 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_ADAPTATIONEVNT);
5098 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_ADAPTATIONEVNT);
5101 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_AUTHEVNT);
5103 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_AUTHEVNT);
5106 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_DRYEVNT);
5108 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_DRYEVNT);
5111 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_STREAM_RESETEVNT);
5113 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_STREAM_RESETEVNT);
5115 SCTP_TCB_UNLOCK(stcb);
5124 stcb = LIST_FIRST(&inp->sctp_asoc_list);
5125 if (stcb != NULL) {
5126 SCTP_TCB_LOCK(stcb);
5127 if (TAILQ_EMPTY(&stcb->asoc.send_queue) &&
5128 TAILQ_EMPTY(&stcb->asoc.sent_queue) &&
5129 (stcb->asoc.stream_queue_cnt == 0)) {
5130 sctp_ulp_notify(SCTP_NOTIFY_SENDER_DRY, stcb, 0, NULL, SCTP_SO_LOCKED);
5132 SCTP_TCB_UNLOCK(stcb);
5167 SCTP_FIND_STCB(inp, stcb, s_info->sinfo_assoc_id);
5169 if (stcb) {
5170 if (s_info->sinfo_stream < stcb->asoc.streamoutcnt) {
5171 memcpy(&stcb->asoc.def_send, s_info, min(optsize, sizeof(stcb->asoc.def_send)));
5176 SCTP_TCB_UNLOCK(stcb);
5191 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
5192 SCTP_TCB_LOCK(stcb);
5193 if (s_info->sinfo_stream < stcb->asoc.streamoutcnt) {
5194 memcpy(&stcb->asoc.def_send, s_info, min(optsize, sizeof(stcb->asoc.def_send)));
5196 SCTP_TCB_UNLOCK(stcb);
5213 SCTP_FIND_STCB(inp, stcb, paddrp->spp_assoc_id);
5232 if (stcb != NULL) {
5233 net = sctp_findnet(stcb, addr);
5244 stcb = sctp_findassociation_ep_addr(&inp, addr,
5246 if (stcb == NULL) {
5250 if ((stcb != NULL) && (net == NULL)) {
5258 SCTP_TCB_UNLOCK(stcb);
5271 SCTP_TCB_UNLOCK(stcb);
5279 SCTP_TCB_UNLOCK(stcb);
5286 if (stcb)
5287 SCTP_TCB_UNLOCK(stcb);
5293 if (stcb)
5294 SCTP_TCB_UNLOCK(stcb);
5302 if (stcb)
5303 SCTP_TCB_UNLOCK(stcb);
5308 if (stcb != NULL) {
5315 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net,
5326 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net,
5328 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
5332 if (SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) {
5333 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
5334 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED);
5335 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
5340 sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net,
5360 if (net->mtu < stcb->asoc.smallest_mtu) {
5361 sctp_pathmtu_adjustment(stcb, net->mtu, true);
5367 sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net);
5380 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
5382 stcb->sctp_ep, stcb, net,
5384 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
5390 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
5395 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
5415 stcb->asoc.def_net_failure = paddrp->spp_pathmaxrxt;
5416 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5425 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
5427 stcb->sctp_ep, stcb, net,
5429 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
5435 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
5440 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
5448 stcb->asoc.heart_beat_delay = paddrp->spp_hbinterval;
5450 stcb->asoc.heart_beat_delay = 0;
5453 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5462 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net,
5464 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
5466 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_DONOT_HEARTBEAT);
5469 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5474 inp, stcb, net,
5479 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_DONOT_HEARTBEAT);
5482 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5484 sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net,
5504 if (net->mtu < stcb->asoc.smallest_mtu) {
5505 sctp_pathmtu_adjustment(stcb, net->mtu, true);
5510 stcb->asoc.default_mtu = paddrp->spp_pathmtu;
5512 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD);
5515 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5517 sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net);
5521 stcb->asoc.default_mtu = 0;
5522 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD);
5525 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5529 stcb->asoc.default_dscp = paddrp->spp_dscp & 0xfc;
5530 stcb->asoc.default_dscp |= 0x01;
5534 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5540 stcb->asoc.default_flowlabel = paddrp->spp_ipv6_flowlabel & 0x000fffff;
5541 stcb->asoc.default_flowlabel |= 0x80000000;
5545 SCTP_TCB_UNLOCK(stcb);
5615 SCTP_FIND_STCB(inp, stcb, srto->srto_assoc_id);
5617 if (stcb) {
5621 new_init = stcb->asoc.initial_rto;
5625 new_max = stcb->asoc.maxrto;
5629 new_min = stcb->asoc.minrto;
5631 stcb->asoc.initial_rto = new_init;
5632 stcb->asoc.maxrto = new_max;
5633 stcb->asoc.minrto = new_min;
5638 SCTP_TCB_UNLOCK(stcb);
5678 SCTP_FIND_STCB(inp, stcb, sasoc->sasoc_assoc_id);
5688 if (stcb) {
5690 stcb->asoc.max_send_times = sasoc->sasoc_asocmaxrxt;
5693 stcb->asoc.cookie_life = sctp_msecs_to_ticks(sasoc->sasoc_cookie_life);
5695 SCTP_TCB_UNLOCK(stcb);
5746 SCTP_FIND_STCB(inp, stcb, spa->ssp_assoc_id);
5765 if (stcb != NULL) {
5766 net = sctp_findnet(stcb, addr);
5777 stcb = sctp_findassociation_ep_addr(&inp, addr,
5779 if (stcb == NULL) {
5784 if ((stcb != NULL) && (net != NULL)) {
5785 if (net != stcb->asoc.primary_destination) {
5788 if (sctp_set_primary_addr(stcb, (struct sockaddr *)NULL, net) == 0) {
5789 if ((stcb->asoc.alternate) &&
5792 sctp_free_remote_addr(stcb->asoc.alternate);
5793 stcb->asoc.alternate = NULL;
5808 if (stcb != NULL) {
5809 SCTP_TCB_UNLOCK(stcb);
5836 SCTP_FIND_STCB(inp, stcb, sspp->sspp_assoc_id);
5837 if (stcb != NULL) {
5857 ifa = sctp_find_ifa_by_addr(addr, stcb->asoc.vrf_id, SCTP_ADDR_NOT_LOCKED);
5877 if ((sctp_is_addr_restricted(stcb, laddr->ifa)) &&
5878 (!sctp_is_addr_pending(stcb, laddr->ifa))) {
5929 if (sctp_set_primary_ip_address_sa(stcb, addr) != 0) {
5933 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED);
5935 SCTP_TCB_UNLOCK(stcb);
5958 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
5974 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
6003 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
6019 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
6037 SCTP_FIND_STCB(inp, stcb, event->se_assoc_id);
6090 if (stcb) {
6092 sctp_stcb_feature_on(inp, stcb, event_type);
6094 if (TAILQ_EMPTY(&stcb->asoc.send_queue) &&
6095 TAILQ_EMPTY(&stcb->asoc.sent_queue) &&
6096 (stcb->asoc.stream_queue_cnt == 0)) {
6097 sctp_ulp_notify(SCTP_NOTIFY_SENDER_DRY, stcb, 0, NULL, SCTP_SO_LOCKED);
6101 sctp_stcb_feature_off(inp, stcb, event_type);
6103 SCTP_TCB_UNLOCK(stcb);
6135 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
6136 SCTP_TCB_LOCK(stcb);
6138 sctp_stcb_feature_on(inp, stcb, event_type);
6140 sctp_stcb_feature_off(inp, stcb, event_type);
6142 SCTP_TCB_UNLOCK(stcb);
6148 if (stcb) {
6149 SCTP_TCB_UNLOCK(stcb);
6188 SCTP_FIND_STCB(inp, stcb, info->snd_assoc_id);
6190 if (stcb) {
6191 if (info->snd_sid < stcb->asoc.streamoutcnt) {
6192 stcb->asoc.def_send.sinfo_stream = info->snd_sid;
6193 policy = PR_SCTP_POLICY(stcb->asoc.def_send.sinfo_flags);
6194 stcb->asoc.def_send.sinfo_flags = info->snd_flags;
6195 stcb->asoc.def_send.sinfo_flags |= policy;
6196 stcb->asoc.def_send.sinfo_ppid = info->snd_ppid;
6197 stcb->asoc.def_send.sinfo_context = info->snd_context;
6202 SCTP_TCB_UNLOCK(stcb);
6222 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
6223 SCTP_TCB_LOCK(stcb);
6224 if (info->snd_sid < stcb->asoc.streamoutcnt) {
6225 stcb->asoc.def_send.sinfo_stream = info->snd_sid;
6226 policy = PR_SCTP_POLICY(stcb->asoc.def_send.sinfo_flags);
6227 stcb->asoc.def_send.sinfo_flags = info->snd_flags;
6228 stcb->asoc.def_send.sinfo_flags |= policy;
6229 stcb->asoc.def_send.sinfo_ppid = info->snd_ppid;
6230 stcb->asoc.def_send.sinfo_context = info->snd_context;
6232 SCTP_TCB_UNLOCK(stcb);
6244 SCTP_FIND_STCB(inp, stcb, info->pr_assoc_id);
6247 if (stcb) {
6248 SCTP_TCB_UNLOCK(stcb);
6254 if (stcb) {
6255 stcb->asoc.def_send.sinfo_flags &= 0xfff0;
6256 stcb->asoc.def_send.sinfo_flags |= info->pr_policy;
6257 stcb->asoc.def_send.sinfo_timetolive = info->pr_value;
6258 SCTP_TCB_UNLOCK(stcb);
6275 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
6276 SCTP_TCB_LOCK(stcb);
6277 stcb->asoc.def_send.sinfo_flags &= 0xfff0;
6278 stcb->asoc.def_send.sinfo_flags |= info->pr_policy;
6279 stcb->asoc.def_send.sinfo_timetolive = info->pr_value;
6280 SCTP_TCB_UNLOCK(stcb);
6298 SCTP_FIND_STCB(inp, stcb, thlds->spt_assoc_id);
6317 if (stcb != NULL) {
6318 net = sctp_findnet(stcb, addr);
6329 stcb = sctp_findassociation_ep_addr(&inp, addr,
6331 if (stcb == NULL) {
6335 if ((stcb != NULL) && (net == NULL)) {
6343 SCTP_TCB_UNLOCK(stcb);
6356 SCTP_TCB_UNLOCK(stcb);
6364 SCTP_TCB_UNLOCK(stcb);
6370 if (stcb != NULL) {
6371 SCTP_TCB_UNLOCK(stcb);
6377 if (stcb != NULL) {
6390 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
6392 stcb->sctp_ep, stcb, net,
6394 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
6400 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
6405 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
6409 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
6421 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
6423 stcb->sctp_ep, stcb, net,
6425 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
6431 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
6436 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
6440 stcb->asoc.def_net_failure = thlds->spt_pathmaxrxt;
6441 stcb->asoc.def_net_pf_threshold = thlds->spt_pathpfthld;
6443 SCTP_TCB_UNLOCK(stcb);
6470 SCTP_FIND_STCB(inp, stcb, encaps->sue_assoc_id);
6489 if (stcb != NULL) {
6490 net = sctp_findnet(stcb, addr);
6501 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
6502 if (stcb == NULL) {
6506 if ((stcb != NULL) && (net == NULL)) {
6514 SCTP_TCB_UNLOCK(stcb);
6527 SCTP_TCB_UNLOCK(stcb);
6535 SCTP_TCB_UNLOCK(stcb);
6541 if (stcb != NULL) {
6545 stcb->asoc.port = encaps->sue_port;
6547 SCTP_TCB_UNLOCK(stcb);
6568 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6570 if (stcb) {
6573 SCTP_TCB_UNLOCK(stcb);
6598 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6600 if (stcb) {
6603 SCTP_TCB_UNLOCK(stcb);
6628 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6630 if (stcb) {
6633 SCTP_TCB_UNLOCK(stcb);
6668 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6670 if (stcb) {
6673 SCTP_TCB_UNLOCK(stcb);
6716 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6718 if (stcb) {
6721 SCTP_TCB_UNLOCK(stcb);
6746 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6748 if (stcb) {
6751 SCTP_TCB_UNLOCK(stcb);
6776 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6778 if (stcb) {
6781 SCTP_TCB_UNLOCK(stcb);
6807 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6809 if (stcb) {
6810 stcb->asoc.max_cwnd = av->assoc_value;
6811 if (stcb->asoc.max_cwnd > 0) {
6812 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
6813 if ((net->cwnd > stcb->asoc.max_cwnd) &&
6815 net->cwnd = stcb->asoc.max_cwnd;
6822 SCTP_TCB_UNLOCK(stcb);
6946 struct sctp_tcb *stcb = NULL; local
7035 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EADDRINUSE);
7041 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7050 stcb = sctp_findassociation_ep_addr(&inp, addr, NULL, NULL, NULL);
7051 if (stcb == NULL) {
7054 SCTP_TCB_UNLOCK(stcb);
7057 if (stcb != NULL) {
7066 stcb = sctp_aloc_assoc_connected(inp, addr, &error, 0, 0, vrf_id,
7070 if (stcb == NULL) {
7074 SCTP_SET_STATE(stcb, SCTP_STATE_COOKIE_WAIT);
7075 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
7077 sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED);
7078 SCTP_TCB_UNLOCK(stcb);
7271 struct sctp_tcb *stcb; local
7294 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7295 if (stcb == NULL) {
7300 SCTP_TCB_LOCK(stcb);
7301 store = stcb->asoc.primary_destination->ro._l_addr;
7302 SCTP_CLEAR_SUBSTATE(stcb, SCTP_STATE_IN_ACCEPT_QUEUE);
7327 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
7328 sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC,
7331 SCTP_TCB_UNLOCK(stcb);
7386 struct sctp_tcb *stcb; local
7391 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7392 if (stcb == NULL) {
7397 SCTP_TCB_LOCK(stcb);
7398 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
7411 SCTP_TCB_UNLOCK(stcb);
7417 stcb,
7424 SCTP_TCB_UNLOCK(stcb);
7464 struct sctp_tcb *stcb; local
7480 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7481 if (stcb) {
7482 SCTP_TCB_LOCK(stcb);
7485 if (stcb == NULL) {
7490 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
7494 sin->sin_port = stcb->rport;
7499 SCTP_TCB_UNLOCK(stcb);