hrev54678 adds 1 changeset to branch 'master'
old head: fb4fd84f4dcd4ee910143eb46c600fe2b842d142
new head: 7335fb0d5c8025c9f46f978085cfdabc7da0da99
overview:
https://git.haiku-os.org/haiku/log/?qt=range&q=7335fb0d5c80+%5Efb4fd84f4dcd
----------------------------------------------------------------------------
7335fb0d5c80: in6.h: declare in6_addr with a union and extra fields
According to https://tools.ietf.org/html/rfc3493:
3.2 IPv6 Address Structure
"The structure in6_addr above is usually implemented with an embedded
union with extra fields that force the desired alignment level in a
manner similar to BSD implementations of "struct in_addr"."
Change-Id: Ibe0ee685366398c143cdf9573dcb77566a12888b
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3348
Reviewed-by: Rene Gollent <rene@xxxxxxxxxxx>
[ Jérôme Duval <jerome.duval@xxxxxxxxx> ]
----------------------------------------------------------------------------
Revision: hrev54678
Commit: 7335fb0d5c8025c9f46f978085cfdabc7da0da99
URL: https://git.haiku-os.org/haiku/commit/?id=7335fb0d5c80
Author: Jérôme Duval <jerome.duval@xxxxxxxxx>
Date: Thu Oct 22 14:48:05 2020 UTC
----------------------------------------------------------------------------
1 file changed, 21 insertions(+), 12 deletions(-)
headers/posix/netinet6/in6.h | 33 +++++++++++++++++++++------------
----------------------------------------------------------------------------
diff --git a/headers/posix/netinet6/in6.h b/headers/posix/netinet6/in6.h
index 8f897c8373..e3af7fa3a3 100644
--- a/headers/posix/netinet6/in6.h
+++ b/headers/posix/netinet6/in6.h
@@ -11,8 +11,17 @@
struct in6_addr {
- uint8_t s6_addr[16];
-};
+ union {
+ uint8_t u6_addr8[16];
+ uint16_t u6_addr16[8];
+ uint32_t u6_addr32[4];
+ } in6_u;
+ #define s6_addr in6_u.u6_addr8
+ #define s6_addr16 in6_u.u6_addr16
+ #define s6_addr32 in6_u.u6_addr32
+} _PACKED;
+
+
/* IP Version 6 socket address. */
struct sockaddr_in6 {
@@ -25,21 +34,21 @@ struct sockaddr_in6 {
};
-#define IN6ADDR_ANY_INIT {{ \
+#define IN6ADDR_ANY_INIT {{{ \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}
-#define IN6ADDR_LOOPBACK_INIT {{ \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }}}
+#define IN6ADDR_LOOPBACK_INIT {{{ \
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}
-#define IN6ADDR_NODELOCAL_ALLNODES_INIT {{ \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
+#define IN6ADDR_NODELOCAL_ALLNODES_INIT {{{ \
0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}
-#define IN6ADDR_LINKLOCAL_ALLNODES_INIT {{ \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
+#define IN6ADDR_LINKLOCAL_ALLNODES_INIT {{{ \
0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}
-#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT {{ \
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01 }}}
+#define IN6ADDR_LINKLOCAL_ALLROUTERS_INIT {{{ \
0xff, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, \
- 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02 }}}
extern const struct in6_addr in6addr_any;
extern const struct in6_addr in6addr_loopback;