Lines Matching +full:wakeup +full:- +full:rtt +full:- +full:timer

1 /*-
2 * SPDX-License-Identifier: BSD-3-Clause
4 * Copyright (c) 2001-2008, by Cisco Systems, Inc. All rights reserved.
5 * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved.
6 * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved.
112 asoc = &stcb->asoc; in sctp_pathmtu_adjustment()
113 KASSERT(mtu < asoc->smallest_mtu, in sctp_pathmtu_adjustment()
115 asoc->smallest_mtu, mtu)); in sctp_pathmtu_adjustment()
116 asoc->smallest_mtu = mtu; in sctp_pathmtu_adjustment()
117 if (stcb->sctp_ep->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { in sctp_pathmtu_adjustment()
122 if (asoc->idata_supported) { in sctp_pathmtu_adjustment()
123 if (sctp_auth_is_required_chunk(SCTP_IDATA, asoc->peer_auth_chunks)) { in sctp_pathmtu_adjustment()
124 overhead += sctp_get_auth_chunk_len(asoc->peer_hmac_id); in sctp_pathmtu_adjustment()
127 if (sctp_auth_is_required_chunk(SCTP_DATA, asoc->peer_auth_chunks)) { in sctp_pathmtu_adjustment()
128 overhead += sctp_get_auth_chunk_len(asoc->peer_hmac_id); in sctp_pathmtu_adjustment()
133 TAILQ_FOREACH(chk, &asoc->send_queue, sctp_next) { in sctp_pathmtu_adjustment()
134 if (((uint32_t)chk->send_size + overhead) > mtu) { in sctp_pathmtu_adjustment()
135 chk->flags |= CHUNK_FLAGS_FRAGMENT_OK; in sctp_pathmtu_adjustment()
138 TAILQ_FOREACH(chk, &asoc->sent_queue, sctp_next) { in sctp_pathmtu_adjustment()
139 if (((uint32_t)chk->send_size + overhead) > mtu) { in sctp_pathmtu_adjustment()
140 chk->flags |= CHUNK_FLAGS_FRAGMENT_OK; in sctp_pathmtu_adjustment()
141 if (resend && chk->sent < SCTP_DATAGRAM_RESEND) { in sctp_pathmtu_adjustment()
149 chk->sent = SCTP_DATAGRAM_RESEND; in sctp_pathmtu_adjustment()
150 sctp_ucount_incr(asoc->sent_queue_retran_cnt); in sctp_pathmtu_adjustment()
151 chk->rec.data.doing_fast_retransmit = 0; in sctp_pathmtu_adjustment()
154 chk->whoTo->flight_size, in sctp_pathmtu_adjustment()
155 chk->book_size, in sctp_pathmtu_adjustment()
156 (uint32_t)(uintptr_t)chk->whoTo, in sctp_pathmtu_adjustment()
157 chk->rec.data.tsn); in sctp_pathmtu_adjustment()
159 /* Clear any time, so NO RTT is being done. */ in sctp_pathmtu_adjustment()
160 if (chk->do_rtt == 1) { in sctp_pathmtu_adjustment()
161 chk->do_rtt = 0; in sctp_pathmtu_adjustment()
162 chk->whoTo->rto_needed = 1; in sctp_pathmtu_adjustment()
195 if (net->dest_state & SCTP_ADDR_REACHABLE) { in sctp_notify()
197 net->dest_state &= ~SCTP_ADDR_REACHABLE; in sctp_notify()
198 net->dest_state &= ~SCTP_ADDR_PF; in sctp_notify()
212 if (net->dest_state & SCTP_ADDR_NO_PMTUD) { in sctp_notify()
225 /* Stop the PMTU timer. */ in sctp_notify()
226 if (SCTP_OS_TIMER_PENDING(&net->pmtu_timer.timer)) { in sctp_notify()
234 if (net->port) { in sctp_notify()
235 next_mtu -= sizeof(struct udphdr); in sctp_notify()
237 if (net->mtu > next_mtu) { in sctp_notify()
238 net->mtu = next_mtu; in sctp_notify()
239 if (net->port) { in sctp_notify()
240 sctp_hc_set_mtu(&net->ro._l_addr, inp->fibnum, next_mtu + sizeof(struct udphdr)); in sctp_notify()
242 sctp_hc_set_mtu(&net->ro._l_addr, inp->fibnum, next_mtu); in sctp_notify()
246 if (stcb->asoc.smallest_mtu > next_mtu) { in sctp_notify()
249 /* Finally, start the PMTU timer if it was running before. */ in sctp_notify()
273 outer_ip = (struct ip *)((caddr_t)icmp - sizeof(struct ip)); in sctp_ctlinput()
274 inner_ip = &icmp->icmp_ip; in sctp_ctlinput()
275 sh = (struct sctphdr *)((caddr_t)inner_ip + (inner_ip->ip_hl << 2)); in sctp_ctlinput()
279 src.sin_port = sh->src_port; in sctp_ctlinput()
280 src.sin_addr = inner_ip->ip_src; in sctp_ctlinput()
284 dst.sin_port = sh->dest_port; in sctp_ctlinput()
285 dst.sin_addr = inner_ip->ip_dst; in sctp_ctlinput()
301 if (ntohl(sh->v_tag) != 0) { in sctp_ctlinput()
307 if (ntohl(sh->v_tag) != stcb->asoc.peer_vtag) { in sctp_ctlinput()
312 if (ntohs(outer_ip->ip_len) >= in sctp_ctlinput()
314 8 + (inner_ip->ip_hl << 2) + 20) { in sctp_ctlinput()
321 if ((ch->ch.chunk_type != SCTP_INITIATION) || in sctp_ctlinput()
322 (ntohl(ch->init.initiate_tag) != stcb->asoc.my_vtag)) { in sctp_ctlinput()
332 icmp->icmp_type, in sctp_ctlinput()
333 icmp->icmp_code, in sctp_ctlinput()
334 ntohs(inner_ip->ip_len), in sctp_ctlinput()
335 (uint32_t)ntohs(icmp->icmp_nextmtu)); in sctp_ctlinput()
338 /* reduce ref-count */ in sctp_ctlinput()
361 /* FIX, for non-bsd is this right? */ in sctp_getcred()
364 error = priv_check(req->td, PRIV_NETINET_GETCRED); in sctp_getcred()
376 if (stcb == NULL || inp == NULL || inp->sctp_socket == NULL) { in sctp_getcred()
378 /* reduce ref-count */ in sctp_getcred()
397 error = cr_canseesocket(req->td->td_ucred, inp->sctp_socket); in sctp_getcred()
402 cru2x(inp->sctp_socket->so_cred, &xuc); in sctp_getcred()
420 inp = (struct sctp_inpcb *)so->so_pcb; in sctp_abort()
430 if (((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0)) { in sctp_abort()
431 inp->sctp_flags |= SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_CLOSE_IP; in sctp_abort()
441 SCTP_SB_CLEAR(so->so_snd); in sctp_abort()
442 SCTP_SB_CLEAR(so->so_rcv); in sctp_abort()
444 so->so_pcb = NULL; in sctp_abort()
461 inp = (struct sctp_inpcb *)so->so_pcb; in sctp_attach()
466 if (so->so_snd.sb_hiwat == 0 || so->so_rcv.sb_hiwat == 0) { in sctp_attach()
476 inp = (struct sctp_inpcb *)so->so_pcb; in sctp_attach()
478 inp->sctp_flags &= ~SCTP_PCB_FLAGS_BOUND_V6; /* I'm not v6! */ in sctp_attach()
479 ip_inp = &inp->ip_inp.inp; in sctp_attach()
480 ip_inp->inp_vflag |= INP_IPV4; in sctp_attach()
481 ip_inp->inp_ip_ttl = MODULE_GLOBAL(ip_defttl); in sctp_attach()
491 inp = (struct sctp_inpcb *)so->so_pcb; in sctp_bind()
497 if ((addr->sa_family != AF_INET) || in sctp_bind()
498 (addr->sa_len != sizeof(struct sockaddr_in))) { in sctp_bind()
513 inp = (struct sctp_inpcb *)so->so_pcb; in sctp_close()
525 if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) { in sctp_close()
526 inp->sctp_flags |= SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_CLOSE_IP; in sctp_close()
527 if (((so->so_options & SO_LINGER) && (so->so_linger == 0)) || in sctp_close()
528 (SCTP_SBAVAIL(&so->so_rcv) > 0)) { in sctp_close()
549 SCTP_SB_CLEAR(so->so_snd); in sctp_close()
550 SCTP_SB_CLEAR(so->so_rcv); in sctp_close()
553 so->so_pcb = NULL; in sctp_close()
572 inp = (struct sctp_inpcb *)so->so_pcb; in sctp_sendm()
584 ((inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) || in sctp_sendm()
585 (inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE))) { in sctp_sendm()
593 } else if (addr->sa_family != AF_INET) { in sctp_sendm()
596 } else if (addr->sa_len != sizeof(struct sockaddr_in)) { in sctp_sendm()
611 if (inp->control) { in sctp_sendm()
612 sctp_m_freem(inp->control); in sctp_sendm()
613 inp->control = NULL; in sctp_sendm()
615 inp->control = control; in sctp_sendm()
618 if (inp->pkt) { in sctp_sendm()
619 SCTP_BUF_NEXT(inp->pkt_last) = m; in sctp_sendm()
620 inp->pkt_last = m; in sctp_sendm()
622 inp->pkt_last = inp->pkt = m; in sctp_sendm()
630 * by OpenBSD-- NetBSD, FreeBSD, and MacOS have methods for in sctp_sendm()
631 * re-defining sosend to use the sctp_sosend. One can in sctp_sendm()
640 ret = sctp_output(inp, inp->pkt, addr, inp->control, p, flags); in sctp_sendm()
642 inp->pkt = NULL; in sctp_sendm()
643 inp->control = NULL; in sctp_sendm()
658 inp = (struct sctp_inpcb *)so->so_pcb; in sctp_disconnect()
664 KASSERT(inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE || in sctp_disconnect()
665 inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL, in sctp_disconnect()
666 ("Not a one-to-one style socket")); in sctp_disconnect()
667 stcb = LIST_FIRST(&inp->sctp_asoc_list); in sctp_disconnect()
674 asoc = &stcb->asoc; in sctp_disconnect()
675 if (asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) { in sctp_disconnect()
682 if (((so->so_options & SO_LINGER) && (so->so_linger == 0)) || in sctp_disconnect()
683 (SCTP_SBAVAIL(&so->so_rcv) > 0)) { in sctp_disconnect()
703 if (TAILQ_EMPTY(&asoc->send_queue) && in sctp_disconnect()
704 TAILQ_EMPTY(&asoc->sent_queue) && in sctp_disconnect()
705 (asoc->stream_queue_cnt == 0)) { in sctp_disconnect()
707 if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { 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()
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()
741 * first and move to SHUTDOWN-PENDING in sctp_disconnect()
744 if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { in sctp_disconnect()
747 if (TAILQ_EMPTY(&asoc->send_queue) && in sctp_disconnect()
748 TAILQ_EMPTY(&asoc->sent_queue) && in sctp_disconnect()
749 (asoc->state & 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()
780 struct sctp_inpcb *inp = (struct sctp_inpcb *)so->so_pcb; in sctp_shutdown()
792 if (!((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) || in sctp_shutdown()
793 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL))) in sctp_shutdown()
799 so->so_error = ECONNABORTED; in sctp_shutdown()
804 } else if ((so->so_state & in sctp_shutdown()
812 * For 1-to-1 style sockets, flush the read queue and trigger an in sctp_shutdown()
821 stcb = LIST_FIRST(&inp->sctp_asoc_list); in sctp_shutdown()
826 inp->sctp_flags |= SCTP_PCB_FLAGS_SOCKET_CANT_READ; in sctp_shutdown()
828 TAILQ_FOREACH_SAFE(control, &inp->read_queue, next, ncontrol) { in sctp_shutdown()
829 if ((control->spec_flags & M_NOTIFICATION) == 0) { in sctp_shutdown()
832 TAILQ_REMOVE(&inp->read_queue, control, next); in sctp_shutdown()
833 control->on_read_q = 0; in sctp_shutdown()
834 for (m = control->data; m; m = SCTP_BUF_NEXT(m)) { in sctp_shutdown()
835 sctp_sbfree(control, control->stcb, in sctp_shutdown()
836 &so->so_rcv, m); in sctp_shutdown()
838 if (control->on_strm_q == 0) { in sctp_shutdown()
839 sctp_free_remote_addr(control->whoFrom); in sctp_shutdown()
840 if (control->data) { in sctp_shutdown()
841 sctp_m_freem(control->data); in sctp_shutdown()
842 control->data = NULL; in sctp_shutdown()
847 stcb->asoc.size_on_all_streams += in sctp_shutdown()
848 control->length; in sctp_shutdown()
855 inp->last_abort_code = SCTP_FROM_SCTP_USRREQ + in sctp_shutdown()
884 stcb = LIST_FIRST(&inp->sctp_asoc_list); in sctp_shutdown()
895 asoc = &stcb->asoc; in sctp_shutdown()
896 if (asoc->state & SCTP_STATE_ABOUT_TO_BE_FREED) { in sctp_shutdown()
913 if (stcb->asoc.alternate) { in sctp_shutdown()
914 netp = stcb->asoc.alternate; in sctp_shutdown()
916 netp = stcb->asoc.primary_destination; in sctp_shutdown()
919 TAILQ_EMPTY(&asoc->send_queue) && in sctp_shutdown()
920 TAILQ_EMPTY(&asoc->sent_queue) && in sctp_shutdown()
921 (asoc->stream_queue_cnt == 0)) { in sctp_shutdown()
922 if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { in sctp_shutdown()
931 stcb->sctp_ep, stcb, netp); in sctp_shutdown()
933 stcb->sctp_ep, stcb, NULL); in sctp_shutdown()
940 if ((*asoc->ss_functions.sctp_ss_is_user_msgs_incomplete) (stcb, asoc)) { in sctp_shutdown()
943 if (TAILQ_EMPTY(&asoc->send_queue) && in sctp_shutdown()
944 TAILQ_EMPTY(&asoc->sent_queue) && in sctp_shutdown()
945 (asoc->state & SCTP_STATE_PARTIAL_MSG_LEFT)) { in sctp_shutdown()
950 stcb->sctp_ep->last_abort_code = SCTP_FROM_SCTP_USRREQ + SCTP_LOC_6; in sctp_shutdown()
952 sctp_abort_an_association(stcb->sctp_ep, stcb, in sctp_shutdown()
968 wakeup(&so->so_timeo); in sctp_shutdown()
986 memcpy(dst, src, src->sa_len); in sctp_fill_user_address()
1016 loopback_scope = stcb->asoc.scope.loopback_scope; in sctp_fill_up_addresses_vrf()
1018 ipv4_local_scope = stcb->asoc.scope.ipv4_local_scope; in sctp_fill_up_addresses_vrf()
1019 ipv4_addr_legal = stcb->asoc.scope.ipv4_addr_legal; in sctp_fill_up_addresses_vrf()
1022 local_scope = stcb->asoc.scope.local_scope; in sctp_fill_up_addresses_vrf()
1023 site_scope = stcb->asoc.scope.site_scope; in sctp_fill_up_addresses_vrf()
1024 ipv6_addr_legal = stcb->asoc.scope.ipv6_addr_legal; in sctp_fill_up_addresses_vrf()
1036 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) { in sctp_fill_up_addresses_vrf()
1060 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { in sctp_fill_up_addresses_vrf()
1061 LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) { in sctp_fill_up_addresses_vrf()
1067 LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) { in sctp_fill_up_addresses_vrf()
1070 * For the BOUND-ALL case, the list in sctp_fill_up_addresses_vrf()
1082 switch (sctp_ifa->address.sa.sa_family) { in sctp_fill_up_addresses_vrf()
1088 sin = &sctp_ifa->address.sin; in sctp_fill_up_addresses_vrf()
1089 if (sin->sin_addr.s_addr == 0) { in sctp_fill_up_addresses_vrf()
1097 if (prison_check_ip4(inp->ip_inp.inp.inp_cred, in sctp_fill_up_addresses_vrf()
1098 &sin->sin_addr) != 0) { in sctp_fill_up_addresses_vrf()
1102 (IN4_ISPRIVATE_ADDRESS(&sin->sin_addr))) { in sctp_fill_up_addresses_vrf()
1111 ((struct sockaddr_in6 *)addr)->sin6_port = inp->sctp_lport; in sctp_fill_up_addresses_vrf()
1120 ((struct sockaddr_in *)addr)->sin_port = inp->sctp_lport; in sctp_fill_up_addresses_vrf()
1136 sin6 = &sctp_ifa->address.sin6; in sctp_fill_up_addresses_vrf()
1137 if (IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) { in sctp_fill_up_addresses_vrf()
1145 if (prison_check_ip6(inp->ip_inp.inp.inp_cred, in sctp_fill_up_addresses_vrf()
1146 &sin6->sin6_addr) != 0) { in sctp_fill_up_addresses_vrf()
1149 if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr)) { in sctp_fill_up_addresses_vrf()
1152 if (sin6->sin6_scope_id == 0) { in sctp_fill_up_addresses_vrf()
1167 (IN6_IS_ADDR_SITELOCAL(&sin6->sin6_addr))) { in sctp_fill_up_addresses_vrf()
1174 ((struct sockaddr_in6 *)addr)->sin6_port = inp->sctp_lport; in sctp_fill_up_addresses_vrf()
1192 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { in sctp_fill_up_addresses_vrf()
1194 if (sctp_is_addr_restricted(stcb, laddr->ifa)) { in sctp_fill_up_addresses_vrf()
1198 sa_len = laddr->ifa->address.sa.sa_len; in sctp_fill_up_addresses_vrf()
1202 if (sctp_fill_user_address(addr, &laddr->ifa->address.sa)) in sctp_fill_up_addresses_vrf()
1204 switch (laddr->ifa->address.sa.sa_family) { in sctp_fill_up_addresses_vrf()
1207 ((struct sockaddr_in *)addr)->sin_port = inp->sctp_lport; in sctp_fill_up_addresses_vrf()
1212 ((struct sockaddr_in6 *)addr)->sin6_port = inp->sctp_lport; in sctp_fill_up_addresses_vrf()
1237 inp->def_vrf_id); in sctp_fill_up_addresses()
1249 * In both sub-set bound an bound_all cases we return the size of in sctp_max_size_addresses_vrf()
1251 * the sub-set bound may have an exclusion list for a given TCB or in sctp_max_size_addresses_vrf()
1252 * in the bound-all case a TCB may NOT include the loopback or other in sctp_max_size_addresses_vrf()
1261 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) { in sctp_max_size_addresses_vrf()
1265 LIST_FOREACH(sctp_ifn, &vrf->ifnlist, next_ifn) { in sctp_max_size_addresses_vrf()
1266 LIST_FOREACH(sctp_ifa, &sctp_ifn->ifalist, next_ifa) { in sctp_max_size_addresses_vrf()
1268 switch (sctp_ifa->address.sa.sa_family) { in sctp_max_size_addresses_vrf()
1294 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) { in sctp_max_size_addresses_vrf()
1295 switch (laddr->ifa->address.sa.sa_family) { in sctp_max_size_addresses_vrf()
1328 size = sctp_max_size_addresses_vrf(inp, inp->def_vrf_id); in sctp_max_size_addresses()
1347 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) && in sctp_do_connect_x()
1348 (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED)) { in sctp_do_connect_x()
1354 if ((inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) && in sctp_do_connect_x()
1360 if (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) { in sctp_do_connect_x()
1362 stcb = LIST_FIRST(&inp->sctp_asoc_list); in sctp_do_connect_x()
1372 if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) || in sctp_do_connect_x()
1373 (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) { in sctp_do_connect_x()
1381 …error = sctp_connectx_helper_find(inp, sa, totaddr, &num_v4, &num_v6, (unsigned int)(optsize - siz… in sctp_do_connect_x()
1390 if (((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) && in sctp_do_connect_x()
1395 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) && in sctp_do_connect_x()
1400 * to a v4 addr or v4-mapped addr in sctp_do_connect_x()
1408 if (inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) { in sctp_do_connect_x()
1417 vrf_id = inp->def_vrf_id; in sctp_do_connect_x()
1421 inp->sctp_ep.pre_open_stream_count, in sctp_do_connect_x()
1422 inp->sctp_ep.port, in sctp_do_connect_x()
1431 switch (sa->sa_family) { in sctp_do_connect_x()
1447 sctp_connectx_helper_add(stcb, sa, (totaddr - 1), &error); in sctp_do_connect_x()
1457 stcb->asoc.delayed_connection = 1; in sctp_do_connect_x()
1458 sctp_timer_start(SCTP_TIMER_TYPE_INIT, inp, stcb, stcb->asoc.primary_destination); in sctp_do_connect_x()
1460 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered); in sctp_do_connect_x()
1473 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||\
1474 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { \
1476 stcb = LIST_FIRST(&inp->sctp_asoc_list); \
1516 inp = (struct sctp_inpcb *)so->so_pcb;
1540 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
1560 val = sctp_ticks_to_secs(inp->sctp_ep.auto_close_time);
1568 } /* end switch (sopt->sopt_name) */
1600 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE)) {
1601 /* Can't do this for a 1-m socket */
1615 *value = inp->partial_delivery_point;
1641 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1644 av->assoc_value = stcb->asoc.idata_supported;
1647 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1648 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
1649 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
1650 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
1652 if (inp->idata_supported) {
1653 av->assoc_value = 1;
1655 av->assoc_value = 0;
1673 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1675 av->assoc_value = stcb->asoc.sctp_cmt_on_off;
1678 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1679 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
1680 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
1681 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
1683 av->assoc_value = inp->sctp_cmt_on_off;
1700 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1702 av->assoc_value = stcb->asoc.congestion_control_module;
1705 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1706 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
1707 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
1708 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
1710 av->assoc_value = inp->sctp_ep.sctp_default_cc_module;
1727 SCTP_FIND_STCB(inp, stcb, cc_opt->aid_value.assoc_id);
1731 if (stcb->asoc.cc_functions.sctp_cwnd_socket_option == NULL) {
1734 error = (*stcb->asoc.cc_functions.sctp_cwnd_socket_option) (stcb, 0, cc_opt);
1746 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1748 av->assoc_value = stcb->asoc.stream_scheduling_module;
1751 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1752 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
1753 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
1754 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
1756 av->assoc_value = inp->sctp_ep.sctp_default_ss_module;
1773 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1775 if ((av->stream_id >= stcb->asoc.streamoutcnt) ||
1776 … (stcb->asoc.ss_functions.sctp_ss_get_value(stcb, &stcb->asoc, &stcb->asoc.strmout[av->stream_id],
1777 &av->stream_value) < 0)) {
1801 if (av->assoc_value == AF_INET) {
1802 av->assoc_value = sizeof(struct sockaddr_in);
1807 if (av->assoc_value == AF_INET6) {
1808 av->assoc_value = sizeof(struct sockaddr_in6);
1825 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1826 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) {
1827 /* Can't do this for a 1-1 socket */
1833 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
1849 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1850 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) {
1851 /* Can't do this for a 1-1 socket */
1857 limit = (*optsize - sizeof(uint32_t)) / sizeof(sctp_assoc_t);
1858 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
1860 ids->gaids_assoc_id[at++] = sctp_get_associd(stcb);
1874 ids->gaids_number_of_ids = at;
1884 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1887 av->assoc_value = stcb->asoc.context;
1890 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1891 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
1892 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
1893 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
1895 av->assoc_value = inp->sctp_context;
1912 *default_vrfid = inp->def_vrf_id;
1921 SCTP_FIND_STCB(inp, stcb, id->assoc_id);
1926 id->assoc_value = stcb->asoc.vrf_id;
1943 SCTP_FIND_STCB(inp, stcb, gnv->gn_assoc_id);
1946 gnv->gn_peers_tag = stcb->asoc.peer_vtag;
1947 gnv->gn_local_tag = stcb->asoc.my_vtag;
1961 SCTP_FIND_STCB(inp, stcb, sack->sack_assoc_id);
1963 sack->sack_delay = stcb->asoc.delayed_ack;
1964 sack->sack_freq = stcb->asoc.sack_freq;
1967 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1968 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
1969 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
1970 (sack->sack_assoc_id == SCTP_FUTURE_ASSOC))) {
1972 sack->sack_delay = sctp_ticks_to_msecs(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_RECV]);
1973 sack->sack_freq = inp->sctp_ep.sctp_sack_freq;
1990 SCTP_FIND_STCB(inp, stcb, ss->ss_assoc_id);
1993 ss->ss_total_sndbuf = stcb->asoc.total_output_queue_size;
1994 ss->ss_total_recv_buf = (stcb->asoc.size_on_reasm_queue +
1995 stcb->asoc.size_on_all_streams);
2009 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
2012 av->assoc_value = stcb->asoc.max_burst;
2015 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2016 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2017 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
2018 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
2020 av->assoc_value = inp->sctp_ep.max_burst;
2037 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
2040 av->assoc_value = stcb->asoc.sctp_frag_point;
2043 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2044 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2045 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
2046 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
2048 av->assoc_value = inp->sctp_frag_point;
2071 events->sctp_data_io_event = 1;
2074 events->sctp_association_event = 1;
2077 events->sctp_address_event = 1;
2080 events->sctp_send_failure_event = 1;
2083 events->sctp_peer_error_event = 1;
2086 events->sctp_shutdown_event = 1;
2089 events->sctp_partial_delivery_event = 1;
2092 events->sctp_adaptation_layer_event = 1;
2095 events->sctp_authentication_event = 1;
2098 events->sctp_sender_dry_event = 1;
2101 events->sctp_stream_reset_event = 1;
2113 *value = inp->sctp_ep.adaptation_layer_indicator;
2124 *value = inp->sctp_ep.initial_sequence_debug;
2153 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
2154 switch (net->ro._l_addr.sa.sa_family) {
2181 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
2203 SCTP_FIND_STCB(inp, stcb, saddr->sget_assoc_id);
2206 left = *optsize - offsetof(struct sctp_getaddresses, addr);
2208 addr = &saddr->addr[0].sa;
2210 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
2211 switch (net->ro._l_addr.sa.sa_family) {
2243 (net->ro._l_addr.sa.sa_family == AF_INET)) {
2245 in6_sin_2_v4mapsin6(&net->ro._l_addr.sin,
2248 memcpy(addr, &net->ro._l_addr, cpsz);
2251 memcpy(addr, &net->ro._l_addr, cpsz);
2253 ((struct sockaddr_in *)addr)->sin_port = stcb->rport;
2256 left -= cpsz;
2261 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
2262 (saddr->sget_assoc_id <= SCTP_ALL_ASSOC)) {
2277 SCTP_FIND_STCB(inp, stcb, saddr->sget_assoc_id);
2279 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
2280 ((saddr->sget_assoc_id == SCTP_CURRENT_ASSOC) ||
2281 (saddr->sget_assoc_id == SCTP_ALL_ASSOC))) {
2284 limit = *optsize - offsetof(struct sctp_getaddresses, addr);
2285 actual = sctp_fill_up_addresses(inp, stcb, limit, &saddr->addr[0].sa);
2303 SCTP_FIND_STCB(inp, stcb, paddrp->spp_assoc_id);
2306 if (paddrp->spp_address.ss_family == AF_INET6) {
2309 sin6 = (struct sockaddr_in6 *)&paddrp->spp_address;
2310 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
2314 addr = (struct sockaddr *)&paddrp->spp_address;
2317 addr = (struct sockaddr *)&paddrp->spp_address;
2320 addr = (struct sockaddr *)&paddrp->spp_address;
2341 if (addr->sa_family == AF_INET) {
2345 if (sin->sin_addr.s_addr != INADDR_ANY) {
2354 if (addr->sa_family == AF_INET6) {
2358 if (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
2376 paddrp->spp_flags = 0;
2378 paddrp->spp_hbinterval = net->heart_beat_delay;
2379 paddrp->spp_pathmaxrxt = net->failure_threshold;
2380 paddrp->spp_pathmtu = net->mtu;
2381 switch (net->ro._l_addr.sa.sa_family) {
2384 paddrp->spp_pathmtu -= SCTP_MIN_V4_OVERHEAD;
2389 paddrp->spp_pathmtu -= SCTP_MIN_OVERHEAD;
2396 if (net->dest_state & SCTP_ADDR_NOHB) {
2397 paddrp->spp_flags |= SPP_HB_DISABLE;
2399 paddrp->spp_flags |= SPP_HB_ENABLE;
2402 if (net->dest_state & SCTP_ADDR_NO_PMTUD) {
2403 paddrp->spp_flags |= SPP_PMTUD_DISABLE;
2405 paddrp->spp_flags |= SPP_PMTUD_ENABLE;
2407 if (net->dscp & 0x01) {
2408 paddrp->spp_dscp = net->dscp & 0xfc;
2409 paddrp->spp_flags |= SPP_DSCP;
2412 if ((net->ro._l_addr.sa.sa_family == AF_INET6) &&
2413 (net->flowlabel & 0x80000000)) {
2414 paddrp->spp_ipv6_flowlabel = net->flowlabel & 0x000fffff;
2415 paddrp->spp_flags |= SPP_IPV6_FLOWLABEL;
2423 paddrp->spp_pathmaxrxt = stcb->asoc.def_net_failure;
2424 paddrp->spp_pathmtu = stcb->asoc.default_mtu;
2425 if (stcb->asoc.default_dscp & 0x01) {
2426 paddrp->spp_dscp = stcb->asoc.default_dscp & 0xfc;
2427 paddrp->spp_flags |= SPP_DSCP;
2430 if (stcb->asoc.default_flowlabel & 0x80000000) {
2431 paddrp->spp_ipv6_flowlabel = stcb->asoc.default_flowlabel & 0x000fffff;
2432 paddrp->spp_flags |= SPP_IPV6_FLOWLABEL;
2437 paddrp->spp_flags |= SPP_HB_DISABLE;
2439 paddrp->spp_flags |= SPP_HB_ENABLE;
2442 paddrp->spp_flags |= SPP_PMTUD_DISABLE;
2444 paddrp->spp_flags |= SPP_PMTUD_ENABLE;
2446 paddrp->spp_hbinterval = stcb->asoc.heart_beat_delay;
2448 paddrp->spp_assoc_id = sctp_get_associd(stcb);
2451 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2452 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2453 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
2454 (paddrp->spp_assoc_id == SCTP_FUTURE_ASSOC))) {
2457 paddrp->spp_pathmaxrxt = inp->sctp_ep.def_net_failure;
2458 …paddrp->spp_hbinterval = sctp_ticks_to_msecs(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT]);
2459 paddrp->spp_assoc_id = SCTP_FUTURE_ASSOC;
2461 if (inp->sctp_ep.default_dscp & 0x01) {
2462 paddrp->spp_dscp = inp->sctp_ep.default_dscp & 0xfc;
2463 paddrp->spp_flags |= SPP_DSCP;
2466 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
2467 (inp->sctp_ep.default_flowlabel & 0x80000000)) {
2468 paddrp->spp_ipv6_flowlabel = inp->sctp_ep.default_flowlabel & 0x000fffff;
2469 paddrp->spp_flags |= SPP_IPV6_FLOWLABEL;
2472 paddrp->spp_pathmtu = inp->sctp_ep.default_mtu;
2475 paddrp->spp_flags |= SPP_HB_ENABLE;
2477 paddrp->spp_flags |= SPP_HB_DISABLE;
2480 paddrp->spp_flags |= SPP_PMTUD_ENABLE;
2482 paddrp->spp_flags |= SPP_PMTUD_DISABLE;
2505 SCTP_FIND_STCB(inp, stcb, paddri->spinfo_assoc_id);
2508 if (paddri->spinfo_address.ss_family == AF_INET6) {
2511 sin6 = (struct sockaddr_in6 *)&paddri->spinfo_address;
2512 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
2516 addr = (struct sockaddr *)&paddri->spinfo_address;
2519 addr = (struct sockaddr *)&paddri->spinfo_address;
2522 addr = (struct sockaddr *)&paddri->spinfo_address;
2543 if (net->dest_state & SCTP_ADDR_UNCONFIRMED) {
2545 paddri->spinfo_state = SCTP_UNCONFIRMED;
2546 } else if (net->dest_state & SCTP_ADDR_REACHABLE) {
2548 paddri->spinfo_state = SCTP_ACTIVE;
2551 paddri->spinfo_state = SCTP_INACTIVE;
2553 paddri->spinfo_cwnd = net->cwnd;
2554 paddri->spinfo_srtt = net->lastsa >> SCTP_RTT_SHIFT;
2555 paddri->spinfo_rto = net->RTO;
2556 paddri->spinfo_assoc_id = sctp_get_associd(stcb);
2557 paddri->spinfo_mtu = net->mtu;
2558 switch (addr->sa_family) {
2561 paddri->spinfo_mtu -= SCTP_MIN_V4_OVERHEAD;
2566 paddri->spinfo_mtu -= SCTP_MIN_OVERHEAD;
2598 SCTP_FIND_STCB(inp, stcb, sstat->sstat_assoc_id);
2605 sstat->sstat_state = sctp_map_assoc_state(stcb->asoc.state);
2606 sstat->sstat_assoc_id = sctp_get_associd(stcb);
2607 sstat->sstat_rwnd = stcb->asoc.peers_rwnd;
2608 sstat->sstat_unackdata = stcb->asoc.sent_queue_cnt;
2613 sstat->sstat_penddata = (stcb->asoc.cnt_on_reasm_queue +
2614 stcb->asoc.cnt_on_all_streams);
2615 sstat->sstat_instrms = stcb->asoc.streamincnt;
2616 sstat->sstat_outstrms = stcb->asoc.streamoutcnt;
2617 sstat->sstat_fragmentation_point = sctp_get_frag_point(stcb);
2618 net = stcb->asoc.primary_destination;
2620 memcpy(&sstat->sstat_primary.spinfo_address,
2621 &net->ro._l_addr,
2622 ((struct sockaddr *)(&net->ro._l_addr))->sa_len);
2623 ((struct sockaddr_in *)&sstat->sstat_primary.spinfo_address)->sin_port = stcb->rport;
2629 if (net->dest_state & SCTP_ADDR_UNCONFIRMED) {
2631 sstat->sstat_primary.spinfo_state = SCTP_UNCONFIRMED;
2632 } else if (net->dest_state & SCTP_ADDR_REACHABLE) {
2634 sstat->sstat_primary.spinfo_state = SCTP_ACTIVE;
2637 sstat->sstat_primary.spinfo_state = SCTP_INACTIVE;
2639 sstat->sstat_primary.spinfo_cwnd = net->cwnd;
2640 sstat->sstat_primary.spinfo_srtt = net->lastsa >> SCTP_RTT_SHIFT;
2641 sstat->sstat_primary.spinfo_rto = net->RTO;
2642 sstat->sstat_primary.spinfo_mtu = net->mtu;
2643 switch (stcb->asoc.primary_destination->ro._l_addr.sa.sa_family) {
2646 sstat->sstat_primary.spinfo_mtu -= SCTP_MIN_V4_OVERHEAD;
2651 sstat->sstat_primary.spinfo_mtu -= SCTP_MIN_OVERHEAD;
2658 memset(&sstat->sstat_primary, 0, sizeof(struct sctp_paddrinfo));
2660 sstat->sstat_primary.spinfo_assoc_id = sctp_get_associd(stcb);
2670 SCTP_FIND_STCB(inp, stcb, srto->srto_assoc_id);
2673 srto->srto_initial = stcb->asoc.initial_rto;
2674 srto->srto_max = stcb->asoc.maxrto;
2675 srto->srto_min = stcb->asoc.minrto;
2678 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2679 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2680 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
2681 (srto->srto_assoc_id == SCTP_FUTURE_ASSOC))) {
2683 srto->srto_initial = inp->sctp_ep.initial_rto;
2684 srto->srto_max = inp->sctp_ep.sctp_maxrto;
2685 srto->srto_min = inp->sctp_ep.sctp_minrto;
2702 SCTP_FIND_STCB(inp, stcb, stimo->stimo_assoc_id);
2705 stimo->stimo_init = stcb->asoc.timoinit;
2706 stimo->stimo_data = stcb->asoc.timodata;
2707 stimo->stimo_sack = stcb->asoc.timosack;
2708 stimo->stimo_shutdown = stcb->asoc.timoshutdown;
2709 stimo->stimo_heartbeat = stcb->asoc.timoheartbeat;
2710 stimo->stimo_cookie = stcb->asoc.timocookie;
2711 stimo->stimo_shutdownack = stcb->asoc.timoshutdownack;
2725 SCTP_FIND_STCB(inp, stcb, sasoc->sasoc_assoc_id);
2728 sasoc->sasoc_cookie_life = sctp_ticks_to_msecs(stcb->asoc.cookie_life);
2729 sasoc->sasoc_asocmaxrxt = stcb->asoc.max_send_times;
2730 sasoc->sasoc_number_peer_destinations = stcb->asoc.numnets;
2731 sasoc->sasoc_peer_rwnd = stcb->asoc.peers_rwnd;
2732 sasoc->sasoc_local_rwnd = stcb->asoc.my_rwnd;
2735 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2736 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2737 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
2738 (sasoc->sasoc_assoc_id == SCTP_FUTURE_ASSOC))) {
2740 sasoc->sasoc_cookie_life = sctp_ticks_to_msecs(inp->sctp_ep.def_cookie_life);
2741 sasoc->sasoc_asocmaxrxt = inp->sctp_ep.max_send_times;
2742 sasoc->sasoc_number_peer_destinations = 0;
2743 sasoc->sasoc_peer_rwnd = 0;
2744 sasoc->sasoc_local_rwnd = (uint32_t)sbspace(&inp->sctp_socket->so_rcv);
2761 SCTP_FIND_STCB(inp, stcb, s_info->sinfo_assoc_id);
2764 memcpy(s_info, &stcb->asoc.def_send, sizeof(stcb->asoc.def_send));
2767 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2768 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2769 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
2770 (s_info->sinfo_assoc_id == SCTP_FUTURE_ASSOC))) {
2772 memcpy(s_info, &inp->def_send, sizeof(inp->def_send));
2790 sinit->sinit_num_ostreams = inp->sctp_ep.pre_open_stream_count;
2791 sinit->sinit_max_instreams = inp->sctp_ep.max_open_streams_intome;
2792 sinit->sinit_max_attempts = inp->sctp_ep.max_init_times;
2793 sinit->sinit_max_init_timeo = inp->sctp_ep.initial_init_rto_max;
2804 SCTP_FIND_STCB(inp, stcb, ssp->ssp_assoc_id);
2809 addr = &stcb->asoc.primary_destination->ro._l_addr;
2810 switch (addr->sa.sa_family) {
2815 in6_sin_2_v4mapsin6(&addr->sin,
2816 (struct sockaddr_in6 *)&ssp->ssp_addr);
2818 memcpy(&ssp->ssp_addr, &addr->sin, sizeof(struct sockaddr_in));
2821 memcpy(&ssp->ssp_addr, &addr->sin, sizeof(struct sockaddr_in));
2827 memcpy(&ssp->ssp_addr, &addr->sin6, sizeof(struct sockaddr_in6));
2851 hmaclist = inp->sctp_ep.local_hmacs;
2859 size = sizeof(*shmac) + (hmaclist->num_algo *
2860 sizeof(shmac->shmac_idents[0]));
2868 shmac->shmac_number_of_idents = hmaclist->num_algo;
2869 for (i = 0; i < hmaclist->num_algo; i++) {
2870 shmac->shmac_idents[i] = hmaclist->hmac[i];
2881 SCTP_FIND_STCB(inp, stcb, scact->scact_assoc_id);
2885 scact->scact_keynumber = stcb->asoc.authinfo.active_keyid;
2888 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2889 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2890 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
2891 (scact->scact_assoc_id == SCTP_FUTURE_ASSOC))) {
2894 scact->scact_keynumber = inp->sctp_ep.default_keyid;
2913 SCTP_FIND_STCB(inp, stcb, sac->gauth_assoc_id);
2917 chklist = stcb->asoc.local_auth_chunks;
2925 (void)sctp_serialize_auth_chunks(chklist, sac->gauth_chunks);
2926 sac->gauth_number_of_chunks = (uint32_t)size;
2931 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2932 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2933 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
2934 (sac->gauth_assoc_id == SCTP_FUTURE_ASSOC))) {
2937 chklist = inp->sctp_ep.local_auth_chunks;
2945 (void)sctp_serialize_auth_chunks(chklist, sac->gauth_chunks);
2946 sac->gauth_number_of_chunks = (uint32_t)size;
2964 SCTP_FIND_STCB(inp, stcb, sac->gauth_assoc_id);
2968 chklist = stcb->asoc.peer_auth_chunks;
2976 (void)sctp_serialize_auth_chunks(chklist, sac->gauth_chunks);
2977 sac->gauth_number_of_chunks = (uint32_t)size;
2993 SCTP_FIND_STCB(inp, stcb, event->se_assoc_id);
2995 switch (event->se_type) {
3048 event->se_on = sctp_stcb_is_feature_on(inp, stcb, event_type);
3050 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3051 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3052 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3053 (event->se_assoc_id == SCTP_FUTURE_ASSOC))) {
3055 event->se_on = sctp_is_feature_on(inp, event_type);
3098 SCTP_FIND_STCB(inp, stcb, info->snd_assoc_id);
3101 info->snd_sid = stcb->asoc.def_send.sinfo_stream;
3102 info->snd_flags = stcb->asoc.def_send.sinfo_flags;
3103 info->snd_flags &= 0xfff0;
3104 info->snd_ppid = stcb->asoc.def_send.sinfo_ppid;
3105 info->snd_context = stcb->asoc.def_send.sinfo_context;
3108 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3109 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3110 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3111 (info->snd_assoc_id == SCTP_FUTURE_ASSOC))) {
3113 info->snd_sid = inp->def_send.sinfo_stream;
3114 info->snd_flags = inp->def_send.sinfo_flags;
3115 info->snd_flags &= 0xfff0;
3116 info->snd_ppid = inp->def_send.sinfo_ppid;
3117 info->snd_context = inp->def_send.sinfo_context;
3134 SCTP_FIND_STCB(inp, stcb, info->pr_assoc_id);
3137 info->pr_policy = PR_SCTP_POLICY(stcb->asoc.def_send.sinfo_flags);
3138 info->pr_value = stcb->asoc.def_send.sinfo_timetolive;
3141 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3142 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3143 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3144 (info->pr_assoc_id == SCTP_FUTURE_ASSOC))) {
3146 info->pr_policy = PR_SCTP_POLICY(inp->def_send.sinfo_flags);
3147 info->pr_value = inp->def_send.sinfo_timetolive;
3169 SCTP_FIND_STCB(inp, stcb, thlds->spt_assoc_id);
3172 if (thlds->spt_address.ss_family == AF_INET6) {
3175 sin6 = (struct sockaddr_in6 *)&thlds->spt_address;
3176 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
3180 addr = (struct sockaddr *)&thlds->spt_address;
3183 addr = (struct sockaddr *)&thlds->spt_address;
3186 addr = (struct sockaddr *)&thlds->spt_address;
3207 if (addr->sa_family == AF_INET) {
3211 if (sin->sin_addr.s_addr != INADDR_ANY) {
3220 if (addr->sa_family == AF_INET6) {
3224 if (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
3242 thlds->spt_pathmaxrxt = net->failure_threshold;
3243 thlds->spt_pathpfthld = net->pf_threshold;
3244 thlds->spt_pathcpthld = 0xffff;
3246 thlds->spt_pathmaxrxt = stcb->asoc.def_net_failure;
3247 thlds->spt_pathpfthld = stcb->asoc.def_net_pf_threshold;
3248 thlds->spt_pathcpthld = 0xffff;
3250 thlds->spt_assoc_id = sctp_get_associd(stcb);
3253 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3254 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3255 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3256 (thlds->spt_assoc_id == SCTP_FUTURE_ASSOC))) {
3259 thlds->spt_pathmaxrxt = inp->sctp_ep.def_net_failure;
3260 thlds->spt_pathpfthld = inp->sctp_ep.def_net_pf_threshold;
3261 thlds->spt_pathcpthld = 0xffff;
3283 SCTP_FIND_STCB(inp, stcb, encaps->sue_assoc_id);
3286 if (encaps->sue_address.ss_family == AF_INET6) {
3289 sin6 = (struct sockaddr_in6 *)&encaps->sue_address;
3290 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
3294 addr = (struct sockaddr *)&encaps->sue_address;
3297 addr = (struct sockaddr *)&encaps->sue_address;
3300 addr = (struct sockaddr *)&encaps->sue_address;
3321 if (addr->sa_family == AF_INET) {
3325 if (sin->sin_addr.s_addr != INADDR_ANY) {
3334 if (addr->sa_family == AF_INET6) {
3338 if (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
3356 encaps->sue_port = net->port;
3358 encaps->sue_port = stcb->asoc.port;
3362 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3363 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3364 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3365 (encaps->sue_assoc_id == SCTP_FUTURE_ASSOC))) {
3367 encaps->sue_port = inp->sctp_ep.port;
3384 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3387 av->assoc_value = stcb->asoc.ecn_supported;
3390 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3391 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3392 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3393 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
3395 av->assoc_value = inp->ecn_supported;
3412 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3415 av->assoc_value = stcb->asoc.prsctp_supported;
3418 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3419 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3420 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3421 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
3423 av->assoc_value = inp->prsctp_supported;
3440 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3443 av->assoc_value = stcb->asoc.auth_supported;
3446 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3447 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3448 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3449 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
3451 av->assoc_value = inp->auth_supported;
3468 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3471 av->assoc_value = stcb->asoc.asconf_supported;
3474 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3475 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3476 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3477 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
3479 av->assoc_value = inp->asconf_supported;
3496 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3499 av->assoc_value = stcb->asoc.reconfig_supported;
3502 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3503 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3504 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3505 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
3507 av->assoc_value = inp->reconfig_supported;
3524 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3527 av->assoc_value = stcb->asoc.nrsack_supported;
3530 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3531 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3532 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3533 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
3535 av->assoc_value = inp->nrsack_supported;
3552 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3555 av->assoc_value = stcb->asoc.pktdrop_supported;
3558 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3559 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3560 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3561 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
3563 av->assoc_value = inp->pktdrop_supported;
3580 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3583 av->assoc_value = (uint32_t)stcb->asoc.local_strreset_support;
3586 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3587 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3588 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3589 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
3591 av->assoc_value = (uint32_t)inp->local_strreset_support;
3610 SCTP_FIND_STCB(inp, stcb, sprstat->sprstat_assoc_id);
3612 sid = sprstat->sprstat_sid;
3613 policy = sprstat->sprstat_policy;
3616 (sid < stcb->asoc.streamoutcnt) &&
3621 sprstat->sprstat_abandoned_unsent = stcb->asoc.strmout[sid].abandoned_unsent[0];
3622 sprstat->sprstat_abandoned_sent = stcb->asoc.strmout[sid].abandoned_sent[0];
3624 sprstat->sprstat_abandoned_unsent = stcb->asoc.strmout[sid].abandoned_unsent[policy];
3625 sprstat->sprstat_abandoned_sent = stcb->asoc.strmout[sid].abandoned_sent[policy];
3629 (sid < stcb->asoc.streamoutcnt) &&
3631 sprstat->sprstat_abandoned_unsent = stcb->asoc.strmout[sid].abandoned_unsent[0];
3632 sprstat->sprstat_abandoned_sent = stcb->asoc.strmout[sid].abandoned_sent[0];
3652 SCTP_FIND_STCB(inp, stcb, sprstat->sprstat_assoc_id);
3654 policy = sprstat->sprstat_policy;
3660 sprstat->sprstat_abandoned_unsent = stcb->asoc.abandoned_unsent[0];
3661 sprstat->sprstat_abandoned_sent = stcb->asoc.abandoned_sent[0];
3663 sprstat->sprstat_abandoned_unsent = stcb->asoc.abandoned_unsent[policy];
3664 sprstat->sprstat_abandoned_sent = stcb->asoc.abandoned_sent[policy];
3683 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3686 av->assoc_value = stcb->asoc.max_cwnd;
3689 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3690 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3691 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3692 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
3694 av->assoc_value = inp->max_cwnd;
3710 } /* end switch (sopt->sopt_name) */
3731 inp = (struct sctp_inpcb *)so->so_pcb;
3736 vrf_id = inp->def_vrf_id;
3760 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
3781 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
3792 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3793 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) {
3802 inp->sctp_ep.auto_close_time = sctp_secs_to_ticks(*mopt);
3816 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) == 0) {
3821 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE)) {
3822 /* Can't do this for a 1-m socket */
3842 inp->partial_delivery_point = *value;
3846 /* not yet until we re-write sctp_recvmsg() */
3872 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3879 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3880 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3881 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3882 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
3884 if (av->assoc_value == 0) {
3885 inp->idata_supported = 0;
3889 inp->idata_supported = 1;
3914 if (av->assoc_value > SCTP_CMT_MAX) {
3919 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3921 stcb->asoc.sctp_cmt_on_off = av->assoc_value;
3924 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3925 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3926 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3927 ((av->assoc_id == SCTP_FUTURE_ASSOC) ||
3928 (av->assoc_id == SCTP_ALL_ASSOC)))) {
3930 inp->sctp_cmt_on_off = av->assoc_value;
3933 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3934 ((av->assoc_id == SCTP_CURRENT_ASSOC) ||
3935 (av->assoc_id == SCTP_ALL_ASSOC))) {
3937 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
3939 stcb->asoc.sctp_cmt_on_off = av->assoc_value;
3956 if ((av->assoc_value != SCTP_CC_RFC2581) &&
3957 (av->assoc_value != SCTP_CC_HSTCP) &&
3958 (av->assoc_value != SCTP_CC_HTCP) &&
3959 (av->assoc_value != SCTP_CC_RTCC)) {
3964 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3966 stcb->asoc.cc_functions = sctp_cc_functions[av->assoc_value];
3967 stcb->asoc.congestion_control_module = av->assoc_value;
3968 if (stcb->asoc.cc_functions.sctp_set_initial_cc_param != NULL) {
3969 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
3970 stcb->asoc.cc_functions.sctp_set_initial_cc_param(stcb, net);
3975 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3976 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3977 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3978 ((av->assoc_id == SCTP_FUTURE_ASSOC) ||
3979 (av->assoc_id == SCTP_ALL_ASSOC)))) {
3981 inp->sctp_ep.sctp_default_cc_module = av->assoc_value;
3984 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
3985 ((av->assoc_id == SCTP_CURRENT_ASSOC) ||
3986 (av->assoc_id == SCTP_ALL_ASSOC))) {
3988 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
3990 stcb->asoc.cc_functions = sctp_cc_functions[av->assoc_value];
3991 stcb->asoc.congestion_control_module = av->assoc_value;
3992 if (stcb->asoc.cc_functions.sctp_set_initial_cc_param != NULL) {
3993 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
3994 stcb->asoc.cc_functions.sctp_set_initial_cc_param(stcb, net);
4009 SCTP_FIND_STCB(inp, stcb, cc_opt->aid_value.assoc_id);
4011 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4012 (cc_opt->aid_value.assoc_id == SCTP_CURRENT_ASSOC)) {
4014 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4016 if (stcb->asoc.cc_functions.sctp_cwnd_socket_option) {
4017 (*stcb->asoc.cc_functions.sctp_cwnd_socket_option) (stcb, 1, cc_opt);
4026 if (stcb->asoc.cc_functions.sctp_cwnd_socket_option == NULL) {
4029 error = (*stcb->asoc.cc_functions.sctp_cwnd_socket_option) (stcb, 1,
4041 if ((av->assoc_value != SCTP_SS_DEFAULT) &&
4042 (av->assoc_value != SCTP_SS_RR) &&
4043 (av->assoc_value != SCTP_SS_RR_PKT) &&
4044 (av->assoc_value != SCTP_SS_PRIO) &&
4045 (av->assoc_value != SCTP_SS_FB) &&
4046 (av->assoc_value != SCTP_SS_FCFS)) {
4051 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4053 stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, true);
4054 stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value];
4055 stcb->asoc.stream_scheduling_module = av->assoc_value;
4056 stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc);
4059 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4060 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4061 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4062 ((av->assoc_id == SCTP_FUTURE_ASSOC) ||
4063 (av->assoc_id == SCTP_ALL_ASSOC)))) {
4065 inp->sctp_ep.sctp_default_ss_module = av->assoc_value;
4068 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4069 ((av->assoc_id == SCTP_CURRENT_ASSOC) ||
4070 (av->assoc_id == SCTP_ALL_ASSOC))) {
4072 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4074 stcb->asoc.ss_functions.sctp_ss_clear(stcb, &stcb->asoc, true);
4075 stcb->asoc.ss_functions = sctp_ss_functions[av->assoc_value];
4076 stcb->asoc.stream_scheduling_module = av->assoc_value;
4077 stcb->asoc.ss_functions.sctp_ss_init(stcb, &stcb->asoc);
4090 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4092 if ((av->stream_id >= stcb->asoc.streamoutcnt) ||
4093 … (stcb->asoc.ss_functions.sctp_ss_set_value(stcb, &stcb->asoc, &stcb->asoc.strmout[av->stream_id],
4094 av->stream_value) < 0)) {
4100 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4101 (av->assoc_id == SCTP_CURRENT_ASSOC)) {
4103 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4105 if (av->stream_id < stcb->asoc.streamoutcnt) {
4106 stcb->asoc.ss_functions.sctp_ss_set_value(stcb,
4107 &stcb->asoc,
4108 &stcb->asoc.strmout[av->stream_id],
4109 av->stream_value);
4134 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4137 stcb->asoc.context = av->assoc_value;
4140 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4141 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4142 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4143 ((av->assoc_id == SCTP_FUTURE_ASSOC) ||
4144 (av->assoc_id == SCTP_ALL_ASSOC)))) {
4146 inp->sctp_context = av->assoc_value;
4149 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4150 ((av->assoc_id == SCTP_CURRENT_ASSOC) ||
4151 (av->assoc_id == SCTP_ALL_ASSOC))) {
4153 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4155 stcb->asoc.context = av->assoc_value;
4173 inp->def_vrf_id = *default_vrfid;
4193 SCTP_FIND_STCB(inp, stcb, sack->sack_assoc_id);
4194 if (sack->sack_delay) {
4195 if (sack->sack_delay > SCTP_MAX_SACK_DELAY) {
4204 if (sack->sack_delay) {
4205 stcb->asoc.delayed_ack = sack->sack_delay;
4207 if (sack->sack_freq) {
4208 stcb->asoc.sack_freq = sack->sack_freq;
4212 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4213 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4214 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4215 ((sack->sack_assoc_id == SCTP_FUTURE_ASSOC) ||
4216 (sack->sack_assoc_id == SCTP_ALL_ASSOC)))) {
4218 if (sack->sack_delay) {
4219 inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_RECV] = sctp_msecs_to_ticks(sack->sack_delay);
4221 if (sack->sack_freq) {
4222 inp->sctp_ep.sctp_sack_freq = sack->sack_freq;
4226 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4227 ((sack->sack_assoc_id == SCTP_CURRENT_ASSOC) ||
4228 (sack->sack_assoc_id == SCTP_ALL_ASSOC))) {
4230 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4232 if (sack->sack_delay) {
4233 stcb->asoc.delayed_ack = sack->sack_delay;
4235 if (sack->sack_freq) {
4236 stcb->asoc.sack_freq = sack->sack_freq;
4252 if (sctp_auth_add_chunk(sauth->sauth_chunk, inp->sctp_ep.local_auth_chunks)) {
4256 inp->auth_supported = 1;
4270 if (sca->sca_keylength == 0) {
4271 size = optsize - sizeof(struct sctp_authkey);
4273 if (sca->sca_keylength + sizeof(struct sctp_authkey) <= optsize) {
4274 size = sca->sca_keylength;
4281 SCTP_FIND_STCB(inp, stcb, sca->sca_assoc_id);
4284 shared_keys = &stcb->asoc.shared_keys;
4286 sctp_clear_cachedkeys(stcb, sca->sca_keynumber);
4292 key = sctp_set_key(sca->sca_key, (uint32_t)size);
4308 shared_key->key = key;
4309 shared_key->keyid = sca->sca_keynumber;
4313 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4314 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4315 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4316 ((sca->sca_assoc_id == SCTP_FUTURE_ASSOC) ||
4317 (sca->sca_assoc_id == SCTP_ALL_ASSOC)))) {
4319 shared_keys = &inp->sctp_ep.shared_keys;
4324 sctp_clear_cachedkeys_ep(inp, sca->sca_keynumber);
4330 key = sctp_set_key(sca->sca_key, (uint32_t)size);
4346 shared_key->key = key;
4347 shared_key->keyid = sca->sca_keynumber;
4351 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4352 ((sca->sca_assoc_id == SCTP_CURRENT_ASSOC) ||
4353 (sca->sca_assoc_id == SCTP_ALL_ASSOC))) {
4355 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4357 shared_keys = &stcb->asoc.shared_keys;
4362 sctp_clear_cachedkeys(stcb, sca->sca_keynumber);
4368 key = sctp_set_key(sca->sca_key, (uint32_t)size);
4380 shared_key->key = key;
4381 shared_key->keyid = sca->sca_keynumber;
4398 … if ((optsize < sizeof(struct sctp_hmacalgo) + shmac->shmac_number_of_idents * sizeof(uint16_t)) ||
4399 (shmac->shmac_number_of_idents > 0xffff)) {
4405 hmaclist = sctp_alloc_hmaclist((uint16_t)shmac->shmac_number_of_idents);
4411 for (i = 0; i < shmac->shmac_number_of_idents; i++) {
4412 hmacid = shmac->shmac_idents[i];
4421 for (i = 0; i < hmaclist->num_algo; i++) {
4422 if (hmaclist->hmac[i] == SCTP_AUTH_HMAC_ID_SHA1) {
4427 if (i == hmaclist->num_algo) {
4436 if (inp->sctp_ep.local_hmacs)
4437 sctp_free_hmaclist(inp->sctp_ep.local_hmacs);
4438 inp->sctp_ep.local_hmacs = hmaclist;
4448 SCTP_FIND_STCB(inp, stcb, scact->scact_assoc_id);
4454 scact->scact_keynumber)) {
4462 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4463 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4464 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4465 ((scact->scact_assoc_id == SCTP_FUTURE_ASSOC) ||
4466 (scact->scact_assoc_id == SCTP_ALL_ASSOC)))) {
4468 if (sctp_auth_setactivekey_ep(inp, scact->scact_keynumber)) {
4474 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4475 ((scact->scact_assoc_id == SCTP_CURRENT_ASSOC) ||
4476 (scact->scact_assoc_id == SCTP_ALL_ASSOC))) {
4478 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4480 sctp_auth_setactivekey(stcb, scact->scact_keynumber);
4493 SCTP_FIND_STCB(inp, stcb, scdel->scact_assoc_id);
4497 if (sctp_delete_sharedkey(stcb, scdel->scact_keynumber)) {
4503 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4504 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4505 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4506 ((scdel->scact_assoc_id == SCTP_FUTURE_ASSOC) ||
4507 (scdel->scact_assoc_id == SCTP_ALL_ASSOC)))) {
4509 if (sctp_delete_sharedkey_ep(inp, scdel->scact_keynumber)) {
4515 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4516 ((scdel->scact_assoc_id == SCTP_CURRENT_ASSOC) ||
4517 (scdel->scact_assoc_id == SCTP_ALL_ASSOC))) {
4519 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4521 sctp_delete_sharedkey(stcb, scdel->scact_keynumber);
4534 SCTP_FIND_STCB(inp, stcb, keyid->scact_assoc_id);
4538 if (sctp_deact_sharedkey(stcb, keyid->scact_keynumber)) {
4544 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4545 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4546 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4547 ((keyid->scact_assoc_id == SCTP_FUTURE_ASSOC) ||
4548 (keyid->scact_assoc_id == SCTP_ALL_ASSOC)))) {
4550 if (sctp_deact_sharedkey_ep(inp, keyid->scact_keynumber)) {
4556 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4557 ((keyid->scact_assoc_id == SCTP_CURRENT_ASSOC) ||
4558 (keyid->scact_assoc_id == SCTP_ALL_ASSOC))) {
4560 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4562 sctp_deact_sharedkey(stcb, keyid->scact_keynumber);
4575 if (av->assoc_value & (~SCTP_ENABLE_VALUE_MASK)) {
4580 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4582 stcb->asoc.local_strreset_support = (uint8_t)av->assoc_value;
4585 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4586 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4587 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4588 ((av->assoc_id == SCTP_FUTURE_ASSOC) ||
4589 (av->assoc_id == SCTP_ALL_ASSOC)))) {
4591 inp->local_strreset_support = (uint8_t)av->assoc_value;
4594 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4595 ((av->assoc_id == SCTP_CURRENT_ASSOC) ||
4596 (av->assoc_id == SCTP_ALL_ASSOC))) {
4598 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4600 stcb->asoc.local_strreset_support = (uint8_t)av->assoc_value;
4615 SCTP_FIND_STCB(inp, stcb, strrst->srs_assoc_id);
4621 if (stcb->asoc.reconfig_supported == 0) {
4637 strrst->srs_number_streams * sizeof(uint16_t) > optsize) {
4642 if (strrst->srs_flags & SCTP_STREAM_RESET_INCOMING) {
4644 if (stcb->asoc.stream_reset_outstanding) {
4651 if (strrst->srs_flags & SCTP_STREAM_RESET_OUTGOING) {
4654 if ((strrst->srs_number_streams > SCTP_MAX_STREAMS_AT_ONCE_RESET) && send_in) {
4666 for (i = 0; i < strrst->srs_number_streams; i++) {
4668 (strrst->srs_stream_list[i] >= stcb->asoc.streamincnt)) {
4674 (strrst->srs_stream_list[i] >= stcb->asoc.streamoutcnt)) {
4688 if (strrst->srs_number_streams) {
4689 for (i = 0, cnt = 0; i < strrst->srs_number_streams; i++) {
4690 strm = strrst->srs_stream_list[i];
4691 if (stcb->asoc.strmout[strm].state == SCTP_STREAM_OPEN) {
4692 stcb->asoc.strmout[strm].state = SCTP_STREAM_RESET_PENDING;
4698 for (i = 0, cnt = 0; i < stcb->asoc.streamoutcnt; i++) {
4699 if (stcb->asoc.strmout[i].state == SCTP_STREAM_OPEN) {
4700 stcb->asoc.strmout[i].state = SCTP_STREAM_RESET_PENDING;
4707 error = sctp_send_str_reset_req(stcb, strrst->srs_number_streams,
4708 strrst->srs_stream_list,
4735 SCTP_FIND_STCB(inp, stcb, stradd->sas_assoc_id);
4741 if (stcb->asoc.reconfig_supported == 0) {
4756 if (stcb->asoc.stream_reset_outstanding) {
4762 if ((stradd->sas_outstrms == 0) &&
4763 (stradd->sas_instrms == 0)) {
4767 if (stradd->sas_outstrms) {
4770 add_o_strmcnt = stradd->sas_outstrms;
4771 if ((((int)add_o_strmcnt) + ((int)stcb->asoc.streamoutcnt)) > 0x0000ffff) {
4777 if (stradd->sas_instrms) {
4785 add_i_strmcnt = stradd->sas_instrms;
4787 cnt += stcb->asoc.streamincnt;
4793 if (cnt > (int)stcb->asoc.max_inbound_streams) {
4817 if (stcb->asoc.reconfig_supported == 0) {
4832 if (stcb->asoc.stream_reset_outstanding) {
4842 if (!TAILQ_EMPTY(&stcb->asoc.send_queue) ||
4843 !TAILQ_EMPTY(&stcb->asoc.sent_queue)) {
4851 for (i = 0; i < stcb->asoc.streamoutcnt; i++) {
4852 if (!TAILQ_EMPTY(&stcb->asoc.strmout[i].outqueue)) {
4885 if (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) {
4887 stcb = LIST_FIRST(&inp->sctp_asoc_list);
4912 if (stcb->asoc.delayed_connection == 1) {
4913 stcb->asoc.delayed_connection = 0;
4914 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
4916 stcb->asoc.primary_destination,
4935 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4938 stcb->asoc.max_burst = av->assoc_value;
4941 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4942 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4943 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4944 ((av->assoc_id == SCTP_FUTURE_ASSOC) ||
4945 (av->assoc_id == SCTP_ALL_ASSOC)))) {
4947 inp->sctp_ep.max_burst = av->assoc_value;
4950 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4951 ((av->assoc_id == SCTP_CURRENT_ASSOC) ||
4952 (av->assoc_id == SCTP_ALL_ASSOC))) {
4954 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4956 stcb->asoc.max_burst = av->assoc_value;
4969 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4972 stcb->asoc.sctp_frag_point = av->assoc_value;
4975 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4976 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4977 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
4978 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
4980 inp->sctp_frag_point = av->assoc_value;
4996 if (events->sctp_data_io_event) {
5002 if (events->sctp_association_event) {
5008 if (events->sctp_address_event) {
5014 if (events->sctp_send_failure_event) {
5020 if (events->sctp_peer_error_event) {
5026 if (events->sctp_shutdown_event) {
5032 if (events->sctp_partial_delivery_event) {
5038 if (events->sctp_adaptation_layer_event) {
5044 if (events->sctp_authentication_event) {
5050 if (events->sctp_sender_dry_event) {
5056 if (events->sctp_stream_reset_event) {
5062 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
5064 if (events->sctp_association_event) {
5069 if (events->sctp_address_event) {
5074 if (events->sctp_send_failure_event) {
5079 if (events->sctp_peer_error_event) {
5084 if (events->sctp_shutdown_event) {
5089 if (events->sctp_partial_delivery_event) {
5094 if (events->sctp_adaptation_layer_event) {
5099 if (events->sctp_authentication_event) {
5104 if (events->sctp_sender_dry_event) {
5109 if (events->sctp_stream_reset_event) {
5117 * Send up the sender dry event only for 1-to-1
5120 if (events->sctp_sender_dry_event) {
5121 if (((inp->sctp_flags & (SCTP_PCB_FLAGS_TCPTYPE | SCTP_PCB_FLAGS_IN_TCPPOOL)) != 0) &&
5123 stcb = LIST_FIRST(&inp->sctp_asoc_list);
5126 if (TAILQ_EMPTY(&stcb->asoc.send_queue) &&
5127 TAILQ_EMPTY(&stcb->asoc.sent_queue) &&
5128 (stcb->asoc.stream_queue_cnt == 0)) {
5144 inp->sctp_ep.adaptation_layer_indicator = adap_bits->ssb_adaptation_ind;
5145 inp->sctp_ep.adaptation_layer_indicator_provided = 1;
5156 inp->sctp_ep.initial_sequence_debug = *vvv;
5166 SCTP_FIND_STCB(inp, stcb, s_info->sinfo_assoc_id);
5169 if (s_info->sinfo_stream < stcb->asoc.streamoutcnt) {
5170 memcpy(&stcb->asoc.def_send, s_info, min(optsize, sizeof(stcb->asoc.def_send)));
5177 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
5178 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
5179 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
5180 ((s_info->sinfo_assoc_id == SCTP_FUTURE_ASSOC) ||
5181 (s_info->sinfo_assoc_id == SCTP_ALL_ASSOC)))) {
5183 memcpy(&inp->def_send, s_info, min(optsize, sizeof(inp->def_send)));
5186 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
5187 ((s_info->sinfo_assoc_id == SCTP_CURRENT_ASSOC) ||
5188 (s_info->sinfo_assoc_id == SCTP_ALL_ASSOC))) {
5190 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
5192 if (s_info->sinfo_stream < stcb->asoc.streamoutcnt) {
5193 memcpy(&stcb->asoc.def_send, s_info, min(optsize, sizeof(stcb->asoc.def_send)));
5212 SCTP_FIND_STCB(inp, stcb, paddrp->spp_assoc_id);
5215 if (paddrp->spp_address.ss_family == AF_INET6) {
5218 sin6 = (struct sockaddr_in6 *)&paddrp->spp_address;
5219 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
5223 addr = (struct sockaddr *)&paddrp->spp_address;
5226 addr = (struct sockaddr *)&paddrp->spp_address;
5229 addr = (struct sockaddr *)&paddrp->spp_address;
5251 if (addr->sa_family == AF_INET) {
5255 if (sin->sin_addr.s_addr != INADDR_ANY) {
5264 if (addr->sa_family == AF_INET6) {
5268 if (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
5284 if ((paddrp->spp_flags & SPP_HB_ENABLE) && (paddrp->spp_flags & SPP_HB_DISABLE)) {
5291 if ((paddrp->spp_flags & SPP_PMTUD_ENABLE) && (paddrp->spp_flags & SPP_PMTUD_DISABLE)) {
5297 if ((paddrp->spp_flags & SPP_PMTUD_DISABLE) &&
5298 (paddrp->spp_pathmtu > 0) &&
5299 ((paddrp->spp_pathmtu < SCTP_SMALLEST_PMTU) ||
5300 (paddrp->spp_pathmtu > SCTP_LARGEST_PMTU))) {
5311 if (paddrp->spp_flags & SPP_HB_DISABLE) {
5312 if (((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0) &&
5313 ((net->dest_state & SCTP_ADDR_NOHB) == 0)) {
5317 net->dest_state |= SCTP_ADDR_NOHB;
5319 if (paddrp->spp_flags & SPP_HB_ENABLE) {
5320 if (paddrp->spp_hbinterval) {
5321 net->heart_beat_delay = paddrp->spp_hbinterval;
5322 } else if (paddrp->spp_flags & SPP_HB_TIME_IS_ZERO) {
5323 net->heart_beat_delay = 0;
5328 net->dest_state &= ~SCTP_ADDR_NOHB;
5330 if (paddrp->spp_flags & SPP_HB_DEMAND) {
5337 if (paddrp->spp_flags & SPP_PMTUD_DISABLE) {
5338 if (SCTP_OS_TIMER_PENDING(&net->pmtu_timer.timer)) {
5342 net->dest_state |= SCTP_ADDR_NO_PMTUD;
5343 if (paddrp->spp_pathmtu > 0) {
5344 net->mtu = paddrp->spp_pathmtu;
5345 switch (net->ro._l_addr.sa.sa_family) {
5348 net->mtu += SCTP_MIN_V4_OVERHEAD;
5353 net->mtu += SCTP_MIN_OVERHEAD;
5359 if (net->mtu < stcb->asoc.smallest_mtu) {
5360 sctp_pathmtu_adjustment(stcb, net->mtu, true);
5364 if (paddrp->spp_flags & SPP_PMTUD_ENABLE) {
5365 if (!SCTP_OS_TIMER_PENDING(&net->pmtu_timer.timer)) {
5368 net->dest_state &= ~SCTP_ADDR_NO_PMTUD;
5370 if (paddrp->spp_pathmaxrxt > 0) {
5371 if (net->dest_state & SCTP_ADDR_PF) {
5372 if (net->error_count > paddrp->spp_pathmaxrxt) {
5373 net->dest_state &= ~SCTP_ADDR_PF;
5376 if ((net->error_count <= paddrp->spp_pathmaxrxt) &&
5377 (net->error_count > net->pf_threshold)) {
5378 net->dest_state |= SCTP_ADDR_PF;
5381 stcb->sctp_ep, stcb, net,
5383 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
5386 if (net->dest_state & SCTP_ADDR_REACHABLE) {
5387 if (net->error_count > paddrp->spp_pathmaxrxt) {
5388 net->dest_state &= ~SCTP_ADDR_REACHABLE;
5392 if (net->error_count <= paddrp->spp_pathmaxrxt) {
5393 net->dest_state |= SCTP_ADDR_REACHABLE;
5397 net->failure_threshold = paddrp->spp_pathmaxrxt;
5399 if (paddrp->spp_flags & SPP_DSCP) {
5400 net->dscp = paddrp->spp_dscp & 0xfc;
5401 net->dscp |= 0x01;
5404 if (paddrp->spp_flags & SPP_IPV6_FLOWLABEL) {
5405 if (net->ro._l_addr.sa.sa_family == AF_INET6) {
5406 net->flowlabel = paddrp->spp_ipv6_flowlabel & 0x000fffff;
5407 net->flowlabel |= 0x80000000;
5412 /************************ASSOC ONLY -- NO NET SPECIFIC SET ******************/
5413 if (paddrp->spp_pathmaxrxt > 0) {
5414 stcb->asoc.def_net_failure = paddrp->spp_pathmaxrxt;
5415 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5416 if (net->dest_state & SCTP_ADDR_PF) {
5417 if (net->error_count > paddrp->spp_pathmaxrxt) {
5418 net->dest_state &= ~SCTP_ADDR_PF;
5421 if ((net->error_count <= paddrp->spp_pathmaxrxt) &&
5422 (net->error_count > net->pf_threshold)) {
5423 net->dest_state |= SCTP_ADDR_PF;
5426 stcb->sctp_ep, stcb, net,
5428 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
5431 if (net->dest_state & SCTP_ADDR_REACHABLE) {
5432 if (net->error_count > paddrp->spp_pathmaxrxt) {
5433 net->dest_state &= ~SCTP_ADDR_REACHABLE;
5437 if (net->error_count <= paddrp->spp_pathmaxrxt) {
5438 net->dest_state |= SCTP_ADDR_REACHABLE;
5442 net->failure_threshold = paddrp->spp_pathmaxrxt;
5445 if (paddrp->spp_flags & SPP_HB_ENABLE) {
5446 if (paddrp->spp_hbinterval != 0) {
5447 stcb->asoc.heart_beat_delay = paddrp->spp_hbinterval;
5448 } else if (paddrp->spp_flags & SPP_HB_TIME_IS_ZERO) {
5449 stcb->asoc.heart_beat_delay = 0;
5451 /* Turn back on the timer */
5452 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5453 if (paddrp->spp_hbinterval != 0) {
5454 net->heart_beat_delay = paddrp->spp_hbinterval;
5455 } else if (paddrp->spp_flags & SPP_HB_TIME_IS_ZERO) {
5456 net->heart_beat_delay = 0;
5458 if (net->dest_state & SCTP_ADDR_NOHB) {
5459 net->dest_state &= ~SCTP_ADDR_NOHB;
5467 if (paddrp->spp_flags & SPP_HB_DISABLE) {
5468 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5469 if ((net->dest_state & SCTP_ADDR_NOHB) == 0) {
5470 net->dest_state |= SCTP_ADDR_NOHB;
5471 if ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0) {
5480 if (paddrp->spp_flags & SPP_PMTUD_DISABLE) {
5481 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5482 if (SCTP_OS_TIMER_PENDING(&net->pmtu_timer.timer)) {
5486 net->dest_state |= SCTP_ADDR_NO_PMTUD;
5487 if (paddrp->spp_pathmtu > 0) {
5488 net->mtu = paddrp->spp_pathmtu;
5489 switch (net->ro._l_addr.sa.sa_family) {
5492 net->mtu += SCTP_MIN_V4_OVERHEAD;
5497 net->mtu += SCTP_MIN_OVERHEAD;
5503 if (net->mtu < stcb->asoc.smallest_mtu) {
5504 sctp_pathmtu_adjustment(stcb, net->mtu, true);
5508 if (paddrp->spp_pathmtu > 0) {
5509 stcb->asoc.default_mtu = paddrp->spp_pathmtu;
5513 if (paddrp->spp_flags & SPP_PMTUD_ENABLE) {
5514 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5515 if (!SCTP_OS_TIMER_PENDING(&net->pmtu_timer.timer)) {
5518 net->dest_state &= ~SCTP_ADDR_NO_PMTUD;
5520 stcb->asoc.default_mtu = 0;
5523 if (paddrp->spp_flags & SPP_DSCP) {
5524 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5525 net->dscp = paddrp->spp_dscp & 0xfc;
5526 net->dscp |= 0x01;
5528 stcb->asoc.default_dscp = paddrp->spp_dscp & 0xfc;
5529 stcb->asoc.default_dscp |= 0x01;
5532 if (paddrp->spp_flags & SPP_IPV6_FLOWLABEL) {
5533 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
5534 if (net->ro._l_addr.sa.sa_family == AF_INET6) {
5535 net->flowlabel = paddrp->spp_ipv6_flowlabel & 0x000fffff;
5536 net->flowlabel |= 0x80000000;
5539 stcb->asoc.default_flowlabel = paddrp->spp_ipv6_flowlabel & 0x000fffff;
5540 stcb->asoc.default_flowlabel |= 0x80000000;
5547 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
5548 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
5549 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
5550 (paddrp->spp_assoc_id == SCTP_FUTURE_ASSOC))) {
5557 if (paddrp->spp_pathmaxrxt > 0) {
5558 inp->sctp_ep.def_net_failure = paddrp->spp_pathmaxrxt;
5561 if (paddrp->spp_flags & SPP_HB_TIME_IS_ZERO)
5562 inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = 0;
5563 else if (paddrp->spp_hbinterval != 0) {
5564 if (paddrp->spp_hbinterval > SCTP_MAX_HB_INTERVAL)
5565 paddrp->spp_hbinterval = SCTP_MAX_HB_INTERVAL;
5566 …inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = sctp_msecs_to_ticks(paddrp->spp_hbinterval);
5569 if (paddrp->spp_flags & SPP_HB_ENABLE) {
5570 if (paddrp->spp_flags & SPP_HB_TIME_IS_ZERO) {
5571 inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = 0;
5572 } else if (paddrp->spp_hbinterval) {
5573 …inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = sctp_msecs_to_ticks(paddrp->spp_hbinterval);
5576 } else if (paddrp->spp_flags & SPP_HB_DISABLE) {
5579 if (paddrp->spp_flags & SPP_PMTUD_ENABLE) {
5580 inp->sctp_ep.default_mtu = 0;
5582 } else if (paddrp->spp_flags & SPP_PMTUD_DISABLE) {
5583 if (paddrp->spp_pathmtu > 0) {
5584 inp->sctp_ep.default_mtu = paddrp->spp_pathmtu;
5588 if (paddrp->spp_flags & SPP_DSCP) {
5589 inp->sctp_ep.default_dscp = paddrp->spp_dscp & 0xfc;
5590 inp->sctp_ep.default_dscp |= 0x01;
5593 if (paddrp->spp_flags & SPP_IPV6_FLOWLABEL) {
5594 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
5595 inp->sctp_ep.default_flowlabel = paddrp->spp_ipv6_flowlabel & 0x000fffff;
5596 inp->sctp_ep.default_flowlabel |= 0x80000000;
5614 SCTP_FIND_STCB(inp, stcb, srto->srto_assoc_id);
5617 if (srto->srto_initial)
5618 new_init = srto->srto_initial;
5620 new_init = stcb->asoc.initial_rto;
5621 if (srto->srto_max)
5622 new_max = srto->srto_max;
5624 new_max = stcb->asoc.maxrto;
5625 if (srto->srto_min)
5626 new_min = srto->srto_min;
5628 new_min = stcb->asoc.minrto;
5630 stcb->asoc.initial_rto = new_init;
5631 stcb->asoc.maxrto = new_max;
5632 stcb->asoc.minrto = new_min;
5639 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
5640 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
5641 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
5642 (srto->srto_assoc_id == SCTP_FUTURE_ASSOC))) {
5644 if (srto->srto_initial)
5645 new_init = srto->srto_initial;
5647 new_init = inp->sctp_ep.initial_rto;
5648 if (srto->srto_max)
5649 new_max = srto->srto_max;
5651 new_max = inp->sctp_ep.sctp_maxrto;
5652 if (srto->srto_min)
5653 new_min = srto->srto_min;
5655 new_min = inp->sctp_ep.sctp_minrto;
5657 inp->sctp_ep.initial_rto = new_init;
5658 inp->sctp_ep.sctp_maxrto = new_max;
5659 inp->sctp_ep.sctp_minrto = new_min;
5677 SCTP_FIND_STCB(inp, stcb, sasoc->sasoc_assoc_id);
5678 if (sasoc->sasoc_cookie_life > 0) {
5680 if (sasoc->sasoc_cookie_life < SCTP_MIN_COOKIE_LIFE) {
5681 sasoc->sasoc_cookie_life = SCTP_MIN_COOKIE_LIFE;
5683 if (sasoc->sasoc_cookie_life > SCTP_MAX_COOKIE_LIFE) {
5684 sasoc->sasoc_cookie_life = SCTP_MAX_COOKIE_LIFE;
5688 if (sasoc->sasoc_asocmaxrxt > 0) {
5689 stcb->asoc.max_send_times = sasoc->sasoc_asocmaxrxt;
5691 if (sasoc->sasoc_cookie_life > 0) {
5692 stcb->asoc.cookie_life = sctp_msecs_to_ticks(sasoc->sasoc_cookie_life);
5696 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
5697 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
5698 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
5699 (sasoc->sasoc_assoc_id == SCTP_FUTURE_ASSOC))) {
5701 if (sasoc->sasoc_asocmaxrxt > 0) {
5702 inp->sctp_ep.max_send_times = sasoc->sasoc_asocmaxrxt;
5704 if (sasoc->sasoc_cookie_life > 0) {
5705 inp->sctp_ep.def_cookie_life = sctp_msecs_to_ticks(sasoc->sasoc_cookie_life);
5721 if (sinit->sinit_num_ostreams)
5722 inp->sctp_ep.pre_open_stream_count = sinit->sinit_num_ostreams;
5724 if (sinit->sinit_max_instreams)
5725 inp->sctp_ep.max_open_streams_intome = sinit->sinit_max_instreams;
5727 if (sinit->sinit_max_attempts)
5728 inp->sctp_ep.max_init_times = sinit->sinit_max_attempts;
5730 if (sinit->sinit_max_init_timeo)
5731 inp->sctp_ep.initial_init_rto_max = sinit->sinit_max_init_timeo;
5745 SCTP_FIND_STCB(inp, stcb, spa->ssp_assoc_id);
5748 if (spa->ssp_addr.ss_family == AF_INET6) {
5751 sin6 = (struct sockaddr_in6 *)&spa->ssp_addr;
5752 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
5756 addr = (struct sockaddr *)&spa->ssp_addr;
5759 addr = (struct sockaddr *)&spa->ssp_addr;
5762 addr = (struct sockaddr *)&spa->ssp_addr;
5784 if (net != stcb->asoc.primary_destination) {
5785 if ((net->dest_state & SCTP_ADDR_UNCONFIRMED) == 0) {
5788 if ((stcb->asoc.alternate) &&
5789 ((net->dest_state & SCTP_ADDR_PF) == 0) &&
5790 (net->dest_state & SCTP_ADDR_REACHABLE)) {
5791 sctp_free_remote_addr(stcb->asoc.alternate);
5792 stcb->asoc.alternate = NULL;
5823 error = sctp_dynamic_set_primary(&ss->sa, vrf_id);
5835 SCTP_FIND_STCB(inp, stcb, sspp->sspp_assoc_id);
5840 if (sspp->sspp_addr.ss_family == AF_INET6) {
5843 sin6 = (struct sockaddr_in6 *)&sspp->sspp_addr;
5844 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
5848 addr = (struct sockaddr *)&sspp->sspp_addr;
5851 addr = (struct sockaddr *)&sspp->sspp_addr;
5854 addr = (struct sockaddr *)&sspp->sspp_addr;
5856 ifa = sctp_find_ifa_by_addr(addr, stcb->asoc.vrf_id, SCTP_ADDR_NOT_LOCKED);
5862 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0) {
5870 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
5871 if (laddr->ifa == NULL) {
5876 if ((sctp_is_addr_restricted(stcb, laddr->ifa)) &&
5877 (!sctp_is_addr_pending(stcb, laddr->ifa))) {
5880 if (laddr->ifa == ifa) {
5891 switch (addr->sa_family) {
5898 if (prison_check_ip4(inp->ip_inp.inp.inp_cred,
5899 &sin->sin_addr) != 0) {
5913 if (prison_check_ip6(inp->ip_inp.inp.inp_cred,
5914 &sin6->sin6_addr) != 0) {
5949 if (sa->sa_family == AF_INET) {
5956 (error = prison_local_ip4(td->td_ucred, &(((struct sockaddr_in *)sa)->sin_addr)))) {
5963 if (sa->sa_family == AF_INET6) {
5970 (error = prison_local_ip6(td->td_ucred,
5971 &(((struct sockaddr_in6 *)sa)->sin6_addr),
5994 if (sa->sa_family == AF_INET) {
6001 (error = prison_local_ip4(td->td_ucred, &(((struct sockaddr_in *)sa)->sin_addr)))) {
6008 if (sa->sa_family == AF_INET6) {
6015 (error = prison_local_ip6(td->td_ucred,
6016 &(((struct sockaddr_in6 *)sa)->sin6_addr),
6036 SCTP_FIND_STCB(inp, stcb, event->se_assoc_id);
6037 switch (event->se_type) {
6090 if (event->se_on) {
6093 if (TAILQ_EMPTY(&stcb->asoc.send_queue) &&
6094 TAILQ_EMPTY(&stcb->asoc.sent_queue) &&
6095 (stcb->asoc.stream_queue_cnt == 0)) {
6110 (inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6111 ((event->se_assoc_id == SCTP_ALL_ASSOC) ||
6112 (event->se_assoc_id == SCTP_CURRENT_ASSOC))) {
6117 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6118 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6119 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6120 ((event->se_assoc_id == SCTP_FUTURE_ASSOC) ||
6121 (event->se_assoc_id == SCTP_ALL_ASSOC)))) {
6123 if (event->se_on) {
6130 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6131 ((event->se_assoc_id == SCTP_CURRENT_ASSOC) ||
6132 (event->se_assoc_id == SCTP_ALL_ASSOC))) {
6134 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
6136 if (event->se_on) {
6187 SCTP_FIND_STCB(inp, stcb, info->snd_assoc_id);
6190 if (info->snd_sid < stcb->asoc.streamoutcnt) {
6191 stcb->asoc.def_send.sinfo_stream = info->snd_sid;
6192 policy = PR_SCTP_POLICY(stcb->asoc.def_send.sinfo_flags);
6193 stcb->asoc.def_send.sinfo_flags = info->snd_flags;
6194 stcb->asoc.def_send.sinfo_flags |= policy;
6195 stcb->asoc.def_send.sinfo_ppid = info->snd_ppid;
6196 stcb->asoc.def_send.sinfo_context = info->snd_context;
6203 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6204 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6205 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6206 ((info->snd_assoc_id == SCTP_FUTURE_ASSOC) ||
6207 (info->snd_assoc_id == SCTP_ALL_ASSOC)))) {
6209 inp->def_send.sinfo_stream = info->snd_sid;
6210 policy = PR_SCTP_POLICY(inp->def_send.sinfo_flags);
6211 inp->def_send.sinfo_flags = info->snd_flags;
6212 inp->def_send.sinfo_flags |= policy;
6213 inp->def_send.sinfo_ppid = info->snd_ppid;
6214 inp->def_send.sinfo_context = info->snd_context;
6217 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6218 ((info->snd_assoc_id == SCTP_CURRENT_ASSOC) ||
6219 (info->snd_assoc_id == SCTP_ALL_ASSOC))) {
6221 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
6223 if (info->snd_sid < stcb->asoc.streamoutcnt) {
6224 stcb->asoc.def_send.sinfo_stream = info->snd_sid;
6225 policy = PR_SCTP_POLICY(stcb->asoc.def_send.sinfo_flags);
6226 stcb->asoc.def_send.sinfo_flags = info->snd_flags;
6227 stcb->asoc.def_send.sinfo_flags |= policy;
6228 stcb->asoc.def_send.sinfo_ppid = info->snd_ppid;
6229 stcb->asoc.def_send.sinfo_context = info->snd_context;
6243 SCTP_FIND_STCB(inp, stcb, info->pr_assoc_id);
6245 if (info->pr_policy > SCTP_PR_SCTP_MAX) {
6254 stcb->asoc.def_send.sinfo_flags &= 0xfff0;
6255 stcb->asoc.def_send.sinfo_flags |= info->pr_policy;
6256 stcb->asoc.def_send.sinfo_timetolive = info->pr_value;
6259 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6260 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6261 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6262 ((info->pr_assoc_id == SCTP_FUTURE_ASSOC) ||
6263 (info->pr_assoc_id == SCTP_ALL_ASSOC)))) {
6265 inp->def_send.sinfo_flags &= 0xfff0;
6266 inp->def_send.sinfo_flags |= info->pr_policy;
6267 inp->def_send.sinfo_timetolive = info->pr_value;
6270 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6271 ((info->pr_assoc_id == SCTP_CURRENT_ASSOC) ||
6272 (info->pr_assoc_id == SCTP_ALL_ASSOC))) {
6274 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
6276 stcb->asoc.def_send.sinfo_flags &= 0xfff0;
6277 stcb->asoc.def_send.sinfo_flags |= info->pr_policy;
6278 stcb->asoc.def_send.sinfo_timetolive = info->pr_value;
6297 SCTP_FIND_STCB(inp, stcb, thlds->spt_assoc_id);
6300 if (thlds->spt_address.ss_family == AF_INET6) {
6303 sin6 = (struct sockaddr_in6 *)&thlds->spt_address;
6304 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
6308 addr = (struct sockaddr *)&thlds->spt_address;
6311 addr = (struct sockaddr *)&thlds->spt_address;
6314 addr = (struct sockaddr *)&thlds->spt_address;
6336 if (addr->sa_family == AF_INET) {
6340 if (sin->sin_addr.s_addr != INADDR_ANY) {
6349 if (addr->sa_family == AF_INET6) {
6353 if (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
6368 if (thlds->spt_pathcpthld != 0xffff) {
6378 net->failure_threshold = thlds->spt_pathmaxrxt;
6379 net->pf_threshold = thlds->spt_pathpfthld;
6380 if (net->dest_state & SCTP_ADDR_PF) {
6381 if ((net->error_count > net->failure_threshold) ||
6382 (net->error_count <= net->pf_threshold)) {
6383 net->dest_state &= ~SCTP_ADDR_PF;
6386 if ((net->error_count > net->pf_threshold) &&
6387 (net->error_count <= net->failure_threshold)) {
6388 net->dest_state |= SCTP_ADDR_PF;
6391 stcb->sctp_ep, stcb, net,
6393 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
6396 if (net->dest_state & SCTP_ADDR_REACHABLE) {
6397 if (net->error_count > net->failure_threshold) {
6398 net->dest_state &= ~SCTP_ADDR_REACHABLE;
6402 if (net->error_count <= net->failure_threshold) {
6403 net->dest_state |= SCTP_ADDR_REACHABLE;
6408 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
6409 net->failure_threshold = thlds->spt_pathmaxrxt;
6410 net->pf_threshold = thlds->spt_pathpfthld;
6411 if (net->dest_state & SCTP_ADDR_PF) {
6412 if ((net->error_count > net->failure_threshold) ||
6413 (net->error_count <= net->pf_threshold)) {
6414 net->dest_state &= ~SCTP_ADDR_PF;
6417 if ((net->error_count > net->pf_threshold) &&
6418 (net->error_count <= net->failure_threshold)) {
6419 net->dest_state |= SCTP_ADDR_PF;
6422 stcb->sctp_ep, stcb, net,
6424 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, stcb->sctp_ep, stcb, net);
6427 if (net->dest_state & SCTP_ADDR_REACHABLE) {
6428 if (net->error_count > net->failure_threshold) {
6429 net->dest_state &= ~SCTP_ADDR_REACHABLE;
6433 if (net->error_count <= net->failure_threshold) {
6434 net->dest_state |= SCTP_ADDR_REACHABLE;
6439 stcb->asoc.def_net_failure = thlds->spt_pathmaxrxt;
6440 stcb->asoc.def_net_pf_threshold = thlds->spt_pathpfthld;
6444 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6445 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6446 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6447 (thlds->spt_assoc_id == SCTP_FUTURE_ASSOC))) {
6449 inp->sctp_ep.def_net_failure = thlds->spt_pathmaxrxt;
6450 inp->sctp_ep.def_net_pf_threshold = thlds->spt_pathpfthld;
6469 SCTP_FIND_STCB(inp, stcb, encaps->sue_assoc_id);
6472 if (encaps->sue_address.ss_family == AF_INET6) {
6475 sin6 = (struct sockaddr_in6 *)&encaps->sue_address;
6476 if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr)) {
6480 addr = (struct sockaddr *)&encaps->sue_address;
6483 addr = (struct sockaddr *)&encaps->sue_address;
6486 addr = (struct sockaddr *)&encaps->sue_address;
6507 if (addr->sa_family == AF_INET) {
6511 if (sin->sin_addr.s_addr != INADDR_ANY) {
6520 if (addr->sa_family == AF_INET6) {
6524 if (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr)) {
6542 net->port = encaps->sue_port;
6544 stcb->asoc.port = encaps->sue_port;
6548 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6549 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6550 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6551 (encaps->sue_assoc_id == SCTP_FUTURE_ASSOC))) {
6553 inp->sctp_ep.port = encaps->sue_port;
6567 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6574 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6575 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6576 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6577 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
6579 if (av->assoc_value == 0) {
6580 inp->ecn_supported = 0;
6582 inp->ecn_supported = 1;
6597 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6604 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6605 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6606 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6607 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
6609 if (av->assoc_value == 0) {
6610 inp->prsctp_supported = 0;
6612 inp->prsctp_supported = 1;
6627 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6634 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6635 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6636 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6637 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
6638 if ((av->assoc_value == 0) &&
6639 (inp->asconf_supported == 1)) {
6648 if (av->assoc_value == 0) {
6649 inp->auth_supported = 0;
6651 inp->auth_supported = 1;
6667 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6674 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6675 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6676 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6677 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
6678 if ((av->assoc_value != 0) &&
6679 (inp->auth_supported == 0)) {
6688 if (av->assoc_value == 0) {
6689 inp->asconf_supported = 0;
6691 inp->sctp_ep.local_auth_chunks);
6693 inp->sctp_ep.local_auth_chunks);
6695 inp->asconf_supported = 1;
6697 inp->sctp_ep.local_auth_chunks);
6699 inp->sctp_ep.local_auth_chunks);
6715 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6722 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6723 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6724 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6725 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
6727 if (av->assoc_value == 0) {
6728 inp->reconfig_supported = 0;
6730 inp->reconfig_supported = 1;
6745 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6752 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6753 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6754 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6755 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
6757 if (av->assoc_value == 0) {
6758 inp->nrsack_supported = 0;
6760 inp->nrsack_supported = 1;
6775 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6782 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6783 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6784 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6785 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
6787 if (av->assoc_value == 0) {
6788 inp->pktdrop_supported = 0;
6790 inp->pktdrop_supported = 1;
6806 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6809 stcb->asoc.max_cwnd = av->assoc_value;
6810 if (stcb->asoc.max_cwnd > 0) {
6811 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
6812 if ((net->cwnd > stcb->asoc.max_cwnd) &&
6813 (net->cwnd > (net->mtu - sizeof(struct sctphdr)))) {
6814 net->cwnd = stcb->asoc.max_cwnd;
6815 if (net->cwnd < (net->mtu - sizeof(struct sctphdr))) {
6816 net->cwnd = net->mtu - sizeof(struct sctphdr);
6823 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6824 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6825 ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) &&
6826 (av->assoc_id == SCTP_FUTURE_ASSOC))) {
6828 inp->max_cwnd = av->assoc_value;
6845 inp->rcv_edmid = *value;
6872 if ((sopt->sopt_level == SOL_SOCKET) &&
6873 (sopt->sopt_name == SO_SETFIB)) {
6874 inp = (struct sctp_inpcb *)so->so_pcb;
6876 SCTP_LTRACE_ERR_RET(so->so_pcb, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOBUFS);
6880 inp->fibnum = so->so_fibnum;
6884 if (sopt->sopt_level != IPPROTO_SCTP) {
6898 optsize = sopt->sopt_valsize;
6900 SCTP_LTRACE_ERR_RET(so->so_pcb, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOBUFS);
6906 SCTP_LTRACE_ERR_RET(so->so_pcb, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOBUFS);
6915 p = (void *)sopt->sopt_td;
6916 if (sopt->sopt_dir == SOPT_SET) {
6918 error = sctp_setopt(so, sopt->sopt_name, optval, optsize, p);
6920 } else if (sopt->sopt_dir == SOPT_GET) {
6921 error = sctp_getopt(so, sopt->sopt_name, optval, &optsize, p);
6923 SCTP_LTRACE_ERR_RET(so->so_pcb, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6947 inp = (struct sctp_inpcb *)so->so_pcb;
6958 switch (addr->sa_family) {
6964 if (addr->sa_len != sizeof(struct sockaddr_in6)) {
6969 if (p != NULL && (error = prison_remote_ip6(p->td_ucred, &sin6->sin6_addr)) != 0) {
6981 if (addr->sa_len != sizeof(struct sockaddr_in)) {
6986 if (p != NULL && (error = prison_remote_ip4(p->td_ucred, &sin->sin_addr)) != 0) {
7002 if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
7003 (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) {
7010 if (((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) &&
7011 (addr->sa_family == AF_INET6)) {
7017 if (inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) {
7025 if ((inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) &&
7031 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
7032 (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED)) {
7038 if (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) {
7040 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7063 vrf_id = inp->def_vrf_id;
7066 inp->sctp_ep.pre_open_stream_count,
7067 inp->sctp_ep.port, p,
7074 (void)SCTP_GETTIME_TIMEVAL(&stcb->asoc.time_entered);
7103 inp = (struct sctp_inpcb *)so->so_pcb;
7114 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0) {
7118 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
7119 memcpy(&store, &laddr->ifa->address, sizeof(store));
7123 store.sin.sin_port = inp->sctp_lport;
7128 store.sin6.sin6_port = inp->sctp_lport;
7134 tinp = sctp_pcb_findep(&store.sa, 0, 0, inp->def_vrf_id);
7136 ((tinp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) == 0) &&
7137 ((tinp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) &&
7153 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
7159 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) {
7167 store.sin.sin_port = inp->sctp_lport;
7172 store.sin6.sin6_port = inp->sctp_lport;
7178 tinp = sctp_pcb_findep(&store.sa, 0, 0, inp->def_vrf_id);
7180 ((tinp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) == 0) &&
7181 ((tinp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE) == 0) &&
7202 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) {
7204 * The unlucky case - We are in the tcp pool with this guy.
7205 * - Someone else is in the main inp slot. - We must move
7206 * this guy (the listener) to the main slot - We must then
7221 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
7222 (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED)) {
7229 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
7230 ((inp->sctp_flags & SCTP_PCB_FLAGS_WAS_CONNECTED) ||
7231 (inp->sctp_flags & SCTP_PCB_FLAGS_WAS_ABORTED))) {
7238 if (inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) {
7246 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) == 0) {
7249 inp->sctp_flags |= SCTP_PCB_FLAGS_ACCEPTING;
7254 inp->sctp_flags |= SCTP_PCB_FLAGS_ACCEPTING;
7256 inp->sctp_flags &= ~SCTP_PCB_FLAGS_ACCEPTING;
7276 inp = (struct sctp_inpcb *)so->so_pcb;
7283 if (inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) {
7288 if (so->so_state & SS_ISDISCONNECTED) {
7293 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7300 store = stcb->asoc.primary_destination->ro._l_addr;
7303 if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) {
7304 inp->sctp_flags &= ~SCTP_PCB_FLAGS_DONT_WAKE;
7305 if (inp->sctp_flags & SCTP_PCB_FLAGS_WAKEOUTPUT) {
7306 inp->sctp_flags &= ~SCTP_PCB_FLAGS_WAKEOUTPUT;
7307 SOCKBUF_LOCK(&inp->sctp_socket->so_snd);
7308 if (sowriteable(inp->sctp_socket)) {
7309 sowwakeup_locked(inp->sctp_socket);
7311 SOCKBUF_UNLOCK(&inp->sctp_socket->so_snd);
7314 if (inp->sctp_flags & SCTP_PCB_FLAGS_WAKEINPUT) {
7315 inp->sctp_flags &= ~SCTP_PCB_FLAGS_WAKEINPUT;
7316 SOCKBUF_LOCK(&inp->sctp_socket->so_rcv);
7317 if (soreadable(inp->sctp_socket)) {
7319 sorwakeup_locked(inp->sctp_socket);
7321 SOCKBUF_UNLOCK(&inp->sctp_socket->so_rcv);
7326 if (stcb->asoc.state & SCTP_STATE_ABOUT_TO_BE_FREED) {
7376 inp = (struct sctp_inpcb *)so->so_pcb;
7382 sin->sin_port = inp->sctp_lport;
7383 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
7384 if (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) {
7390 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7397 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
7398 sin_a = (struct sockaddr_in *)&net->ro._l_addr;
7403 if (sin_a->sin_family == AF_INET) {
7414 vrf_id = inp->def_vrf_id;
7417 (sctp_route_t *)&net->ro,
7420 sin->sin_addr = sctp_ifa->address.sin.sin_addr;
7427 sin->sin_addr.s_addr = 0;
7435 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
7436 if (laddr->ifa->address.sa.sa_family == AF_INET) {
7439 sin_a = &laddr->ifa->address.sin;
7440 sin->sin_addr = sin_a->sin_addr;
7471 inp = (struct sctp_inpcb *)so->so_pcb;
7473 ((inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) == 0)) {
7479 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7489 TAILQ_FOREACH(net, &stcb->asoc.nets, sctp_next) {
7490 sin_a = (struct sockaddr_in *)&net->ro._l_addr;
7491 if (sin_a->sin_family == AF_INET) {
7493 sin->sin_port = stcb->rport;
7494 sin->sin_addr = sin_a->sin_addr;