diff --git a/toxcore/network.c b/toxcore/network.c index 49e1726c..af9e8cdd 100644 --- a/toxcore/network.c +++ b/toxcore/network.c @@ -28,6 +28,10 @@ #include "network.h" #include "util.h" +#ifndef IPV6_V6ONLY +#define IPV6_V6ONLY 27 +#endif + /* return current UNIX time in microseconds (us). */ uint64_t current_time(void) { @@ -407,7 +411,7 @@ Networking_Core *new_networking(IP ip, uint16_t port) #ifdef LOGGING res = #endif - setsockopt(temp->sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, &mreq, sizeof(mreq)); + setsockopt(temp->sock, IPPROTO_IPV6, IPV6_ADD_MEMBERSHIP, (char*)&mreq, sizeof(mreq)); #ifdef LOGGING if (res < 0) { diff --git a/toxcore/network.h b/toxcore/network.h index 4432baed..f6256ab4 100644 --- a/toxcore/network.h +++ b/toxcore/network.h @@ -40,6 +40,15 @@ #include typedef unsigned int sock_t; +typedef unsigned int sa_family_t; + +#ifndef IN6_ARE_ADDR_EQUAL +#define IN6_ARE_ADDR_EQUAL(a,b) \ + ((((__const uint32_t *) (a))[0] == ((__const uint32_t *) (b))[0]) \ + && (((__const uint32_t *) (a))[1] == ((__const uint32_t *) (b))[1]) \ + && (((__const uint32_t *) (a))[2] == ((__const uint32_t *) (b))[2]) \ + && (((__const uint32_t *) (a))[3] == ((__const uint32_t *) (b))[3])) +#endif #else // Linux includes