mirror of
https://github.com/libretro/RetroArch
synced 2025-01-30 21:32:45 +00:00
HAVE_SOCKET_LEGACY -> no IPv6
I had previously assumed that if AF_INET6 is defined, IPv6 support was present. Some psychopathic console SDKs which shall not be named actually define AF_INET6 but none of the IPv6 structures. As there is therefore no way to determine whether IPv6 support is present at preprocessor time, I'm ust assuming that HAVE_SOCKET_LEGACY implies no IPv6. This means in effect that no consoles get IPv6 support.
This commit is contained in:
parent
4bf806ef00
commit
9a4b28735b
@ -42,6 +42,10 @@
|
|||||||
#define MAX_RETRIES 16
|
#define MAX_RETRIES 16
|
||||||
#define RETRY_MS 500
|
#define RETRY_MS 500
|
||||||
|
|
||||||
|
#if defined(AF_INET6) && !defined(HAVE_SOCKET_LEGACY)
|
||||||
|
#define HAVE_INET6 1
|
||||||
|
#endif
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
CMD_OPT_ALLOWED_IN_SPECTATE_MODE = 0x1,
|
CMD_OPT_ALLOWED_IN_SPECTATE_MODE = 0x1,
|
||||||
@ -102,7 +106,7 @@ static int init_tcp_connection(const struct addrinfo *res,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if defined(AF_INET6) && defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
|
#if defined(HAVE_INET6) && defined(IPPROTO_IPV6) && defined(IPV6_V6ONLY)
|
||||||
/* Make sure we accept connections on both IPv6 and IPv4 */
|
/* Make sure we accept connections on both IPv6 and IPv4 */
|
||||||
int on = 0;
|
int on = 0;
|
||||||
if (res->ai_family == AF_INET6)
|
if (res->ai_family == AF_INET6)
|
||||||
@ -142,7 +146,7 @@ static bool init_tcp_socket(netplay_t *netplay, void *direct_host,
|
|||||||
|
|
||||||
if (!direct_host)
|
if (!direct_host)
|
||||||
{
|
{
|
||||||
#ifdef AF_INET6
|
#ifdef HAVE_INET6
|
||||||
/* Default to hosting on IPv6 and IPv4 */
|
/* Default to hosting on IPv6 and IPv4 */
|
||||||
if (!server)
|
if (!server)
|
||||||
hints.ai_family = AF_INET6;
|
hints.ai_family = AF_INET6;
|
||||||
@ -154,7 +158,7 @@ static bool init_tcp_socket(netplay_t *netplay, void *direct_host,
|
|||||||
snprintf(port_buf, sizeof(port_buf), "%hu", (unsigned short)port);
|
snprintf(port_buf, sizeof(port_buf), "%hu", (unsigned short)port);
|
||||||
if (getaddrinfo_retro(server, port_buf, &hints, &res) < 0)
|
if (getaddrinfo_retro(server, port_buf, &hints, &res) < 0)
|
||||||
{
|
{
|
||||||
#ifdef AF_INET6
|
#ifdef HAVE_INET6
|
||||||
if (!server)
|
if (!server)
|
||||||
{
|
{
|
||||||
/* Didn't work with IPv6, try wildcard */
|
/* Didn't work with IPv6, try wildcard */
|
||||||
@ -186,7 +190,7 @@ static bool init_tcp_socket(netplay_t *netplay, void *direct_host,
|
|||||||
|
|
||||||
/* If we're serving on IPv6, make sure we accept all connections, including
|
/* If we're serving on IPv6, make sure we accept all connections, including
|
||||||
* IPv4 */
|
* IPv4 */
|
||||||
#ifdef AF_INET6
|
#ifdef HAVE_INET6
|
||||||
if (!direct_host && !server && res->ai_family == AF_INET6)
|
if (!direct_host && !server && res->ai_family == AF_INET6)
|
||||||
{
|
{
|
||||||
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) res->ai_addr;
|
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) res->ai_addr;
|
||||||
@ -1110,7 +1114,7 @@ static void announce_nat_traversal(netplay_t *netplay)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
}
|
}
|
||||||
#ifdef AF_INET6
|
#ifdef HAVE_INET6
|
||||||
else if (netplay->nat_traversal_state.have_inet6)
|
else if (netplay->nat_traversal_state.have_inet6)
|
||||||
{
|
{
|
||||||
if (getnameinfo((const struct sockaddr *) &netplay->nat_traversal_state.ext_inet6_addr,
|
if (getnameinfo((const struct sockaddr *) &netplay->nat_traversal_state.ext_inet6_addr,
|
||||||
|
@ -43,6 +43,10 @@
|
|||||||
#include "netplay_discovery.h"
|
#include "netplay_discovery.h"
|
||||||
#include "netplay_private.h"
|
#include "netplay_private.h"
|
||||||
|
|
||||||
|
#if defined(AF_INET6) && !defined(HAVE_SOCKET_LEGACY)
|
||||||
|
#define HAVE_INET6 1
|
||||||
|
#endif
|
||||||
|
|
||||||
struct ad_packet
|
struct ad_packet
|
||||||
{
|
{
|
||||||
uint32_t header;
|
uint32_t header;
|
||||||
@ -260,7 +264,7 @@ static int16_t htons_for_morons(int16_t value)
|
|||||||
int16_t s[2];
|
int16_t s[2];
|
||||||
} val;
|
} val;
|
||||||
val.l = htonl(value);
|
val.l = htonl(value);
|
||||||
return val.s[2];
|
return val.s[1];
|
||||||
}
|
}
|
||||||
#ifndef htons
|
#ifndef htons
|
||||||
#define htons htons_for_morons
|
#define htons htons_for_morons
|
||||||
@ -310,7 +314,7 @@ bool netplay_lan_ad_client(void)
|
|||||||
sin->sin_port = htons(ntohl(ad_packet_buffer.port));
|
sin->sin_port = htons(ntohl(ad_packet_buffer.port));
|
||||||
|
|
||||||
}
|
}
|
||||||
#ifdef AF_INET6
|
#ifdef HAVE_INET6
|
||||||
else if (their_addr.sa_family == AF_INET6)
|
else if (their_addr.sa_family == AF_INET6)
|
||||||
{
|
{
|
||||||
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) &their_addr;
|
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) &their_addr;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user