+#if 0 /* the followings are relic in IPv4 and hence are disabled */
+#define IPV6_OPTIONS 1 /* buf/ip6_opts; set/get IP6 options */
+#define IPV6_RECVOPTS 5 /* bool; receive all IP6 opts w/dgram */
+#define IPV6_RECVRETOPTS 6 /* bool; receive IP6 opts for response */
+#define IPV6_RECVDSTADDR 7 /* bool; receive IP6 dst addr w/dgram */
+#define IPV6_RETOPTS 8 /* ip6_opts; set/get IP6 options */
+#endif /* 0 */
+#define IPV6_SOCKOPT_RESERVED1 3 /* reserved for future use */
+#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
+#define IPV6_UNICAST_HOPS 4 /* int; IP6 hops */
+#define IPV6_MULTICAST_IF 9 /* __uint8_t; set/get IP6 multicast i/f */
+#define IPV6_MULTICAST_HOPS 10 /* __uint8_t; set/get IP6 multicast hops */
+#define IPV6_MULTICAST_LOOP 11 /* __uint8_t; set/get IP6 mcast loopback */
+#define IPV6_JOIN_GROUP 12 /* ip6_mreq; join a group membership */
+#define IPV6_LEAVE_GROUP 13 /* ip6_mreq; leave a group membership */
+
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */
+#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */
+#define IPV6_2292PKTINFO 19 /* bool; send/recv if, src/dst addr */
+#define IPV6_2292HOPLIMIT 20 /* bool; hop limit */
+#define IPV6_2292NEXTHOP 21 /* bool; next hop addr */
+#define IPV6_2292HOPOPTS 22 /* bool; hop-by-hop option */
+#define IPV6_2292DSTOPTS 23 /* bool; destinaion option */
+#define IPV6_2292RTHDR 24 /* ip6_rthdr: routing header */
+
+/* buf/cmsghdr; set/get IPv6 options [obsoleted by RFC3542] */
+#define IPV6_2292PKTOPTIONS 25
+
+#ifdef __APPLE_USE_RFC_2292
+#define IPV6_PKTINFO IPV6_2292PKTINFO
+#define IPV6_HOPLIMIT IPV6_2292HOPLIMIT
+#define IPV6_NEXTHOP IPV6_2292NEXTHOP
+#define IPV6_HOPOPTS IPV6_2292HOPOPTS
+#define IPV6_DSTOPTS IPV6_2292DSTOPTS
+#define IPV6_RTHDR IPV6_2292RTHDR
+#define IPV6_PKTOPTIONS IPV6_2292PKTOPTIONS
+#endif /* __APPLE_USE_RFC_2292 */
+
+#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */
+#endif /* (_POSIX_C_SOURCE && !_DARWIN_C_SOURCE) */
+#define IPV6_V6ONLY 27 /* bool; only bind INET6 at wildcard bind */
+#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
+#ifndef KERNEL
+#define IPV6_BINDV6ONLY IPV6_V6ONLY
+#endif /* KERNEL */
+
+
+#if 1 /* IPSEC */
+#define IPV6_IPSEC_POLICY 28 /* struct; get/set security policy */
+#endif /* 1 */
+#define IPV6_FAITH 29 /* deprecated */
+
+#if 1 /* IPV6FIREWALL */
+#define IPV6_FW_ADD 30 /* add a firewall rule to chain */
+#define IPV6_FW_DEL 31 /* delete a firewall rule from chain */
+#define IPV6_FW_FLUSH 32 /* flush firewall rule chain */
+#define IPV6_FW_ZERO 33 /* clear single/all firewall counter(s) */
+#define IPV6_FW_GET 34 /* get entire firewall rule chain */
+#endif /* 1 */
+
+/*
+ * APPLE: NOTE the value of those 2 options is kept unchanged from
+ * previous version of darwin/OS X for binary compatibility reasons
+ * and differ from FreeBSD (values 57 and 61). See below.
+ */
+#define IPV6_RECVTCLASS 35 /* bool; recv traffic class values */
+#define IPV6_TCLASS 36 /* int; send traffic class value */
+
+#ifdef __APPLE_USE_RFC_3542
+/* new socket options introduced in RFC3542 */
+/*
+ * ip6_dest; send dst option before rthdr
+ * APPLE: Value purposely different than FreeBSD (35) to avoid
+ * collision with definition of IPV6_RECVTCLASS in previous
+ * darwin implementations
+ */
+#define IPV6_RTHDRDSTOPTS 57
+
+/*
+ * bool; recv if, dst addr
+ * APPLE: Value purposely different than FreeBSD(36) to avoid
+ * collision with definition of IPV6_TCLASS in previous
+ * darwin implementations
+ */
+#define IPV6_RECVPKTINFO 61
+
+#define IPV6_RECVHOPLIMIT 37 /* bool; recv hop limit */
+#define IPV6_RECVRTHDR 38 /* bool; recv routing header */
+#define IPV6_RECVHOPOPTS 39 /* bool; recv hop-by-hop option */
+#define IPV6_RECVDSTOPTS 40 /* bool; recv dst option after rthdr */
+#ifdef KERNEL
+#define IPV6_RECVRTHDRDSTOPTS 41 /* bool; recv dst option before rthdr */