Lines Matching refs:inp

149 sctp_notify(struct sctp_inpcb *inp,
191 so = SCTP_INP_SO(inp);
198 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC,
218 sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net,
236 sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net);
251 struct sctp_inpcb *inp;
287 inp = NULL;
291 &inp, &net, 1,
295 (inp != NULL)) {
328 sctp_notify(inp, stcb, net,
334 if ((stcb == NULL) && (inp != NULL)) {
336 SCTP_INP_WLOCK(inp);
337 SCTP_INP_DECR_REF(inp);
338 SCTP_INP_WUNLOCK(inp);
355 struct sctp_inpcb *inp;
375 &inp, &net, 1, vrf_id);
376 if (stcb == NULL || inp == NULL || inp->sctp_socket == NULL) {
377 if ((inp != NULL) && (stcb == NULL)) {
379 SCTP_INP_WLOCK(inp);
380 SCTP_INP_DECR_REF(inp);
383 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT);
394 SCTP_INP_WLOCK(inp);
396 error = cr_canseesocket(req->td->td_ucred, inp->sctp_socket);
398 SCTP_INP_WUNLOCK(inp);
401 cru2x(inp->sctp_socket->so_cred, &xuc);
402 SCTP_INP_WUNLOCK(inp);
416 struct sctp_inpcb *inp;
419 inp = (struct sctp_inpcb *)so->so_pcb;
420 if (inp == NULL) {
424 flags = inp->sctp_flags;
426 sctp_log_closing(inp, NULL, 17);
429 (atomic_cmpset_int(&inp->sctp_flags, flags, (flags | SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_CLOSE_IP)))) {
431 sctp_log_closing(inp, NULL, 16);
433 sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT,
447 flags = inp->sctp_flags;
458 struct sctp_inpcb *inp;
463 inp = (struct sctp_inpcb *)so->so_pcb;
464 if (inp != NULL) {
465 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
478 inp = (struct sctp_inpcb *)so->so_pcb;
479 SCTP_INP_WLOCK(inp);
480 inp->sctp_flags &= ~SCTP_PCB_FLAGS_BOUND_V6; /* I'm not v6! */
481 ip_inp = &inp->ip_inp.inp;
484 SCTP_INP_WUNLOCK(inp);
491 struct sctp_inpcb *inp;
493 inp = (struct sctp_inpcb *)so->so_pcb;
494 if (inp == NULL) {
495 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
501 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
512 struct sctp_inpcb *inp;
515 inp = (struct sctp_inpcb *)so->so_pcb;
516 if (inp == NULL)
523 flags = inp->sctp_flags;
525 sctp_log_closing(inp, NULL, 17);
528 (atomic_cmpset_int(&inp->sctp_flags, flags, (flags | SCTP_PCB_FLAGS_SOCKET_GONE | SCTP_PCB_FLAGS_CLOSE_IP)))) {
532 sctp_log_closing(inp, NULL, 13);
534 sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_ABORT,
538 sctp_log_closing(inp, NULL, 14);
540 sctp_inpcb_free(inp, SCTP_FREE_SHOULD_USE_GRACEFUL_CLOSE,
559 flags = inp->sctp_flags;
577 struct sctp_inpcb *inp;
580 inp = (struct sctp_inpcb *)so->so_pcb;
581 if (inp == NULL) {
586 SCTP_LTRACE_ERR_RET_PKT(m, inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
592 ((inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) ||
593 (inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE))) {
596 SCTP_LTRACE_ERR_RET_PKT(m, inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EDESTADDRREQ);
608 SCTP_LTRACE_ERR_RET_PKT(m, inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EDESTADDRREQ);
621 if (inp->control) {
623 sctp_m_freem(inp->control);
624 inp->control = NULL;
626 inp->control = control;
629 if (inp->pkt) {
630 SCTP_BUF_NEXT(inp->pkt_last) = m;
631 inp->pkt_last = m;
633 inp->pkt_last = inp->pkt = m;
649 ret = sctp_output(inp, inp->pkt, addr, inp->control, p, flags);
650 inp->pkt = NULL;
651 inp->control = NULL;
661 struct sctp_inpcb *inp;
663 inp = (struct sctp_inpcb *)so->so_pcb;
664 if (inp == NULL) {
665 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTCONN);
668 SCTP_INP_RLOCK(inp);
669 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
670 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) {
671 if (LIST_EMPTY(&inp->sctp_asoc_list)) {
673 SCTP_INP_RUNLOCK(inp);
679 stcb = LIST_FIRST(&inp->sctp_asoc_list);
681 SCTP_INP_RUNLOCK(inp);
682 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
690 SCTP_INP_RUNLOCK(inp);
717 SCTP_INP_RUNLOCK(inp);
722 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC,
797 SCTP_INP_RUNLOCK(inp);
798 (void)sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC,
802 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CLOSING, SCTP_SO_LOCKED);
807 SCTP_INP_RUNLOCK(inp);
813 SCTP_INP_RUNLOCK(inp);
814 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP);
828 struct sctp_inpcb *inp;
830 inp = (struct sctp_inpcb *)so->so_pcb;
831 if (inp == NULL) {
832 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
835 SCTP_INP_RLOCK(inp);
837 if (inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) {
838 SCTP_INP_RUNLOCK(inp);
841 SCTP_INP_RUNLOCK(inp);
847 SCTP_INP_WLOCK(inp);
848 SCTP_INP_READ_LOCK(inp);
849 inp->sctp_flags |= SCTP_PCB_FLAGS_SOCKET_CANT_READ;
850 SCTP_INP_READ_UNLOCK(inp);
851 SCTP_INP_WUNLOCK(inp);
872 struct sctp_inpcb *inp;
874 inp = (struct sctp_inpcb *)so->so_pcb;
875 if (inp == NULL) {
876 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
879 SCTP_INP_RLOCK(inp);
881 if (!((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
882 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL))) {
888 SCTP_INP_RUNLOCK(inp);
889 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP);
903 SCTP_INP_RUNLOCK(inp);
908 stcb = LIST_FIRST(&inp->sctp_asoc_list);
915 SCTP_INP_RUNLOCK(inp);
922 SCTP_INP_RUNLOCK(inp);
933 SCTP_INP_RUNLOCK(inp);
975 SCTP_INP_RUNLOCK(inp);
984 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_CLOSING, SCTP_SO_LOCKED);
986 SCTP_INP_RUNLOCK(inp);
1014 sctp_fill_up_addresses_vrf(struct sctp_inpcb *inp,
1061 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
1066 if (SCTP_IPV6_V6ONLY(inp)) {
1085 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
1122 if (prison_check_ip4(inp->ip_inp.inp.inp_cred,
1131 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NEEDS_MAPPED_V4)) {
1133 ((struct sockaddr_in6 *)sas)->sin6_port = inp->sctp_lport;
1139 ((struct sockaddr_in *)sas)->sin_port = inp->sctp_lport;
1167 if (prison_check_ip6(inp->ip_inp.inp.inp_cred,
1198 ((struct sockaddr_in6 *)sas)->sin6_port = inp->sctp_lport;
1218 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
1229 ((struct sockaddr_in *)sas)->sin_port = inp->sctp_lport;
1234 ((struct sockaddr_in6 *)sas)->sin6_port = inp->sctp_lport;
1253 sctp_fill_up_addresses(struct sctp_inpcb *inp,
1262 size = sctp_fill_up_addresses_vrf(inp, stcb, limit, sas,
1263 inp->def_vrf_id);
1272 sctp_count_max_addresses_vrf(struct sctp_inpcb *inp, uint32_t vrf_id)
1288 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
1299 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NEEDS_MAPPED_V4))
1321 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
1326 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NEEDS_MAPPED_V4))
1349 sctp_count_max_addresses(struct sctp_inpcb *inp)
1355 cnt = sctp_count_max_addresses_vrf(inp, inp->def_vrf_id);
1361 sctp_do_connect_x(struct socket *so, struct sctp_inpcb *inp, void *optval,
1375 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
1376 (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED)) {
1378 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EADDRINUSE);
1381 if ((inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) &&
1382 (sctp_is_feature_off(inp, SCTP_PCB_FLAGS_PORTREUSE))) {
1383 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
1386 if (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) {
1387 SCTP_INP_RLOCK(inp);
1388 stcb = LIST_FIRST(&inp->sctp_asoc_list);
1389 SCTP_INP_RUNLOCK(inp);
1392 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY);
1395 SCTP_INP_INCR_REF(inp);
1396 SCTP_ASOC_CREATE_LOCK(inp);
1398 if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
1399 (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) {
1400 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EFAULT);
1407 stcb = sctp_connectx_helper_find(inp, sa, &totaddr, &num_v4, &num_v6, &error, (unsigned int)(optsize - sizeof(int)), &bad_addresses);
1410 SCTP_ASOC_CREATE_UNLOCK(inp);
1415 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY);
1421 if (((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) &&
1426 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
1430 inp6 = (struct in6pcb *)inp;
1436 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
1442 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) ==
1451 vrf_id = inp->def_vrf_id;
1455 stcb = sctp_aloc_assoc(inp, sa, &error, 0, vrf_id,
1456 inp->sctp_ep.pre_open_stream_count,
1457 inp->sctp_ep.port,
1490 (void)sctp_free_assoc(inp, stcb, SCTP_PCBFREE_FORCE,
1498 sctp_initialize_auth_params(inp, stcb);
1503 sctp_timer_start(SCTP_TIMER_TYPE_INIT, inp, stcb, stcb->asoc.primary_destination);
1506 sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED);
1516 SCTP_ASOC_CREATE_UNLOCK(inp);
1518 SCTP_INP_DECR_REF(inp);
1522 #define SCTP_FIND_STCB(inp, stcb, assoc_id) { \
1523 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||\
1524 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) { \
1525 SCTP_INP_RLOCK(inp); \
1526 stcb = LIST_FIRST(&inp->sctp_asoc_list); \
1530 SCTP_INP_RUNLOCK(inp); \
1532 stcb = sctp_findassociation_ep_asocid(inp, assoc_id, 1); \
1534 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT); \
1546 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL); \
1558 struct sctp_inpcb *inp = NULL;
1563 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
1566 inp = (struct sctp_inpcb *)so->so_pcb;
1567 if (inp == NULL) {
1568 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
1581 SCTP_INP_RLOCK(inp);
1584 val = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NO_FRAGMENT);
1587 val = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NEEDS_MAPPED_V4);
1590 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
1592 val = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTO_ASCONF);
1594 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
1600 val = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXPLICIT_EOR);
1603 val = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NODELAY);
1606 val = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_EXT_RCVINFO);
1609 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTOCLOSE))
1610 val = TICKS_TO_SEC(inp->sctp_ep.auto_close_time);
1616 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOPROTOOPT);
1620 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
1624 SCTP_INP_RUNLOCK(inp);
1641 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP);
1650 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE)) {
1656 *value = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE);
1665 *value = inp->partial_delivery_point;
1674 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE)) {
1675 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS)) {
1691 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1697 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1698 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
1700 SCTP_INP_RLOCK(inp);
1701 if (inp->idata_supported) {
1706 SCTP_INP_RUNLOCK(inp);
1708 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
1722 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1727 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1728 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
1730 SCTP_INP_RLOCK(inp);
1731 av->assoc_value = inp->sctp_cmt_on_off;
1732 SCTP_INP_RUNLOCK(inp);
1734 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
1748 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1753 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1754 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
1756 SCTP_INP_RLOCK(inp);
1757 av->assoc_value = inp->sctp_ep.sctp_default_cc_module;
1758 SCTP_INP_RUNLOCK(inp);
1760 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
1774 SCTP_FIND_STCB(inp, stcb, cc_opt->aid_value.assoc_id);
1793 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1798 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1799 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
1801 SCTP_INP_RLOCK(inp);
1802 av->assoc_value = inp->sctp_ep.sctp_default_ss_module;
1803 SCTP_INP_RUNLOCK(inp);
1805 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
1819 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1824 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
1835 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
1859 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
1870 SCTP_INP_RLOCK(inp);
1871 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1872 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) {
1875 SCTP_INP_RUNLOCK(inp);
1879 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
1882 SCTP_INP_RUNLOCK(inp);
1894 SCTP_INP_RLOCK(inp);
1895 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1896 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) {
1899 SCTP_INP_RUNLOCK(inp);
1904 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
1909 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
1914 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
1918 SCTP_INP_RUNLOCK(inp);
1930 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
1936 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
1937 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
1939 SCTP_INP_RLOCK(inp);
1940 av->assoc_value = inp->sctp_context;
1941 SCTP_INP_RUNLOCK(inp);
1943 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
1957 *default_vrfid = inp->def_vrf_id;
1966 SCTP_FIND_STCB(inp, stcb, id->assoc_id);
1969 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
1978 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP);
1987 SCTP_FIND_STCB(inp, stcb, gnv->gn_assoc_id);
1995 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTCONN);
2005 SCTP_FIND_STCB(inp, stcb, sack->sack_assoc_id);
2011 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2012 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2014 SCTP_INP_RLOCK(inp);
2015 sack->sack_delay = TICKS_TO_MSEC(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_RECV]);
2016 sack->sack_freq = inp->sctp_ep.sctp_sack_freq;
2017 SCTP_INP_RUNLOCK(inp);
2019 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
2033 SCTP_FIND_STCB(inp, stcb, ss->ss_assoc_id);
2042 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTCONN);
2052 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
2058 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2059 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2061 SCTP_INP_RLOCK(inp);
2062 av->assoc_value = inp->sctp_ep.max_burst;
2063 SCTP_INP_RUNLOCK(inp);
2065 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
2080 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
2086 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2087 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2089 SCTP_INP_RLOCK(inp);
2090 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
2095 if (inp->sctp_frag_point >= SCTP_DEFAULT_MAXSEGMENT)
2098 av->assoc_value = inp->sctp_frag_point - ovh;
2099 SCTP_INP_RUNLOCK(inp);
2101 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
2119 SCTP_INP_RLOCK(inp);
2120 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVDATAIOEVNT))
2123 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVASSOCEVNT))
2126 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVPADDREVNT))
2129 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVSENDFAILEVNT))
2132 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVPEERERR))
2135 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT))
2138 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PDAPIEVNT))
2141 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_ADAPTATIONEVNT))
2144 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_AUTHEVNT))
2147 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_DRYEVNT))
2150 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_STREAM_RESETEVNT))
2152 SCTP_INP_RUNLOCK(inp);
2162 SCTP_INP_RLOCK(inp);
2163 *value = inp->sctp_ep.adaptation_layer_indicator;
2164 SCTP_INP_RUNLOCK(inp);
2173 SCTP_INP_RLOCK(inp);
2174 *value = inp->sctp_ep.initial_sequence_debug;
2175 SCTP_INP_RUNLOCK(inp);
2184 SCTP_INP_RLOCK(inp);
2185 *value = sctp_count_max_addresses(inp);
2186 SCTP_INP_RUNLOCK(inp);
2198 SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t) * value);
2208 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NEEDS_MAPPED_V4)) {
2231 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTCONN);
2248 SCTP_FIND_STCB(inp, stcb, saddr->sget_assoc_id);
2260 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NEEDS_MAPPED_V4)) {
2287 if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NEEDS_MAPPED_V4)) &&
2306 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT);
2318 SCTP_FIND_STCB(inp, stcb, saddr->sget_assoc_id);
2322 actual = sctp_fill_up_addresses(inp, stcb, limit, sas);
2341 SCTP_FIND_STCB(inp, stcb, paddrp->spp_assoc_id);
2371 SCTP_INP_INCR_REF(inp);
2372 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
2374 SCTP_INP_DECR_REF(inp);
2386 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
2399 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
2407 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
2473 if (sctp_stcb_is_feature_on(inp, stcb, SCTP_PCB_FLAGS_DONOT_HEARTBEAT)) {
2478 if (sctp_stcb_is_feature_on(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD)) {
2488 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2489 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2492 SCTP_INP_RLOCK(inp);
2493 paddrp->spp_pathmaxrxt = inp->sctp_ep.def_net_failure;
2494 paddrp->spp_hbinterval = TICKS_TO_MSEC(inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT]);
2496 /* get inp's default */
2497 if (inp->sctp_ep.default_dscp & 0x01) {
2498 paddrp->spp_dscp = inp->sctp_ep.default_dscp & 0xfc;
2502 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) &&
2503 (inp->sctp_ep.default_flowlabel & 0x80000000)) {
2504 paddrp->spp_ipv6_flowlabel = inp->sctp_ep.default_flowlabel & 0x000fffff;
2511 if (sctp_is_feature_off(inp, SCTP_PCB_FLAGS_DONOT_HEARTBEAT)) {
2516 if (sctp_is_feature_off(inp, SCTP_PCB_FLAGS_DO_NOT_PMTUD)) {
2521 SCTP_INP_RUNLOCK(inp);
2523 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
2544 SCTP_FIND_STCB(inp, stcb, paddri->spinfo_assoc_id);
2574 SCTP_INP_INCR_REF(inp);
2575 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
2577 SCTP_INP_DECR_REF(inp);
2617 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT);
2637 SCTP_FIND_STCB(inp, stcb, sstat->sstat_assoc_id);
2640 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
2706 SCTP_FIND_STCB(inp, stcb, srto->srto_assoc_id);
2714 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2715 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2717 SCTP_INP_RLOCK(inp);
2718 srto->srto_initial = inp->sctp_ep.initial_rto;
2719 srto->srto_max = inp->sctp_ep.sctp_maxrto;
2720 srto->srto_min = inp->sctp_ep.sctp_minrto;
2721 SCTP_INP_RUNLOCK(inp);
2723 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
2737 SCTP_FIND_STCB(inp, stcb, stimo->stimo_assoc_id);
2750 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
2760 SCTP_FIND_STCB(inp, stcb, sasoc->sasoc_assoc_id);
2770 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2771 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2773 SCTP_INP_RLOCK(inp);
2774 sasoc->sasoc_cookie_life = TICKS_TO_MSEC(inp->sctp_ep.def_cookie_life);
2775 sasoc->sasoc_asocmaxrxt = inp->sctp_ep.max_send_times;
2778 sasoc->sasoc_local_rwnd = sbspace(&inp->sctp_socket->so_rcv);
2779 SCTP_INP_RUNLOCK(inp);
2781 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
2795 SCTP_FIND_STCB(inp, stcb, s_info->sinfo_assoc_id);
2801 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2802 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2804 SCTP_INP_RLOCK(inp);
2805 memcpy(s_info, &inp->def_send, sizeof(inp->def_send));
2806 SCTP_INP_RUNLOCK(inp);
2808 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
2822 SCTP_INP_RLOCK(inp);
2823 sinit->sinit_num_ostreams = inp->sctp_ep.pre_open_stream_count;
2824 sinit->sinit_max_instreams = inp->sctp_ep.max_open_streams_intome;
2825 sinit->sinit_max_attempts = inp->sctp_ep.max_init_times;
2826 sinit->sinit_max_init_timeo = inp->sctp_ep.initial_init_rto_max;
2827 SCTP_INP_RUNLOCK(inp);
2837 SCTP_FIND_STCB(inp, stcb, ssp->ssp_assoc_id);
2847 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_NEEDS_MAPPED_V4)) {
2869 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
2883 SCTP_INP_RLOCK(inp);
2884 hmaclist = inp->sctp_ep.local_hmacs;
2888 SCTP_INP_RUNLOCK(inp);
2895 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
2897 SCTP_INP_RUNLOCK(inp);
2905 SCTP_INP_RUNLOCK(inp);
2914 SCTP_FIND_STCB(inp, stcb, scact->scact_assoc_id);
2921 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2922 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2925 SCTP_INP_RLOCK(inp);
2926 scact->scact_keynumber = inp->sctp_ep.default_keyid;
2927 SCTP_INP_RUNLOCK(inp);
2929 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
2945 SCTP_FIND_STCB(inp, stcb, sac->gauth_assoc_id);
2954 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
2963 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
2964 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
2967 SCTP_INP_RLOCK(inp);
2968 chklist = inp->sctp_ep.local_auth_chunks;
2973 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
2980 SCTP_INP_RUNLOCK(inp);
2982 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
2995 SCTP_FIND_STCB(inp, stcb, sac->gauth_assoc_id);
3004 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
3013 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT);
3024 SCTP_FIND_STCB(inp, stcb, event->se_assoc_id);
3059 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTSUP);
3073 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3079 event->se_on = sctp_stcb_is_feature_on(inp, stcb, event_type);
3082 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3083 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3085 SCTP_INP_RLOCK(inp);
3086 event->se_on = sctp_is_feature_on(inp, event_type);
3087 SCTP_INP_RUNLOCK(inp);
3089 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3104 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3107 SCTP_INP_RLOCK(inp);
3108 onoff = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVRCVINFO);
3109 SCTP_INP_RUNLOCK(inp);
3123 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3126 SCTP_INP_RLOCK(inp);
3127 onoff = sctp_is_feature_on(inp, SCTP_PCB_FLAGS_RECVNXTINFO);
3128 SCTP_INP_RUNLOCK(inp);
3142 SCTP_FIND_STCB(inp, stcb, info->snd_assoc_id);
3152 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3153 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3155 SCTP_INP_RLOCK(inp);
3156 info->snd_sid = inp->def_send.sinfo_stream;
3157 info->snd_flags = inp->def_send.sinfo_flags;
3159 info->snd_ppid = inp->def_send.sinfo_ppid;
3160 info->snd_context = inp->def_send.sinfo_context;
3161 SCTP_INP_RUNLOCK(inp);
3163 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3177 SCTP_FIND_STCB(inp, stcb, info->pr_assoc_id);
3184 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3185 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3187 SCTP_INP_RLOCK(inp);
3188 info->pr_policy = PR_SCTP_POLICY(inp->def_send.sinfo_flags);
3189 info->pr_value = inp->def_send.sinfo_timetolive;
3190 SCTP_INP_RUNLOCK(inp);
3192 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3213 SCTP_FIND_STCB(inp, stcb, thlds->spt_assoc_id);
3243 SCTP_INP_INCR_REF(inp);
3244 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
3246 SCTP_INP_DECR_REF(inp);
3258 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
3271 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
3279 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
3296 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3297 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3300 SCTP_INP_RLOCK(inp);
3301 thlds->spt_pathmaxrxt = inp->sctp_ep.def_net_failure;
3302 thlds->spt_pathpfthld = inp->sctp_ep.def_net_pf_threshold;
3304 SCTP_INP_RUNLOCK(inp);
3306 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3327 SCTP_FIND_STCB(inp, stcb, encaps->sue_assoc_id);
3357 SCTP_INP_INCR_REF(inp);
3358 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
3360 SCTP_INP_DECR_REF(inp);
3372 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
3385 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
3393 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
3405 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3406 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3408 SCTP_INP_RLOCK(inp);
3409 encaps->sue_port = inp->sctp_ep.port;
3410 SCTP_INP_RUNLOCK(inp);
3412 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3426 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3432 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3433 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3435 SCTP_INP_RLOCK(inp);
3436 av->assoc_value = inp->ecn_supported;
3437 SCTP_INP_RUNLOCK(inp);
3439 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3453 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3459 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3460 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3462 SCTP_INP_RLOCK(inp);
3463 av->assoc_value = inp->prsctp_supported;
3464 SCTP_INP_RUNLOCK(inp);
3466 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3480 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3486 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3487 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3489 SCTP_INP_RLOCK(inp);
3490 av->assoc_value = inp->auth_supported;
3491 SCTP_INP_RUNLOCK(inp);
3493 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3507 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3513 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3514 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3516 SCTP_INP_RLOCK(inp);
3517 av->assoc_value = inp->asconf_supported;
3518 SCTP_INP_RUNLOCK(inp);
3520 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3534 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3540 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3541 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3543 SCTP_INP_RLOCK(inp);
3544 av->assoc_value = inp->reconfig_supported;
3545 SCTP_INP_RUNLOCK(inp);
3547 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3561 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3567 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3568 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3570 SCTP_INP_RLOCK(inp);
3571 av->assoc_value = inp->nrsack_supported;
3572 SCTP_INP_RUNLOCK(inp);
3574 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3588 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3594 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3595 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3597 SCTP_INP_RLOCK(inp);
3598 av->assoc_value = inp->pktdrop_supported;
3599 SCTP_INP_RUNLOCK(inp);
3601 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3615 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3621 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3622 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3624 SCTP_INP_RLOCK(inp);
3625 av->assoc_value = (uint32_t) inp->local_strreset_support;
3626 SCTP_INP_RUNLOCK(inp);
3628 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3644 SCTP_FIND_STCB(inp, stcb, sprstat->sprstat_assoc_id);
3671 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3682 SCTP_FIND_STCB(inp, stcb, sprstat->sprstat_assoc_id);
3699 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3709 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3715 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3716 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3718 SCTP_INP_RLOCK(inp);
3719 av->assoc_value = inp->max_cwnd;
3720 SCTP_INP_RUNLOCK(inp);
3722 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3732 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOPROTOOPT);
3749 struct sctp_inpcb *inp = NULL;
3754 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3757 inp = (struct sctp_inpcb *)so->so_pcb;
3758 if (inp == NULL) {
3759 SCTP_PRINTF("inp is NULL?\n");
3760 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3763 vrf_id = inp->def_vrf_id;
3787 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
3792 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EPERM);
3797 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3808 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
3811 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3819 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3820 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) {
3821 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3829 inp->sctp_ep.auto_close_time = SEC_TO_TICKS(*mopt);
3832 SCTP_INP_WLOCK(inp);
3834 sctp_feature_on(inp, set_opt);
3836 sctp_feature_off(inp, set_opt);
3838 SCTP_INP_WUNLOCK(inp);
3843 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) == 0) {
3848 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE)) {
3854 sctp_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE);
3856 sctp_feature_off(inp, SCTP_PCB_FLAGS_PORTREUSE);
3865 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3869 inp->partial_delivery_point = *value;
3879 sctp_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE);
3880 sctp_feature_on(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS);
3882 sctp_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE);
3883 sctp_feature_off(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS);
3885 sctp_feature_off(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE);
3886 sctp_feature_off(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS);
3889 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3899 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3902 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3906 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3907 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3909 SCTP_INP_WLOCK(inp);
3911 inp->idata_supported = 0;
3913 if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_FRAG_INTERLEAVE)) &&
3914 (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_INTERLEAVE_STRMS))) {
3915 inp->idata_supported = 1;
3923 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3927 SCTP_INP_WUNLOCK(inp);
3929 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3941 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3945 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3950 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
3951 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
3954 SCTP_INP_WLOCK(inp);
3955 inp->sctp_cmt_on_off = av->assoc_value;
3956 SCTP_INP_WUNLOCK(inp);
3960 SCTP_INP_RLOCK(inp);
3961 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
3966 SCTP_INP_RUNLOCK(inp);
3970 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOPROTOOPT);
3984 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
3988 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
3999 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4000 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4003 SCTP_INP_WLOCK(inp);
4004 inp->sctp_ep.sctp_default_cc_module = av->assoc_value;
4005 SCTP_INP_WUNLOCK(inp);
4009 SCTP_INP_RLOCK(inp);
4010 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4021 SCTP_INP_RUNLOCK(inp);
4031 SCTP_FIND_STCB(inp, stcb, cc_opt->aid_value.assoc_id);
4034 SCTP_INP_RLOCK(inp);
4035 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4042 SCTP_INP_RUNLOCK(inp);
4068 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4072 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4080 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4081 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4084 SCTP_INP_WLOCK(inp);
4085 inp->sctp_ep.sctp_default_ss_module = av->assoc_value;
4086 SCTP_INP_WUNLOCK(inp);
4090 SCTP_INP_RLOCK(inp);
4091 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4099 SCTP_INP_RUNLOCK(inp);
4109 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4114 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4120 SCTP_INP_RLOCK(inp);
4121 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4131 SCTP_INP_RUNLOCK(inp);
4137 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4144 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP);
4152 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4158 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4159 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4162 SCTP_INP_WLOCK(inp);
4163 inp->sctp_context = av->assoc_value;
4164 SCTP_INP_WUNLOCK(inp);
4168 SCTP_INP_RLOCK(inp);
4169 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4174 SCTP_INP_RUNLOCK(inp);
4185 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4189 inp->def_vrf_id = *default_vrfid;
4194 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP);
4200 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP);
4209 SCTP_FIND_STCB(inp, stcb, sack->sack_assoc_id);
4226 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4227 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4230 SCTP_INP_WLOCK(inp);
4232 inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_RECV] = MSEC_TO_TICKS(sack->sack_delay);
4235 inp->sctp_ep.sctp_sack_freq = sack->sack_freq;
4237 SCTP_INP_WUNLOCK(inp);
4241 SCTP_INP_RLOCK(inp);
4242 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4252 SCTP_INP_RUNLOCK(inp);
4263 SCTP_INP_WLOCK(inp);
4264 if (sctp_auth_add_chunk(sauth->sauth_chunk, inp->sctp_ep.local_auth_chunks)) {
4265 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4268 SCTP_INP_WUNLOCK(inp);
4286 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4291 SCTP_FIND_STCB(inp, stcb, sca->sca_assoc_id);
4304 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOMEM);
4313 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOMEM);
4323 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4324 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4327 SCTP_INP_WLOCK(inp);
4328 shared_keys = &inp->sctp_ep.shared_keys;
4333 sctp_clear_cachedkeys_ep(inp, sca->sca_keynumber);
4341 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOMEM);
4343 SCTP_INP_WUNLOCK(inp);
4350 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOMEM);
4352 SCTP_INP_WUNLOCK(inp);
4358 SCTP_INP_WUNLOCK(inp);
4362 SCTP_INP_RLOCK(inp);
4363 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4393 SCTP_INP_RUNLOCK(inp);
4408 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4414 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOMEM);
4422 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4437 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4442 SCTP_INP_WLOCK(inp);
4443 if (inp->sctp_ep.local_hmacs)
4444 sctp_free_hmaclist(inp->sctp_ep.local_hmacs);
4445 inp->sctp_ep.local_hmacs = hmaclist;
4446 SCTP_INP_WUNLOCK(inp);
4455 SCTP_FIND_STCB(inp, stcb, scact->scact_assoc_id);
4462 SCTP_LTRACE_ERR_RET(inp, NULL, NULL,
4469 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4470 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4473 SCTP_INP_WLOCK(inp);
4474 if (sctp_auth_setactivekey_ep(inp, scact->scact_keynumber)) {
4475 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4478 SCTP_INP_WUNLOCK(inp);
4482 SCTP_INP_RLOCK(inp);
4483 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4488 SCTP_INP_RUNLOCK(inp);
4498 SCTP_FIND_STCB(inp, stcb, scdel->scact_assoc_id);
4503 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4508 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4509 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4512 SCTP_INP_WLOCK(inp);
4513 if (sctp_delete_sharedkey_ep(inp, scdel->scact_keynumber)) {
4514 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4517 SCTP_INP_WUNLOCK(inp);
4521 SCTP_INP_RLOCK(inp);
4522 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4527 SCTP_INP_RUNLOCK(inp);
4537 SCTP_FIND_STCB(inp, stcb, keyid->scact_assoc_id);
4542 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4547 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4548 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4551 SCTP_INP_WLOCK(inp);
4552 if (sctp_deact_sharedkey_ep(inp, keyid->scact_keynumber)) {
4553 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4556 SCTP_INP_WUNLOCK(inp);
4560 SCTP_INP_RLOCK(inp);
4561 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4566 SCTP_INP_RUNLOCK(inp);
4577 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4581 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4586 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4587 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4590 SCTP_INP_WLOCK(inp);
4591 inp->local_strreset_support = (uint8_t) av->assoc_value;
4592 SCTP_INP_WUNLOCK(inp);
4596 SCTP_INP_RLOCK(inp);
4597 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4602 SCTP_INP_RUNLOCK(inp);
4614 SCTP_FIND_STCB(inp, stcb, strrst->srs_assoc_id);
4616 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT);
4624 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP);
4638 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY);
4648 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOMEM);
4654 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4662 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4668 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4707 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED);
4728 SCTP_FIND_STCB(inp, stcb, stradd->sas_assoc_id);
4730 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT);
4738 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP);
4744 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY);
4787 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED);
4798 SCTP_FIND_STCB(inp, stcb, (sctp_assoc_t) * value);
4800 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT);
4808 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP);
4814 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY);
4827 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
4838 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_STRRST_REQ, SCTP_SO_LOCKED);
4844 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4848 error = sctp_do_connect_x(so, inp, optval, optsize, p, 0);
4852 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4856 error = sctp_do_connect_x(so, inp, optval, optsize, p, 1);
4866 if (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) {
4867 SCTP_INP_RLOCK(inp);
4868 stcb = LIST_FIRST(&inp->sctp_asoc_list);
4872 SCTP_INP_RUNLOCK(inp);
4881 SCTP_INP_INCR_REF(inp);
4882 stcb = sctp_findassociation_ep_addr(&inp, sa, NULL, NULL, NULL);
4884 SCTP_INP_DECR_REF(inp);
4889 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT);
4896 sctp_timer_stop(SCTP_TIMER_TYPE_INIT, inp, stcb,
4899 sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED);
4905 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY);
4916 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4922 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4923 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4926 SCTP_INP_WLOCK(inp);
4927 inp->sctp_ep.max_burst = av->assoc_value;
4928 SCTP_INP_WUNLOCK(inp);
4932 SCTP_INP_RLOCK(inp);
4933 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
4938 SCTP_INP_RUNLOCK(inp);
4949 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
4951 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
4964 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
4965 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
4967 SCTP_INP_WLOCK(inp);
4973 inp->sctp_frag_point = (av->assoc_value + ovh);
4975 inp->sctp_frag_point = SCTP_DEFAULT_MAXSEGMENT;
4977 SCTP_INP_WUNLOCK(inp);
4979 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
4991 SCTP_INP_WLOCK(inp);
4993 sctp_feature_on(inp, SCTP_PCB_FLAGS_RECVDATAIOEVNT);
4995 sctp_feature_off(inp, SCTP_PCB_FLAGS_RECVDATAIOEVNT);
4999 sctp_feature_on(inp, SCTP_PCB_FLAGS_RECVASSOCEVNT);
5001 sctp_feature_off(inp, SCTP_PCB_FLAGS_RECVASSOCEVNT);
5005 sctp_feature_on(inp, SCTP_PCB_FLAGS_RECVPADDREVNT);
5007 sctp_feature_off(inp, SCTP_PCB_FLAGS_RECVPADDREVNT);
5011 sctp_feature_on(inp, SCTP_PCB_FLAGS_RECVSENDFAILEVNT);
5013 sctp_feature_off(inp, SCTP_PCB_FLAGS_RECVSENDFAILEVNT);
5017 sctp_feature_on(inp, SCTP_PCB_FLAGS_RECVPEERERR);
5019 sctp_feature_off(inp, SCTP_PCB_FLAGS_RECVPEERERR);
5023 sctp_feature_on(inp, SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT);
5025 sctp_feature_off(inp, SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT);
5029 sctp_feature_on(inp, SCTP_PCB_FLAGS_PDAPIEVNT);
5031 sctp_feature_off(inp, SCTP_PCB_FLAGS_PDAPIEVNT);
5035 sctp_feature_on(inp, SCTP_PCB_FLAGS_ADAPTATIONEVNT);
5037 sctp_feature_off(inp, SCTP_PCB_FLAGS_ADAPTATIONEVNT);
5041 sctp_feature_on(inp, SCTP_PCB_FLAGS_AUTHEVNT);
5043 sctp_feature_off(inp, SCTP_PCB_FLAGS_AUTHEVNT);
5047 sctp_feature_on(inp, SCTP_PCB_FLAGS_DRYEVNT);
5049 sctp_feature_off(inp, SCTP_PCB_FLAGS_DRYEVNT);
5053 sctp_feature_on(inp, SCTP_PCB_FLAGS_STREAM_RESETEVNT);
5055 sctp_feature_off(inp, SCTP_PCB_FLAGS_STREAM_RESETEVNT);
5057 SCTP_INP_WUNLOCK(inp);
5059 SCTP_INP_RLOCK(inp);
5060 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
5063 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVASSOCEVNT);
5065 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVASSOCEVNT);
5068 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVPADDREVNT);
5070 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVPADDREVNT);
5073 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT);
5075 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVSENDFAILEVNT);
5078 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVPEERERR);
5080 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVPEERERR);
5083 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT);
5085 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_RECVSHUTDOWNEVNT);
5088 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_PDAPIEVNT);
5090 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_PDAPIEVNT);
5093 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_ADAPTATIONEVNT);
5095 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_ADAPTATIONEVNT);
5098 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_AUTHEVNT);
5100 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_AUTHEVNT);
5103 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_DRYEVNT);
5105 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_DRYEVNT);
5108 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_STREAM_RESETEVNT);
5110 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_STREAM_RESETEVNT);
5119 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
5120 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) {
5121 stcb = LIST_FIRST(&inp->sctp_asoc_list);
5133 SCTP_INP_RUNLOCK(inp);
5141 SCTP_INP_WLOCK(inp);
5142 inp->sctp_ep.adaptation_layer_indicator = adap_bits->ssb_adaptation_ind;
5143 inp->sctp_ep.adaptation_layer_indicator_provided = 1;
5144 SCTP_INP_WUNLOCK(inp);
5153 SCTP_INP_WLOCK(inp);
5154 inp->sctp_ep.initial_sequence_debug = *vvv;
5155 SCTP_INP_WUNLOCK(inp);
5164 SCTP_FIND_STCB(inp, stcb, s_info->sinfo_assoc_id);
5170 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5175 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
5176 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
5179 SCTP_INP_WLOCK(inp);
5180 memcpy(&inp->def_send, s_info, min(optsize, sizeof(inp->def_send)));
5181 SCTP_INP_WUNLOCK(inp);
5185 SCTP_INP_RLOCK(inp);
5186 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
5193 SCTP_INP_RUNLOCK(inp);
5210 SCTP_FIND_STCB(inp, stcb, paddrp->spp_assoc_id);
5240 SCTP_INP_INCR_REF(inp);
5241 stcb = sctp_findassociation_ep_addr(&inp, addr,
5244 SCTP_INP_DECR_REF(inp);
5255 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5268 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5278 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
5286 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5292 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5302 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net,
5313 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net,
5315 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
5321 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED);
5322 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
5326 sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net,
5351 sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net);
5446 sctp_timer_stop(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net,
5448 sctp_timer_start(SCTP_TIMER_TYPE_HEARTBEAT, inp, stcb, net);
5450 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_DONOT_HEARTBEAT);
5458 inp, stcb, net,
5463 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_DONOT_HEARTBEAT);
5468 sctp_timer_stop(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net,
5491 sctp_stcb_feature_on(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD);
5496 sctp_timer_start(SCTP_TIMER_TYPE_PATHMTURAISE, inp, stcb, net);
5500 sctp_stcb_feature_off(inp, stcb, SCTP_PCB_FLAGS_DO_NOT_PMTUD);
5526 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
5527 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
5529 SCTP_INP_WLOCK(inp);
5536 inp->sctp_ep.def_net_failure = paddrp->spp_pathmaxrxt;
5539 inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = 0;
5543 inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = MSEC_TO_TICKS(paddrp->spp_hbinterval);
5547 inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = 0;
5549 inp->sctp_ep.sctp_timeoutticks[SCTP_TIMER_HEARTBEAT] = MSEC_TO_TICKS(paddrp->spp_hbinterval);
5551 sctp_feature_off(inp, SCTP_PCB_FLAGS_DONOT_HEARTBEAT);
5553 sctp_feature_on(inp, SCTP_PCB_FLAGS_DONOT_HEARTBEAT);
5556 sctp_feature_off(inp, SCTP_PCB_FLAGS_DO_NOT_PMTUD);
5558 sctp_feature_on(inp, SCTP_PCB_FLAGS_DO_NOT_PMTUD);
5561 inp->sctp_ep.default_dscp = paddrp->spp_dscp & 0xfc;
5562 inp->sctp_ep.default_dscp |= 0x01;
5566 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
5567 inp->sctp_ep.default_flowlabel = paddrp->spp_ipv6_flowlabel & 0x000fffff;
5568 inp->sctp_ep.default_flowlabel |= 0x80000000;
5572 SCTP_INP_WUNLOCK(inp);
5574 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5586 SCTP_FIND_STCB(inp, stcb, srto->srto_assoc_id);
5606 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5611 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
5612 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
5614 SCTP_INP_WLOCK(inp);
5618 new_init = inp->sctp_ep.initial_rto;
5622 new_max = inp->sctp_ep.sctp_maxrto;
5626 new_min = inp->sctp_ep.sctp_minrto;
5628 inp->sctp_ep.initial_rto = new_init;
5629 inp->sctp_ep.sctp_maxrto = new_max;
5630 inp->sctp_ep.sctp_minrto = new_min;
5632 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5635 SCTP_INP_WUNLOCK(inp);
5637 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5648 SCTP_FIND_STCB(inp, stcb, sasoc->sasoc_assoc_id);
5665 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
5666 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
5668 SCTP_INP_WLOCK(inp);
5670 inp->sctp_ep.max_send_times = sasoc->sasoc_asocmaxrxt;
5672 inp->sctp_ep.def_cookie_life = MSEC_TO_TICKS(sasoc->sasoc_cookie_life);
5674 SCTP_INP_WUNLOCK(inp);
5676 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5687 SCTP_INP_WLOCK(inp);
5689 inp->sctp_ep.pre_open_stream_count = sinit->sinit_num_ostreams;
5692 inp->sctp_ep.max_open_streams_intome = sinit->sinit_max_instreams;
5695 inp->sctp_ep.max_init_times = sinit->sinit_max_attempts;
5698 inp->sctp_ep.initial_init_rto_max = sinit->sinit_max_init_timeo;
5699 SCTP_INP_WUNLOCK(inp);
5714 SCTP_FIND_STCB(inp, stcb, spa->ssp_assoc_id);
5744 SCTP_INP_INCR_REF(inp);
5745 stcb = sctp_findassociation_ep_addr(&inp, addr,
5748 SCTP_INP_DECR_REF(inp);
5764 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5768 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5773 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5806 SCTP_FIND_STCB(inp, stcb, sspp->sspp_assoc_id);
5829 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5833 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0) {
5841 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
5857 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5869 if (prison_check_ip4(inp->ip_inp.inp.inp_cred,
5871 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5884 if (prison_check_ip6(inp->ip_inp.inp.inp_cred,
5886 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5894 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5900 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5903 sctp_chunk_output(inp, stcb, SCTP_OUTPUT_FROM_SOCKOPT, SCTP_SO_LOCKED);
5907 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5923 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5928 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
5936 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5941 (SCTP_IPV6_V6ONLY(inp) != 0))) != 0) {
5942 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
5951 sctp_bindx_add_address(so, inp, addrs->addr,
5967 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5972 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
5980 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
5987 (SCTP_IPV6_V6ONLY(inp) != 0))) != 0) {
5988 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, error);
5997 sctp_bindx_delete_address(inp, addrs->addr,
6008 SCTP_FIND_STCB(inp, stcb, event->se_assoc_id);
6042 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTSUP);
6056 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6063 sctp_stcb_feature_on(inp, stcb, event_type);
6072 sctp_stcb_feature_off(inp, stcb, event_type);
6082 ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) == 0) &&
6083 ((inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) == 0) &&
6086 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTSUP);
6090 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6091 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6094 SCTP_INP_WLOCK(inp);
6096 sctp_feature_on(inp, event_type);
6098 sctp_feature_off(inp, event_type);
6100 SCTP_INP_WUNLOCK(inp);
6104 SCTP_INP_RLOCK(inp);
6105 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
6108 sctp_stcb_feature_on(inp, stcb, event_type);
6110 sctp_stcb_feature_off(inp, stcb, event_type);
6114 SCTP_INP_RUNLOCK(inp);
6125 SCTP_INP_WLOCK(inp);
6127 sctp_feature_on(inp, SCTP_PCB_FLAGS_RECVRCVINFO);
6129 sctp_feature_off(inp, SCTP_PCB_FLAGS_RECVRCVINFO);
6131 SCTP_INP_WUNLOCK(inp);
6139 SCTP_INP_WLOCK(inp);
6141 sctp_feature_on(inp, SCTP_PCB_FLAGS_RECVNXTINFO);
6143 sctp_feature_off(inp, SCTP_PCB_FLAGS_RECVNXTINFO);
6145 SCTP_INP_WUNLOCK(inp);
6154 SCTP_FIND_STCB(inp, stcb, info->snd_assoc_id);
6165 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6170 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6171 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6174 SCTP_INP_WLOCK(inp);
6175 inp->def_send.sinfo_stream = info->snd_sid;
6176 policy = PR_SCTP_POLICY(inp->def_send.sinfo_flags);
6177 inp->def_send.sinfo_flags = info->snd_flags;
6178 inp->def_send.sinfo_flags |= policy;
6179 inp->def_send.sinfo_ppid = info->snd_ppid;
6180 inp->def_send.sinfo_context = info->snd_context;
6181 SCTP_INP_WUNLOCK(inp);
6185 SCTP_INP_RLOCK(inp);
6186 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
6198 SCTP_INP_RUNLOCK(inp);
6208 SCTP_FIND_STCB(inp, stcb, info->pr_assoc_id);
6211 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6221 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6222 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6225 SCTP_INP_WLOCK(inp);
6226 inp->def_send.sinfo_flags &= 0xfff0;
6227 inp->def_send.sinfo_flags |= info->pr_policy;
6228 inp->def_send.sinfo_timetolive = info->pr_value;
6229 SCTP_INP_WUNLOCK(inp);
6233 SCTP_INP_RLOCK(inp);
6234 LIST_FOREACH(stcb, &inp->sctp_asoc_list, sctp_tcblist) {
6241 SCTP_INP_RUNLOCK(inp);
6259 SCTP_FIND_STCB(inp, stcb, thlds->spt_assoc_id);
6289 SCTP_INP_INCR_REF(inp);
6290 stcb = sctp_findassociation_ep_addr(&inp, addr,
6293 SCTP_INP_DECR_REF(inp);
6304 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6317 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6327 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
6333 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
6404 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6405 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6407 SCTP_INP_WLOCK(inp);
6408 inp->sctp_ep.def_net_failure = thlds->spt_pathmaxrxt;
6409 inp->sctp_ep.def_net_pf_threshold = thlds->spt_pathpfthld;
6410 SCTP_INP_WUNLOCK(inp);
6412 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6430 SCTP_FIND_STCB(inp, stcb, encaps->sue_assoc_id);
6460 SCTP_INP_INCR_REF(inp);
6461 stcb = sctp_findassociation_ep_addr(&inp, addr, &net, NULL, NULL);
6463 SCTP_INP_DECR_REF(inp);
6474 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6487 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6497 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
6509 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6510 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6512 SCTP_INP_WLOCK(inp);
6513 inp->sctp_ep.port = encaps->sue_port;
6514 SCTP_INP_WUNLOCK(inp);
6516 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6527 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6530 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6534 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6535 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6537 SCTP_INP_WLOCK(inp);
6539 inp->ecn_supported = 0;
6541 inp->ecn_supported = 1;
6543 SCTP_INP_WUNLOCK(inp);
6545 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6556 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6559 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6563 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6564 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6566 SCTP_INP_WLOCK(inp);
6568 inp->prsctp_supported = 0;
6570 inp->prsctp_supported = 1;
6572 SCTP_INP_WUNLOCK(inp);
6574 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6585 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6588 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6592 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6593 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6596 (inp->asconf_supported == 1)) {
6601 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6604 SCTP_INP_WLOCK(inp);
6606 inp->auth_supported = 0;
6608 inp->auth_supported = 1;
6610 SCTP_INP_WUNLOCK(inp);
6613 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6624 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6627 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6631 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6632 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6635 (inp->auth_supported == 0)) {
6640 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6643 SCTP_INP_WLOCK(inp);
6645 inp->asconf_supported = 0;
6647 inp->sctp_ep.local_auth_chunks);
6649 inp->sctp_ep.local_auth_chunks);
6651 inp->asconf_supported = 1;
6653 inp->sctp_ep.local_auth_chunks);
6655 inp->sctp_ep.local_auth_chunks);
6657 SCTP_INP_WUNLOCK(inp);
6660 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6671 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6674 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6678 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6679 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6681 SCTP_INP_WLOCK(inp);
6683 inp->reconfig_supported = 0;
6685 inp->reconfig_supported = 1;
6687 SCTP_INP_WUNLOCK(inp);
6689 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6700 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6703 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6707 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6708 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6710 SCTP_INP_WLOCK(inp);
6712 inp->nrsack_supported = 0;
6714 inp->nrsack_supported = 1;
6716 SCTP_INP_WUNLOCK(inp);
6718 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6729 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6732 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6736 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6737 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6739 SCTP_INP_WLOCK(inp);
6741 inp->pktdrop_supported = 0;
6743 inp->pktdrop_supported = 1;
6745 SCTP_INP_WUNLOCK(inp);
6747 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6759 SCTP_FIND_STCB(inp, stcb, av->assoc_id);
6776 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) ||
6777 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) ||
6779 SCTP_INP_WLOCK(inp);
6780 inp->max_cwnd = av->assoc_value;
6781 SCTP_INP_WUNLOCK(inp);
6783 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6790 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOPROTOOPT);
6804 struct sctp_inpcb *inp;
6808 inp = (struct sctp_inpcb *)so->so_pcb;
6809 if (inp == NULL) {
6813 SCTP_INP_WLOCK(inp);
6814 inp->fibnum = so->so_fibnum;
6815 SCTP_INP_WUNLOCK(inp);
6871 struct sctp_inpcb *inp;
6874 inp = (struct sctp_inpcb *)so->so_pcb;
6875 if (inp == NULL) {
6877 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6881 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6891 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6896 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
6908 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6913 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, error);
6920 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EAFNOSUPPORT);
6923 SCTP_INP_INCR_REF(inp);
6924 SCTP_ASOC_CREATE_LOCK(inp);
6928 if ((inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_ALLGONE) ||
6929 (inp->sctp_flags & SCTP_PCB_FLAGS_SOCKET_GONE)) {
6931 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EFAULT);
6936 if (((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) &&
6938 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6943 if ((inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) ==
6952 if ((inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL) &&
6953 (sctp_is_feature_off(inp, SCTP_PCB_FLAGS_PORTREUSE))) {
6954 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
6958 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
6959 (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED)) {
6961 SCTP_LTRACE_ERR_RET(inp, stcb, NULL, SCTP_FROM_SCTP_USRREQ, EADDRINUSE);
6965 if (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) {
6966 SCTP_INP_RLOCK(inp);
6967 stcb = LIST_FIRST(&inp->sctp_asoc_list);
6968 SCTP_INP_RUNLOCK(inp);
6975 SCTP_INP_INCR_REF(inp);
6976 stcb = sctp_findassociation_ep_addr(&inp, addr, NULL, NULL, NULL);
6978 SCTP_INP_DECR_REF(inp);
6985 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EALREADY);
6989 vrf_id = inp->def_vrf_id;
6991 stcb = sctp_aloc_assoc(inp, addr, &error, 0, vrf_id,
6992 inp->sctp_ep.pre_open_stream_count,
6993 inp->sctp_ep.port, p);
7007 sctp_initialize_auth_params(inp, stcb);
7009 sctp_send_initiate(inp, stcb, SCTP_SO_LOCKED);
7013 SCTP_ASOC_CREATE_UNLOCK(inp);
7015 SCTP_INP_DECR_REF(inp);
7034 struct sctp_inpcb *inp;
7036 inp = (struct sctp_inpcb *)so->so_pcb;
7037 if (inp == NULL) {
7039 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
7042 if (sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) {
7047 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) == 0) {
7051 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
7056 store.sin.sin_port = inp->sctp_lport;
7061 store.sin6.sin6_port = inp->sctp_lport;
7067 tinp = sctp_pcb_findep(&store.sa, 0, 0, inp->def_vrf_id);
7068 if (tinp && (tinp != inp) &&
7074 * its not this inp.
7086 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) {
7092 if ((inp->sctp_flags & SCTP_PCB_FLAGS_BOUND_V6) == 0) {
7100 store.sin.sin_port = inp->sctp_lport;
7105 store.sin6.sin6_port = inp->sctp_lport;
7111 tinp = sctp_pcb_findep(&store.sa, 0, 0, inp->def_vrf_id);
7112 if (tinp && (tinp != inp) &&
7118 * this inp.
7127 SCTP_INP_RLOCK(inp);
7130 sctp_log_lock(inp, (struct sctp_tcb *)NULL, SCTP_LOG_LOCK_SOCK);
7137 SCTP_INP_RUNLOCK(inp);
7140 if ((sctp_is_feature_on(inp, SCTP_PCB_FLAGS_PORTREUSE)) &&
7141 (inp->sctp_flags & SCTP_PCB_FLAGS_IN_TCPPOOL)) {
7144 * - Someone else is in the main inp slot. - We must move
7148 if (sctp_swap_inpcb_for_listen(inp)) {
7149 SCTP_INP_RUNLOCK(inp);
7150 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EADDRINUSE);
7154 if ((inp->sctp_flags & SCTP_PCB_FLAGS_TCPTYPE) &&
7155 (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED)) {
7157 SCTP_INP_RUNLOCK(inp);
7158 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EADDRINUSE);
7161 SCTP_INP_RUNLOCK(inp);
7162 if (inp->sctp_flags & SCTP_PCB_FLAGS_UNBOUND) {
7172 if (inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) {
7190 struct sctp_inpcb *inp;
7197 inp = (struct sctp_inpcb *)so->so_pcb;
7199 if (inp == NULL) {
7200 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
7203 SCTP_INP_RLOCK(inp);
7204 if (inp->sctp_flags & SCTP_PCB_FLAGS_UDPTYPE) {
7205 SCTP_INP_RUNLOCK(inp);
7206 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EOPNOTSUPP);
7210 SCTP_INP_RUNLOCK(inp);
7211 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ECONNABORTED);
7214 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7216 SCTP_INP_RUNLOCK(inp);
7217 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
7221 SCTP_INP_RUNLOCK(inp);
7267 if (inp->sctp_flags & SCTP_PCB_FLAGS_DONT_WAKE) {
7268 SCTP_INP_WLOCK(inp);
7269 inp->sctp_flags &= ~SCTP_PCB_FLAGS_DONT_WAKE;
7270 if (inp->sctp_flags & SCTP_PCB_FLAGS_WAKEOUTPUT) {
7271 inp->sctp_flags &= ~SCTP_PCB_FLAGS_WAKEOUTPUT;
7272 SCTP_INP_WUNLOCK(inp);
7273 SOCKBUF_LOCK(&inp->sctp_socket->so_snd);
7274 if (sowriteable(inp->sctp_socket)) {
7275 sowwakeup_locked(inp->sctp_socket);
7277 SOCKBUF_UNLOCK(&inp->sctp_socket->so_snd);
7279 SCTP_INP_WLOCK(inp);
7281 if (inp->sctp_flags & SCTP_PCB_FLAGS_WAKEINPUT) {
7282 inp->sctp_flags &= ~SCTP_PCB_FLAGS_WAKEINPUT;
7283 SCTP_INP_WUNLOCK(inp);
7284 SOCKBUF_LOCK(&inp->sctp_socket->so_rcv);
7285 if (soreadable(inp->sctp_socket)) {
7287 sorwakeup_locked(inp->sctp_socket);
7289 SOCKBUF_UNLOCK(&inp->sctp_socket->so_rcv);
7291 SCTP_INP_WLOCK(inp);
7293 SCTP_INP_WUNLOCK(inp);
7297 sctp_free_assoc(inp, stcb, SCTP_NORMAL_PROC,
7309 struct sctp_inpcb *inp;
7320 inp = (struct sctp_inpcb *)so->so_pcb;
7321 if (!inp) {
7323 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
7326 SCTP_INP_RLOCK(inp);
7327 sin->sin_port = inp->sctp_lport;
7328 if (inp->sctp_flags & SCTP_PCB_FLAGS_BOUNDALL) {
7329 if (inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) {
7335 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7358 vrf_id = inp->def_vrf_id;
7359 sctp_ifa = sctp_source_address_selection(inp,
7379 LIST_FOREACH(laddr, &inp->sctp_addr_list, sctp_nxt_addr) {
7391 SCTP_INP_RUNLOCK(inp);
7392 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT);
7396 SCTP_INP_RUNLOCK(inp);
7407 struct sctp_inpcb *inp;
7418 inp = (struct sctp_inpcb *)so->so_pcb;
7419 if ((inp == NULL) ||
7420 ((inp->sctp_flags & SCTP_PCB_FLAGS_CONNECTED) == 0)) {
7423 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOTCONN);
7426 SCTP_INP_RLOCK(inp);
7427 stcb = LIST_FIRST(&inp->sctp_asoc_list);
7431 SCTP_INP_RUNLOCK(inp);
7434 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, EINVAL);
7451 SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP_USRREQ, ENOENT);