diff options
Diffstat (limited to 'toxcore')
-rw-r--r-- | toxcore/network.c | 6 | ||||
-rw-r--r-- | toxcore/network.h | 2 |
2 files changed, 6 insertions, 2 deletions
diff --git a/toxcore/network.c b/toxcore/network.c index 08fb71c7..1186a468 100644 --- a/toxcore/network.c +++ b/toxcore/network.c | |||
@@ -258,10 +258,14 @@ static int receivepacket(sock_t sock, IP_Port *ip_port, uint8_t *data, uint32_t | |||
258 | ip_port->port = addr_in->sin_port; | 258 | ip_port->port = addr_in->sin_port; |
259 | } else if (addr.ss_family == AF_INET6) { | 259 | } else if (addr.ss_family == AF_INET6) { |
260 | struct sockaddr_in6 *addr_in6 = (struct sockaddr_in6 *)&addr; | 260 | struct sockaddr_in6 *addr_in6 = (struct sockaddr_in6 *)&addr; |
261 | |||
262 | ip_port->ip.family = addr_in6->sin6_family; | 261 | ip_port->ip.family = addr_in6->sin6_family; |
263 | ip_port->ip.ip6.in6_addr = addr_in6->sin6_addr; | 262 | ip_port->ip.ip6.in6_addr = addr_in6->sin6_addr; |
264 | ip_port->port = addr_in6->sin6_port; | 263 | ip_port->port = addr_in6->sin6_port; |
264 | |||
265 | if (IN6_IS_ADDR_V4MAPPED(&ip_port->ip.ip6.in6_addr)) { | ||
266 | ip_port->ip.family = AF_INET; | ||
267 | ip_port->ip.ip4.uint32 = ip_port->ip.ip6.uint32[3]; | ||
268 | } | ||
265 | } else | 269 | } else |
266 | return -1; | 270 | return -1; |
267 | 271 | ||
diff --git a/toxcore/network.h b/toxcore/network.h index 2ba2b005..4c7f1a83 100644 --- a/toxcore/network.h +++ b/toxcore/network.h | |||
@@ -81,7 +81,7 @@ typedef int sock_t; | |||
81 | #endif | 81 | #endif |
82 | 82 | ||
83 | #if defined(__AIX__) | 83 | #if defined(__AIX__) |
84 | # define _XOPEN_SOURCE 1 | 84 | # define _XOPEN_SOURCE 1 |
85 | #endif | 85 | #endif |
86 | 86 | ||
87 | #if defined(__sun__) | 87 | #if defined(__sun__) |