mirror of
https://github.com/libretro/RetroArch
synced 2025-03-03 04:14:00 +00:00
(Netplay) LAN addresses only for UPnP (#13461)
Some router devices might accept non-LAN addresses without raising an error.
This commit is contained in:
parent
87c5720988
commit
c2df109874
@ -101,17 +101,24 @@ static void task_netplay_nat_traversal_handler(retro_task_t *task)
|
||||
}
|
||||
|
||||
/* Grab a suitable interface. */
|
||||
hints.ai_family = AF_INET;
|
||||
for (i = data->iface; i < natt_st->interfaces.size; i++)
|
||||
{
|
||||
struct net_ifinfo_entry *tmp_entry =
|
||||
&natt_st->interfaces.entries[i];
|
||||
|
||||
/* Ignore localhost */
|
||||
if (string_is_equal(tmp_entry->host, "127.0.0.1"))
|
||||
if (getaddrinfo_retro(tmp_entry->host, NULL, &hints, &addr) ||
|
||||
!addr)
|
||||
continue;
|
||||
/* Ignore IPv6 */
|
||||
if (strchr(tmp_entry->host, ':'))
|
||||
|
||||
/* Ignore non-LAN interfaces */
|
||||
if (!netplay_is_lan_address(
|
||||
(struct sockaddr_in *) addr->ai_addr))
|
||||
{
|
||||
freeaddrinfo_retro(addr);
|
||||
addr = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
entry = tmp_entry;
|
||||
data->iface = i;
|
||||
@ -125,16 +132,6 @@ static void task_netplay_nat_traversal_handler(retro_task_t *task)
|
||||
break;
|
||||
}
|
||||
|
||||
if (getaddrinfo_retro(entry->host, NULL, &hints, &addr) ||
|
||||
!addr)
|
||||
{
|
||||
if (++data->iface < natt_st->interfaces.size)
|
||||
data->forward_type = NATT_FORWARD_TYPE_ANY;
|
||||
else
|
||||
data->status = NAT_TRAVERSAL_STATUS_SELECT_DEVICE;
|
||||
break;
|
||||
}
|
||||
|
||||
memcpy(&data->request.addr.sin_addr,
|
||||
&((struct sockaddr_in *) addr->ai_addr)->sin_addr,
|
||||
sizeof(data->request.addr.sin_addr));
|
||||
|
Loading…
x
Reference in New Issue
Block a user