From: Felipe Huici Date: Mon, 21 Oct 2019 13:46:34 +0000 (+0200) Subject: Add IPv6 macro definitions X-Git-Tag: RELEASE-0.4~19 X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=52ceaeada3217d648c34b7572cfb0b7917faf97c;p=unikraft%2Flibs%2Flwip.git 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 Reviewed-by: Vlad-Andrei Badoiu --- 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 +/* 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 #endif