summaryrefslogtreecommitdiff
path: root/inet/netinet
diff options
context:
space:
mode:
authorFlorian Weimer <fweimer@redhat.com>2016-12-09 11:27:44 +0100
committerFlorian Weimer <fweimer@redhat.com>2016-12-09 11:27:44 +0100
commit0abbe7cd700951082b314182a0958d65238297ef (patch)
treeadcd0df49e7cb1024fbe39034a54798c36f116d7 /inet/netinet
parentc23de0aacbeaa7a091609b35764bed931475a16d (diff)
downloadglibc-0abbe7cd700951082b314182a0958d65238297ef.tar.gz
inet: Make IN6_IS_ADDR_UNSPECIFIED etc. usable with POSIX [BZ #16421]
Previously, under some feature test macros and compilers, the macros were defined, but references undefined struct members in their implementation.
Diffstat (limited to 'inet/netinet')
-rw-r--r--inet/netinet/in.h44
1 files changed, 21 insertions, 23 deletions
diff --git a/inet/netinet/in.h b/inet/netinet/in.h
index c801593b32..01594c6aec 100644
--- a/inet/netinet/in.h
+++ b/inet/netinet/in.h
@@ -213,10 +213,8 @@ struct in6_addr
union
{
uint8_t __u6_addr8[16];
-#ifdef __USE_MISC
uint16_t __u6_addr16[8];
uint32_t __u6_addr32[4];
-#endif
} __in6_u;
#define s6_addr __in6_u.__u6_addr8
#ifdef __USE_MISC
@@ -411,52 +409,52 @@ extern uint16_t htons (uint16_t __hostshort)
# define IN6_IS_ADDR_UNSPECIFIED(a) \
(__extension__ \
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
- __a->s6_addr32[0] == 0 \
- && __a->s6_addr32[1] == 0 \
- && __a->s6_addr32[2] == 0 \
- && __a->s6_addr32[3] == 0; }))
+ __a->__in6_u.__u6_addr32[0] == 0 \
+ && __a->__in6_u.__u6_addr32[1] == 0 \
+ && __a->__in6_u.__u6_addr32[2] == 0 \
+ && __a->__in6_u.__u6_addr32[3] == 0; }))
# define IN6_IS_ADDR_LOOPBACK(a) \
(__extension__ \
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
- __a->s6_addr32[0] == 0 \
- && __a->s6_addr32[1] == 0 \
- && __a->s6_addr32[2] == 0 \
- && __a->s6_addr32[3] == htonl (1); }))
+ __a->__in6_u.__u6_addr32[0] == 0 \
+ && __a->__in6_u.__u6_addr32[1] == 0 \
+ && __a->__in6_u.__u6_addr32[2] == 0 \
+ && __a->__in6_u.__u6_addr32[3] == htonl (1); }))
# define IN6_IS_ADDR_LINKLOCAL(a) \
(__extension__ \
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
- (__a->s6_addr32[0] & htonl (0xffc00000)) == htonl (0xfe800000); }))
+ (__a->__in6_u.__u6_addr32[0] & htonl (0xffc00000)) == htonl (0xfe800000); }))
# define IN6_IS_ADDR_SITELOCAL(a) \
(__extension__ \
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
- (__a->s6_addr32[0] & htonl (0xffc00000)) == htonl (0xfec00000); }))
+ (__a->__in6_u.__u6_addr32[0] & htonl (0xffc00000)) == htonl (0xfec00000); }))
# define IN6_IS_ADDR_V4MAPPED(a) \
(__extension__ \
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
- __a->s6_addr32[0] == 0 \
- && __a->s6_addr32[1] == 0 \
- && __a->s6_addr32[2] == htonl (0xffff); }))
+ __a->__in6_u.__u6_addr32[0] == 0 \
+ && __a->__in6_u.__u6_addr32[1] == 0 \
+ && __a->__in6_u.__u6_addr32[2] == htonl (0xffff); }))
# define IN6_IS_ADDR_V4COMPAT(a) \
(__extension__ \
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
- __a->s6_addr32[0] == 0 \
- && __a->s6_addr32[1] == 0 \
- && __a->s6_addr32[2] == 0 \
- && ntohl (__a->s6_addr32[3]) > 1; }))
+ __a->__in6_u.__u6_addr32[0] == 0 \
+ && __a->__in6_u.__u6_addr32[1] == 0 \
+ && __a->__in6_u.__u6_addr32[2] == 0 \
+ && ntohl (__a->__in6_u.__u6_addr32[3]) > 1; }))
# define IN6_ARE_ADDR_EQUAL(a,b) \
(__extension__ \
({ const struct in6_addr *__a = (const struct in6_addr *) (a); \
const struct in6_addr *__b = (const struct in6_addr *) (b); \
- __a->s6_addr32[0] == __b->s6_addr32[0] \
- && __a->s6_addr32[1] == __b->s6_addr32[1] \
- && __a->s6_addr32[2] == __b->s6_addr32[2] \
- && __a->s6_addr32[3] == __b->s6_addr32[3]; }))
+ __a->__in6_u.__u6_addr32[0] == __b->__in6_u.__u6_addr32[0] \
+ && __a->__in6_u.__u6_addr32[1] == __b->__in6_u.__u6_addr32[1] \
+ && __a->__in6_u.__u6_addr32[2] == __b->__in6_u.__u6_addr32[2] \
+ && __a->__in6_u.__u6_addr32[3] == __b->__in6_u.__u6_addr32[3]; }))
#else
# define IN6_IS_ADDR_UNSPECIFIED(a) \
(((const uint32_t *) (a))[0] == 0 \