Lines Matching defs:stcb

101 sctp_pathmtu_adjustment(struct sctp_tcb *stcb, uint16_t nxtsz)
107 stcb->asoc.smallest_mtu = nxtsz;
110 if (sctp_auth_is_required_chunk(SCTP_DATA, stcb->asoc.peer_auth_chunks)) {
111 overhead += sctp_get_auth_chunk_len(stcb->asoc.peer_hmac_id);
113 TAILQ_FOREACH(chk, &stcb->asoc.send_queue, sctp_next) {
118 TAILQ_FOREACH(chk, &stcb->asoc.sent_queue, sctp_next) {
127 sctp_total_flight_decrease(stcb, chk);
129 sctp_ucount_incr(stcb->asoc.sent_queue_retran_cnt);
148 struct sctp_tcb *stcb,
158 if ((inp == NULL) || (stcb == NULL) || (net == NULL) ||
160 if (stcb != NULL) {
161 SCTP_TCB_UNLOCK(stcb);
166 if (ntohl(sh->v_tag) != (stcb->asoc.peer_vtag)) {
167 SCTP_TCB_UNLOCK(stcb);
174 SCTP_TCB_UNLOCK(stcb);
179 SCTP_TCB_UNLOCK(stcb);
196 sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net,
207 if (stcb->asoc.smallest_mtu > nxtsz) {
208 sctp_pathmtu_adjustment(stcb, nxtsz);
211 sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net);
213 SCTP_TCB_UNLOCK(stcb);
221 struct sctp_tcb *stcb,
231 if ((inp == NULL) || (stcb == NULL) || (net == NULL) ||
233 if (stcb)
234 SCTP_TCB_UNLOCK(stcb);
238 if (ntohl(sh->v_tag) != (stcb->asoc.peer_vtag)) {
239 SCTP_TCB_UNLOCK(stcb);
246 SCTP_TCB_UNLOCK(stcb);
269 stcb, 0,
272 SCTP_TCB_UNLOCK(stcb);
282 sctp_abort_notification(stcb, 1, 0, NULL, SCTP_SO_NOT_LOCKED);
285 atomic_add_int(&stcb->asoc.refcnt, 1);
286 SCTP_TCB_UNLOCK(stcb);
288 SCTP_TCB_LOCK(stcb);
289 atomic_subtract_int(&stcb->asoc.refcnt, 1);
291 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC,
295 /* SCTP_TCB_UNLOCK(stcb); MT: I think this is not needed. */
299 SCTP_TCB_UNLOCK(stcb);
329 struct sctp_tcb *stcb = NULL;
348 stcb = sctp_findassociation_addr_sa((struct sockaddr *)&to,
351 if (stcb != NULL && inp && (inp->sctp_socket != NULL)) {
354 (struct sockaddr *)&to, stcb,
358 sctp_notify_mbuf(inp, stcb, net, ip, sh);
361 if ((stcb == NULL) && (inp != NULL)) {
367 if (stcb) {
368 SCTP_TCB_UNLOCK(stcb);
384 struct sctp_tcb *stcb;
400 stcb = sctp_findassociation_addr_sa(sintosa(&addrs[1]),
403 if (stcb == NULL || inp == NULL || inp->sctp_socket == NULL) {
404 if ((inp != NULL) && (stcb == NULL)) {
414 SCTP_TCB_UNLOCK(stcb);
704 struct sctp_tcb *stcb;
706 stcb = LIST_FIRST(&inp->sctp_asoc_list);
707 if (stcb == NULL) {
712 SCTP_TCB_LOCK(stcb);
713 asoc = &stcb->asoc;
714 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
716 SCTP_TCB_UNLOCK(stcb);
741 sctp_send_abort_tcb(stcb, err, SCTP_SO_LOCKED);
745 if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) ||
746 (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
749 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC,
772 sctp_stop_timers_for_shutdown(stcb);
773 if (stcb->asoc.alternate) {
774 netp = stcb->asoc.alternate;
776 netp = stcb->asoc.primary_destination;
778 sctp_send_shutdown(stcb, netp);
780 stcb->sctp_ep, stcb, netp);
782 stcb->sctp_ep, stcb, netp);
783 sctp_chunk_output(stcb->sctp_ep, stcb, SCTP_OUTPUT_FROM_T3, SCTP_SO_LOCKED);
798 if (stcb->asoc.alternate) {
799 netp = stcb->asoc.alternate;
801 netp = stcb->asoc.primary_destination;
805 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb,
827 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_4;
828 sctp_send_abort_tcb(stcb, op_err, SCTP_SO_LOCKED);
830 if ((SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_OPEN) ||
831 (SCTP_GET_STATE(&stcb->asoc) == SCTP_STATE_SHUTDOWN_RECEIVED)) {
835 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC,
839 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CLOSING, SCTP_SO_LOCKED);
843 SCTP_TCB_UNLOCK(stcb);
934 struct sctp_tcb *stcb;
945 stcb = LIST_FIRST(&inp->sctp_asoc_list);
946 if (stcb == NULL) {
955 SCTP_TCB_LOCK(stcb);
956 asoc = &stcb->asoc;
958 SCTP_TCB_UNLOCK(stcb);
969 SCTP_TCB_UNLOCK(stcb);
973 if (stcb->asoc.alternate) {
974 netp = stcb->asoc.alternate;
976 netp = stcb->asoc.primary_destination;
989 sctp_stop_timers_for_shutdown(stcb);
990 sctp_send_shutdown(stcb, netp);
992 stcb->sctp_ep, stcb, netp);
1020 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6;
1021 sctp_abort_an_association(stcb->sctp_ep, stcb,
1027 sctp_timer_start(SCTP_TIMER_TYPE_SHUTDOWNGUARD, stcb->sctp_ep, stcb, netp);
1032 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CLOSING, SCTP_SO_LOCKED);
1033 SCTP_TCB_UNLOCK(stcb);
1063 struct sctp_tcb *stcb,
1087 if (stcb) {
1089 loopback_scope = stcb->asoc.scope.loopback_scope;
1091 ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope;
1092 ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal;
1095 local_scope = stcb->asoc.scope.local_scope;
1096 site_scope = stcb->asoc.scope.site_scope;
1097 ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal;
1141 if (stcb) {
1150 if (sctp_is_addr_restricted(stcb,
1267 if (stcb) {
1268 if (sctp_is_addr_restricted(stcb, laddr->ifa)) {
1302 struct sctp_tcb *stcb,
1310 size = sctp_fill_up_addresses_vrf(inp, stcb, limit, sas,
1414 struct sctp_tcb *stcb = NULL;
1426 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EADDRINUSE);
1431 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
1436 stcb = LIST_FIRST(&inp->sctp_asoc_list);
1439 if (stcb) {
1440 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY);
1448 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EFAULT);
1455 stcb = sctp_connectx_helper_find(inp, sa, &totaddr, &num_v4, &num_v6, &error, (optsize - sizeof(int)), &bad_addresses);
1456 if ((stcb != NULL) || bad_addresses) {
1460 if (stcb)
1461 SCTP_TCB_UNLOCK(stcb);
1484 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
1503 stcb = sctp_aloc_assoc(inp, sa, &error, 0, vrf_id,
1507 if (stcb == NULL) {
1511 if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) {
1512 stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED;
1516 SCTP_SET_STATE(&stcb->asoc, SCTP_STATE_COOKIE_WAIT);
1534 sctp_connectx_helper_add(stcb, sa, (totaddr - 1), &error);
1537 (void)sctp_free_assoc(inp, stcb, SCTP_PCBFREE_FORCE,
1542 *a_id = sctp_get_associd(stcb);
1545 sctp_initialize_auth_params(inp, stcb);
1549 stcb->asoc.delayed_connection = 1;
1550 sctp_timer_start(SCTP_TIMER_TYPE_INIT, inp, stcb, stcb->asoc.primary_destination);
1552 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
1553 sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED);
1555 SCTP_TCB_UNLOCK(stcb);
1556 if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) {
1557 stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED;
1569 #define SCTP_FIND_STCB(inp, stcb, assoc_id) { \
1573 stcb = LIST_FIRST(&inp->sctp_asoc_list); \
1574 if (stcb) { \
1575 SCTP_TCB_LOCK(stcb); \
1579 stcb = sctp_findassociation_ep_asocid(inp, assoc_id, 1); \
1580 if (stcb == NULL) { \
1586 stcb = NULL; \
1607 struct sctp_tcb *stcb = NULL;
1738 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1739 if (stcb) {
1740 av->assoc_value = stcb->asoc.sctp_cmt_on_off;
1741 SCTP_TCB_UNLOCK(stcb);
1764 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1765 if (stcb) {
1766 av->assoc_value = stcb->asoc.congestion_control_module;
1767 SCTP_TCB_UNLOCK(stcb);
1790 SCTP_FIND_STCB(inp, stcb, cc_opt->aid_value.assoc_id);
1791 if (stcb == NULL) {
1794 if (stcb->asoc.cc_functions.sctp_cwnd_socket_option == NULL) {
1797 error = (*stcb->asoc.cc_functions.sctp_cwnd_socket_option) (stcb, 0, cc_opt);
1800 SCTP_TCB_UNLOCK(stcb);
1809 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1810 if (stcb) {
1811 av->assoc_value = stcb->asoc.stream_scheduling_module;
1812 SCTP_TCB_UNLOCK(stcb);
1835 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1836 if (stcb) {
1837 if ((av->stream_id >= stcb->asoc.streamoutcnt) ||
1838 (stcb->asoc.ss_functions.sctp_ss_get_value(stcb, &stcb->asoc, &stcb->asoc.strmout[av->stream_id],
1845 SCTP_TCB_UNLOCK(stcb);
1895 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
1919 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
1921 ids->gaids_assoc_id[at++] = sctp_get_associd(stcb);
1940 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1942 if (stcb) {
1943 av->assoc_value = stcb->asoc.context;
1944 SCTP_TCB_UNLOCK(stcb);
1976 SCTP_FIND_STCB(inp, stcb, id->assoc_id);
1977 if (stcb == NULL) {
1981 id->assoc_value = stcb->asoc.vrf_id;
1997 SCTP_FIND_STCB(inp, stcb, gnv->gn_assoc_id);
1999 if (stcb) {
2000 gnv->gn_peers_tag = stcb->asoc.peer_vtag;
2001 gnv->gn_local_tag = stcb->asoc.my_vtag;
2002 SCTP_TCB_UNLOCK(stcb);
2015 SCTP_FIND_STCB(inp, stcb, sack->sack_assoc_id);
2016 if (stcb) {
2017 sack->sack_delay = stcb->asoc.delayed_ack;
2018 sack->sack_freq = stcb->asoc.sack_freq;
2019 SCTP_TCB_UNLOCK(stcb);
2043 SCTP_FIND_STCB(inp, stcb, ss->ss_assoc_id);
2045 if (stcb) {
2046 ss->ss_total_sndbuf = stcb->asoc.total_output_queue_size;
2047 ss->ss_total_recv_buf = (stcb->asoc.size_on_reasm_queue +
2048 stcb->asoc.size_on_all_streams);
2049 SCTP_TCB_UNLOCK(stcb);
2062 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
2064 if (stcb) {
2065 av->assoc_value = stcb->asoc.max_burst;
2066 SCTP_TCB_UNLOCK(stcb);
2090 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
2092 if (stcb) {
2093 av->assoc_value = sctp_get_frag_point(stcb, &stcb->asoc);
2094 SCTP_TCB_UNLOCK(stcb);
2208 SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t) * value);
2210 if (stcb) {
2213 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
2237 SCTP_TCB_UNLOCK(stcb);
2258 SCTP_FIND_STCB(inp, stcb, saddr->sget_assoc_id);
2260 if (stcb) {
2265 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
2308 ((struct sockaddr_in *)sas)->sin_port = stcb->rport;
2314 SCTP_TCB_UNLOCK(stcb);
2328 SCTP_FIND_STCB(inp, stcb, saddr->sget_assoc_id);
2332 actual = sctp_fill_up_addresses(inp, stcb, limit, sas);
2333 if (stcb) {
2334 SCTP_TCB_UNLOCK(stcb);
2351 SCTP_FIND_STCB(inp, stcb, paddrp->spp_assoc_id);
2370 if (stcb != NULL) {
2371 net = sctp_findnet(stcb, addr);
2376 * decrement if it finds the stcb as long as
2382 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
2383 if (stcb == NULL) {
2387 if ((stcb != NULL) && (net == NULL)) {
2395 SCTP_TCB_UNLOCK(stcb);
2408 SCTP_TCB_UNLOCK(stcb);
2416 SCTP_TCB_UNLOCK(stcb);
2421 if (stcb != NULL) {
2470 paddrp->spp_pathmaxrxt = stcb->asoc.def_net_failure;
2472 if (stcb->asoc.default_dscp & 0x01) {
2473 paddrp->spp_dscp = stcb->asoc.default_dscp & 0xfc;
2477 if (stcb->asoc.default_flowlabel & 0x80000000) {
2478 paddrp->spp_ipv6_flowlabel = stcb->asoc.default_flowlabel & 0x000fffff;
2483 if (sctp_stcb_is_feature_on(inp, stcb, SCTP_PCB_FLAGS_DONOT_HEARTBEAT)) {
2488 if (sctp_stcb_is_feature_on(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD)) {
2493 paddrp->spp_hbinterval = stcb->asoc.heart_beat_delay;
2495 paddrp->spp_assoc_id = sctp_get_associd(stcb);
2496 SCTP_TCB_UNLOCK(stcb);
2554 SCTP_FIND_STCB(inp, stcb, paddri->spinfo_assoc_id);
2573 if (stcb != NULL) {
2574 net = sctp_findnet(stcb, addr);
2579 * decrement if it finds the stcb as long as
2585 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
2586 if (stcb == NULL) {
2591 if ((stcb != NULL) && (net != NULL)) {
2605 paddri->spinfo_assoc_id = sctp_get_associd(stcb);
2621 SCTP_TCB_UNLOCK(stcb);
2624 if (stcb != NULL) {
2625 SCTP_TCB_UNLOCK(stcb);
2647 SCTP_FIND_STCB(inp, stcb, sstat->sstat_assoc_id);
2649 if (stcb == NULL) {
2654 sstat->sstat_state = sctp_map_assoc_state(stcb->asoc.state);
2655 sstat->sstat_assoc_id = sctp_get_associd(stcb);
2656 sstat->sstat_rwnd = stcb->asoc.peers_rwnd;
2657 sstat->sstat_unackdata = stcb->asoc.sent_queue_cnt;
2662 sstat->sstat_penddata = (stcb->asoc.cnt_on_reasm_queue +
2663 stcb->asoc.cnt_on_all_streams);
2666 sstat->sstat_instrms = stcb->asoc.streamincnt;
2667 sstat->sstat_outstrms = stcb->asoc.streamoutcnt;
2668 sstat->sstat_fragmentation_point = sctp_get_frag_point(stcb, &stcb->asoc);
2670 &stcb->asoc.primary_destination->ro._l_addr,
2671 ((struct sockaddr *)(&stcb->asoc.primary_destination->ro._l_addr))->sa_len);
2672 net = stcb->asoc.primary_destination;
2673 ((struct sockaddr_in *)&sstat->sstat_primary.spinfo_address)->sin_port = stcb->rport;
2692 switch (stcb->asoc.primary_destination->ro._l_addr.sa.sa_family) {
2706 sstat->sstat_primary.spinfo_assoc_id = sctp_get_associd(stcb);
2707 SCTP_TCB_UNLOCK(stcb);
2716 SCTP_FIND_STCB(inp, stcb, srto->srto_assoc_id);
2718 if (stcb) {
2719 srto->srto_initial = stcb->asoc.initial_rto;
2720 srto->srto_max = stcb->asoc.maxrto;
2721 srto->srto_min = stcb->asoc.minrto;
2722 SCTP_TCB_UNLOCK(stcb);
2747 SCTP_FIND_STCB(inp, stcb, stimo->stimo_assoc_id);
2749 if (stcb) {
2750 stimo->stimo_init = stcb->asoc.timoinit;
2751 stimo->stimo_data = stcb->asoc.timodata;
2752 stimo->stimo_sack = stcb->asoc.timosack;
2753 stimo->stimo_shutdown = stcb->asoc.timoshutdown;
2754 stimo->stimo_heartbeat = stcb->asoc.timoheartbeat;
2755 stimo->stimo_cookie = stcb->asoc.timocookie;
2756 stimo->stimo_shutdownack = stcb->asoc.timoshutdownack;
2757 SCTP_TCB_UNLOCK(stcb);
2770 SCTP_FIND_STCB(inp, stcb, sasoc->sasoc_assoc_id);
2772 if (stcb) {
2773 sasoc->sasoc_cookie_life = TICKS_TO_MSEC(stcb->asoc.cookie_life);
2774 sasoc->sasoc_asocmaxrxt = stcb->asoc.max_send_times;
2775 sasoc->sasoc_number_peer_destinations = stcb->asoc.numnets;
2776 sasoc->sasoc_peer_rwnd = stcb->asoc.peers_rwnd;
2777 sasoc->sasoc_local_rwnd = stcb->asoc.my_rwnd;
2778 SCTP_TCB_UNLOCK(stcb);
2805 SCTP_FIND_STCB(inp, stcb, s_info->sinfo_assoc_id);
2807 if (stcb) {
2808 memcpy(s_info, &stcb->asoc.def_send, sizeof(stcb->asoc.def_send));
2809 SCTP_TCB_UNLOCK(stcb);
2847 SCTP_FIND_STCB(inp, stcb, ssp->ssp_assoc_id);
2849 if (stcb) {
2852 addr = &stcb->asoc.primary_destination->ro._l_addr;
2876 SCTP_TCB_UNLOCK(stcb);
2924 SCTP_FIND_STCB(inp, stcb, scact->scact_assoc_id);
2926 if (stcb) {
2928 scact->scact_keynumber = stcb->asoc.authinfo.active_keyid;
2929 SCTP_TCB_UNLOCK(stcb);
2955 SCTP_FIND_STCB(inp, stcb, sac->gauth_assoc_id);
2957 if (stcb) {
2959 chklist = stcb->asoc.local_auth_chunks;
2971 SCTP_TCB_UNLOCK(stcb);
3005 SCTP_FIND_STCB(inp, stcb, sac->gauth_assoc_id);
3007 if (stcb) {
3009 chklist = stcb->asoc.peer_auth_chunks;
3021 SCTP_TCB_UNLOCK(stcb);
3034 SCTP_FIND_STCB(inp, stcb, event->se_assoc_id);
3088 if (stcb) {
3089 event->se_on = sctp_stcb_is_feature_on(inp, stcb, event_type);
3090 SCTP_TCB_UNLOCK(stcb);
3152 SCTP_FIND_STCB(inp, stcb, info->snd_assoc_id);
3154 if (stcb) {
3155 info->snd_sid = stcb->asoc.def_send.sinfo_stream;
3156 info->snd_flags = stcb->asoc.def_send.sinfo_flags;
3158 info->snd_ppid = stcb->asoc.def_send.sinfo_ppid;
3159 info->snd_context = stcb->asoc.def_send.sinfo_context;
3160 SCTP_TCB_UNLOCK(stcb);
3187 SCTP_FIND_STCB(inp, stcb, info->pr_assoc_id);
3189 if (stcb) {
3190 info->pr_policy = PR_SCTP_POLICY(stcb->asoc.def_send.sinfo_flags);
3191 info->pr_value = stcb->asoc.def_send.sinfo_timetolive;
3192 SCTP_TCB_UNLOCK(stcb);
3223 SCTP_FIND_STCB(inp, stcb, thlds->spt_assoc_id);
3242 if (stcb != NULL) {
3243 net = sctp_findnet(stcb, addr);
3248 * decrement if it finds the stcb as long as
3254 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
3255 if (stcb == NULL) {
3259 if ((stcb != NULL) && (net == NULL)) {
3267 SCTP_TCB_UNLOCK(stcb);
3280 SCTP_TCB_UNLOCK(stcb);
3288 SCTP_TCB_UNLOCK(stcb);
3293 if (stcb != NULL) {
3298 thlds->spt_pathmaxrxt = stcb->asoc.def_net_failure;
3299 thlds->spt_pathpfthld = stcb->asoc.def_net_pf_threshold;
3301 thlds->spt_assoc_id = sctp_get_associd(stcb);
3302 SCTP_TCB_UNLOCK(stcb);
3334 SCTP_FIND_STCB(inp, stcb, encaps->sue_assoc_id);
3353 if (stcb) {
3354 net = sctp_findnet(stcb, addr);
3359 * decrement if it finds the stcb as long as
3365 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
3366 if (stcb == NULL) {
3370 if ((stcb != NULL) && (net == NULL)) {
3378 SCTP_TCB_UNLOCK(stcb);
3391 SCTP_TCB_UNLOCK(stcb);
3399 SCTP_TCB_UNLOCK(stcb);
3404 if (stcb != NULL) {
3408 encaps->sue_port = stcb->asoc.port;
3410 SCTP_TCB_UNLOCK(stcb);
3433 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3435 if (stcb) {
3436 av->assoc_value = stcb->asoc.ecn_supported;
3437 SCTP_TCB_UNLOCK(stcb);
3460 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3462 if (stcb) {
3463 av->assoc_value = stcb->asoc.prsctp_supported;
3464 SCTP_TCB_UNLOCK(stcb);
3487 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3489 if (stcb) {
3490 av->assoc_value = stcb->asoc.auth_supported;
3491 SCTP_TCB_UNLOCK(stcb);
3514 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3516 if (stcb) {
3517 av->assoc_value = stcb->asoc.asconf_supported;
3518 SCTP_TCB_UNLOCK(stcb);
3541 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3543 if (stcb) {
3544 av->assoc_value = stcb->asoc.reconfig_supported;
3545 SCTP_TCB_UNLOCK(stcb);
3568 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3570 if (stcb) {
3571 av->assoc_value = stcb->asoc.nrsack_supported;
3572 SCTP_TCB_UNLOCK(stcb);
3595 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3597 if (stcb) {
3598 av->assoc_value = stcb->asoc.pktdrop_supported;
3599 SCTP_TCB_UNLOCK(stcb);
3622 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3624 if (stcb) {
3625 av->assoc_value = (uint32_t) stcb->asoc.local_strreset_support;
3626 SCTP_TCB_UNLOCK(stcb);
3651 SCTP_FIND_STCB(inp, stcb, sprstat->sprstat_assoc_id);
3656 if ((stcb != NULL) &&
3657 (sid < stcb->asoc.streamoutcnt) &&
3662 sprstat->sprstat_abandoned_unsent = stcb->asoc.strmout[sid].abandoned_unsent[0];
3663 sprstat->sprstat_abandoned_sent = stcb->asoc.strmout[sid].abandoned_sent[0];
3665 sprstat->sprstat_abandoned_unsent = stcb->asoc.strmout[sid].abandoned_unsent[policy];
3666 sprstat->sprstat_abandoned_sent = stcb->asoc.strmout[sid].abandoned_sent[policy];
3669 if ((stcb != NULL) &&
3670 (sid < stcb->asoc.streamoutcnt) &&
3672 sprstat->sprstat_abandoned_unsent = stcb->asoc.strmout[sid].abandoned_unsent[0];
3673 sprstat->sprstat_abandoned_sent = stcb->asoc.strmout[sid].abandoned_sent[0];
3675 SCTP_TCB_UNLOCK(stcb);
3689 SCTP_FIND_STCB(inp, stcb, sprstat->sprstat_assoc_id);
3692 if ((stcb != NULL) &&
3697 sprstat->sprstat_abandoned_unsent = stcb->asoc.abandoned_unsent[0];
3698 sprstat->sprstat_abandoned_sent = stcb->asoc.abandoned_sent[0];
3700 sprstat->sprstat_abandoned_unsent = stcb->asoc.abandoned_unsent[policy];
3701 sprstat->sprstat_abandoned_sent = stcb->asoc.abandoned_sent[policy];
3703 SCTP_TCB_UNLOCK(stcb);
3716 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3718 if (stcb) {
3719 av->assoc_value = stcb->asoc.max_cwnd;
3720 SCTP_TCB_UNLOCK(stcb);
3755 struct sctp_tcb *stcb = NULL;
3911 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3912 if (stcb) {
3913 stcb->asoc.sctp_cmt_on_off = av->assoc_value;
3914 SCTP_TCB_UNLOCK(stcb);
3927 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
3928 SCTP_TCB_LOCK(stcb);
3929 stcb->asoc.sctp_cmt_on_off = av->assoc_value;
3930 SCTP_TCB_UNLOCK(stcb);
3954 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3955 if (stcb) {
3956 stcb->asoc.cc_functions = sctp_cc_functions[av->assoc_value];
3957 stcb->asoc.congestion_control_module = av->assoc_value;
3958 if (stcb->asoc.cc_functions.sctp_set_initial_cc_param != NULL) {
3959 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
3960 stcb->asoc.cc_functions.sctp_set_initial_cc_param(stcb, net);
3963 SCTP_TCB_UNLOCK(stcb);
3976 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
3977 SCTP_TCB_LOCK(stcb);
3978 stcb->asoc.cc_functions = sctp_cc_functions[av->assoc_value];
3979 stcb->asoc.congestion_control_module = av->assoc_value;
3980 if (stcb->asoc.cc_functions.sctp_set_initial_cc_param != NULL) {
3981 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
3982 stcb->asoc.cc_functions.sctp_set_initial_cc_param(stcb, net);
3985 SCTP_TCB_UNLOCK(stcb);
3997 SCTP_FIND_STCB(inp, stcb, cc_opt->aid_value.assoc_id);
3998 if (stcb == NULL) {
4001 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4002 SCTP_TCB_LOCK(stcb);
4003 if (stcb->asoc.cc_functions.sctp_cwnd_socket_option) {
4004 (*stcb->asoc.cc_functions.sctp_cwnd_socket_option) (stcb, 1, cc_opt);
4006 SCTP_TCB_UNLOCK(stcb);
4013 if (stcb->asoc.cc_functions.sctp_cwnd_socket_option == NULL) {
4016 error = (*stcb->asoc.cc_functions.sctp_cwnd_socket_option) (stcb, 1,
4019 SCTP_TCB_UNLOCK(stcb);
4038 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4039 if (stcb) {
4040 stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 1, 1);
4041 stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value];
4042 stcb->asoc.stream_scheduling_module = av->assoc_value;
4043 stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc, 1);
4044 SCTP_TCB_UNLOCK(stcb);
4057 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4058 SCTP_TCB_LOCK(stcb);
4059 stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, 1, 1);
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, 1);
4063 SCTP_TCB_UNLOCK(stcb);
4075 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4076 if (stcb) {
4077 if ((av->stream_id >= stcb->asoc.streamoutcnt) ||
4078 (stcb->asoc.ss_functions.sctp_ss_set_value(stcb, &stcb->asoc, &stcb->asoc.strmout[av->stream_id],
4083 SCTP_TCB_UNLOCK(stcb);
4087 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4088 SCTP_TCB_LOCK(stcb);
4089 if (av->stream_id < stcb->asoc.streamoutcnt) {
4090 stcb->asoc.ss_functions.sctp_ss_set_value(stcb,
4091 &stcb->asoc,
4092 &stcb->asoc.strmout[av->stream_id],
4095 SCTP_TCB_UNLOCK(stcb);
4118 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4120 if (stcb) {
4121 stcb->asoc.context = av->assoc_value;
4122 SCTP_TCB_UNLOCK(stcb);
4135 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4136 SCTP_TCB_LOCK(stcb);
4137 stcb->asoc.context = av->assoc_value;
4138 SCTP_TCB_UNLOCK(stcb);
4175 SCTP_FIND_STCB(inp, stcb, sack->sack_assoc_id);
4183 if (stcb) {
4185 stcb->asoc.delayed_ack = sack->sack_delay;
4188 stcb->asoc.sack_freq = sack->sack_freq;
4190 SCTP_TCB_UNLOCK(stcb);
4208 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4209 SCTP_TCB_LOCK(stcb);
4211 stcb->asoc.delayed_ack = sack->sack_delay;
4214 stcb->asoc.sack_freq = sack->sack_freq;
4216 SCTP_TCB_UNLOCK(stcb);
4257 SCTP_FIND_STCB(inp, stcb, sca->sca_assoc_id);
4259 if (stcb) {
4260 shared_keys = &stcb->asoc.shared_keys;
4262 sctp_clear_cachedkeys(stcb, sca->sca_keynumber);
4272 SCTP_TCB_UNLOCK(stcb);
4281 SCTP_TCB_UNLOCK(stcb);
4287 SCTP_TCB_UNLOCK(stcb);
4329 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4330 SCTP_TCB_LOCK(stcb);
4331 shared_keys = &stcb->asoc.shared_keys;
4336 sctp_clear_cachedkeys(stcb, sca->sca_keynumber);
4344 SCTP_TCB_UNLOCK(stcb);
4351 SCTP_TCB_UNLOCK(stcb);
4357 SCTP_TCB_UNLOCK(stcb);
4421 SCTP_FIND_STCB(inp, stcb, scact->scact_assoc_id);
4424 if (stcb) {
4426 if (sctp_auth_setactivekey(stcb,
4433 SCTP_TCB_UNLOCK(stcb);
4449 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4450 SCTP_TCB_LOCK(stcb);
4451 sctp_auth_setactivekey(stcb, scact->scact_keynumber);
4452 SCTP_TCB_UNLOCK(stcb);
4464 SCTP_FIND_STCB(inp, stcb, scdel->scact_assoc_id);
4467 if (stcb) {
4468 if (sctp_delete_sharedkey(stcb, scdel->scact_keynumber)) {
4472 SCTP_TCB_UNLOCK(stcb);
4488 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4489 SCTP_TCB_LOCK(stcb);
4490 sctp_delete_sharedkey(stcb, scdel->scact_keynumber);
4491 SCTP_TCB_UNLOCK(stcb);
4503 SCTP_FIND_STCB(inp, stcb, keyid->scact_assoc_id);
4506 if (stcb) {
4507 if (sctp_deact_sharedkey(stcb, keyid->scact_keynumber)) {
4511 SCTP_TCB_UNLOCK(stcb);
4527 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4528 SCTP_TCB_LOCK(stcb);
4529 sctp_deact_sharedkey(stcb, keyid->scact_keynumber);
4530 SCTP_TCB_UNLOCK(stcb);
4547 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4548 if (stcb) {
4549 stcb->asoc.local_strreset_support = (uint8_t) av->assoc_value;
4550 SCTP_TCB_UNLOCK(stcb);
4563 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4564 SCTP_TCB_LOCK(stcb);
4565 stcb->asoc.local_strreset_support = (uint8_t) av->assoc_value;
4566 SCTP_TCB_UNLOCK(stcb);
4580 SCTP_FIND_STCB(inp, stcb, strrst->srs_assoc_id);
4581 if (stcb == NULL) {
4586 if (stcb->asoc.reconfig_supported == 0) {
4592 SCTP_TCB_UNLOCK(stcb);
4598 SCTP_TCB_UNLOCK(stcb);
4603 if (stcb->asoc.stream_reset_outstanding) {
4606 SCTP_TCB_UNLOCK(stcb);
4616 SCTP_TCB_UNLOCK(stcb);
4622 SCTP_TCB_UNLOCK(stcb);
4627 (strrst->srs_stream_list[i] > stcb->asoc.streamincnt)) {
4633 (strrst->srs_stream_list[i] > stcb->asoc.streamoutcnt)) {
4640 SCTP_TCB_UNLOCK(stcb);
4650 if (stcb->asoc.strmout[strm].state == SCTP_STREAM_OPEN) {
4651 stcb->asoc.strmout[strm].state = SCTP_STREAM_RESET_PENDING;
4657 for (i = 0, cnt = 0; i < stcb->asoc.streamoutcnt; i++) {
4658 if (stcb->asoc.strmout[i].state == SCTP_STREAM_OPEN) {
4659 stcb->asoc.strmout[i].state = SCTP_STREAM_RESET_PENDING;
4666 error = sctp_send_str_reset_req(stcb, strrst->srs_number_streams,
4670 error = sctp_send_stream_reset_out_if_possible(stcb, SCTP_SO_LOCKED);
4673 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED);
4683 SCTP_TCB_UNLOCK(stcb);
4694 SCTP_FIND_STCB(inp, stcb, stradd->sas_assoc_id);
4695 if (stcb == NULL) {
4700 if (stcb->asoc.reconfig_supported == 0) {
4706 SCTP_TCB_UNLOCK(stcb);
4709 if (stcb->asoc.stream_reset_outstanding) {
4712 SCTP_TCB_UNLOCK(stcb);
4724 if ((((int)add_o_strmcnt) + ((int)stcb->asoc.streamoutcnt)) > 0x0000ffff) {
4740 cnt += stcb->asoc.streamincnt;
4746 if (cnt > (int)stcb->asoc.max_inbound_streams) {
4752 error = sctp_send_str_reset_req(stcb, 0, NULL, 0, 0, addstream, add_o_strmcnt, add_i_strmcnt, 0);
4753 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED);
4755 SCTP_TCB_UNLOCK(stcb);
4764 SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t) * value);
4765 if (stcb == NULL) {
4770 if (stcb->asoc.reconfig_supported == 0) {
4776 SCTP_TCB_UNLOCK(stcb);
4779 if (stcb->asoc.stream_reset_outstanding) {
4782 SCTP_TCB_UNLOCK(stcb);
4789 if (!TAILQ_EMPTY(&stcb->asoc.send_queue) ||
4790 !TAILQ_EMPTY(&stcb->asoc.sent_queue)) {
4794 SCTP_TCB_UNLOCK(stcb);
4798 for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
4799 if (!TAILQ_EMPTY(&stcb->asoc.strmout[i].outqueue)) {
4803 error = sctp_send_str_reset_req(stcb, 0, NULL, 0, 1, 0, 0, 0, 0);
4804 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED);
4805 SCTP_TCB_UNLOCK(stcb);
4834 stcb = LIST_FIRST(&inp->sctp_asoc_list);
4835 if (stcb) {
4836 SCTP_TCB_LOCK(stcb);
4843 * decrement if it finds the stcb as long as
4848 stcb = sctp_findassociation_ep_addr(&inp, sa, NULL, NULL, NULL);
4849 if (stcb == NULL) {
4854 if (stcb == NULL) {
4859 if (stcb->asoc.delayed_connection == 1) {
4860 stcb->asoc.delayed_connection = 0;
4861 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
4862 sctp_timer_stop(SCTP_TIMER_TYPE_INIT, inp, stcb,
4863 stcb->asoc.primary_destination,
4865 sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED);
4874 SCTP_TCB_UNLOCK(stcb);
4882 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4884 if (stcb) {
4885 stcb->asoc.max_burst = av->assoc_value;
4886 SCTP_TCB_UNLOCK(stcb);
4899 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4900 SCTP_TCB_LOCK(stcb);
4901 stcb->asoc.max_burst = av->assoc_value;
4902 SCTP_TCB_UNLOCK(stcb);
4915 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4922 if (stcb) {
4924 stcb->asoc.sctp_frag_point = (av->assoc_value + ovh);
4926 stcb->asoc.sctp_frag_point = SCTP_DEFAULT_MAXSEGMENT;
4928 SCTP_TCB_UNLOCK(stcb);
5026 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
5027 SCTP_TCB_LOCK(stcb);
5029 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVASSOCEVNT);
5031 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVASSOCEVNT);
5034 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVPADDREVNT);
5036 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVPADDREVNT);
5039 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT);
5041 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT);
5044 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVPEERERR);
5046 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVPEERERR);
5049 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT);
5051 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT);
5054 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_PDAPIEVNT);
5056 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_PDAPIEVNT);
5059 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_ADAPTATIONEVNT);
5061 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_ADAPTATIONEVNT);
5064 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_AUTHEVNT);
5066 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_AUTHEVNT);
5069 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_DRYEVNT);
5071 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_DRYEVNT);
5074 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_STREAM_RESETEVNT);
5076 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_STREAM_RESETEVNT);
5078 SCTP_TCB_UNLOCK(stcb);
5087 stcb = LIST_FIRST(&inp->sctp_asoc_list);
5088 if (stcb) {
5089 SCTP_TCB_LOCK(stcb);
5090 if (TAILQ_EMPTY(&stcb->asoc.send_queue) &&
5091 TAILQ_EMPTY(&stcb->asoc.sent_queue) &&
5092 (stcb->asoc.stream_queue_cnt == 0)) {
5093 sctp_ulp_notify(SCTP_NOTIFY_SENDER_DRY, stcb, 0, NULL, SCTP_SO_LOCKED);
5095 SCTP_TCB_UNLOCK(stcb);
5130 SCTP_FIND_STCB(inp, stcb, s_info->sinfo_assoc_id);
5132 if (stcb) {
5133 if (s_info->sinfo_stream < stcb->asoc.streamoutcnt) {
5134 memcpy(&stcb->asoc.def_send, s_info, min(optsize, sizeof(stcb->asoc.def_send)));
5139 SCTP_TCB_UNLOCK(stcb);
5152 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
5153 SCTP_TCB_LOCK(stcb);
5154 if (s_info->sinfo_stream < stcb->asoc.streamoutcnt) {
5155 memcpy(&stcb->asoc.def_send, s_info, min(optsize, sizeof(stcb->asoc.def_send)));
5157 SCTP_TCB_UNLOCK(stcb);
5176 SCTP_FIND_STCB(inp, stcb, paddrp->spp_assoc_id);
5195 if (stcb != NULL) {
5196 net = sctp_findnet(stcb, addr);
5201 * decrement if it finds the stcb as long as
5207 stcb = sctp_findassociation_ep_addr(&inp, addr,
5209 if (stcb == NULL) {
5213 if ((stcb != NULL) && (net == NULL)) {
5222 SCTP_TCB_UNLOCK(stcb);
5235 SCTP_TCB_UNLOCK(stcb);
5243 SCTP_TCB_UNLOCK(stcb);
5250 if (stcb)
5251 SCTP_TCB_UNLOCK(stcb);
5256 if (stcb)
5257 SCTP_TCB_UNLOCK(stcb);
5261 if (stcb != NULL) {
5268 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net,
5279 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net,
5281 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
5286 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
5287 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED);
5288 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
5292 sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net,
5311 if (net->mtu < stcb->asoc.smallest_mtu) {
5312 sctp_pathmtu_adjustment(stcb, net->mtu);
5317 sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net);
5330 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
5332 stcb->sctp_ep, stcb, net,
5334 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
5340 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
5345 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
5365 stcb->asoc.def_net_failure = paddrp->spp_pathmaxrxt;
5366 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5375 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
5377 stcb->sctp_ep, stcb, net,
5379 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
5385 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
5390 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
5398 stcb->asoc.heart_beat_delay = paddrp->spp_hbinterval;
5400 stcb->asoc.heart_beat_delay = 0;
5403 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5412 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net,
5414 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
5416 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_DONOT_HEARTBEAT);
5419 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5424 inp, stcb, net,
5429 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_DONOT_HEARTBEAT);
5432 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5434 sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net,
5453 if (net->mtu < stcb->asoc.smallest_mtu) {
5454 sctp_pathmtu_adjustment(stcb, net->mtu);
5457 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD);
5460 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5462 sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net);
5466 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD);
5469 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5473 stcb->asoc.default_dscp = paddrp->spp_dscp & 0xfc;
5474 stcb->asoc.default_dscp |= 0x01;
5478 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5484 stcb->asoc.default_flowlabel = paddrp->spp_ipv6_flowlabel & 0x000fffff;
5485 stcb->asoc.default_flowlabel |= 0x80000000;
5489 SCTP_TCB_UNLOCK(stcb);
5552 SCTP_FIND_STCB(inp, stcb, srto->srto_assoc_id);
5554 if (stcb) {
5558 new_init = stcb->asoc.initial_rto;
5562 new_max = stcb->asoc.maxrto;
5566 new_min = stcb->asoc.minrto;
5568 stcb->asoc.initial_rto = new_init;
5569 stcb->asoc.maxrto = new_max;
5570 stcb->asoc.minrto = new_min;
5575 SCTP_TCB_UNLOCK(stcb);
5614 SCTP_FIND_STCB(inp, stcb, sasoc->sasoc_assoc_id);
5623 if (stcb) {
5625 stcb->asoc.max_send_times = sasoc->sasoc_asocmaxrxt;
5627 stcb->asoc.cookie_life = MSEC_TO_TICKS(sasoc->sasoc_cookie_life);
5629 SCTP_TCB_UNLOCK(stcb);
5680 SCTP_FIND_STCB(inp, stcb, spa->ssp_assoc_id);
5699 if (stcb != NULL) {
5700 net = sctp_findnet(stcb, addr);
5705 * decrement if it finds the stcb as long as
5711 stcb = sctp_findassociation_ep_addr(&inp, addr,
5713 if (stcb == NULL) {
5718 if ((stcb != NULL) && (net != NULL)) {
5719 if (net != stcb->asoc.primary_destination) {
5722 if (sctp_set_primary_addr(stcb, (struct sockaddr *)NULL, net) == 0) {
5723 if ((stcb->asoc.alternate) &&
5726 sctp_free_remote_addr(stcb->asoc.alternate);
5727 stcb->asoc.alternate = NULL;
5742 if (stcb != NULL) {
5743 SCTP_TCB_UNLOCK(stcb);
5772 SCTP_FIND_STCB(inp, stcb, sspp->sspp_assoc_id);
5773 if (stcb != NULL) {
5793 ifa = sctp_find_ifa_by_addr(addr, stcb->asoc.vrf_id, SCTP_ADDR_NOT_LOCKED);
5861 if (sctp_set_primary_ip_address_sa(stcb, addr) != 0) {
5866 SCTP_TCB_UNLOCK(stcb);
5889 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
5903 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
5933 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
5949 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
5969 SCTP_FIND_STCB(inp, stcb, event->se_assoc_id);
6022 if (stcb) {
6024 sctp_stcb_feature_on(inp, stcb, event_type);
6026 if (TAILQ_EMPTY(&stcb->asoc.send_queue) &&
6027 TAILQ_EMPTY(&stcb->asoc.sent_queue) &&
6028 (stcb->asoc.stream_queue_cnt == 0)) {
6029 sctp_ulp_notify(SCTP_NOTIFY_SENDER_DRY, stcb, 0, NULL, SCTP_SO_LOCKED);
6033 sctp_stcb_feature_off(inp, stcb, event_type);
6035 SCTP_TCB_UNLOCK(stcb);
6066 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
6067 SCTP_TCB_LOCK(stcb);
6069 sctp_stcb_feature_on(inp, stcb, event_type);
6071 sctp_stcb_feature_off(inp, stcb, event_type);
6073 SCTP_TCB_UNLOCK(stcb);
6115 SCTP_FIND_STCB(inp, stcb, info->snd_assoc_id);
6117 if (stcb) {
6118 if (info->snd_sid < stcb->asoc.streamoutcnt) {
6119 stcb->asoc.def_send.sinfo_stream = info->snd_sid;
6120 policy = PR_SCTP_POLICY(stcb->asoc.def_send.sinfo_flags);
6121 stcb->asoc.def_send.sinfo_flags = info->snd_flags;
6122 stcb->asoc.def_send.sinfo_flags |= policy;
6123 stcb->asoc.def_send.sinfo_ppid = info->snd_ppid;
6124 stcb->asoc.def_send.sinfo_context = info->snd_context;
6129 SCTP_TCB_UNLOCK(stcb);
6147 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
6148 SCTP_TCB_LOCK(stcb);
6149 if (info->snd_sid < stcb->asoc.streamoutcnt) {
6150 stcb->asoc.def_send.sinfo_stream = info->snd_sid;
6151 policy = PR_SCTP_POLICY(stcb->asoc.def_send.sinfo_flags);
6152 stcb->asoc.def_send.sinfo_flags = info->snd_flags;
6153 stcb->asoc.def_send.sinfo_flags |= policy;
6154 stcb->asoc.def_send.sinfo_ppid = info->snd_ppid;
6155 stcb->asoc.def_send.sinfo_context = info->snd_context;
6157 SCTP_TCB_UNLOCK(stcb);
6169 SCTP_FIND_STCB(inp, stcb, info->pr_assoc_id);
6176 if (stcb) {
6177 stcb->asoc.def_send.sinfo_flags &= 0xfff0;
6178 stcb->asoc.def_send.sinfo_flags |= info->pr_policy;
6179 stcb->asoc.def_send.sinfo_timetolive = info->pr_value;
6180 SCTP_TCB_UNLOCK(stcb);
6195 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
6196 SCTP_TCB_LOCK(stcb);
6197 stcb->asoc.def_send.sinfo_flags &= 0xfff0;
6198 stcb->asoc.def_send.sinfo_flags |= info->pr_policy;
6199 stcb->asoc.def_send.sinfo_timetolive = info->pr_value;
6200 SCTP_TCB_UNLOCK(stcb);
6220 SCTP_FIND_STCB(inp, stcb, thlds->spt_assoc_id);
6239 if (stcb != NULL) {
6240 net = sctp_findnet(stcb, addr);
6245 * decrement if it finds the stcb as long as
6251 stcb = sctp_findassociation_ep_addr(&inp, addr,
6253 if (stcb == NULL) {
6257 if ((stcb != NULL) && (net == NULL)) {
6266 SCTP_TCB_UNLOCK(stcb);
6279 SCTP_TCB_UNLOCK(stcb);
6287 SCTP_TCB_UNLOCK(stcb);
6292 if (stcb != NULL) {
6305 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
6307 stcb->sctp_ep, stcb, net,
6309 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
6315 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
6320 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
6324 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
6336 sctp_send_hb(stcb, net, SCTP_SO_LOCKED);
6338 stcb->sctp_ep, stcb, net,
6340 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
6346 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_DOWN, stcb, 0, net, SCTP_SO_LOCKED);
6351 sctp_ulp_notify(SCTP_NOTIFY_INTERFACE_UP, stcb, 0, net, SCTP_SO_LOCKED);
6355 stcb->asoc.def_net_failure = thlds->spt_pathmaxrxt;
6356 stcb->asoc.def_net_pf_threshold = thlds->spt_pathpfthld;
6358 SCTP_TCB_UNLOCK(stcb);
6386 SCTP_FIND_STCB(inp, stcb, encaps->sue_assoc_id);
6405 if (stcb != NULL) {
6406 net = sctp_findnet(stcb, addr);
6411 * decrement if it finds the stcb as long as
6417 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
6418 if (stcb == NULL) {
6422 if ((stcb != NULL) && (net == NULL)) {
6431 SCTP_TCB_UNLOCK(stcb);
6444 SCTP_TCB_UNLOCK(stcb);
6452 SCTP_TCB_UNLOCK(stcb);
6457 if (stcb != NULL) {
6461 stcb->asoc.port = encaps->sue_port;
6463 SCTP_TCB_UNLOCK(stcb);
6483 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6485 if (stcb) {
6488 SCTP_TCB_UNLOCK(stcb);
6512 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6514 if (stcb) {
6517 SCTP_TCB_UNLOCK(stcb);
6541 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6543 if (stcb) {
6546 SCTP_TCB_UNLOCK(stcb);
6580 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6582 if (stcb) {
6585 SCTP_TCB_UNLOCK(stcb);
6627 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6629 if (stcb) {
6632 SCTP_TCB_UNLOCK(stcb);
6656 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6658 if (stcb) {
6661 SCTP_TCB_UNLOCK(stcb);
6685 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6687 if (stcb) {
6690 SCTP_TCB_UNLOCK(stcb);
6715 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6717 if (stcb) {
6718 stcb->asoc.max_cwnd = av->assoc_value;
6719 if (stcb->asoc.max_cwnd > 0) {
6720 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
6721 if ((net->cwnd > stcb->asoc.max_cwnd) &&
6723 net->cwnd = stcb->asoc.max_cwnd;
6730 SCTP_TCB_UNLOCK(stcb);
6828 struct sctp_tcb *stcb = NULL;
6917 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EADDRINUSE);
6923 stcb = LIST_FIRST(&inp->sctp_asoc_list);
6928 * will do a decrement if it finds the stcb as long as the
6932 stcb = sctp_findassociation_ep_addr(&inp, addr, NULL, NULL, NULL);
6933 if (stcb == NULL) {
6936 SCTP_TCB_UNLOCK(stcb);
6939 if (stcb != NULL) {
6947 stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id, inp->sctp_ep.pre_open_stream_count, p);
6948 if (stcb == NULL) {
6952 if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) {
6953 stcb->sctp_ep->sctp_flags |= SCTP_PCB_FLAGS_CONNECTED;
6957 SCTP_SET_STATE(&stcb->asoc, SCTP_STATE_COOKIE_WAIT);
6958 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
6961 sctp_initialize_auth_params(inp, stcb);
6963 sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED);
6964 SCTP_TCB_UNLOCK(stcb);
7143 struct sctp_tcb *stcb;
7168 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7169 if (stcb == NULL) {
7174 SCTP_TCB_LOCK(stcb);
7176 store = stcb->asoc.primary_destination->ro._l_addr;
7177 stcb->asoc.state &= ~SCTP_STATE_IN_ACCEPT_QUEUE;
7178 SCTP_TCB_UNLOCK(stcb);
7249 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
7250 SCTP_TCB_LOCK(stcb);
7251 sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC,
7284 struct sctp_tcb *stcb;
7289 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7290 if (stcb == NULL) {
7295 SCTP_TCB_LOCK(stcb);
7296 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
7309 SCTP_TCB_UNLOCK(stcb);
7314 stcb,
7321 SCTP_TCB_UNLOCK(stcb);
7362 struct sctp_tcb *stcb;
7381 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7382 if (stcb) {
7383 SCTP_TCB_LOCK(stcb);
7386 if (stcb == NULL) {
7392 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
7396 sin->sin_port = stcb->rport;
7401 SCTP_TCB_UNLOCK(stcb);