Browse Source

Upgrade c-ares to 1.7.4

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
fc634cd92c
  1. 19
      deps/c-ares/CHANGES
  2. 21
      deps/c-ares/RELEASE-NOTES
  3. 19
      deps/c-ares/ares.h
  4. 1
      deps/c-ares/ares_data.c
  5. 10
      deps/c-ares/ares_gethostbyaddr.c
  6. 22
      deps/c-ares/ares_getnameinfo.c
  7. 81
      deps/c-ares/ares_init.c
  8. 4
      deps/c-ares/ares_ipv6.h
  9. 18
      deps/c-ares/ares_nowarn.c
  10. 2
      deps/c-ares/ares_nowarn.h
  11. 126
      deps/c-ares/ares_options.c
  12. 2
      deps/c-ares/ares_parse_a_reply.c
  13. 7
      deps/c-ares/ares_private.h
  14. 47
      deps/c-ares/ares_process.c
  15. 2
      deps/c-ares/ares_search.c
  16. 7
      deps/c-ares/ares_version.h
  17. 7
      deps/c-ares/config-win32.h
  18. 12
      deps/c-ares/inet_net_pton.c
  19. 2
      deps/c-ares/setup_once.h

19
deps/c-ares/CHANGES

@ -1,5 +1,24 @@
Changelog for the c-ares project
Version 1.7.4 (December 9, 2010)
Changed:
o local-bind: Support binding to local interface/IPs, see
ares_set_local_ip4, ares_set_local_ip6, ares_set_local_dev
Fixed:
o memory leak in ares_getnameinfo
o add missing break that caused get_ares_servers to fail
o ares_parse_a_reply: fix CNAME response parsing
o init_by_options: don't copy an empty sortlist
o Replaced uint32_t with unsigned int to fix broken builds
on a couple of platforms
o Fix lookup with HOSTALIASES set
o adig: fix NAPTR parsing
o compiler warning cleanups
Version 1.7.3 (June 11, 2010)
Fixed:

21
deps/c-ares/RELEASE-NOTES

@ -1,12 +1,25 @@
c-ares version 1.7.3
c-ares version 1.7.4
Changed:
o local-bind: Support binding to local interface/IPs, see
ares_set_local_ip4, ares_set_local_ip6, ares_set_local_dev
Fixed:
o builds on Android
o now includes all files necessary to build it (1.7.2 lacked a file)
o memory leak in ares_getnameinfo
o add missing break that caused get_ares_servers to fail
o ares_parse_a_reply: fix CNAME response parsing
o init_by_options: don't copy an empty sortlist
o Replaced uint32_t with unsigned int to fix broken builds
on a couple of platforms
o Fix lookup with HOSTALIASES set
o adig: fix NAPTR parsing
o compiler warning cleanups
Thanks go to these friendly people for their efforts and contributions:
Yang Tse, Bogdan Vatra
Andrew C. Morrow, Ben Greear, Ben Noordhuis, Daniel Stenberg,
Guenter Knauf, Mike Crowe, Patrik Thunstrom, Yang Tse
Have fun!

19
deps/c-ares/ares.h

