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
373 stcb = sctp_findassociation_addr_sa(sintosa(&addrs[1]), in sctp_getcred()
376 if (stcb == NULL || inp == NULL || inp->sctp_socket == NULL) { in sctp_getcred()
377 if ((inp != NULL) && (stcb == NULL)) { in sctp_getcred()
388 SCTP_TCB_UNLOCK(stcb); in sctp_getcred()
656 struct sctp_tcb *stcb; in sctp_disconnect() local
667 stcb = LIST_FIRST(&inp->sctp_asoc_list); in sctp_disconnect()
668 if (stcb == NULL) { in sctp_disconnect()
673 SCTP_TCB_LOCK(stcb); in sctp_disconnect()
674 asoc = &stcb->asoc; in sctp_disconnect()
677 SCTP_TCB_UNLOCK(stcb); in sctp_disconnect()
684 if (SCTP_GET_STATE(stcb) != SCTP_STATE_COOKIE_WAIT) { in sctp_disconnect()
689 sctp_send_abort_tcb(stcb, op_err, SCTP_SO_LOCKED); in sctp_disconnect()
693 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || in sctp_disconnect()
694 (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_RECEIVED)) { in sctp_disconnect()
697 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, in sctp_disconnect()
707 if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { in sctp_disconnect()
710 if ((SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_SENT) && in sctp_disconnect()
711 (SCTP_GET_STATE(stcb) != SCTP_STATE_SHUTDOWN_ACK_SENT)) { in sctp_disconnect()
715 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || in sctp_disconnect()
716 (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_RECEIVED)) { in sctp_disconnect()
719 SCTP_SET_STATE(stcb, SCTP_STATE_SHUTDOWN_SENT); in sctp_disconnect()
720 sctp_stop_timers_for_shutdown(stcb); in sctp_disconnect()
721 if (stcb->asoc.alternate) { in sctp_disconnect()
722 netp = stcb->asoc.alternate; in sctp_disconnect()
724 netp = stcb->asoc.primary_destination; in sctp_disconnect()
726 sctp_send_shutdown(stcb, netp); in sctp_disconnect()
728 stcb->sctp_ep, stcb, netp); in sctp_disconnect()
730 stcb->sctp_ep, stcb, NULL); in sctp_disconnect()
731 sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_CLOSING, SCTP_SO_LOCKED); in sctp_disconnect()
743 SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_SHUTDOWN_PENDING); in sctp_disconnect()
744 if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { in sctp_disconnect()
745 SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_PARTIAL_MSG_LEFT); in sctp_disconnect()
754 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_4; in sctp_disconnect()
755 sctp_send_abort_tcb(stcb, op_err, SCTP_SO_LOCKED); in sctp_disconnect()
757 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) || in sctp_disconnect()
758 (SCTP_GET_STATE(stcb) == SCTP_STATE_SHUTDOWN_RECEIVED)) { in sctp_disconnect()
762 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC, in sctp_disconnect()
767 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CLOSING, SCTP_SO_LOCKED); in sctp_disconnect()
772 SCTP_TCB_UNLOCK(stcb); in sctp_disconnect()
781 struct sctp_tcb *stcb; in sctp_flush() local
808 stcb = LIST_FIRST(&inp->sctp_asoc_list); in sctp_flush()
809 if (stcb != NULL) { in sctp_flush()
810 SCTP_TCB_LOCK(stcb); in sctp_flush()
822 sctp_sbfree(control, control->stcb, &so->so_rcv, m); in sctp_flush()
830 sctp_free_a_readq(stcb, control); in sctp_flush()
832 stcb->asoc.size_on_all_streams += control->length; in sctp_flush()
837 if (need_to_abort && (stcb != NULL)) { in sctp_flush()
842 sctp_abort_an_association(inp, stcb, op_err, false, SCTP_SO_LOCKED); in sctp_flush()
846 if (stcb != NULL) { in sctp_flush()
847 SCTP_TCB_UNLOCK(stcb); in sctp_flush()
882 struct sctp_tcb *stcb; in sctp_shutdown() local
893 stcb = LIST_FIRST(&inp->sctp_asoc_list); in sctp_shutdown()
894 if (stcb == NULL) { in sctp_shutdown()
903 SCTP_TCB_LOCK(stcb); in sctp_shutdown()
904 asoc = &stcb->asoc; in sctp_shutdown()
906 SCTP_TCB_UNLOCK(stcb); in sctp_shutdown()
910 if ((SCTP_GET_STATE(stcb) != SCTP_STATE_COOKIE_WAIT) && in sctp_shutdown()
911 (SCTP_GET_STATE(stcb) != SCTP_STATE_COOKIE_ECHOED) && in sctp_shutdown()
912 (SCTP_GET_STATE(stcb) != SCTP_STATE_OPEN)) { in sctp_shutdown()
917 SCTP_TCB_UNLOCK(stcb); in sctp_shutdown()
922 if (stcb->asoc.alternate) { in sctp_shutdown()
923 netp = stcb->asoc.alternate; in sctp_shutdown()
925 netp = stcb->asoc.primary_destination; in sctp_shutdown()
927 if ((SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) && in sctp_shutdown()
931 if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { in sctp_shutdown()
936 SCTP_SET_STATE(stcb, SCTP_STATE_SHUTDOWN_SENT); in sctp_shutdown()
937 sctp_stop_timers_for_shutdown(stcb); in sctp_shutdown()
938 sctp_send_shutdown(stcb, netp); in sctp_shutdown()
940 stcb->sctp_ep, stcb, netp); in sctp_shutdown()
942 stcb->sctp_ep, stcb, NULL); in sctp_shutdown()
948 SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_SHUTDOWN_PENDING); in sctp_shutdown()
949 if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { in sctp_shutdown()
950 SCTP_ADD_SUBSTATE(stcb, SCTP_STATE_PARTIAL_MSG_LEFT); in sctp_shutdown()
959 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6; in sctp_shutdown()
961 sctp_abort_an_association(stcb->sctp_ep, stcb, in sctp_shutdown()
971 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CLOSING, SCTP_SO_LOCKED); in sctp_shutdown()
972 SCTP_TCB_UNLOCK(stcb); in sctp_shutdown()
998 struct sctp_tcb *stcb, in sctp_fill_up_addresses_vrf() argument
1020 if (stcb) { in sctp_fill_up_addresses_vrf()
1022 loopback_scope = stcb->asoc.scope.loopback_scope; in sctp_fill_up_addresses_vrf()
1024 ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope; in sctp_fill_up_addresses_vrf()
1025 ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal; in sctp_fill_up_addresses_vrf()
1028 local_scope = stcb->asoc.scope.local_scope; in sctp_fill_up_addresses_vrf()
1029 site_scope = stcb->asoc.scope.site_scope; in sctp_fill_up_addresses_vrf()
1030 ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal; in sctp_fill_up_addresses_vrf()
1074 if (stcb) { in sctp_fill_up_addresses_vrf()
1083 if (sctp_is_addr_restricted(stcb, in sctp_fill_up_addresses_vrf()
1199 if (stcb) { in sctp_fill_up_addresses_vrf()
1200 if (sctp_is_addr_restricted(stcb, laddr->ifa)) { in sctp_fill_up_addresses_vrf()
1234 struct sctp_tcb *stcb, in sctp_fill_up_addresses() argument
1242 size = sctp_fill_up_addresses_vrf(inp, stcb, limit, addr, in sctp_fill_up_addresses()
1345 struct sctp_tcb *stcb = NULL; in sctp_do_connect_x() local
1356 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EADDRINUSE); in sctp_do_connect_x()
1362 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); in sctp_do_connect_x()
1368 stcb = LIST_FIRST(&inp->sctp_asoc_list); in sctp_do_connect_x()
1371 if (stcb) { in sctp_do_connect_x()
1372 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY); in sctp_do_connect_x()
1380 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EFAULT); in sctp_do_connect_x()
1408 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); in sctp_do_connect_x()
1426 stcb = sctp_aloc_assoc_connected(inp, sa, &error, 0, 0, vrf_id, in sctp_do_connect_x()
1431 if (stcb == NULL) { in sctp_do_connect_x()
1435 SCTP_SET_STATE(stcb, SCTP_STATE_COOKIE_WAIT); in sctp_do_connect_x()
1453 sctp_connectx_helper_add(stcb, sa, (totaddr - 1), &error); in sctp_do_connect_x()
1459 *a_id = sctp_get_associd(stcb); in sctp_do_connect_x()
1463 stcb->asoc.delayed_connection = 1; in sctp_do_connect_x()
1464 sctp_timer_start(SCTP_TIMER_TYPE_INIT, inp, stcb, stcb->asoc.primary_destination); in sctp_do_connect_x()
1466 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); in sctp_do_connect_x()
1467 sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED); in sctp_do_connect_x()
1469 SCTP_TCB_UNLOCK(stcb); in sctp_do_connect_x()
1478 #define SCTP_FIND_STCB(inp, stcb, assoc_id) { \ argument
1482 stcb = LIST_FIRST(&inp->sctp_asoc_list); \
1483 if (stcb) { \
1484 SCTP_TCB_LOCK(stcb); \
1488 stcb = sctp_findassociation_ep_asocid(inp, assoc_id, 1); \
1489 if (stcb == NULL) { \
1495 stcb = NULL; \
1515 struct sctp_tcb *stcb = NULL; local
1647 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1649 if (stcb) {
1650 av->assoc_value = stcb->asoc.idata_supported;
1651 SCTP_TCB_UNLOCK(stcb);
1679 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1680 if (stcb) {
1681 av->assoc_value = stcb->asoc.sctp_cmt_on_off;
1682 SCTP_TCB_UNLOCK(stcb);
1706 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1707 if (stcb) {
1708 av->assoc_value = stcb->asoc.congestion_control_module;
1709 SCTP_TCB_UNLOCK(stcb);
1733 SCTP_FIND_STCB(inp, stcb, cc_opt->aid_value.assoc_id);
1734 if (stcb == NULL) {
1737 if (stcb->asoc.cc_functions.sctp_cwnd_socket_option == NULL) {
1740 error = (*stcb->asoc.cc_functions.sctp_cwnd_socket_option) (stcb, 0, cc_opt);
1743 SCTP_TCB_UNLOCK(stcb);
1752 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1753 if (stcb) {
1754 av->assoc_value = stcb->asoc.stream_scheduling_module;
1755 SCTP_TCB_UNLOCK(stcb);
1779 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1780 if (stcb) {
1781 if ((av->stream_id >= stcb->asoc.streamoutcnt) ||
1782 … (stcb->asoc.ss_functions.sctp_ss_get_value(stcb, &stcb->asoc, &stcb->asoc.strmout[av->stream_id],
1789 SCTP_TCB_UNLOCK(stcb);
1839 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
1864 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
1866 ids->gaids_assoc_id[at++] = sctp_get_associd(stcb);
1890 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1892 if (stcb) {
1893 av->assoc_value = stcb->asoc.context;
1894 SCTP_TCB_UNLOCK(stcb);
1927 SCTP_FIND_STCB(inp, stcb, id->assoc_id);
1928 if (stcb == NULL) {
1932 id->assoc_value = stcb->asoc.vrf_id;
1933 SCTP_TCB_UNLOCK(stcb);
1949 SCTP_FIND_STCB(inp, stcb, gnv->gn_assoc_id);
1951 if (stcb) {
1952 gnv->gn_peers_tag = stcb->asoc.peer_vtag;
1953 gnv->gn_local_tag = stcb->asoc.my_vtag;
1954 SCTP_TCB_UNLOCK(stcb);
1967 SCTP_FIND_STCB(inp, stcb, sack->sack_assoc_id);
1968 if (stcb) {
1969 sack->sack_delay = stcb->asoc.delayed_ack;
1970 sack->sack_freq = stcb->asoc.sack_freq;
1971 SCTP_TCB_UNLOCK(stcb);
1996 SCTP_FIND_STCB(inp, stcb, ss->ss_assoc_id);
1998 if (stcb) {
1999 ss->ss_total_sndbuf = stcb->asoc.total_output_queue_size;
2000 ss->ss_total_recv_buf = (stcb->asoc.size_on_reasm_queue +
2001 stcb->asoc.size_on_all_streams);
2002 SCTP_TCB_UNLOCK(stcb);
2015 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
2017 if (stcb) {
2018 av->assoc_value = stcb->asoc.max_burst;
2019 SCTP_TCB_UNLOCK(stcb);
2043 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
2045 if (stcb) {
2046 av->assoc_value = stcb->asoc.sctp_frag_point;
2047 SCTP_TCB_UNLOCK(stcb);
2154 SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t)*value);
2156 if (stcb != NULL) {
2159 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
2183 SCTP_TCB_UNLOCK(stcb);
2209 SCTP_FIND_STCB(inp, stcb, saddr->sget_assoc_id);
2211 if (stcb != NULL) {
2216 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
2259 ((struct sockaddr_in *)addr)->sin_port = stcb->rport;
2265 SCTP_TCB_UNLOCK(stcb);
2283 SCTP_FIND_STCB(inp, stcb, saddr->sget_assoc_id);
2291 actual = sctp_fill_up_addresses(inp, stcb, limit, &saddr->addr[0].sa);
2294 if (stcb != NULL) {
2295 SCTP_TCB_UNLOCK(stcb);
2309 SCTP_FIND_STCB(inp, stcb, paddrp->spp_assoc_id);
2328 if (stcb != NULL) {
2329 net = sctp_findnet(stcb, addr);
2340 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
2341 if (stcb == NULL) {
2345 if ((stcb != NULL) && (net == NULL)) {
2353 SCTP_TCB_UNLOCK(stcb);
2366 SCTP_TCB_UNLOCK(stcb);
2374 SCTP_TCB_UNLOCK(stcb);
2380 if (stcb != NULL) {
2429 paddrp->spp_pathmaxrxt = stcb->asoc.def_net_failure;
2430 paddrp->spp_pathmtu = stcb->asoc.default_mtu;
2431 if (stcb->asoc.default_dscp & 0x01) {
2432 paddrp->spp_dscp = stcb->asoc.default_dscp & 0xfc;
2436 if (stcb->asoc.default_flowlabel & 0x80000000) {
2437 paddrp->spp_ipv6_flowlabel = stcb->asoc.default_flowlabel & 0x000fffff;
2442 if (sctp_stcb_is_feature_on(inp, stcb, SCTP_PCB_FLAGS_DONOT_HEARTBEAT)) {
2447 if (sctp_stcb_is_feature_on(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD)) {
2452 paddrp->spp_hbinterval = stcb->asoc.heart_beat_delay;
2454 paddrp->spp_assoc_id = sctp_get_associd(stcb);
2455 SCTP_TCB_UNLOCK(stcb);
2511 SCTP_FIND_STCB(inp, stcb, paddri->spinfo_assoc_id);
2530 if (stcb != NULL) {
2531 net = sctp_findnet(stcb, addr);
2542 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
2543 if (stcb == NULL) {
2548 if ((stcb != NULL) && (net != NULL)) {
2562 paddri->spinfo_assoc_id = sctp_get_associd(stcb);
2578 SCTP_TCB_UNLOCK(stcb);
2581 if (stcb != NULL) {
2582 SCTP_TCB_UNLOCK(stcb);
2604 SCTP_FIND_STCB(inp, stcb, sstat->sstat_assoc_id);
2606 if (stcb == NULL) {
2611 sstat->sstat_state = sctp_map_assoc_state(stcb->asoc.state);
2612 sstat->sstat_assoc_id = sctp_get_associd(stcb);
2613 sstat->sstat_rwnd = stcb->asoc.peers_rwnd;
2614 sstat->sstat_unackdata = stcb->asoc.sent_queue_cnt;
2619 sstat->sstat_penddata = (stcb->asoc.cnt_on_reasm_queue +
2620 stcb->asoc.cnt_on_all_streams);
2621 sstat->sstat_instrms = stcb->asoc.streamincnt;
2622 sstat->sstat_outstrms = stcb->asoc.streamoutcnt;
2623 sstat->sstat_fragmentation_point = sctp_get_frag_point(stcb);
2624 net = stcb->asoc.primary_destination;
2629 ((struct sockaddr_in *)&sstat->sstat_primary.spinfo_address)->sin_port = stcb->rport;
2649 switch (stcb->asoc.primary_destination->ro._l_addr.sa.sa_family) {
2666 sstat->sstat_primary.spinfo_assoc_id = sctp_get_associd(stcb);
2667 SCTP_TCB_UNLOCK(stcb);
2676 SCTP_FIND_STCB(inp, stcb, srto->srto_assoc_id);
2678 if (stcb) {
2679 srto->srto_initial = stcb->asoc.initial_rto;
2680 srto->srto_max = stcb->asoc.maxrto;
2681 srto->srto_min = stcb->asoc.minrto;
2682 SCTP_TCB_UNLOCK(stcb);
2708 SCTP_FIND_STCB(inp, stcb, stimo->stimo_assoc_id);
2710 if (stcb) {
2711 stimo->stimo_init = stcb->asoc.timoinit;
2712 stimo->stimo_data = stcb->asoc.timodata;
2713 stimo->stimo_sack = stcb->asoc.timosack;
2714 stimo->stimo_shutdown = stcb->asoc.timoshutdown;
2715 stimo->stimo_heartbeat = stcb->asoc.timoheartbeat;
2716 stimo->stimo_cookie = stcb->asoc.timocookie;
2717 stimo->stimo_shutdownack = stcb->asoc.timoshutdownack;
2718 SCTP_TCB_UNLOCK(stcb);
2731 SCTP_FIND_STCB(inp, stcb, sasoc->sasoc_assoc_id);
2733 if (stcb) {
2734 sasoc->sasoc_cookie_life = sctp_ticks_to_msecs(stcb->asoc.cookie_life);
2735 sasoc->sasoc_asocmaxrxt = stcb->asoc.max_send_times;
2736 sasoc->sasoc_number_peer_destinations = stcb->asoc.numnets;
2737 sasoc->sasoc_peer_rwnd = stcb->asoc.peers_rwnd;
2738 sasoc->sasoc_local_rwnd = stcb->asoc.my_rwnd;
2739 SCTP_TCB_UNLOCK(stcb);
2767 SCTP_FIND_STCB(inp, stcb, s_info->sinfo_assoc_id);
2769 if (stcb) {
2770 memcpy(s_info, &stcb->asoc.def_send, sizeof(stcb->asoc.def_send));
2771 SCTP_TCB_UNLOCK(stcb);
2810 SCTP_FIND_STCB(inp, stcb, ssp->ssp_assoc_id);
2812 if (stcb) {
2815 addr = &stcb->asoc.primary_destination->ro._l_addr;
2839 SCTP_TCB_UNLOCK(stcb);
2887 SCTP_FIND_STCB(inp, stcb, scact->scact_assoc_id);
2889 if (stcb) {
2891 scact->scact_keynumber = stcb->asoc.authinfo.active_keyid;
2892 SCTP_TCB_UNLOCK(stcb);
2919 SCTP_FIND_STCB(inp, stcb, sac->gauth_assoc_id);
2921 if (stcb) {
2923 chklist = stcb->asoc.local_auth_chunks;
2935 SCTP_TCB_UNLOCK(stcb);
2970 SCTP_FIND_STCB(inp, stcb, sac->gauth_assoc_id);
2972 if (stcb) {
2974 chklist = stcb->asoc.peer_auth_chunks;
2986 SCTP_TCB_UNLOCK(stcb);
2999 SCTP_FIND_STCB(inp, stcb, event->se_assoc_id);
3053 if (stcb) {
3054 event->se_on = sctp_stcb_is_feature_on(inp, stcb, event_type);
3069 if (stcb != NULL) {
3070 SCTP_TCB_UNLOCK(stcb);
3104 SCTP_FIND_STCB(inp, stcb, info->snd_assoc_id);
3106 if (stcb) {
3107 info->snd_sid = stcb->asoc.def_send.sinfo_stream;
3108 info->snd_flags = stcb->asoc.def_send.sinfo_flags;
3110 info->snd_ppid = stcb->asoc.def_send.sinfo_ppid;
3111 info->snd_context = stcb->asoc.def_send.sinfo_context;
3112 SCTP_TCB_UNLOCK(stcb);
3140 SCTP_FIND_STCB(inp, stcb, info->pr_assoc_id);
3142 if (stcb) {
3143 info->pr_policy = PR_SCTP_POLICY(stcb->asoc.def_send.sinfo_flags);
3144 info->pr_value = stcb->asoc.def_send.sinfo_timetolive;
3145 SCTP_TCB_UNLOCK(stcb);
3175 SCTP_FIND_STCB(inp, stcb, thlds->spt_assoc_id);
3194 if (stcb != NULL) {
3195 net = sctp_findnet(stcb, addr);
3206 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
3207 if (stcb == NULL) {
3211 if ((stcb != NULL) && (net == NULL)) {
3219 SCTP_TCB_UNLOCK(stcb);
3232 SCTP_TCB_UNLOCK(stcb);
3240 SCTP_TCB_UNLOCK(stcb);
3246 if (stcb != NULL) {
3252 thlds->spt_pathmaxrxt = stcb->asoc.def_net_failure;
3253 thlds->spt_pathpfthld = stcb->asoc.def_net_pf_threshold;
3256 thlds->spt_assoc_id = sctp_get_associd(stcb);
3257 SCTP_TCB_UNLOCK(stcb);
3289 SCTP_FIND_STCB(inp, stcb, encaps->sue_assoc_id);
3308 if (stcb) {
3309 net = sctp_findnet(stcb, addr);
3320 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
3321 if (stcb == NULL) {
3325 if ((stcb != NULL) && (net == NULL)) {
3333 SCTP_TCB_UNLOCK(stcb);
3346 SCTP_TCB_UNLOCK(stcb);
3354 SCTP_TCB_UNLOCK(stcb);
3360 if (stcb != NULL) {
3364 encaps->sue_port = stcb->asoc.port;
3366 SCTP_TCB_UNLOCK(stcb);
3390 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3392 if (stcb) {
3393 av->assoc_value = stcb->asoc.ecn_supported;
3394 SCTP_TCB_UNLOCK(stcb);
3418 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3420 if (stcb) {
3421 av->assoc_value = stcb->asoc.prsctp_supported;
3422 SCTP_TCB_UNLOCK(stcb);
3446 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3448 if (stcb) {
3449 av->assoc_value = stcb->asoc.auth_supported;
3450 SCTP_TCB_UNLOCK(stcb);
3474 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3476 if (stcb) {
3477 av->assoc_value = stcb->asoc.asconf_supported;
3478 SCTP_TCB_UNLOCK(stcb);
3502 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3504 if (stcb) {
3505 av->assoc_value = stcb->asoc.reconfig_supported;
3506 SCTP_TCB_UNLOCK(stcb);
3530 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3532 if (stcb) {
3533 av->assoc_value = stcb->asoc.nrsack_supported;
3534 SCTP_TCB_UNLOCK(stcb);
3558 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3560 if (stcb) {
3561 av->assoc_value = stcb->asoc.pktdrop_supported;
3562 SCTP_TCB_UNLOCK(stcb);
3586 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3588 if (stcb) {
3589 av->assoc_value = (uint32_t)stcb->asoc.local_strreset_support;
3590 SCTP_TCB_UNLOCK(stcb);
3616 SCTP_FIND_STCB(inp, stcb, sprstat->sprstat_assoc_id);
3621 if ((stcb != NULL) &&
3622 (sid < stcb->asoc.streamoutcnt) &&
3627 sprstat->sprstat_abandoned_unsent = stcb->asoc.strmout[sid].abandoned_unsent[0];
3628 sprstat->sprstat_abandoned_sent = stcb->asoc.strmout[sid].abandoned_sent[0];
3630 sprstat->sprstat_abandoned_unsent = stcb->asoc.strmout[sid].abandoned_unsent[policy];
3631 sprstat->sprstat_abandoned_sent = stcb->asoc.strmout[sid].abandoned_sent[policy];
3634 if ((stcb != NULL) &&
3635 (sid < stcb->asoc.streamoutcnt) &&
3637 sprstat->sprstat_abandoned_unsent = stcb->asoc.strmout[sid].abandoned_unsent[0];
3638 sprstat->sprstat_abandoned_sent = stcb->asoc.strmout[sid].abandoned_sent[0];
3644 if (stcb != NULL) {
3645 SCTP_TCB_UNLOCK(stcb);
3658 SCTP_FIND_STCB(inp, stcb, sprstat->sprstat_assoc_id);
3661 if ((stcb != NULL) &&
3666 sprstat->sprstat_abandoned_unsent = stcb->asoc.abandoned_unsent[0];
3667 sprstat->sprstat_abandoned_sent = stcb->asoc.abandoned_sent[0];
3669 sprstat->sprstat_abandoned_unsent = stcb->asoc.abandoned_unsent[policy];
3670 sprstat->sprstat_abandoned_sent = stcb->asoc.abandoned_sent[policy];
3676 if (stcb != NULL) {
3677 SCTP_TCB_UNLOCK(stcb);
3689 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3691 if (stcb) {
3692 av->assoc_value = stcb->asoc.max_cwnd;
3693 SCTP_TCB_UNLOCK(stcb);
3729 struct sctp_tcb *stcb = NULL; local
3878 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3880 if (stcb) {
3883 SCTP_TCB_UNLOCK(stcb);
3925 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3926 if (stcb) {
3927 stcb->asoc.sctp_cmt_on_off = av->assoc_value;
3928 SCTP_TCB_UNLOCK(stcb);
3943 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
3944 SCTP_TCB_LOCK(stcb);
3945 stcb->asoc.sctp_cmt_on_off = av->assoc_value;
3946 SCTP_TCB_UNLOCK(stcb);
3970 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3971 if (stcb) {
3972 stcb->asoc.cc_functions = sctp_cc_functions[av->assoc_value];
3973 stcb->asoc.congestion_control_module = av->assoc_value;
3974 if (stcb->asoc.cc_functions.sctp_set_initial_cc_param != NULL) {
3975 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
3976 stcb->asoc.cc_functions.sctp_set_initial_cc_param(stcb, net);
3979 SCTP_TCB_UNLOCK(stcb);
3994 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
3995 SCTP_TCB_LOCK(stcb);
3996 stcb->asoc.cc_functions = sctp_cc_functions[av->assoc_value];
3997 stcb->asoc.congestion_control_module = av->assoc_value;
3998 if (stcb->asoc.cc_functions.sctp_set_initial_cc_param != NULL) {
3999 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
4000 stcb->asoc.cc_functions.sctp_set_initial_cc_param(stcb, net);
4003 SCTP_TCB_UNLOCK(stcb);
4015 SCTP_FIND_STCB(inp, stcb, cc_opt->aid_value.assoc_id);
4016 if (stcb == NULL) {
4020 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4021 SCTP_TCB_LOCK(stcb);
4022 if (stcb->asoc.cc_functions.sctp_cwnd_socket_option) {
4023 (*stcb->asoc.cc_functions.sctp_cwnd_socket_option) (stcb, 1, cc_opt);
4025 SCTP_TCB_UNLOCK(stcb);
4032 if (stcb->asoc.cc_functions.sctp_cwnd_socket_option == NULL) {
4035 error = (*stcb->asoc.cc_functions.sctp_cwnd_socket_option) (stcb, 1,
4038 SCTP_TCB_UNLOCK(stcb);
4057 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4058 if (stcb) {
4059 stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, true);
4060 stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value];
4061 stcb->asoc.stream_scheduling_module = av->assoc_value;
4062 stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc);
4063 SCTP_TCB_UNLOCK(stcb);
4078 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4079 SCTP_TCB_LOCK(stcb);
4080 stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, true);
4081 stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value];
4082 stcb->asoc.stream_scheduling_module = av->assoc_value;
4083 stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc);
4084 SCTP_TCB_UNLOCK(stcb);
4096 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4097 if (stcb) {
4098 if ((av->stream_id >= stcb->asoc.streamoutcnt) ||
4099 … (stcb->asoc.ss_functions.sctp_ss_set_value(stcb, &stcb->asoc, &stcb->asoc.strmout[av->stream_id],
4104 SCTP_TCB_UNLOCK(stcb);
4109 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4110 SCTP_TCB_LOCK(stcb);
4111 if (av->stream_id < stcb->asoc.streamoutcnt) {
4112 stcb->asoc.ss_functions.sctp_ss_set_value(stcb,
4113 &stcb->asoc,
4114 &stcb->asoc.strmout[av->stream_id],
4117 SCTP_TCB_UNLOCK(stcb);
4140 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4142 if (stcb) {
4143 stcb->asoc.context = av->assoc_value;
4144 SCTP_TCB_UNLOCK(stcb);
4159 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4160 SCTP_TCB_LOCK(stcb);
4161 stcb->asoc.context = av->assoc_value;
4162 SCTP_TCB_UNLOCK(stcb);
4199 SCTP_FIND_STCB(inp, stcb, sack->sack_assoc_id);
4203 if (stcb != NULL) {
4204 SCTP_TCB_UNLOCK(stcb);
4209 if (stcb) {
4211 stcb->asoc.delayed_ack = sack->sack_delay;
4214 stcb->asoc.sack_freq = sack->sack_freq;
4216 SCTP_TCB_UNLOCK(stcb);
4236 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4237 SCTP_TCB_LOCK(stcb);
4239 stcb->asoc.delayed_ack = sack->sack_delay;
4242 stcb->asoc.sack_freq = sack->sack_freq;
4244 SCTP_TCB_UNLOCK(stcb);
4287 SCTP_FIND_STCB(inp, stcb, sca->sca_assoc_id);
4289 if (stcb) {
4290 shared_keys = &stcb->asoc.shared_keys;
4292 sctp_clear_cachedkeys(stcb, sca->sca_keynumber);
4302 SCTP_TCB_UNLOCK(stcb);
4311 SCTP_TCB_UNLOCK(stcb);
4317 SCTP_TCB_UNLOCK(stcb);
4361 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4362 SCTP_TCB_LOCK(stcb);
4363 shared_keys = &stcb->asoc.shared_keys;
4368 sctp_clear_cachedkeys(stcb, sca->sca_keynumber);
4376 SCTP_TCB_UNLOCK(stcb);
4383 SCTP_TCB_UNLOCK(stcb);
4389 SCTP_TCB_UNLOCK(stcb);
4454 SCTP_FIND_STCB(inp, stcb, scact->scact_assoc_id);
4457 if (stcb) {
4459 if (sctp_auth_setactivekey(stcb,
4466 SCTP_TCB_UNLOCK(stcb);
4484 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4485 SCTP_TCB_LOCK(stcb);
4486 sctp_auth_setactivekey(stcb, scact->scact_keynumber);
4487 SCTP_TCB_UNLOCK(stcb);
4499 SCTP_FIND_STCB(inp, stcb, scdel->scact_assoc_id);
4502 if (stcb) {
4503 if (sctp_delete_sharedkey(stcb, scdel->scact_keynumber)) {
4507 SCTP_TCB_UNLOCK(stcb);
4525 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4526 SCTP_TCB_LOCK(stcb);
4527 sctp_delete_sharedkey(stcb, scdel->scact_keynumber);
4528 SCTP_TCB_UNLOCK(stcb);
4540 SCTP_FIND_STCB(inp, stcb, keyid->scact_assoc_id);
4543 if (stcb) {
4544 if (sctp_deact_sharedkey(stcb, keyid->scact_keynumber)) {
4548 SCTP_TCB_UNLOCK(stcb);
4566 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4567 SCTP_TCB_LOCK(stcb);
4568 sctp_deact_sharedkey(stcb, keyid->scact_keynumber);
4569 SCTP_TCB_UNLOCK(stcb);
4586 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4587 if (stcb) {
4588 stcb->asoc.local_strreset_support = (uint8_t)av->assoc_value;
4589 SCTP_TCB_UNLOCK(stcb);
4604 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4605 SCTP_TCB_LOCK(stcb);
4606 stcb->asoc.local_strreset_support = (uint8_t)av->assoc_value;
4607 SCTP_TCB_UNLOCK(stcb);
4621 SCTP_FIND_STCB(inp, stcb, strrst->srs_assoc_id);
4622 if (stcb == NULL) {
4627 if (stcb->asoc.reconfig_supported == 0) {
4633 SCTP_TCB_UNLOCK(stcb);
4636 if (SCTP_GET_STATE(stcb) != SCTP_STATE_OPEN) {
4639 SCTP_TCB_UNLOCK(stcb);
4645 SCTP_TCB_UNLOCK(stcb);
4650 if (stcb->asoc.stream_reset_outstanding) {
4653 SCTP_TCB_UNLOCK(stcb);
4663 SCTP_TCB_UNLOCK(stcb);
4669 SCTP_TCB_UNLOCK(stcb);
4674 (strrst->srs_stream_list[i] >= stcb->asoc.streamincnt)) {
4680 (strrst->srs_stream_list[i] >= stcb->asoc.streamoutcnt)) {
4687 SCTP_TCB_UNLOCK(stcb);
4697 if (stcb->asoc.strmout[strm].state == SCTP_STREAM_OPEN) {
4698 stcb->asoc.strmout[strm].state = SCTP_STREAM_RESET_PENDING;
4704 for (i = 0, cnt = 0; i < stcb->asoc.streamoutcnt; i++) {
4705 if (stcb->asoc.strmout[i].state == SCTP_STREAM_OPEN) {
4706 stcb->asoc.strmout[i].state = SCTP_STREAM_RESET_PENDING;
4713 error = sctp_send_str_reset_req(stcb, strrst->srs_number_streams,
4717 error = sctp_send_stream_reset_out_if_possible(stcb, SCTP_SO_LOCKED);
4720 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED);
4730 SCTP_TCB_UNLOCK(stcb);
4741 SCTP_FIND_STCB(inp, stcb, stradd->sas_assoc_id);
4742 if (stcb == NULL) {
4747 if (stcb->asoc.reconfig_supported == 0) {
4753 SCTP_TCB_UNLOCK(stcb);
4756 if (SCTP_GET_STATE(stcb) != SCTP_STATE_OPEN) {
4759 SCTP_TCB_UNLOCK(stcb);
4762 if (stcb->asoc.stream_reset_outstanding) {
4765 SCTP_TCB_UNLOCK(stcb);
4777 if ((((int)add_o_strmcnt) + ((int)stcb->asoc.streamoutcnt)) > 0x0000ffff) {
4793 cnt += stcb->asoc.streamincnt;
4799 if (cnt > (int)stcb->asoc.max_inbound_streams) {
4805 error = sctp_send_str_reset_req(stcb, 0, NULL, 0, 0, addstream, add_o_strmcnt, add_i_strmcnt, 0);
4806 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED);
4808 SCTP_TCB_UNLOCK(stcb);
4817 SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t)*value);
4818 if (stcb == NULL) {
4823 if (stcb->asoc.reconfig_supported == 0) {
4829 SCTP_TCB_UNLOCK(stcb);
4832 if (SCTP_GET_STATE(stcb) != SCTP_STATE_OPEN) {
4835 SCTP_TCB_UNLOCK(stcb);
4838 if (stcb->asoc.stream_reset_outstanding) {
4841 SCTP_TCB_UNLOCK(stcb);
4848 if (!TAILQ_EMPTY(&stcb->asoc.send_queue) ||
4849 !TAILQ_EMPTY(&stcb->asoc.sent_queue)) {
4853 SCTP_TCB_UNLOCK(stcb);
4857 for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
4858 if (!TAILQ_EMPTY(&stcb->asoc.strmout[i].outqueue)) {
4862 error = sctp_send_str_reset_req(stcb, 0, NULL, 0, 1, 0, 0, 0, 0);
4863 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED);
4864 SCTP_TCB_UNLOCK(stcb);
4893 stcb = LIST_FIRST(&inp->sctp_asoc_list);
4894 if (stcb) {
4895 SCTP_TCB_LOCK(stcb);
4907 stcb = sctp_findassociation_ep_addr(&inp, sa, NULL, NULL, NULL);
4908 if (stcb == NULL) {
4913 if (stcb == NULL) {
4918 if (stcb->asoc.delayed_connection == 1) {
4919 stcb->asoc.delayed_connection = 0;
4920 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
4921 sctp_timer_stop(SCTP_TIMER_TYPE_INIT, inp, stcb,
4922 stcb->asoc.primary_destination,
4924 sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED);
4933 SCTP_TCB_UNLOCK(stcb);
4941 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4943 if (stcb) {
4944 stcb->asoc.max_burst = av->assoc_value;
4945 SCTP_TCB_UNLOCK(stcb);
4960 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4961 SCTP_TCB_LOCK(stcb);
4962 stcb->asoc.max_burst = av->assoc_value;
4963 SCTP_TCB_UNLOCK(stcb);
4975 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4977 if (stcb) {
4978 stcb->asoc.sctp_frag_point = av->assoc_value;
4979 SCTP_TCB_UNLOCK(stcb);
5068 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
5069 SCTP_TCB_LOCK(stcb);
5071 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVASSOCEVNT);
5073 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVASSOCEVNT);
5076 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVPADDREVNT);
5078 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVPADDREVNT);
5081 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT);
5083 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT);
5086 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVPEERERR);
5088 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVPEERERR);
5091 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT);
5093 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT);
5096 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_PDAPIEVNT);
5098 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_PDAPIEVNT);
5101 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_ADAPTATIONEVNT);
5103 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_ADAPTATIONEVNT);
5106 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_AUTHEVNT);
5108 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_AUTHEVNT);
5111 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_DRYEVNT);
5113 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_DRYEVNT);
5116 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_STREAM_RESETEVNT);
5118 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_STREAM_RESETEVNT);
5120 SCTP_TCB_UNLOCK(stcb);
5129 stcb = LIST_FIRST(&inp->sctp_asoc_list);
5130 if (stcb != NULL) {
5131 SCTP_TCB_LOCK(stcb);
5132 if (TAILQ_EMPTY(&stcb->asoc.send_queue) &&
5133 TAILQ_EMPTY(&stcb->asoc.sent_queue) &&
5134 (stcb->asoc.stream_queue_cnt == 0)) {
5135 sctp_ulp_notify(SCTP_NOTIFY_SENDER_DRY, stcb, 0, NULL, SCTP_SO_LOCKED);
5137 SCTP_TCB_UNLOCK(stcb);
5172 SCTP_FIND_STCB(inp, stcb, s_info->sinfo_assoc_id);
5174 if (stcb) {
5175 if (s_info->sinfo_stream < stcb->asoc.streamoutcnt) {
5176 memcpy(&stcb->asoc.def_send, s_info, min(optsize, sizeof(stcb->asoc.def_send)));
5181 SCTP_TCB_UNLOCK(stcb);
5196 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
5197 SCTP_TCB_LOCK(stcb);
5198 if (s_info->sinfo_stream < stcb->asoc.streamoutcnt) {
5199 memcpy(&stcb->asoc.def_send, s_info, min(optsize, sizeof(stcb->asoc.def_send)));
5201 SCTP_TCB_UNLOCK(stcb);
5218 SCTP_FIND_STCB(inp, stcb, paddrp->spp_assoc_id);
5237 if (stcb != NULL) {
5238 net = sctp_findnet(stcb, addr);
5249 stcb = sctp_findassociation_ep_addr(&inp, addr,
5251 if (stcb == NULL) {
5255 if ((stcb != NULL) && (net == NULL)) {
5263 SCTP_TCB_UNLOCK(stcb);
5276 SCTP_TCB_UNLOCK(stcb);
5284 SCTP_TCB_UNLOCK(stcb);
5291 if (stcb)
5292 SCTP_TCB_UNLOCK(stcb);
5298 if (stcb)
5299 SCTP_TCB_UNLOCK(stcb);
5307 if (stcb)
5308 SCTP_TCB_UNLOCK(stcb);
5313 if (stcb != NULL) {
5320 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net,
5331 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net,
5333 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
5337 if (SCTP_GET_STATE(stcb) == SCTP_STATE_OPEN) {
5338 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
5339 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED);
5340 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
5345 sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net,
5365 if (net->mtu < stcb->asoc.smallest_mtu) {
5366 sctp_pathmtu_adjustment(stcb, net->mtu, true);
5372 sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net);
5385 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
5387 stcb->sctp_ep, stcb, net,
5389 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
5395 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
5400 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
5420 stcb->asoc.def_net_failure = paddrp->spp_pathmaxrxt;
5421 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5430 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
5432 stcb->sctp_ep, stcb, net,
5434 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
5440 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
5445 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
5453 stcb->asoc.heart_beat_delay = paddrp->spp_hbinterval;
5455 stcb->asoc.heart_beat_delay = 0;
5458 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5467 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net,
5469 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
5471 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_DONOT_HEARTBEAT);
5474 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5479 inp, stcb, net,
5484 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_DONOT_HEARTBEAT);
5487 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5489 sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net,
5509 if (net->mtu < stcb->asoc.smallest_mtu) {
5510 sctp_pathmtu_adjustment(stcb, net->mtu, true);
5515 stcb->asoc.default_mtu = paddrp->spp_pathmtu;
5517 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD);
5520 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5522 sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net);
5526 stcb->asoc.default_mtu = 0;
5527 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD);
5530 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5534 stcb->asoc.default_dscp = paddrp->spp_dscp & 0xfc;
5535 stcb->asoc.default_dscp |= 0x01;
5539 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5545 stcb->asoc.default_flowlabel = paddrp->spp_ipv6_flowlabel & 0x000fffff;
5546 stcb->asoc.default_flowlabel |= 0x80000000;
5550 SCTP_TCB_UNLOCK(stcb);
5620 SCTP_FIND_STCB(inp, stcb, srto->srto_assoc_id);
5622 if (stcb) {
5626 new_init = stcb->asoc.initial_rto;
5630 new_max = stcb->asoc.maxrto;
5634 new_min = stcb->asoc.minrto;
5636 stcb->asoc.initial_rto = new_init;
5637 stcb->asoc.maxrto = new_max;
5638 stcb->asoc.minrto = new_min;
5643 SCTP_TCB_UNLOCK(stcb);
5683 SCTP_FIND_STCB(inp, stcb, sasoc->sasoc_assoc_id);
5693 if (stcb) {
5695 stcb->asoc.max_send_times = sasoc->sasoc_asocmaxrxt;
5698 stcb->asoc.cookie_life = sctp_msecs_to_ticks(sasoc->sasoc_cookie_life);
5700 SCTP_TCB_UNLOCK(stcb);
5751 SCTP_FIND_STCB(inp, stcb, spa->ssp_assoc_id);
5770 if (stcb != NULL) {
5771 net = sctp_findnet(stcb, addr);
5782 stcb = sctp_findassociation_ep_addr(&inp, addr,
5784 if (stcb == NULL) {
5789 if ((stcb != NULL) && (net != NULL)) {
5790 if (net != stcb->asoc.primary_destination) {
5793 if (sctp_set_primary_addr(stcb, (struct sockaddr *)NULL, net) == 0) {
5794 if ((stcb->asoc.alternate) &&
5797 sctp_free_remote_addr(stcb->asoc.alternate);
5798 stcb->asoc.alternate = NULL;
5813 if (stcb != NULL) {
5814 SCTP_TCB_UNLOCK(stcb);
5841 SCTP_FIND_STCB(inp, stcb, sspp->sspp_assoc_id);
5842 if (stcb != NULL) {
5862 ifa = sctp_find_ifa_by_addr(addr, stcb->asoc.vrf_id, SCTP_ADDR_NOT_LOCKED);
5882 if ((sctp_is_addr_restricted(stcb, laddr->ifa)) &&
5883 (!sctp_is_addr_pending(stcb, laddr->ifa))) {
5934 if (sctp_set_primary_ip_address_sa(stcb, addr) != 0) {
5938 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED);
5940 SCTP_TCB_UNLOCK(stcb);
5963 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
5979 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
6008 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
6024 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
6042 SCTP_FIND_STCB(inp, stcb, event->se_assoc_id);
6095 if (stcb) {
6097 sctp_stcb_feature_on(inp, stcb, event_type);
6099 if (TAILQ_EMPTY(&stcb->asoc.send_queue) &&
6100 TAILQ_EMPTY(&stcb->asoc.sent_queue) &&
6101 (stcb->asoc.stream_queue_cnt == 0)) {
6102 sctp_ulp_notify(SCTP_NOTIFY_SENDER_DRY, stcb, 0, NULL, SCTP_SO_LOCKED);
6106 sctp_stcb_feature_off(inp, stcb, event_type);
6108 SCTP_TCB_UNLOCK(stcb);
6140 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
6141 SCTP_TCB_LOCK(stcb);
6143 sctp_stcb_feature_on(inp, stcb, event_type);
6145 sctp_stcb_feature_off(inp, stcb, event_type);
6147 SCTP_TCB_UNLOCK(stcb);
6153 if (stcb) {
6154 SCTP_TCB_UNLOCK(stcb);
6193 SCTP_FIND_STCB(inp, stcb, info->snd_assoc_id);
6195 if (stcb) {
6196 if (info->snd_sid < stcb->asoc.streamoutcnt) {
6197 stcb->asoc.def_send.sinfo_stream = info->snd_sid;
6198 policy = PR_SCTP_POLICY(stcb->asoc.def_send.sinfo_flags);
6199 stcb->asoc.def_send.sinfo_flags = info->snd_flags;
6200 stcb->asoc.def_send.sinfo_flags |= policy;
6201 stcb->asoc.def_send.sinfo_ppid = info->snd_ppid;
6202 stcb->asoc.def_send.sinfo_context = info->snd_context;
6207 SCTP_TCB_UNLOCK(stcb);
6227 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
6228 SCTP_TCB_LOCK(stcb);
6229 if (info->snd_sid < stcb->asoc.streamoutcnt) {
6230 stcb->asoc.def_send.sinfo_stream = info->snd_sid;
6231 policy = PR_SCTP_POLICY(stcb->asoc.def_send.sinfo_flags);
6232 stcb->asoc.def_send.sinfo_flags = info->snd_flags;
6233 stcb->asoc.def_send.sinfo_flags |= policy;
6234 stcb->asoc.def_send.sinfo_ppid = info->snd_ppid;
6235 stcb->asoc.def_send.sinfo_context = info->snd_context;
6237 SCTP_TCB_UNLOCK(stcb);
6249 SCTP_FIND_STCB(inp, stcb, info->pr_assoc_id);
6252 if (stcb) {
6253 SCTP_TCB_UNLOCK(stcb);
6259 if (stcb) {
6260 stcb->asoc.def_send.sinfo_flags &= 0xfff0;
6261 stcb->asoc.def_send.sinfo_flags |= info->pr_policy;
6262 stcb->asoc.def_send.sinfo_timetolive = info->pr_value;
6263 SCTP_TCB_UNLOCK(stcb);
6280 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
6281 SCTP_TCB_LOCK(stcb);
6282 stcb->asoc.def_send.sinfo_flags &= 0xfff0;
6283 stcb->asoc.def_send.sinfo_flags |= info->pr_policy;
6284 stcb->asoc.def_send.sinfo_timetolive = info->pr_value;
6285 SCTP_TCB_UNLOCK(stcb);
6303 SCTP_FIND_STCB(inp, stcb, thlds->spt_assoc_id);
6322 if (stcb != NULL) {
6323 net = sctp_findnet(stcb, addr);
6334 stcb = sctp_findassociation_ep_addr(&inp, addr,
6336 if (stcb == NULL) {
6340 if ((stcb != NULL) && (net == NULL)) {
6348 SCTP_TCB_UNLOCK(stcb);
6361 SCTP_TCB_UNLOCK(stcb);
6369 SCTP_TCB_UNLOCK(stcb);
6375 if (stcb != NULL) {
6376 SCTP_TCB_UNLOCK(stcb);
6382 if (stcb != NULL) {
6395 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
6397 stcb->sctp_ep, stcb, net,
6399 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
6405 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
6410 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
6414 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
6426 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
6428 stcb->sctp_ep, stcb, net,
6430 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
6436 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
6441 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
6445 stcb->asoc.def_net_failure = thlds->spt_pathmaxrxt;
6446 stcb->asoc.def_net_pf_threshold = thlds->spt_pathpfthld;
6448 SCTP_TCB_UNLOCK(stcb);
6475 SCTP_FIND_STCB(inp, stcb, encaps->sue_assoc_id);
6494 if (stcb != NULL) {
6495 net = sctp_findnet(stcb, addr);
6506 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
6507 if (stcb == NULL) {
6511 if ((stcb != NULL) && (net == NULL)) {
6519 SCTP_TCB_UNLOCK(stcb);
6532 SCTP_TCB_UNLOCK(stcb);
6540 SCTP_TCB_UNLOCK(stcb);
6546 if (stcb != NULL) {
6550 stcb->asoc.port = encaps->sue_port;
6552 SCTP_TCB_UNLOCK(stcb);
6573 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6575 if (stcb) {
6578 SCTP_TCB_UNLOCK(stcb);
6603 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6605 if (stcb) {
6608 SCTP_TCB_UNLOCK(stcb);
6633 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6635 if (stcb) {
6638 SCTP_TCB_UNLOCK(stcb);
6673 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6675 if (stcb) {
6678 SCTP_TCB_UNLOCK(stcb);
6721 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6723 if (stcb) {
6726 SCTP_TCB_UNLOCK(stcb);
6751 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6753 if (stcb) {
6756 SCTP_TCB_UNLOCK(stcb);
6781 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6783 if (stcb) {
6786 SCTP_TCB_UNLOCK(stcb);
6812 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6814 if (stcb) {
6815 stcb->asoc.max_cwnd = av->assoc_value;
6816 if (stcb->asoc.max_cwnd > 0) {
6817 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
6818 if ((net->cwnd > stcb->asoc.max_cwnd) &&
6820 net->cwnd = stcb->asoc.max_cwnd;
6827 SCTP_TCB_UNLOCK(stcb);
6951 struct sctp_tcb *stcb = NULL; local
7040 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EADDRINUSE);
7046 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7055 stcb = sctp_findassociation_ep_addr(&inp, addr, NULL, NULL, NULL);
7056 if (stcb == NULL) {
7059 SCTP_TCB_UNLOCK(stcb);
7062 if (stcb != NULL) {
7071 stcb = sctp_aloc_assoc_connected(inp, addr, &error, 0, 0, vrf_id,
7075 if (stcb == NULL) {
7079 SCTP_SET_STATE(stcb, SCTP_STATE_COOKIE_WAIT);
7080 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
7082 sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED);
7083 SCTP_TCB_UNLOCK(stcb);
7276 struct sctp_tcb *stcb; local
7299 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7300 if (stcb == NULL) {
7305 SCTP_TCB_LOCK(stcb);
7306 store = stcb->asoc.primary_destination->ro._l_addr;
7307 SCTP_CLEAR_SUBSTATE(stcb, SCTP_STATE_IN_ACCEPT_QUEUE);
7332 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
7333 sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC,
7336 SCTP_TCB_UNLOCK(stcb);
7409 struct sctp_tcb *stcb; local
7414 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7415 if (stcb == NULL) {
7420 SCTP_TCB_LOCK(stcb);
7421 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
7434 SCTP_TCB_UNLOCK(stcb);
7440 stcb,
7447 SCTP_TCB_UNLOCK(stcb);
7488 struct sctp_tcb *stcb; local
7507 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7508 if (stcb) {
7509 SCTP_TCB_LOCK(stcb);
7512 if (stcb == NULL) {
7518 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
7522 sin->sin_port = stcb->rport;
7527 SCTP_TCB_UNLOCK(stcb);