-#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 */
-#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 */
-
-#ifndef _POSIX_C_SOURCE
-#define IPV6_PORTRANGE 14 /* int; range to choose for unspec port */
-#define ICMP6_FILTER 18 /* icmp6_filter; icmp6 filter */
-/* RFC2292 options */
-#define IPV6_PKTINFO 19 /* bool; send/recv if, src/dst addr */
-#define IPV6_HOPLIMIT 20 /* bool; hop limit */
-#define IPV6_NEXTHOP 21 /* bool; next hop addr */
-#define IPV6_HOPOPTS 22 /* bool; hop-by-hop option */
-#define IPV6_DSTOPTS 23 /* bool; destination option */
-#define IPV6_RTHDR 24 /* bool; routing header */
-#define IPV6_PKTOPTIONS 25 /* buf/cmsghdr; set/get IPv6 options */
-
-#define IPV6_CHECKSUM 26 /* int; checksum offset for raw socket */
-#endif /* _POSIX_C_SOURCE */
-#define IPV6_V6ONLY 27 /* bool; only bind INET6 at wildcard bind */
-#ifndef _POSIX_C_SOURCE
+#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)