@ -313,6 +313,20 @@ CARES_EXTERN void ares_destroy(ares_channel channel);
CARES_EXTERN void ares_cancel(ares_channel channel);
/* These next 3 configure local binding for the out-going socket
* connection. Use these to specify source IP and/or network device
* on multi-homed systems.
*/
CARES_EXTERN void ares_set_local_ip4(ares_channel channel, unsigned int local_ip);
/* local_ip6 should be 16 bytes in length */
CARES_EXTERN void ares_set_local_ip6(ares_channel channel,
const unsigned char* local_ip6);
/* local_dev_name should be null terminated. */
CARES_EXTERN void ares_set_local_dev(ares_channel channel,
const char* local_dev_name);
CARES_EXTERN void ares_set_socket_callback(ares_channel channel,
ares_sock_create_callback callback,
void *user_data);
@ -496,6 +510,7 @@ CARES_EXTERN void ares_free_data(void *dataptr);
CARES_EXTERN const char *ares_strerror(int code);
/* TODO: Hold port here as well. */
struct ares_addr_node {
struct ares_addr_node *next;
int family;
@ -508,6 +523,10 @@ struct ares_addr_node {
CARES_EXTERN int ares_set_servers(ares_channel channel,
struct ares_addr_node *servers);
/* Incomming string format: host[:port][,host[:port]]... */
CARES_EXTERN int ares_set_servers_csv(ares_channel channel,
const char* servers);
CARES_EXTERN int ares_get_servers(ares_channel channel,
struct ares_addr_node **servers);

1
deps/c-ares/ares_data.c

@ -146,6 +146,7 @@ void *ares_malloc_data(ares_datatype type)
ptr->data.addr_node.family = 0;
memset(&ptr->data.addr_node.addrV6, 0,
sizeof(ptr->data.addr_node.addrV6));
break;
default:
free(ptr);

10
deps/c-ares/ares_gethostbyaddr.c

@ -265,11 +265,11 @@ static void ptr_rr_name(char *name, const struct ares_addr *addr)
if (addr->family == AF_INET)
{
unsigned long laddr = ntohl(addr->addrV4.s_addr);
int a1 = (int)((laddr >> 24) & 0xff);
int a2 = (int)((laddr >> 16) & 0xff);
int a3 = (int)((laddr >> 8) & 0xff);
int a4 = (int)(laddr & 0xff);
sprintf(name, "%d.%d.%d.%d.in-addr.arpa", a4, a3, a2, a1);
unsigned long a1 = (laddr >> 24UL) & 0xFFUL;
unsigned long a2 = (laddr >> 16UL) & 0xFFUL;
unsigned long a3 = (laddr >> 8UL) & 0xFFUL;
unsigned long a4 = laddr & 0xFFUL;
sprintf(name, "%lu.%lu.%lu.%lu.in-addr.arpa", a4, a3, a2, a1);
}
else
{

22
deps/c-ares/ares_getnameinfo.c

@ -99,13 +99,15 @@ void ares_getnameinfo(ares_channel channel, const struct sockaddr *sa,
struct nameinfo_query *niquery;
unsigned int port = 0;
/* Verify the buffer size */
if (salen == sizeof(struct sockaddr_in))
/* Validate socket address family and length */
if ((sa->sa_family == AF_INET) &&
(salen == sizeof(struct sockaddr_in)))
{
addr = (struct sockaddr_in *)sa;
port = addr->sin_port;
}
else if (salen == sizeof(struct sockaddr_in6))
else if ((sa->sa_family == AF_INET6) &&
(salen == sizeof(struct sockaddr_in6)))
{
addr6 = (struct sockaddr_in6 *)sa;
port = addr6->sin6_port;
@ -232,7 +234,7 @@ static void nameinfo_callback(void *arg, int status, int timeouts,
char buf[255];
char *domain;
gethostname(buf, 255);
if ((domain = strchr(buf, '.')))
if ((domain = strchr(buf, '.')) != NULL)
{
char *end = ares_striendstr(host->h_name, domain);
if (end)
@ -243,6 +245,7 @@ static void nameinfo_callback(void *arg, int status, int timeouts,
niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts,
(char *)(host->h_name),
service);
free(niquery);
return;
}
/* We couldn't find the host, but it's OK, we can use the IP */
@ -273,6 +276,7 @@ static void nameinfo_callback(void *arg, int status, int timeouts,
}
niquery->callback(niquery->arg, ARES_SUCCESS, niquery->timeouts, ipbuf,
service);
free(niquery);
return;
}
niquery->callback(niquery->arg, status, niquery->timeouts, NULL, NULL);
@ -354,11 +358,11 @@ static void append_scopeid(struct sockaddr_in6 *addr6, unsigned int flags,
#ifdef HAVE_IF_INDEXTONAME
int is_ll, is_mcll;
#endif
char fmt_u[] = "%u";
char fmt_lu[] = "%lu";
static const char fmt_u[] = "%u";
static const char fmt_lu[] = "%lu";
char tmpbuf[IF_NAMESIZE + 2];
size_t bufl;
char *fmt = (sizeof(addr6->sin6_scope_id) > sizeof(unsigned int))?
const char *fmt = (sizeof(addr6->sin6_scope_id) > sizeof(unsigned int))?
fmt_lu:fmt_u;
tmpbuf[0] = '%';
@ -406,8 +410,8 @@ static char *ares_striendstr(const char *s1, const char *s2)
c2 = s2;
while (c2 < s2+s2_len)
{
lo1 = tolower(*c1);
lo2 = tolower(*c2);
lo1 = TOLOWER(*c1);
lo2 = TOLOWER(*c2);
if (lo1 != lo2)
return NULL;
else

81
deps/c-ares/ares_init.c

@ -67,6 +67,7 @@
#include "ares.h"
#include "inet_net_pton.h"
#include "ares_library_init.h"
#include "ares_nowarn.h"
#include "ares_private.h"
#ifdef ANDROID
@ -94,7 +95,7 @@ static int init_id_key(rc4_key* key,int key_data_len);
#if !defined(WIN32) && !defined(WATT32)
static int sortlist_alloc(struct apattern **sortlist, int *nsort, struct apattern *pat);
static int ip_addr(const char *s, int len, struct in_addr *addr);
static int ip_addr(const char *s, ssize_t len, struct in_addr *addr);
static void natural_mask(struct apattern *pat);
static int config_domain(ares_channel channel, char *str);
static int config_lookup(ares_channel channel, const char *str,
@ -129,8 +130,12 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
if (env)
curl_memdebug(env);
env = getenv("CARES_MEMLIMIT");
if (env)
curl_memlimit(atoi(env));
if (env) {
char *endptr;
long num = strtol(env, &endptr, 10);
if((endptr != env) && (endptr == env + strlen(env)) && (num > 0))
curl_memlimit(num);
}
#endif
if (ares_library_initialized() != ARES_SUCCESS)
@ -172,6 +177,10 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
channel->last_server = 0;
channel->last_timeout_processed = (time_t)now.tv_sec;
memset(&channel->local_dev_name, 0, sizeof(channel->local_dev_name));
channel->local_ip4 = 0;
memset(&channel->local_ip6, 0, sizeof(channel->local_ip6));
/* Initialize our lists of queries */
ares__init_list_head(&(channel->all_queries));
for (i = 0; i < ARES_QID_TABLE_SIZE; i++)
@ -286,6 +295,10 @@ int ares_dup(ares_channel *dest, ares_channel src)
(*dest)->sock_create_cb = src->sock_create_cb;
(*dest)->sock_create_cb_data = src->sock_create_cb_data;
strncpy((*dest)->local_dev_name, src->local_dev_name, sizeof(src->local_dev_name));
(*dest)->local_ip4 = src->local_ip4;
memcpy((*dest)->local_ip6, src->local_ip6, sizeof(src->local_ip6));
/* Full name server cloning required when not all are IPv4 */
for (i = 0; i < src->nservers; i++)
{
@ -393,10 +406,7 @@ int ares_save_options(ares_channel channel, struct ares_options *options,
if (!options->sortlist)
return ARES_ENOMEM;
for (i = 0; i < channel->nsort; i++)
{
memcpy(&(options->sortlist[i]), &(channel->sortlist[i]),
sizeof(struct apattern));
}
options->sortlist[i] = channel->sortlist[i];
}
options->nsort = channel->nsort;
@ -490,16 +500,13 @@ static int init_by_options(ares_channel channel,
}
/* copy sortlist */
if ((optmask & ARES_OPT_SORTLIST) && channel->nsort == -1)
{
if ((optmask & ARES_OPT_SORTLIST) && (channel->nsort == -1) &&
(options->nsort>0)) {
channel->sortlist = malloc(options->nsort * sizeof(struct apattern));
if (!channel->sortlist)
return ARES_ENOMEM;
for (i = 0; i < options->nsort; i++)
{
memcpy(&(channel->sortlist[i]), &(options->sortlist[i]),
sizeof(struct apattern));
}
channel->sortlist[i] = options->sortlist[i];
channel->nsort = options->nsort;
}
@ -1254,16 +1261,16 @@ static int config_sortlist(struct apattern **sortlist, int *nsort,
q = str;
while (*q && *q != '/' && *q != ';' && !ISSPACE(*q))
q++;
memcpy(ipbuf, str, (int)(q-str));
ipbuf[(int)(q-str)] = '\0';
memcpy(ipbuf, str, q-str);
ipbuf[q-str] = '\0';
/* Find the prefix */
if (*q == '/')
{
const char *str2 = q+1;
while (*q && *q != ';' && !ISSPACE(*q))
q++;
memcpy(ipbufpfx, str, (int)(q-str));
ipbufpfx[(int)(q-str)] = '\0';
memcpy(ipbufpfx, str, q-str);
ipbufpfx[q-str] = '\0';
str = str2;
}
else
@ -1291,13 +1298,13 @@ static int config_sortlist(struct apattern **sortlist, int *nsort,
return ARES_ENOMEM;
}
/* See if it is just a regular IP */
else if (ip_addr(ipbuf, (int)(q-str), &pat.addrV4) == 0)
else if (ip_addr(ipbuf, q-str, &pat.addrV4) == 0)
{
if (ipbufpfx[0])
{
memcpy(ipbuf, str, (int)(q-str));
ipbuf[(int)(q-str)] = '\0';
if (ip_addr(ipbuf, (int)(q - str), &pat.mask.addr4) != 0)
memcpy(ipbuf, str, q-str);
ipbuf[q-str] = '\0';
if (ip_addr(ipbuf, q-str, &pat.mask.addr4) != 0)
natural_mask(&pat);
}
else
@ -1394,13 +1401,13 @@ static int set_options(ares_channel channel, const char *str)
q++;
val = try_option(p, q, "ndots:");
if (val && channel->ndots == -1)
channel->ndots = atoi(val);
channel->ndots = aresx_sltosi(strtol(val, NULL, 10));
val = try_option(p, q, "retrans:");
if (val && channel->timeout == -1)
channel->timeout = atoi(val);
channel->timeout = aresx_sltosi(strtol(val, NULL, 10));
val = try_option(p, q, "retry:");
if (val && channel->tries == -1)
channel->tries = atoi(val);
channel->tries = aresx_sltosi(strtol(val, NULL, 10));
val = try_option(p, q, "rotate");
if (val && channel->rotate == -1)
channel->rotate = 1;
@ -1495,7 +1502,7 @@ static int sortlist_alloc(struct apattern **sortlist, int *nsort,
return 1;
}
static int ip_addr(const char *ipbuf, int len, struct in_addr *addr)
static int ip_addr(const char *ipbuf, ssize_t len, struct in_addr *addr)
{
/* Four octets and three periods yields at most 15 characters. */
@ -1552,7 +1559,7 @@ static void randomize_key(unsigned char* key,int key_data_len)
#ifdef RANDOM_FILE
FILE *f = fopen(RANDOM_FILE, "rb");
if(f) {
counter = fread(key, 1, key_data_len, f);
counter = aresx_uztosi(fread(key, 1, key_data_len, f));
fclose(f);
}
#endif
@ -1604,6 +1611,28 @@ unsigned short ares__generate_new_id(rc4_key* key)
return r;
}
void ares_set_local_ip4(ares_channel channel, unsigned int local_ip)
{
channel->local_ip4 = local_ip;
}
/* local_ip6 should be 16 bytes in length */
void ares_set_local_ip6(ares_channel channel,
const unsigned char* local_ip6)
{
memcpy(&channel->local_ip6, local_ip6, sizeof(channel->local_ip6));
}
/* local_dev_name should be null terminated. */
void ares_set_local_dev(ares_channel channel,
const char* local_dev_name)
{
strncpy(channel->local_dev_name, local_dev_name,
sizeof(channel->local_dev_name));
channel->local_dev_name[sizeof(channel->local_dev_name) - 1] = 0;
}
void ares_set_socket_callback(ares_channel channel,
ares_sock_create_callback cb,
void *data)

4
deps/c-ares/ares_ipv6.h

@ -71,4 +71,8 @@ struct addrinfo
#endif
#endif
/* Defined in ares_net_pton.c for no particular reason. */
extern const struct ares_in6_addr ares_in6addr_any; /* :: */
#endif /* ARES_IPV6_H */

18
deps/c-ares/ares_nowarn.c

@ -50,3 +50,21 @@ int aresx_uztosi(size_t uznum)
# pragma warning(pop)
#endif
}
/*
** signed long to signed int
*/
int aresx_sltosi(long slnum)
{
#ifdef __INTEL_COMPILER
# pragma warning(push)
# pragma warning(disable:810) /* conversion may lose significant bits */
#endif
return (int)(slnum & (long) CARES_MASK_SINT);
#ifdef __INTEL_COMPILER
# pragma warning(pop)
#endif
}

2
deps/c-ares/ares_nowarn.h

@ -19,4 +19,6 @@
int aresx_uztosi(size_t uznum);
int aresx_sltosi(long slnum);
#endif /* HEADER_CARES_NOWARN_H */

126
deps/c-ares/ares_options.c

@ -18,8 +18,13 @@
#include "ares_setup.h"
#ifdef HAVE_ARPA_INET_H
# include <arpa/inet.h>
#endif
#include "ares.h"
#include "ares_data.h"
#include "inet_net_pton.h"
#include "ares_private.h"
@ -125,3 +130,124 @@ int ares_set_servers(ares_channel channel,
return ARES_SUCCESS;
}
/* Incomming string format: host[:port][,host[:port]]... */
int ares_set_servers_csv(ares_channel channel,
const char* _csv)
{
int i;
char* csv = NULL;
char* ptr;
char* start_host;
long port;
bool found_port;
int rv = ARES_SUCCESS;
struct ares_addr_node *servers = NULL;
struct ares_addr_node *last = NULL;
if (ares_library_initialized() != ARES_SUCCESS)
return ARES_ENOTINITIALIZED;
if (!channel)
return ARES_ENODATA;
ares__destroy_servers_state(channel);
i = strlen(_csv);
if (i == 0)
return ARES_SUCCESS; /* blank all servers */
csv = malloc(i + 2);
strcpy(csv, _csv);
if (csv[i-1] != ',') { /* make parsing easier by ensuring ending ',' */
csv[i] = ',';
csv[i+1] = 0;
}
start_host = csv;
found_port = false;
for (ptr = csv; *ptr; ptr++) {
if (*ptr == ',') {
char* pp = ptr - 1;
struct in_addr in4;
struct ares_in6_addr in6;
struct ares_addr_node *s = NULL;
*ptr = 0; /* null terminate host:port string */
/* Got an entry..see if port was specified. */
while (pp > start_host) {
if (*pp == ':')
break; /* yes */
if (!ISDIGIT(*pp)) {
/* Found end of digits before we found :, so wasn't a port */
pp = ptr;
break;
}
pp--;
}
if ((pp != start_host) && ((pp + 1) < ptr)) {
/* Found it. */
found_port = true;
port = strtol(pp + 1, NULL, 10);
*pp = 0; /* null terminate host */
}
/* resolve host, try ipv4 first, rslt is in network byte order */
rv = ares_inet_pton(AF_INET, start_host, &in4);
if (!rv) {
/* Ok, try IPv6 then */
rv = ares_inet_pton(AF_INET6, start_host, &in6);
if (!rv) {
rv = ARES_EBADSTR;
goto out;
}
/* was ipv6, add new server */
s = malloc(sizeof(*s));
if (!s) {
rv = ARES_ENOMEM;
goto out;
}
s->family = AF_INET6;
memcpy(&s->addr, &in6, sizeof(struct ares_in6_addr));
}
else {
/* was ipv4, add new server */
s = malloc(sizeof(*s));
if (!s) {
rv = ARES_ENOMEM;
goto out;
}
s->family = AF_INET;
memcpy(&s->addr, &in4, sizeof(struct in_addr));
}
if (s) {
/* TODO: Add port to ares_addr_node and assign it here. */
s->next = NULL;
if (last) {
last->next = s;
}
else {
servers = s;
last = s;
}
}
/* Set up for next one */
found_port = false;
start_host = ptr + 1;
}
}
rv = ares_set_servers(channel, servers);
out:
if (csv)
free(csv);
while (servers) {
struct ares_addr_node *s = servers;
servers = servers->next;
free(s);
}
return rv;
}

2
deps/c-ares/ares_parse_a_reply.c

@ -202,6 +202,8 @@ int ares_parse_a_reply(const unsigned char *abuf, int alen,
}
if (status == ARES_SUCCESS && naddrs == 0 && naliases == 0)
/* the check for naliases to be zero is to make sure CNAME responses
don't get caught here */
status = ARES_ENODATA;
if (status == ARES_SUCCESS)
{

7
deps/c-ares/ares_private.h

@ -257,6 +257,13 @@ struct ares_channeldata {
int nsort;
char *lookups;
/* For binding to local devices and/or IP addresses. Leave
* them null/zero for no binding.
*/
char local_dev_name[32];
unsigned int local_ip4;
unsigned char local_ip6[16];
int optmask; /* the option bitfield passed in at init time */
/* Server addresses and communications state */

47
deps/c-ares/ares_process.c

@ -91,7 +91,6 @@ static void skip_server(ares_channel channel, struct query *query,
int whichserver);
static void next_server(ares_channel channel, struct query *query,
struct timeval *now);
static int configure_socket(ares_socket_t s, ares_channel channel);
static int open_tcp_socket(ares_channel channel, struct server_state *server);
static int open_udp_socket(ares_channel channel, struct server_state *server);
static int same_questions(const unsigned char *qbuf, int qlen,
@ -436,6 +435,7 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
#ifdef HAVE_RECVFROM
ares_socklen_t fromlen;
union {
struct sockaddr sa;
struct sockaddr_in sa4;
struct sockaddr_in6 sa6;
} from;
@ -479,7 +479,7 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
else
fromlen = sizeof(from.sa6);
count = (ssize_t)recvfrom(server->udp_socket, (void *)buf, sizeof(buf),
0, (struct sockaddr *)&from, &fromlen);
0, &from.sa, &fromlen);
#else
count = sread(server->udp_socket, buf, sizeof(buf));
#endif
@ -488,7 +488,7 @@ static void read_udp_packets(ares_channel channel, fd_set *read_fds,
else if (count <= 0)
handle_error(channel, i, now);
#ifdef HAVE_RECVFROM
else if (!same_address((struct sockaddr *)&from, &server->addr))
else if (!same_address(&from.sa, &server->addr))
/* The address the response comes from does not match
* the address we sent the request to. Someone may be
* attempting to perform a cache poisoning attack. */
@ -869,8 +869,14 @@ static int setsocknonblock(ares_socket_t sockfd, /* operate on this */
#endif
}
static int configure_socket(ares_socket_t s, ares_channel channel)
static int configure_socket(ares_socket_t s, int family, ares_channel channel)
{
union {
struct sockaddr sa;
struct sockaddr_in sa4;
struct sockaddr_in6 sa6;
} local;
setsocknonblock(s, TRUE);
#if defined(FD_CLOEXEC) && !defined(MSDOS)
@ -892,6 +898,35 @@ static int configure_socket(ares_socket_t s, ares_channel channel)
sizeof(channel->socket_receive_buffer_size)) == -1)
return -1;
#ifdef SO_BINDTODEVICE
if (channel->local_dev_name[0]) {
if (setsockopt(s, SOL_SOCKET, SO_BINDTODEVICE,
channel->local_dev_name, sizeof(channel->local_dev_name))) {
/* Only root can do this, and usually not fatal if it doesn't work, so */
/* just continue on. */
}
}
#endif
if (family == AF_INET) {
if (channel->local_ip4) {
memset(&local.sa4, 0, sizeof(local.sa4));
local.sa4.sin_family = AF_INET;
local.sa4.sin_addr.s_addr = htonl(channel->local_ip4);
if (bind(s, &local.sa, sizeof(local.sa4)) < 0)
return -1;
}
}
else if (family == AF_INET6) {
if (memcmp(channel->local_ip6, &ares_in6addr_any, sizeof(channel->local_ip6)) != 0) {
memset(&local.sa6, 0, sizeof(local.sa6));
local.sa6.sin6_family = AF_INET6;
memcpy(&local.sa6.sin6_addr, channel->local_ip6, sizeof(channel->local_ip6));
if (bind(s, &local.sa, sizeof(local.sa6)) < 0)
return -1;
}
}
return 0;
}
@ -936,7 +971,7 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server)
return -1;
/* Configure it. */
if (configure_socket(s, channel) < 0)
if (configure_socket(s, server->addr.family, channel) < 0)
{
sclose(s);
return -1;
@ -1028,7 +1063,7 @@ static int open_udp_socket(ares_channel channel, struct server_state *server)
return -1;
/* Set the socket non-blocking. */
if (configure_socket(s, channel) < 0)
if (configure_socket(s, server->addr.family, channel) < 0)
{
sclose(s);
return -1;

2
deps/c-ares/ares_search.c

@ -287,7 +287,7 @@ static int single_domain(ares_channel channel, const char *name, char **s)
}
free(line);
fclose(fp);
if (status != ARES_SUCCESS)
if (status != ARES_SUCCESS && status != ARES_EOF)
return status;
}
else

7
deps/c-ares/ares_version.h

@ -2,13 +2,16 @@
#ifndef ARES__VERSION_H
#define ARES__VERSION_H
/* This is the global package copyright */
#define ARES_COPYRIGHT "2004 - 2010 Daniel Stenberg, <daniel@haxx.se>."
#define ARES_VERSION_MAJOR 1
#define ARES_VERSION_MINOR 7
#define ARES_VERSION_PATCH 3
#define ARES_VERSION_PATCH 4
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
(ARES_VERSION_MINOR<<8)|\
(ARES_VERSION_PATCH))
#define ARES_VERSION_STR "1.7.3"
#define ARES_VERSION_STR "1.7.4"
#if (ARES_VERSION >= 0x010700)
# define CARES_HAVE_ARES_LIBRARY_INIT 1

7
deps/c-ares/config-win32.h

@ -227,6 +227,13 @@
/* The size of `short', as computed by sizeof. */
#define SIZEOF_SHORT 2
/* The size of `size_t', as computed by sizeof. */
#if defined(_WIN64)
# define SIZEOF_SIZE_T 8
#else
# define SIZEOF_SIZE_T 4
#endif
/* ---------------------------------------------------------------- */
/* STRUCT RELATED */
/* ---------------------------------------------------------------- */

12
deps/c-ares/inet_net_pton.c

@ -46,6 +46,10 @@
#include "ares_ipv6.h"
#include "inet_net_pton.h"
const struct ares_in6_addr ares_in6addr_any = { { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 } } };
#if !defined(HAVE_INET_NET_PTON) || !defined(HAVE_INET_NET_PTON_IPV6)
/*
@ -360,14 +364,14 @@ inet_net_pton_ipv6(const char *src, unsigned char *dst, size_t size)
* Since some memmove()'s erroneously fail to handle
* overlapping regions, we'll do the shift by hand.
*/
const int n = (int)(tp - colonp);
int i;
const ssize_t n = tp - colonp;
ssize_t i;
if (tp == endp)
goto enoent;
for (i = 1; i <= n; i++) {
endp[- i] = colonp[n - i];
colonp[n - i] = 0;
*(endp - i) = *(colonp + n - i);
*(colonp + n - i) = 0;
}
tp = endp;
}

2
deps/c-ares/setup_once.h

@ -252,6 +252,8 @@ struct timeval {
#define ISBLANK(x) (int)((((unsigned char)x) == ' ') || \
(((unsigned char)x) == '\t'))
#define TOLOWER(x) (tolower((int) ((unsigned char)x)))
/*
* 'bool' exists on platforms with <stdbool.h>, i.e. C99 platforms.

Loading…
Cancel
Save