aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Karels <karels@FreeBSD.org>2024-05-02 15:24:37 +0000
committerMike Karels <karels@FreeBSD.org>2024-05-02 15:24:37 +0000
commiteb3dbf2dbe22ed6d4df54aebbf23f5b555a21cf1 (patch)
tree2d00ffc7fd97feacae03b56cdc36a292bfde571c
parenteee88ef45f78d7f9996a740c2a554bc6e8496114 (diff)
downloadsrc-eb3dbf2dbe22ed6d4df54aebbf23f5b555a21cf1.tar.gz
src-eb3dbf2dbe22ed6d4df54aebbf23f5b555a21cf1.zip
in6.h: expose s6_addr* definitions to user level
The only element of of in6_addr that is specified in RFC 3493 or in POSIX.1-2017 is s6_addr, implemented via a #define to a union member. However, FreeBSD and other BSD systems have additional definitions for the other union members, s6_addr{8,16,32} which are defined for the kernel and loader. Some Linux applications also use them, and they seem to be allowed by the RFC and POSIX. Remove the current ifdefs, exposing the additional fields to user level, and replace with #if __BSD_VISIBLE. Add an explanatory comment expanding on the previous "nonstandard" comment. MFC after: 1 week Reviewed by: bz Differential Revision: https://reviews.freebsd.org/D44979
-rw-r--r--sys/netinet6/in6.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/sys/netinet6/in6.h b/sys/netinet6/in6.h
index 53a8fad106df..082e5f8990c9 100644
--- a/sys/netinet6/in6.h
+++ b/sys/netinet6/in6.h
@@ -100,7 +100,13 @@ struct in6_addr {
};
#define s6_addr __u6_addr.__u6_addr8
-#if defined(_KERNEL) || defined(_STANDALONE) /* XXX nonstandard */
+#if __BSD_VISIBLE
+/*
+ * s6_addr is the only in6_addr element specified in RFCs 2553 and 3493,
+ * also in POSIX 1003.1-2017. The following three definitions were not
+ * exposed to user programs in FreeBSD before 14.1, or in other BSDs,
+ * and are thus less portable than s6_addr.
+ */
#define s6_addr8 __u6_addr.__u6_addr8
#define s6_addr16 __u6_addr.__u6_addr16
#define s6_addr32 __u6_addr.__u6_addr32