595
596 /* Only switch current if fp is alive */
597 if (fp->sf_state != SCTP_FADDRS_ALIVE || fp == sctp->sctp_current) {
598 return (0);
599 }
600 sctp_set_faddr_current(sctp, fp);
601
602 return (0);
603 }
604
605 /*
606 * Table of all known options handled on a SCTP protocol stack.
607 *
608 * Note: This table contains options processed by both SCTP and IP levels
609 * and is the superset of options that can be performed on a SCTP and IP
610 * stack.
611 */
612 opdes_t sctp_opt_arr[] = {
613
614 { SO_LINGER, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0,
615 sizeof (struct linger), 0 },
616
617 { SO_DEBUG, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
618 { SO_KEEPALIVE, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
619 { SO_DONTROUTE, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
620 { SO_USELOOPBACK, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0
621 },
622 { SO_BROADCAST, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
623 { SO_REUSEADDR, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
624 { SO_OOBINLINE, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
625 { SO_TYPE, SOL_SOCKET, OA_R, OA_R, OP_NP, 0, sizeof (int), 0 },
626 { SO_SNDBUF, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
627 { SO_RCVBUF, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
628 { SO_DGRAM_ERRIND, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0
629 },
630 { SO_SND_COPYAVOID, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
631 { SO_ANON_MLP, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int),
632 0 },
633 { SO_MAC_EXEMPT, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int),
634 0 },
635 { SO_ALLZONES, SOL_SOCKET, OA_R, OA_RW, OP_CONFIG, 0, sizeof (int),
636 0 },
637 { SO_EXCLBIND, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
638
639 { SO_DOMAIN, SOL_SOCKET, OA_R, OA_R, OP_NP, 0, sizeof (int), 0 },
640
641 { SO_PROTOTYPE, SOL_SOCKET, OA_R, OA_R, OP_NP, 0, sizeof (int), 0 },
642
643 { SCTP_ADAPTATION_LAYER, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
644 sizeof (struct sctp_setadaptation), 0 },
645 { SCTP_ADD_ADDR, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, OP_VARLEN,
646 sizeof (int), 0 },
647 { SCTP_ASSOCINFO, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
648 sizeof (struct sctp_assocparams), 0 },
649 { SCTP_AUTOCLOSE, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
650 { SCTP_DEFAULT_SEND_PARAM, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
651 sizeof (struct sctp_sndrcvinfo), 0 },
652 { SCTP_DISABLE_FRAGMENTS, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
653 sizeof (int), 0 },
654 { SCTP_EVENTS, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
655 sizeof (struct sctp_event_subscribe), 0 },
656 { SCTP_GET_LADDRS, IPPROTO_SCTP, OA_R, OA_R, OP_NP, OP_VARLEN,
657 sizeof (int), 0 },
658 { SCTP_GET_NLADDRS, IPPROTO_SCTP, OA_R, OA_R, OP_NP, 0, sizeof (int), 0 },
659 { SCTP_GET_NPADDRS, IPPROTO_SCTP, OA_R, OA_R, OP_NP, 0, sizeof (int), 0 },
660 { SCTP_GET_PADDRS, IPPROTO_SCTP, OA_R, OA_R, OP_NP, OP_VARLEN,
661 sizeof (int), 0 },
662 { SCTP_GET_PEER_ADDR_INFO, IPPROTO_SCTP, OA_R, OA_R, OP_NP, 0,
663 sizeof (struct sctp_paddrinfo), 0 },
664 { SCTP_INITMSG, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
665 sizeof (struct sctp_initmsg), 0 },
666 { SCTP_I_WANT_MAPPED_V4_ADDR, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
667 sizeof (int), 0 },
668 { SCTP_MAXSEG, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
669 { SCTP_NODELAY, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
670 { SCTP_PEER_ADDR_PARAMS, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
671 sizeof (struct sctp_paddrparams), 0 },
672 { SCTP_PRIMARY_ADDR, IPPROTO_SCTP, OA_W, OA_W, OP_NP, 0,
673 sizeof (struct sctp_setpeerprim), 0 },
674 { SCTP_PRSCTP, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
675 { SCTP_GET_ASSOC_STATS, IPPROTO_SCTP, OA_R, OA_R, OP_NP, 0,
676 sizeof (sctp_assoc_stats_t), 0 },
677 { SCTP_REM_ADDR, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, OP_VARLEN,
678 sizeof (int), 0 },
679 { SCTP_RTOINFO, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
680 sizeof (struct sctp_rtoinfo), 0 },
681 { SCTP_SET_PEER_PRIMARY_ADDR, IPPROTO_SCTP, OA_W, OA_W, OP_NP, 0,
682 sizeof (struct sctp_setprim), 0 },
683 { SCTP_STATUS, IPPROTO_SCTP, OA_R, OA_R, OP_NP, 0,
684 sizeof (struct sctp_status), 0 },
685 { SCTP_UC_SWAP, IPPROTO_SCTP, OA_W, OA_W, OP_NP, 0,
686 sizeof (struct sctp_uc_swap), 0 },
687
688 { IP_OPTIONS, IPPROTO_IP, OA_RW, OA_RW, OP_NP,
689 (OP_VARLEN|OP_NODEFAULT),
690 40, -1 /* not initialized */ },
691 { T_IP_OPTIONS, IPPROTO_IP, OA_RW, OA_RW, OP_NP,
692 (OP_VARLEN|OP_NODEFAULT),
693 40, -1 /* not initialized */ },
694
695 { IP_TOS, IPPROTO_IP, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
696 { T_IP_TOS, IPPROTO_IP, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
697 { IP_TTL, IPPROTO_IP, OA_RW, OA_RW, OP_NP, OP_DEF_FN,
698 sizeof (int), -1 /* not initialized */ },
699
700 { IP_SEC_OPT, IPPROTO_IP, OA_RW, OA_RW, OP_NP, OP_NODEFAULT,
701 sizeof (ipsec_req_t), -1 /* not initialized */ },
702
703 { IP_BOUND_IF, IPPROTO_IP, OA_RW, OA_RW, OP_NP, 0,
704 sizeof (int), 0 /* no ifindex */ },
705
706 { IP_UNSPEC_SRC, IPPROTO_IP, OA_R, OA_RW, OP_RAW, 0,
707 sizeof (int), 0 },
708
709 { IPV6_UNICAST_HOPS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, OP_DEF_FN,
710 sizeof (int), -1 /* not initialized */ },
711
712 { IPV6_BOUND_IF, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
713 sizeof (int), 0 /* no ifindex */ },
714
715 { IP_DONTFRAG, IPPROTO_IP, OA_RW, OA_RW, OP_NP, 0, sizeof (int), 0 },
716
717 { IP_NEXTHOP, IPPROTO_IP, OA_R, OA_RW, OP_CONFIG, 0,
718 sizeof (in_addr_t), -1 /* not initialized */ },
719
720 { IPV6_UNSPEC_SRC, IPPROTO_IPV6, OA_R, OA_RW, OP_RAW, 0,
721 sizeof (int), 0 },
722
723 { IPV6_PKTINFO, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP,
724 (OP_NODEFAULT|OP_VARLEN),
725 sizeof (struct in6_pktinfo), -1 /* not initialized */ },
726 { IPV6_NEXTHOP, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP,
727 OP_NODEFAULT,
728 sizeof (sin6_t), -1 /* not initialized */ },
729 { IPV6_HOPOPTS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP,
730 (OP_VARLEN|OP_NODEFAULT), 255*8,
731 -1 /* not initialized */ },
732 { IPV6_DSTOPTS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP,
733 (OP_VARLEN|OP_NODEFAULT), 255*8,
734 -1 /* not initialized */ },
735 { IPV6_RTHDRDSTOPTS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP,
736 (OP_VARLEN|OP_NODEFAULT), 255*8,
737 -1 /* not initialized */ },
738 { IPV6_RTHDR, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP,
739 (OP_VARLEN|OP_NODEFAULT), 255*8,
740 -1 /* not initialized */ },
741 { IPV6_TCLASS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP,
742 OP_NODEFAULT,
743 sizeof (int), -1 /* not initialized */ },
744 { IPV6_PATHMTU, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP,
745 OP_NODEFAULT,
746 sizeof (struct ip6_mtuinfo), -1 /* not initialized */ },
747 { IPV6_DONTFRAG, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
748 sizeof (int), 0 },
749 { IPV6_USE_MIN_MTU, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
750 sizeof (int), 0 },
751 { IPV6_V6ONLY, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
752 sizeof (int), 0 },
753
754 /* Enable receipt of ancillary data */
755 { IPV6_RECVPKTINFO, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
756 sizeof (int), 0 },
757 { IPV6_RECVHOPLIMIT, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
758 sizeof (int), 0 },
759 { IPV6_RECVTCLASS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
760 sizeof (int), 0 },
761 { IPV6_RECVHOPOPTS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
762 sizeof (int), 0 },
763 { _OLD_IPV6_RECVDSTOPTS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
764 sizeof (int), 0 },
765 { IPV6_RECVDSTOPTS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
766 sizeof (int), 0 },
767 { IPV6_RECVRTHDR, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
768 sizeof (int), 0 },
769 { IPV6_RECVRTHDRDSTOPTS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
770 sizeof (int), 0 },
771 { IPV6_RECVTCLASS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
772 sizeof (int), 0 },
773
774 { IPV6_SEC_OPT, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, OP_NODEFAULT,
775 sizeof (ipsec_req_t), -1 /* not initialized */ },
776 { IPV6_SRC_PREFERENCES, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
777 sizeof (uint32_t), IPV6_PREFER_SRC_DEFAULT },
778 };
779
780 uint_t sctp_opt_arr_size = A_CNT(sctp_opt_arr);
781
782 /* Handy on off switch for socket option processing. */
783 #define ONOFF(x) ((x) == 0 ? 0 : 1)
784
785 /*
786 * SCTP routine to get the values of options.
787 */
788 int
789 sctp_get_opt(sctp_t *sctp, int level, int name, void *ptr, socklen_t *optlen)
790 {
791 int *i1 = (int *)ptr;
792 int retval = 0;
793 int buflen = *optlen;
794 conn_t *connp = sctp->sctp_connp;
795 conn_opt_arg_t coas;
796
797 coas.coa_connp = connp;
|
595
596 /* Only switch current if fp is alive */
597 if (fp->sf_state != SCTP_FADDRS_ALIVE || fp == sctp->sctp_current) {
598 return (0);
599 }
600 sctp_set_faddr_current(sctp, fp);
601
602 return (0);
603 }
604
605 /*
606 * Table of all known options handled on a SCTP protocol stack.
607 *
608 * Note: This table contains options processed by both SCTP and IP levels
609 * and is the superset of options that can be performed on a SCTP and IP
610 * stack.
611 */
612 opdes_t sctp_opt_arr[] = {
613
614 { SO_LINGER, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0,
615 sizeof (struct linger), {0}},
616
617 { SO_DEBUG, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
618 { SO_KEEPALIVE, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
619 { SO_DONTROUTE, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
620 { SO_USELOOPBACK, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}
621 },
622 { SO_BROADCAST, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
623 { SO_REUSEADDR, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
624 { SO_OOBINLINE, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
625 { SO_TYPE, SOL_SOCKET, OA_R, OA_R, OP_NP, 0, sizeof (int), {0}},
626 { SO_SNDBUF, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
627 { SO_RCVBUF, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
628 { SO_DGRAM_ERRIND, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}
629 },
630 { SO_SND_COPYAVOID, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
631 { SO_ANON_MLP, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int),
632 {0}},
633 { SO_MAC_EXEMPT, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int),
634 {0}},
635 { SO_ALLZONES, SOL_SOCKET, OA_R, OA_RW, OP_CONFIG, 0, sizeof (int),
636 {0}},
637 { SO_EXCLBIND, SOL_SOCKET, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
638
639 { SO_DOMAIN, SOL_SOCKET, OA_R, OA_R, OP_NP, 0, sizeof (int), {0}},
640
641 { SO_PROTOTYPE, SOL_SOCKET, OA_R, OA_R, OP_NP, 0, sizeof (int), {0}},
642
643 { SCTP_ADAPTATION_LAYER, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
644 sizeof (struct sctp_setadaptation), {0}},
645 { SCTP_ADD_ADDR, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, OP_VARLEN,
646 sizeof (int), {0}},
647 { SCTP_ASSOCINFO, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
648 sizeof (struct sctp_assocparams), {0}},
649 { SCTP_AUTOCLOSE, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
650 { SCTP_DEFAULT_SEND_PARAM, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
651 sizeof (struct sctp_sndrcvinfo), {0}},
652 { SCTP_DISABLE_FRAGMENTS, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
653 sizeof (int), {0}},
654 { SCTP_EVENTS, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
655 sizeof (struct sctp_event_subscribe), {0}},
656 { SCTP_GET_LADDRS, IPPROTO_SCTP, OA_R, OA_R, OP_NP, OP_VARLEN,
657 sizeof (int), {0}},
658 { SCTP_GET_NLADDRS, IPPROTO_SCTP, OA_R, OA_R, OP_NP, 0, sizeof (int), {0}},
659 { SCTP_GET_NPADDRS, IPPROTO_SCTP, OA_R, OA_R, OP_NP, 0, sizeof (int), {0}},
660 { SCTP_GET_PADDRS, IPPROTO_SCTP, OA_R, OA_R, OP_NP, OP_VARLEN,
661 sizeof (int), {0}},
662 { SCTP_GET_PEER_ADDR_INFO, IPPROTO_SCTP, OA_R, OA_R, OP_NP, 0,
663 sizeof (struct sctp_paddrinfo), {0}},
664 { SCTP_INITMSG, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
665 sizeof (struct sctp_initmsg), {0}},
666 { SCTP_I_WANT_MAPPED_V4_ADDR, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
667 sizeof (int), {0}},
668 { SCTP_MAXSEG, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
669 { SCTP_NODELAY, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
670 { SCTP_PEER_ADDR_PARAMS, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
671 sizeof (struct sctp_paddrparams), {0}},
672 { SCTP_PRIMARY_ADDR, IPPROTO_SCTP, OA_W, OA_W, OP_NP, 0,
673 sizeof (struct sctp_setpeerprim), {0}},
674 { SCTP_PRSCTP, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
675 { SCTP_GET_ASSOC_STATS, IPPROTO_SCTP, OA_R, OA_R, OP_NP, 0,
676 sizeof (sctp_assoc_stats_t), {0}},
677 { SCTP_REM_ADDR, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, OP_VARLEN,
678 sizeof (int), {0}},
679 { SCTP_RTOINFO, IPPROTO_SCTP, OA_RW, OA_RW, OP_NP, 0,
680 sizeof (struct sctp_rtoinfo), {0}},
681 { SCTP_SET_PEER_PRIMARY_ADDR, IPPROTO_SCTP, OA_W, OA_W, OP_NP, 0,
682 sizeof (struct sctp_setprim), {0}},
683 { SCTP_STATUS, IPPROTO_SCTP, OA_R, OA_R, OP_NP, 0,
684 sizeof (struct sctp_status), {0}},
685 { SCTP_UC_SWAP, IPPROTO_SCTP, OA_W, OA_W, OP_NP, 0,
686 sizeof (struct sctp_uc_swap), {0}},
687
688 { IP_OPTIONS, IPPROTO_IP, OA_RW, OA_RW, OP_NP,
689 (OP_VARLEN|OP_NODEFAULT),
690 40, {-1} /* not initialized */ },
691 { T_IP_OPTIONS, IPPROTO_IP, OA_RW, OA_RW, OP_NP,
692 (OP_VARLEN|OP_NODEFAULT),
693 40, {-1} /* not initialized */ },
694
695 { IP_TOS, IPPROTO_IP, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
696 { T_IP_TOS, IPPROTO_IP, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
697 { IP_TTL, IPPROTO_IP, OA_RW, OA_RW, OP_NP, OP_DEF_FN,
698 sizeof (int), {-1}/* not initialized */ },
699
700 { IP_SEC_OPT, IPPROTO_IP, OA_RW, OA_RW, OP_NP, OP_NODEFAULT,
701 sizeof (ipsec_req_t), {-1}/* not initialized */ },
702
703 { IP_BOUND_IF, IPPROTO_IP, OA_RW, OA_RW, OP_NP, 0,
704 sizeof (int), {0}/* no ifindex */ },
705
706 { IP_UNSPEC_SRC, IPPROTO_IP, OA_R, OA_RW, OP_RAW, 0,
707 sizeof (int), {0}},
708
709 { IPV6_UNICAST_HOPS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, OP_DEF_FN,
710 sizeof (int), {-1}/* not initialized */ },
711
712 { IPV6_BOUND_IF, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
713 sizeof (int), {0}/* no ifindex */ },
714
715 { IP_DONTFRAG, IPPROTO_IP, OA_RW, OA_RW, OP_NP, 0, sizeof (int), {0}},
716
717 { IP_NEXTHOP, IPPROTO_IP, OA_R, OA_RW, OP_CONFIG, 0,
718 sizeof (in_addr_t), {-1}/* not initialized */ },
719
720 { IPV6_UNSPEC_SRC, IPPROTO_IPV6, OA_R, OA_RW, OP_RAW, 0,
721 sizeof (int), {0}},
722
723 { IPV6_PKTINFO, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP,
724 (OP_NODEFAULT|OP_VARLEN),
725 sizeof (struct in6_pktinfo), {-1}/* not initialized */ },
726 { IPV6_NEXTHOP, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP,
727 OP_NODEFAULT,
728 sizeof (sin6_t), {-1}/* not initialized */ },
729 { IPV6_HOPOPTS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP,
730 (OP_VARLEN|OP_NODEFAULT), 255*8,
731 {-1}/* not initialized */ },
732 { IPV6_DSTOPTS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP,
733 (OP_VARLEN|OP_NODEFAULT), 255*8,
734 {-1}/* not initialized */ },
735 { IPV6_RTHDRDSTOPTS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP,
736 (OP_VARLEN|OP_NODEFAULT), 255*8,
737 {-1}/* not initialized */ },
738 { IPV6_RTHDR, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP,
739 (OP_VARLEN|OP_NODEFAULT), 255*8,
740 {-1}/* not initialized */ },
741 { IPV6_TCLASS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP,
742 OP_NODEFAULT,
743 sizeof (int), {-1}/* not initialized */ },
744 { IPV6_PATHMTU, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP,
745 OP_NODEFAULT,
746 sizeof (struct ip6_mtuinfo), {-1}/* not initialized */ },
747 { IPV6_DONTFRAG, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
748 sizeof (int), {0}},
749 { IPV6_USE_MIN_MTU, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
750 sizeof (int), {0}},
751 { IPV6_V6ONLY, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
752 sizeof (int), {0}},
753
754 /* Enable receipt of ancillary data */
755 { IPV6_RECVPKTINFO, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
756 sizeof (int), {0}},
757 { IPV6_RECVHOPLIMIT, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
758 sizeof (int), {0}},
759 { IPV6_RECVTCLASS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
760 sizeof (int), {0}},
761 { IPV6_RECVHOPOPTS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
762 sizeof (int), {0}},
763 { _OLD_IPV6_RECVDSTOPTS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
764 sizeof (int), {0}},
765 { IPV6_RECVDSTOPTS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
766 sizeof (int), {0}},
767 { IPV6_RECVRTHDR, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
768 sizeof (int), {0}},
769 { IPV6_RECVRTHDRDSTOPTS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
770 sizeof (int), {0}},
771 { IPV6_RECVTCLASS, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
772 sizeof (int), {0}},
773
774 { IPV6_SEC_OPT, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, OP_NODEFAULT,
775 sizeof (ipsec_req_t), {-1}/* not initialized */ },
776 { IPV6_SRC_PREFERENCES, IPPROTO_IPV6, OA_RW, OA_RW, OP_NP, 0,
777 sizeof (uint32_t), {IPV6_PREFER_SRC_DEFAULT} },
778 };
779
780 uint_t sctp_opt_arr_size = A_CNT(sctp_opt_arr);
781
782 /* Handy on off switch for socket option processing. */
783 #define ONOFF(x) ((x) == 0 ? 0 : 1)
784
785 /*
786 * SCTP routine to get the values of options.
787 */
788 int
789 sctp_get_opt(sctp_t *sctp, int level, int name, void *ptr, socklen_t *optlen)
790 {
791 int *i1 = (int *)ptr;
792 int retval = 0;
793 int buflen = *optlen;
794 conn_t *connp = sctp->sctp_connp;
795 conn_opt_arg_t coas;
796
797 coas.coa_connp = connp;
|