Always get numeric host/ports instead of names.

This commit is contained in:
Gregor Richards 2016-11-29 23:08:26 -05:00
parent 42da0a0184
commit c342c103ae
2 changed files with 3 additions and 3 deletions

View File

@ -100,7 +100,7 @@ bool natt_open_port(struct natt_status *status, struct sockaddr *addr, socklen_t
return false;
/* figure out the internal info */
if (getnameinfo(addr, addrlen, host, PATH_MAX_LENGTH, port_str, 6, 0) != 0)
if (getnameinfo(addr, addrlen, host, PATH_MAX_LENGTH, port_str, 6, NI_NUMERICHOST|NI_NUMERICSERV) != 0)
return false;
proto_str = (proto == SOCKET_PROTOCOL_UDP) ? "UDP" : "TCP";

View File

@ -1076,7 +1076,7 @@ static void announce_nat_traversal(netplay_t *netplay)
{
if (getnameinfo((const struct sockaddr *) &netplay->nat_traversal_state.ext_inet4_addr,
sizeof(struct sockaddr_in),
host, PATH_MAX_LENGTH, port, 6, 0) != 0)
host, PATH_MAX_LENGTH, port, 6, NI_NUMERICHOST|NI_NUMERICSERV) != 0)
return;
}
@ -1085,7 +1085,7 @@ static void announce_nat_traversal(netplay_t *netplay)
{
if (getnameinfo((const struct sockaddr *) &netplay->nat_traversal_state.ext_inet6_addr,
sizeof(struct sockaddr_in6),
host, PATH_MAX_LENGTH, port, 6, 0) != 0)
host, PATH_MAX_LENGTH, port, 6, NI_NUMERICHOST|NI_NUMERICSERV) != 0)
return;
}