Skip to content

Commit

Permalink
deps: upgrade to c-ares v1.16.0
Browse files Browse the repository at this point in the history
Refs: https://github.com/c-ares/c-ares/releases/tag/cares-1_16_0

PR-URL: #32246
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: David Carlier <devnexen@gmail.com>
  • Loading branch information
addaleax committed Mar 20, 2020
1 parent c011542 commit 4cfcaae
Show file tree
Hide file tree
Showing 23 changed files with 2,454 additions and 499 deletions.
5 changes: 5 additions & 0 deletions deps/cares/cares.gyp
Expand Up @@ -52,7 +52,9 @@
'src/ares_fds.c',
'src/ares_free_hostent.c',
'src/ares_free_string.c',
'src/ares_freeaddrinfo.c',
'src/ares_getenv.h',
'src/ares_getaddrinfo.c',
'src/ares_gethostbyaddr.c',
'src/ares_gethostbyname.c',
'src/ares__get_hostent.c',
Expand All @@ -70,6 +72,7 @@
'src/ares_nowarn.c',
'src/ares_nowarn.h',
'src/ares_options.c',
'src/ares__parse_into_addrinfo.c',
'src/ares_parse_aaaa_reply.c',
'src/ares_parse_a_reply.c',
'src/ares_parse_mx_reply.c',
Expand All @@ -84,9 +87,11 @@
'src/ares_process.c',
'src/ares_query.c',
'src/ares__read_line.c',
'src/ares__readaddrinfo.c',
'src/ares_search.c',
'src/ares_send.c',
'src/ares_setup.h',
'src/ares__sortaddrinfo.c',
'src/ares_strcasecmp.c',
'src/ares_strcasecmp.h',
'src/ares_strdup.c',
Expand Down
59 changes: 59 additions & 0 deletions deps/cares/include/ares.h
Expand Up @@ -135,6 +135,9 @@ extern "C" {
/* More error codes */
#define ARES_ECANCELLED 24 /* introduced in 1.7.0 */

/* More ares_getaddrinfo error codes */
#define ARES_ESERVICE 25 /* introduced in 1.?.0 */

/* Flag values */
#define ARES_FLAG_USEVC (1 << 0)
#define ARES_FLAG_PRIMARY (1 << 1)
Expand Down Expand Up @@ -192,6 +195,8 @@ extern "C" {
#define ARES_AI_V4MAPPED (1 << 4)
#define ARES_AI_ALL (1 << 5)
#define ARES_AI_ADDRCONFIG (1 << 6)
#define ARES_AI_NOSORT (1 << 7)
#define ARES_AI_ENVHOSTS (1 << 8)
/* Reserved for future use */
#define ARES_AI_IDN (1 << 10)
#define ARES_AI_IDN_ALLOW_UNASSIGNED (1 << 11)
Expand Down Expand Up @@ -278,6 +283,8 @@ struct hostent;
struct timeval;
struct sockaddr;
struct ares_channeldata;
struct ares_addrinfo;
struct ares_addrinfo_hints;

typedef struct ares_channeldata *ares_channel;

Expand Down Expand Up @@ -306,6 +313,11 @@ typedef int (*ares_sock_config_callback)(ares_socket_t socket_fd,
int type,
void *data);

typedef void (*ares_addrinfo_callback)(void *arg,
int status,
int timeouts,
struct ares_addrinfo *res);

CARES_EXTERN int ares_library_init(int flags);

CARES_EXTERN int ares_library_init_mem(int flags,
Expand Down Expand Up @@ -369,6 +381,15 @@ CARES_EXTERN void ares_set_socket_configure_callback(ares_channel channel,
CARES_EXTERN int ares_set_sortlist(ares_channel channel,
const char *sortstr);

CARES_EXTERN void ares_getaddrinfo(ares_channel channel,
const char* node,
const char* service,
const struct ares_addrinfo_hints* hints,
ares_addrinfo_callback callback,
void* arg);

CARES_EXTERN void ares_freeaddrinfo(struct ares_addrinfo* ai);

/*
* Virtual function set to have user-managed socket IO.
* Note that all functions need to be defined, and when
Expand Down Expand Up @@ -558,6 +579,44 @@ struct ares_soa_reply {
unsigned int minttl;
};

/*
* Similar to addrinfo, but with extra ttl and missing canonname.
*/
struct ares_addrinfo_node {
int ai_ttl;
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
ares_socklen_t ai_addrlen;
struct sockaddr *ai_addr;
struct ares_addrinfo_node *ai_next;
};

/*
* alias - label of the resource record.
* name - value (canonical name) of the resource record.
* See RFC2181 10.1.1. CNAME terminology.
*/
struct ares_addrinfo_cname {
int ttl;
char *alias;
char *name;
struct ares_addrinfo_cname *next;
};

struct ares_addrinfo {
struct ares_addrinfo_cname *cnames;
struct ares_addrinfo_node *nodes;
};

struct ares_addrinfo_hints {
int ai_flags;
int ai_family;
int ai_socktype;
int ai_protocol;
};

/*
** Parse the buffer, starting at *abuf and of length alen bytes, previously
** obtained from an ares_search call. Put the results in *host, if nonnull.
Expand Down
6 changes: 3 additions & 3 deletions deps/cares/include/ares_version.h
Expand Up @@ -3,15 +3,15 @@
#define ARES__VERSION_H

/* This is the global package copyright */
#define ARES_COPYRIGHT "2004 - 2018 Daniel Stenberg, <daniel@haxx.se>."
#define ARES_COPYRIGHT "2004 - 2020 Daniel Stenberg, <daniel@haxx.se>."

#define ARES_VERSION_MAJOR 1
#define ARES_VERSION_MINOR 15
#define ARES_VERSION_MINOR 16
#define ARES_VERSION_PATCH 0
#define ARES_VERSION ((ARES_VERSION_MAJOR<<16)|\
(ARES_VERSION_MINOR<<8)|\
(ARES_VERSION_PATCH))
#define ARES_VERSION_STR "1.15.0"
#define ARES_VERSION_STR "1.16.0"

#if (ARES_VERSION >= 0x010700)
# define CARES_HAVE_ARES_LIBRARY_INIT 1
Expand Down
3 changes: 2 additions & 1 deletion deps/cares/src/README.md
Expand Up @@ -2,9 +2,10 @@ c-ares
======

[![Build Status](https://travis-ci.org/c-ares/c-ares.svg?branch=master)](https://travis-ci.org/c-ares/c-ares)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/03i7151772eq3wn3/branch/master?svg=true)](https://ci.appveyor.com/project/c-ares/c-ares)
[![Windows Build Status](https://ci.appveyor.com/api/projects/status/aevgc5914tm72pvs/branch/master?svg=true)](https://ci.appveyor.com/project/c-ares/c-ares/branch/master)
[![Coverage Status](https://coveralls.io/repos/c-ares/c-ares/badge.svg?branch=master&service=github)](https://coveralls.io/github/c-ares/c-ares?branch=master)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/291/badge)](https://bestpractices.coreinfrastructure.org/projects/291)
[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/c-ares.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:c-ares)
[![Releases](https://coderelease.io/badge/c-ares/c-ares)](https://coderelease.io/github/repository/c-ares/c-ares)

This is c-ares, an asynchronous resolver library. It is intended for
Expand Down
108 changes: 75 additions & 33 deletions deps/cares/src/RELEASE-NOTES
@@ -1,43 +1,85 @@
c-ares version 1.15.0
c-ares version 1.16.0

Changes:
o Add ares_init_options() configurability for path to resolv.conf file [1]
o Ability to exclude building of tools (adig, ahost, acountry) in CMake [3]
o Android: Support for domain search suffix [4]
o Report ARES_ENOTFOUND for .onion domain names as per RFC7686. [13]
o Introduction of ares_getaddrinfo() API which provides similar output
(including proper sorting as per RFC 6724) to the system native API, but
utilizes different data structures in order to provide additional information
such as TTLs and all aliases. Please reference the respective man pages for
usage details. [3] [4] [5] [7] [8] [13] [14] [15] [16] [17] [22]
o Parse SOA records from ns_t_any response [29] [30]
o CMake: Provide c-ares version in package export file [24]
o CMake: Add CPACK functionality for DEB and RPM [28]
o CMake: Generate PDB files during build [33] [34]
o CMake: Support manpage installation [37] [38]

Bug fixes:
o AIX build fix for trying to include both nameser_compat.h and
onameser_compat.h [2]
o Windows: Improve DNS suffixes extracting from WinNT registry [5]
o Fix modern GCC warnings [6]
o Apply the IPv6 server blacklist to all nameserver sources, not just Windows
[7]
o Fix warnings emitted by MSVC when using -W4 [8]
o Prevent changing name servers while queries are outstanding [9]
o Harden and rationalize c-ares timeout computation [10]
o Distribute ares_android.h [11]
o ares_set_servers_csv() on failure should not leave channel in a bad state
[12]
o Add missing docs to distribution
o Fix bad expectation in IPv6 localhost test. [1] [2]
o AutoTools: use XC_CHECK_BUILD_FLAGS instead of XC_CHECK_USER_FLAGS to prevent
complaints about CPPFLAGS in CFLAGS. [6]
o Fix .onion handling
o Command line usage was out of date for adig and ahost. [18]
o Typos in manpages [19] [20]
o If ares_getenv is defined, it must return a value on all platforms [21]
o If /etc/resolv.conf has invalid lookup values, use the defaults. [23]
o Tests: Separate live tests from SetServers* tests as only live tests should
require internet access. [25]
o ares_gethostbyname() should return ENODATA if no valid A or AAAA record is
found, but a CNAME was found. [26] [27]
o CMake: Rework library function checking to prevent unintended linking with
system libraries that aren't needed. [31] [32]
o Due to use of inet_addr() it was not possible to return 255.255.255.255 from
ares_gethostbyname(). [35] [36]
o CMake: Fix building of tests on Windows

Thanks go to these friendly people for their efforts and contributions:
@afalin, Andi Schnebinger, Ben Noordhuis, Brad House, Brad Spencer,
David Hotham, @flyingdutchman23, John Schember, Ruslan Baratov,
Sarat Addepalli, Tobias Nießen (11 contributors)
Abhishek Arya (@inferno-chromium), Adam Majer (@AdamMajer),
Andrew Selivanov (@ki11roy), Ben Noordhuis (@bnoordhuis),
Brad House (@bradh352), Christian Ammer (@ChristianAmmer), Dan Noé (@dnoe),
Daniel Stenberg (@bagder), Darrin Cullop (@dwcullop),
Dron Rathore (@DronRathore), Fabrice Fontaine (@ffontaine),
Gregor Jasny (@gjasny), @kedixa, Khaidi Chu (@XadillaX),
Kyle Edwards (@KyleFromKitware), @lifenjoiner, Michal Rostecki (@mrostecki),
Peter Eisentraut (@petere), Piotr Pietraszkiewicz (@ppietrasa),
Stephen Bryant (@bf-bryants), @tjwalton, Vy Nguyen (@oontvoo)
(22 contributors)

References to bug reports and discussions on issues:
[1] = https://github.com/c-ares/c-ares/issues/220
[2] = https://github.com/c-ares/c-ares/issues/224
[3] = https://github.com/c-ares/c-ares/issues/200
[4] = https://github.com/c-ares/c-ares/issues/207
[5] = https://github.com/c-ares/c-ares/pull/202
[6] = https://github.com/c-ares/c-ares/pull/201
[7] = https://github.com/c-ares/c-ares/pull/193
[8] = https://github.com/c-ares/c-ares/pull/192
[9] = https://github.com/c-ares/c-ares/pull/191
[1] = https://github.com/c-ares/c-ares/pull/227
[2] = https://github.com/c-ares/c-ares/issues/85
[3] = https://github.com/c-ares/c-ares/pull/112
[4] = https://github.com/c-ares/c-ares/pull/233
[5] = https://github.com/c-ares/c-ares/pull/234
[6] = https://github.com/c-ares/c-ares/pull/236
[7] = https://github.com/c-ares/c-ares/pull/235
[8] = https://github.com/c-ares/c-ares/pull/239
[9] = https://github.com/c-ares/c-ares/pull/241
[10] = https://github.com/c-ares/c-ares/pull/187
[11] = https://c-ares.haxx.se/mail/c-ares-archive-2018-04/0000.shtml
[12] = https://c-ares.haxx.se/mail/c-ares-archive-2018-03/0000.shtml
[13] = https://github.com/c-ares/c-ares/issues/196
[11] = https://github.com/c-ares/c-ares/pull/252
[12] = https://github.com/c-ares/c-ares/issues/251
[13] = https://github.com/c-ares/c-ares/pull/258
[14] = https://github.com/c-ares/c-ares/pull/257
[15] = https://github.com/c-ares/c-ares/pull/262
[16] = https://github.com/c-ares/c-ares/pull/264
[17] = https://github.com/c-ares/c-ares/pull/265
[18] = https://github.com/c-ares/c-ares/pull/256
[19] = https://github.com/c-ares/c-ares/pull/269
[20] = https://github.com/c-ares/c-ares/pull/275
[21] = https://github.com/c-ares/c-ares/pull/279
[22] = https://github.com/c-ares/c-ares/pull/290
[23] = https://github.com/c-ares/c-ares/pull/274
[24] = https://github.com/c-ares/c-ares/pull/296
[25] = https://github.com/c-ares/c-ares/pull/299
[26] = https://github.com/c-ares/c-ares/pull/304
[27] = https://github.com/c-ares/c-ares/issues/303
[28] = https://github.com/c-ares/c-ares/pull/283
[29] = https://github.com/c-ares/c-ares/pull/103
[30] = https://github.com/c-ares/c-ares/issues/102
[31] = https://github.com/c-ares/c-ares/pull/310
[32] = https://github.com/c-ares/c-ares/issues/307
[33] = https://github.com/c-ares/c-ares/pull/311
[34] = https://github.com/c-ares/c-ares/issues/245
[35] = https://github.com/c-ares/c-ares/issues/309
[36] = https://github.com/c-ares/c-ares/pull/312
[37] = https://github.com/c-ares/c-ares/issues/297
[38] = https://github.com/c-ares/c-ares/pull/314

4 changes: 2 additions & 2 deletions deps/cares/src/ares__close_sockets.c
Expand Up @@ -48,14 +48,14 @@ void ares__close_sockets(ares_channel channel, struct server_state *server)
if (server->tcp_socket != ARES_SOCKET_BAD)
{
SOCK_STATE_CALLBACK(channel, server->tcp_socket, 0, 0);
ares__socket_close(channel, server->tcp_socket);
ares__close_socket(channel, server->tcp_socket);
server->tcp_socket = ARES_SOCKET_BAD;
server->tcp_connection_generation = ++channel->tcp_connection_generation;
}
if (server->udp_socket != ARES_SOCKET_BAD)
{
SOCK_STATE_CALLBACK(channel, server->udp_socket, 0, 0);
ares__socket_close(channel, server->udp_socket);
ares__close_socket(channel, server->udp_socket);
server->udp_socket = ARES_SOCKET_BAD;
}
}
3 changes: 1 addition & 2 deletions deps/cares/src/ares__get_hostent.c
Expand Up @@ -138,8 +138,7 @@ int ares__get_hostent(FILE *fp, int family, struct hostent **host)
addr.addrV4.s_addr = INADDR_NONE;
if ((family == AF_INET) || (family == AF_UNSPEC))
{
addr.addrV4.s_addr = inet_addr(txtaddr);
if (addr.addrV4.s_addr != INADDR_NONE)
if (ares_inet_pton(AF_INET, txtaddr, &addr.addrV4) > 0)
{
/* Actual network address family and length. */
addr.family = AF_INET;
Expand Down

0 comments on commit 4cfcaae

Please sign in to comment.