]> xenbits.xensource.com Git - unikraft/libs/lwip.git/commitdiff
Add IPv6 macro definitions
authorFelipe Huici <felipe.huici@neclab.eu>
Mon, 21 Oct 2019 13:46:34 +0000 (15:46 +0200)
committerFelipe Huici <felipe.huici@neclab.eu>
Mon, 4 Nov 2019 07:52:26 +0000 (08:52 +0100)
Add IN6_IS_ADDR_MULTICAST, IN6_IS_ADDR_LINKLOCAL and
IN6_IS_ADDR_MC_LINKLOCAL macro definitions. These are defined by libc,
but not included in by our netinet/in.h glue when sockets are enabled,
breaking builds that depend on these and sockets.

Signed-off-by: Felipe Huici <felipe.huici@neclab.eu>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@stud.acs.upb.ro>
include/netinet/in.h

index 07fcc7d9172803be43b22f4d0d340b817e7bbf2a..505a20a5312864d63c38e7f1101aa9d0d417401b 100644 (file)
@@ -5,6 +5,14 @@
 
 #ifdef CONFIG_LWIP_SOCKET
 #include <lwip/sockets.h>
+/* Taken from musl's netinet/in.h */
+#ifdef CONFIG_LWIP_IPV6
+#define IN6_IS_ADDR_MULTICAST(a) (((uint8_t *) (a))[0] == 0xff)
+#define IN6_IS_ADDR_LINKLOCAL(a) \
+  ((((uint8_t *) (a))[0]) == 0xfe && (((uint8_t *) (a))[1] & 0xc0) == 0x80)
+#define IN6_IS_ADDR_MC_LINKLOCAL(a) \
+  (IN6_IS_ADDR_MULTICAST(a) && ((((uint8_t *) (a))[1] & 0xf) == 0x2))
+#endif /* LWIP_IPV6 */
 #else /* CONFIG_LWIP_SOCKET */
 #include_next <netinet/in.h>
 #endif