Resolve hostnames to IPv6 addresses in IPv6 mode
This commit is contained in:
parent
fd6def040f
commit
561ba964f3
@ -1035,10 +1035,10 @@ get_in_addr(struct sockaddr *sa)
|
||||
* @return 0 if successful, 1 if an error occurred.
|
||||
*/
|
||||
int
|
||||
ipv4_resolve(const char *dns_str, char *ip_str)
|
||||
ip_resolve(const char *dns_str, char *ip_str, int family)
|
||||
{
|
||||
int error; /* Function error return code */
|
||||
size_t ip_bufsize = MAX_IPV4_STR_LEN;
|
||||
size_t ip_bufsize = MAX_IPV46_STR_LEN;
|
||||
struct addrinfo hints;
|
||||
struct addrinfo *result; /* Result of getaddrinfo() */
|
||||
struct addrinfo *rp; /* Element of the linked list returned by getaddrinfo() */
|
||||
@ -1061,7 +1061,7 @@ ipv4_resolve(const char *dns_str, char *ip_str)
|
||||
#endif
|
||||
|
||||
memset(&hints, 0 , sizeof(hints));
|
||||
hints.ai_family = AF_INET;
|
||||
hints.ai_family = family;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
hints.ai_protocol = IPPROTO_TCP;
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ int count_characters(const char *str, const char match, int len);
|
||||
int strtoargv(const char * const args_str, char **argv_new, int *argc_new);
|
||||
void free_argv(char **argv_new, int *argc_new);
|
||||
|
||||
int ipv4_resolve(const char *dns_str, char *ip_str);
|
||||
int ip_resolve(const char *dns_str, char *ip_str, int family);
|
||||
#if !HAVE_STRLCAT
|
||||
size_t strlcat(char *dst, const char *src, size_t siz);
|
||||
#endif
|
||||
|
||||
@ -1494,7 +1494,7 @@ int
|
||||
process_spa_request(const fko_srv_options_t * const opts,
|
||||
const acc_stanza_t * const acc, spa_data_t * const spadat)
|
||||
{
|
||||
char nat_ip[MAX_IPV4_STR_LEN] = {0};
|
||||
char nat_ip[MAX_IPV46_STR_LEN] = {0};
|
||||
char nat_dst[MAX_HOSTNAME_LEN] = {0};
|
||||
unsigned int nat_port = 0;
|
||||
unsigned int fst_proto;
|
||||
@ -1571,7 +1571,7 @@ process_spa_request(const fko_srv_options_t * const opts,
|
||||
free_acc_port_list(port_list);
|
||||
return res;
|
||||
}
|
||||
if (ipv4_resolve(nat_dst, nat_ip) == 0)
|
||||
if (ip_resolve(nat_dst, nat_ip, AF_INET) == 0)
|
||||
{
|
||||
log_msg(LOG_INFO, "Resolved NAT IP in SPA message");
|
||||
}
|
||||
|
||||
@ -1634,7 +1634,7 @@ process_spa_request(const fko_srv_options_t * const opts,
|
||||
free_acc_port_list(port_list);
|
||||
return res;
|
||||
}
|
||||
if (ipv4_resolve(nat_dst, nat_ip) == 0)
|
||||
if (ip_resolve(nat_dst, nat_ip, ipv6 ? AF_INET6 : AF_INET) == 0)
|
||||
{
|
||||
log_msg(LOG_INFO, "Resolved NAT IP in SPA message");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user