[Toybox] [PATCH] dhcp6: use portable s6_addr instead of linux kernel-specific __in6_u.__u6_addr8

Ariadne Conill ariadne at dereferenced.org
Sat Jul 4 22:41:53 PDT 2020


The glibc headers also provide that member, but s6_addr is the portable way.
This fixes compilation on musl libc.

Signed-off-by: Ariadne Conill <ariadne at dereferenced.org>
---
 toys/pending/dhcp6.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/toys/pending/dhcp6.c b/toys/pending/dhcp6.c
index 728dc7d1..12d11553 100644
--- a/toys/pending/dhcp6.c
+++ b/toys/pending/dhcp6.c
@@ -377,7 +377,7 @@ static void parse_ia_na(uint8_t *data, int data_length)
             if(!getaddrinfo(TT.req_ip, NULL, NULL,&res)) {
               dbg("Requesting IP: %s\n", TT.req_ip);
               memcpy (&TT.input_socket6, res->ai_addr, res->ai_addrlen);
-              memcpy(t+4, TT.input_socket6.sin6_addr.__in6_u.__u6_addr8, 16);
+              memcpy(t+4, TT.input_socket6.sin6_addr.s6_addr, 16);
             } else xprintf("Invalid IP: %s\n",TT.req_ip);
             freeaddrinfo(res);
           }
-- 
2.27.0



More information about the Toybox mailing list