git: eb3dbf2dbe22 - main - in6.h: expose s6_addr* definitions to user level
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 02 May 2024 15:25:33 UTC
The branch main has been updated by karels: URL: https://cgit.FreeBSD.org/src/commit/?id=eb3dbf2dbe22ed6d4df54aebbf23f5b555a21cf1 commit eb3dbf2dbe22ed6d4df54aebbf23f5b555a21cf1 Author: Mike Karels <karels@FreeBSD.org> AuthorDate: 2024-05-02 15:24:37 +0000 Commit: Mike Karels <karels@FreeBSD.org> CommitDate: 2024-05-02 15:24:37 +0000 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 --- sys/netinet6/in6.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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