[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Minios-devel] [UNIKRAFT/LIBLWIP PATCH v2 1/2] Add IPv6 macro definitions



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@xxxxxxxxx>
Reviewed-by: Vlad-Andrei Badoiu <vlad_andrei.badoiu@xxxxxxxxxxxxxxx>
---
 include/netinet/in.h | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/include/netinet/in.h b/include/netinet/in.h
index 07fcc7d..505a20a 100644
--- a/include/netinet/in.h
+++ b/include/netinet/in.h
@@ -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
-- 
2.20.1


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.