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>
#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