Skip to contentSkip to conversation

netconfig: Remove usage of in6_addr.__in6_u

PATCH Applied Andrew Zaborowski 2 participants 2 messages Sep 15, 2021 – Sep 16, 2021

lore
Share & tools
lore

Andrew Zaborowski

author
#0 lore raw

PATCH 1/1 netconfig: Remove usage of in6_addr.__in6_u

in6_addr.__in6_u.__u6_addr8 is glibc-specific and named differently in the headers shipped with musl libc for example. The POSIX compliant and universal way of accessing it is in6_addr.s6_addr.

---
 src/netconfig.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/netconfig.c +1 -1
index ce95db0b..421270c9 100644
@@ -171,7 +171,7 @@ static inline char *netconfig_ipv6_to_string(const uint8_t *addr)
 	struct in6_addr in6_addr;
 	char *addr_str = l_malloc(INET6_ADDRSTRLEN);
 
-	memcpy(in6_addr.__in6_u.__u6_addr8, addr, 16);
+	memcpy(in6_addr.s6_addr, addr, 16);
 
 	if (L_WARN_ON(unlikely(!inet_ntop(AF_INET6, &in6_addr, addr_str,
 						INET6_ADDRSTRLEN)))) {
Signature · 1 line
2.30.2
Applied
#1 lore raw

Hi Andrew,

Quoted 7 lines · Andrew Zaborowski

in6_addr.__in6_u.__u6_addr8 is glibc-specific and named differently in the headers shipped with musl libc for example. The POSIX compliant and universal way of accessing it is in6_addr.s6_addr.

---
  src/netconfig.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Regards,
-Denis