diff --git a/CHANGELOG b/CHANGELOG index 73f38413..34fb7ac8 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -41,6 +41,9 @@ HISTORY ++ Bugfixes: + 2011-08-24: Simon Goldschmidt + * inet6.h: fixed bug #34124 struct in6_addr does not conform to the standard + 2011-08-24: Simon Goldschmidt * api_msg.c, sockets.c: fixed bug #33956 Wrong error returned when calling accept() on UDP connections diff --git a/src/include/ipv6/lwip/inet6.h b/src/include/ipv6/lwip/inet6.h index fbbdcf19..d9800060 100644 --- a/src/include/ipv6/lwip/inet6.h +++ b/src/include/ipv6/lwip/inet6.h @@ -54,22 +54,25 @@ extern "C" { /** For compatibility with BSD code */ struct in6_addr { - u32_t s_addr[4]; + union { + u8_t u8_addr[16]; + u32_t u32_addr[4]; + } un; +#define s6_addr un.u32_addr }; #define IN6ADDR_ANY_INIT {0,0,0,0} #define IN6ADDR_LOOPBACK_INIT {0,0,0,PP_HTONL(1)} - -#define inet6_addr_from_ip6addr(target_in6addr, source_ip6addr) {(target_in6addr)->s_addr[0] = (source_ip6addr)->addr[0]; \ - (target_in6addr)->s_addr[1] = (source_ip6addr)->addr[1]; \ - (target_in6addr)->s_addr[2] = (source_ip6addr)->addr[2]; \ - (target_in6addr)->s_addr[3] = (source_ip6addr)->addr[3];} -#define inet6_addr_to_ip6addr(target_ip6addr, source_in6addr) {(target_ip6addr)->addr[0] = (source_in6addr)->s_addr[0]; \ - (target_ip6addr)->addr[0] = (source_in6addr)->s_addr[0]; \ - (target_ip6addr)->addr[0] = (source_in6addr)->s_addr[0]; \ - (target_ip6addr)->addr[0] = (source_in6addr)->s_addr[0];} +#define inet6_addr_from_ip6addr(target_in6addr, source_ip6addr) {(target_in6addr)->un.u32_addr[0] = (source_ip6addr)->addr[0]; \ + (target_in6addr)->un.u32_addr[1] = (source_ip6addr)->addr[1]; \ + (target_in6addr)->un.u32_addr[2] = (source_ip6addr)->addr[2]; \ + (target_in6addr)->un.u32_addr[3] = (source_ip6addr)->addr[3];} +#define inet6_addr_to_ip6addr(target_ip6addr, source_in6addr) {(target_ip6addr)->addr[0] = (source_in6addr)->un.u32_addr[0]; \ + (target_ip6addr)->addr[0] = (source_in6addr)->un.u32_addr[0]; \ + (target_ip6addr)->addr[0] = (source_in6addr)->un.u32_addr[0]; \ + (target_ip6addr)->addr[0] = (source_in6addr)->un.u32_addr[0];} /* ATTENTION: the next define only works because both in6_addr and ip6_addr_t are an u32_t[4] effectively! */ #define inet6_addr_to_ip6addr_p(target_ip6addr_p, source_in6addr) ((target_ip6addr_p) = (ip6_addr_t*)(source_in6addr))