mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-26 01:30:51 +00:00
Merge pull request #4108 from GregorR/netplay-ipv6
Fix Netplay IPv6 support
This commit is contained in:
commit
153b879a6e
@ -165,11 +165,14 @@ int getaddrinfo_retro(const char *node, const char *service,
|
|||||||
(void)in_addr;
|
(void)in_addr;
|
||||||
(void)info;
|
(void)info;
|
||||||
|
|
||||||
|
if (!hints->ai_family)
|
||||||
|
{
|
||||||
#if defined(_WIN32) || defined(HAVE_SOCKET_LEGACY)
|
#if defined(_WIN32) || defined(HAVE_SOCKET_LEGACY)
|
||||||
hints->ai_family = AF_INET;
|
hints->ai_family = AF_INET;
|
||||||
#else
|
#else
|
||||||
hints->ai_family = AF_UNSPEC;
|
hints->ai_family = AF_UNSPEC;
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef HAVE_SOCKET_LEGACY
|
#ifdef HAVE_SOCKET_LEGACY
|
||||||
info = (struct addrinfo*)calloc(1, sizeof(*info));
|
info = (struct addrinfo*)calloc(1, sizeof(*info));
|
||||||
|
@ -129,6 +129,10 @@ static bool init_tcp_socket(netplay_t *netplay, const char *server,
|
|||||||
|
|
||||||
port_buf[0] = '\0';
|
port_buf[0] = '\0';
|
||||||
|
|
||||||
|
#ifdef AF_INET6
|
||||||
|
if (!server)
|
||||||
|
hints.ai_family = AF_INET6;
|
||||||
|
#endif
|
||||||
hints.ai_socktype = SOCK_STREAM;
|
hints.ai_socktype = SOCK_STREAM;
|
||||||
if (!server)
|
if (!server)
|
||||||
hints.ai_flags = AI_PASSIVE;
|
hints.ai_flags = AI_PASSIVE;
|
||||||
@ -140,6 +144,16 @@ static bool init_tcp_socket(netplay_t *netplay, const char *server,
|
|||||||
if (!res)
|
if (!res)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
/* If we're serving on IPv6, make sure we accept all connections, including
|
||||||
|
* IPv4 */
|
||||||
|
#ifdef AF_INET6
|
||||||
|
if (!server && res->ai_family == AF_INET6)
|
||||||
|
{
|
||||||
|
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) res->ai_addr;
|
||||||
|
sin6->sin6_addr = in6addr_any;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/* If "localhost" is used, it is important to check every possible
|
/* If "localhost" is used, it is important to check every possible
|
||||||
* address for IPv4/IPv6. */
|
* address for IPv4/IPv6. */
|
||||||
tmp_info = res;
|
tmp_info = res;
|
||||||
|
Loading…
Reference in New Issue
Block a user