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;