mirror of
https://github.com/coturn/coturn.git
synced 2025-10-28 13:31:16 +01:00
issue 6 fixed
This commit is contained in:
parent
49a8f18cf3
commit
ada99b9898
@ -7,6 +7,7 @@ Version 4.1.2.2 'Vitari':
|
|||||||
- Move debian package from SVN to GIT.
|
- Move debian package from SVN to GIT.
|
||||||
- Move secondary download area to coturn.net.
|
- Move secondary download area to coturn.net.
|
||||||
- TLS renegotiation DoS attack prevention implemented;
|
- TLS renegotiation DoS attack prevention implemented;
|
||||||
|
- FQDN as relay-ip and listener-ip parameters (issue 6);
|
||||||
- oAuth security implementation. (TODO)
|
- oAuth security implementation. (TODO)
|
||||||
|
|
||||||
08/14/2014 Oleg Moskalenko <mom040267@gmail.com>
|
08/14/2014 Oleg Moskalenko <mom040267@gmail.com>
|
||||||
|
|||||||
@ -29,6 +29,8 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "ns_turn_ioaddr.h"
|
#include "ns_turn_ioaddr.h"
|
||||||
|
#include <netdb.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@ -202,7 +204,38 @@ int make_ioa_addr(const u08bits* saddr, int port, ioa_addr *addr) {
|
|||||||
#endif
|
#endif
|
||||||
addr->s6.sin6_port = nswap16(port);
|
addr->s6.sin6_port = nswap16(port);
|
||||||
} else {
|
} else {
|
||||||
return -1;
|
struct addrinfo addr_hints;
|
||||||
|
struct addrinfo *addr_result = NULL;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
memset(&addr_hints, 0, sizeof(struct addrinfo));
|
||||||
|
addr_hints.ai_family = AF_UNSPEC; /* Allow IPv4 or IPv6 */
|
||||||
|
addr_hints.ai_socktype = SOCK_DGRAM; /* Datagram socket */
|
||||||
|
addr_hints.ai_flags = AI_PASSIVE; /* For wildcard IP address */
|
||||||
|
addr_hints.ai_protocol = 0; /* Any protocol */
|
||||||
|
addr_hints.ai_canonname = NULL;
|
||||||
|
addr_hints.ai_addr = NULL;
|
||||||
|
addr_hints.ai_next = NULL;
|
||||||
|
|
||||||
|
err = getaddrinfo((const char*)saddr, NULL, &addr_hints, &addr_result);
|
||||||
|
if (err != 0) {
|
||||||
|
fprintf(stderr,"error resolving '%s' hostname: %s\n",saddr,gai_strerror(err));
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// getaddrinfo() returns a list of address structures. We just take the
|
||||||
|
// first one.
|
||||||
|
ns_bcopy(addr_result->ai_addr, addr, addr_result->ai_addrlen);
|
||||||
|
if (addr_result->ai_family == AF_INET) {
|
||||||
|
addr->s4.sin_port = nswap16(port);
|
||||||
|
} else if (addr_result->ai_family == AF_INET6) {
|
||||||
|
addr->s6.sin6_port = nswap16(port);
|
||||||
|
#if defined(SIN6_LEN) /* this define is required by IPv6 if used */
|
||||||
|
addr->s6.sin6_len = sizeof(struct sockaddr_in6);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
freeaddrinfo(addr_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user