Skip to content

Commit 127dd62

Browse files
committed
Revert "deps: sync with upstream c-ares/c-ares@4ef6817"
This reverts commit 35c3832. See [0] and [1] for background. Let's hold off on upgrading c-ares until upstream makes an official release. [0] #5185 [1] #5199 PR-URL: #5199 Reviewed-By: Fedor Indutny <fedor@indutny.com>
1 parent 149007c commit 127dd62

File tree

4 files changed

+20
-67
lines changed

4 files changed

+20
-67
lines changed

deps/cares/include/ares.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -294,10 +294,6 @@ typedef int (*ares_sock_create_callback)(ares_socket_t socket_fd,
294294
int type,
295295
void *data);
296296

297-
typedef int (*ares_sock_config_callback)(ares_socket_t socket_fd,
298-
int type,
299-
void *data);
300-
301297
CARES_EXTERN int ares_library_init(int flags);
302298

303299
CARES_EXTERN int ares_library_init_mem(int flags,
@@ -348,10 +344,6 @@ CARES_EXTERN void ares_set_socket_callback(ares_channel channel,
348344
ares_sock_create_callback callback,
349345
void *user_data);
350346

351-
CARES_EXTERN void ares_set_socket_configure_callback(ares_channel channel,
352-
ares_sock_config_callback callback,
353-
void *user_data);
354-
355347
CARES_EXTERN int ares_set_sortlist(ares_channel channel,
356348
const char *sortstr);
357349

deps/cares/src/ares_init.c

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -90,8 +90,7 @@ static void natural_mask(struct apattern *pat);
9090
!defined(ANDROID) && !defined(__ANDROID__) && !defined(CARES_USE_LIBRESOLV)
9191
static int config_domain(ares_channel channel, char *str);
9292
static int config_lookup(ares_channel channel, const char *str,
93-
const char *bindch, const char *altbindch,
94-
const char *filech);
93+
const char *bindch, const char *filech);
9594
static char *try_config(char *s, const char *opt, char scc);
9695
#endif
9796

@@ -165,8 +164,6 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
165164
channel->sock_state_cb_data = NULL;
166165
channel->sock_create_cb = NULL;
167166
channel->sock_create_cb_data = NULL;
168-
channel->sock_config_cb = NULL;
169-
channel->sock_config_cb_data = NULL;
170167

171168
channel->last_server = 0;
172169
channel->last_timeout_processed = (time_t)now.tv_sec;
@@ -294,8 +291,6 @@ int ares_dup(ares_channel *dest, ares_channel src)
294291
/* Now clone the options that ares_save_options() doesn't support. */
295292
(*dest)->sock_create_cb = src->sock_create_cb;
296293
(*dest)->sock_create_cb_data = src->sock_create_cb_data;
297-
(*dest)->sock_config_cb = src->sock_config_cb;
298-
(*dest)->sock_config_cb_data = src->sock_config_cb_data;
299294

300295
strncpy((*dest)->local_dev_name, src->local_dev_name,
301296
sizeof(src->local_dev_name));
@@ -1030,6 +1025,11 @@ static int get_DNS_AdaptersAddresses(char **outptr)
10301025
}
10311026
else if (namesrvr.sa->sa_family == AF_INET6)
10321027
{
1028+
/* Windows apparently always reports some IPv6 DNS servers that
1029+
* prefixed with fec0:0:0:ffff. These ususally do not point to
1030+
* working DNS servers, so we ignore them. */
1031+
if (strncmp(txtaddr, "fec0:0:0:ffff:", 14) == 0)
1032+
continue;
10331033
if (memcmp(&namesrvr.sa6->sin6_addr, &ares_in6addr_any,
10341034
sizeof(namesrvr.sa6->sin6_addr)) == 0)
10351035
continue;
@@ -1269,7 +1269,7 @@ static int init_by_resolv_conf(ares_channel channel)
12691269
if ((p = try_config(line, "domain", ';')) && update_domains)
12701270
status = config_domain(channel, p);
12711271
else if ((p = try_config(line, "lookup", ';')) && !channel->lookups)
1272-
status = config_lookup(channel, p, "bind", NULL, "file");
1272+
status = config_lookup(channel, p, "bind", "file");
12731273
else if ((p = try_config(line, "search", ';')) && update_domains)
12741274
status = set_search(channel, p);
12751275
else if ((p = try_config(line, "nameserver", ';')) &&
@@ -1310,7 +1310,8 @@ static int init_by_resolv_conf(ares_channel channel)
13101310
ARES_SUCCESS)
13111311
{
13121312
if ((p = try_config(line, "hosts:", '\0')) && !channel->lookups)
1313-
(void)config_lookup(channel, p, "dns", "resolve", "files");
1313+
/* ignore errors */
1314+
(void)config_lookup(channel, p, "dns", "files");
13141315
}
13151316
fclose(fp);
13161317
}
@@ -1319,16 +1320,15 @@ static int init_by_resolv_conf(ares_channel channel)
13191320
switch(error) {
13201321
case ENOENT:
13211322
case ESRCH:
1323+
status = ARES_EOF;
13221324
break;
13231325
default:
13241326
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
13251327
error, strerror(error)));
13261328
DEBUGF(fprintf(stderr, "Error opening file: %s\n",
13271329
"/etc/nsswitch.conf"));
1330+
status = ARES_EFILE;
13281331
}
1329-
1330-
/* ignore error, maybe we will get luck in next if clause */
1331-
status = ARES_EOF;
13321332
}
13331333
}
13341334

@@ -1341,7 +1341,7 @@ static int init_by_resolv_conf(ares_channel channel)
13411341
{
13421342
if ((p = try_config(line, "order", '\0')) && !channel->lookups)
13431343
/* ignore errors */
1344-
(void)config_lookup(channel, p, "bind", NULL, "hosts");
1344+
(void)config_lookup(channel, p, "bind", "hosts");
13451345
}
13461346
fclose(fp);
13471347
}
@@ -1350,16 +1350,15 @@ static int init_by_resolv_conf(ares_channel channel)
13501350
switch(error) {
13511351
case ENOENT:
13521352
case ESRCH:
1353+
status = ARES_EOF;
13531354
break;
13541355
default:
13551356
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
13561357
error, strerror(error)));
13571358
DEBUGF(fprintf(stderr, "Error opening file: %s\n",
13581359
"/etc/host.conf"));
1360+
status = ARES_EFILE;
13591361
}
1360-
1361-
/* ignore error, maybe we will get luck in next if clause */
1362-
status = ARES_EOF;
13631362
}
13641363
}
13651364

@@ -1372,7 +1371,7 @@ static int init_by_resolv_conf(ares_channel channel)
13721371
{
13731372
if ((p = try_config(line, "hosts=", '\0')) && !channel->lookups)
13741373
/* ignore errors */
1375-
(void)config_lookup(channel, p, "bind", NULL, "local");
1374+
(void)config_lookup(channel, p, "bind", "local");
13761375
}
13771376
fclose(fp);
13781377
}
@@ -1381,15 +1380,14 @@ static int init_by_resolv_conf(ares_channel channel)
13811380
switch(error) {
13821381
case ENOENT:
13831382
case ESRCH:
1383+
status = ARES_EOF;
13841384
break;
13851385
default:
13861386
DEBUGF(fprintf(stderr, "fopen() failed with error: %d %s\n",
13871387
error, strerror(error)));
13881388
DEBUGF(fprintf(stderr, "Error opening file: %s\n", "/etc/svc.conf"));
1389+
status = ARES_EFILE;
13891390
}
1390-
1391-
/* ignore error, default value will be chosen for `channel->lookups` */
1392-
status = ARES_EOF;
13931391
}
13941392
}
13951393

@@ -1593,15 +1591,11 @@ static int config_domain(ares_channel channel, char *str)
15931591
#endif
15941592

15951593
static int config_lookup(ares_channel channel, const char *str,
1596-
const char *bindch, const char *altbindch,
1597-
const char *filech)
1594+
const char *bindch, const char *filech)
15981595
{
15991596
char lookups[3], *l;
16001597
const char *vqualifier p;
16011598

1602-
if (altbindch == NULL)
1603-
altbindch = bindch;
1604-
16051599
/* Set the lookup order. Only the first letter of each work
16061600
* is relevant, and it has to be "b" for DNS or "f" for the
16071601
* host file. Ignore everything else.
@@ -1610,8 +1604,8 @@ static int config_lookup(ares_channel channel, const char *str,
16101604
p = str;
16111605
while (*p)
16121606
{
1613-
if ((*p == *bindch || *p == *altbindch || *p == *filech) && l < lookups + 2) {
1614-
if (*p == *bindch || *p == *altbindch) *l++ = 'b';
1607+
if ((*p == *bindch || *p == *filech) && l < lookups + 2) {
1608+
if (*p == *bindch) *l++ = 'b';
16151609
else *l++ = 'f';
16161610
}
16171611
while (*p && !ISSPACE(*p) && (*p != ','))
@@ -2096,14 +2090,6 @@ void ares_set_socket_callback(ares_channel channel,
20962090
channel->sock_create_cb_data = data;
20972091
}
20982092

2099-
void ares_set_socket_configure_callback(ares_channel channel,
2100-
ares_sock_config_callback cb,
2101-
void *data)
2102-
{
2103-
channel->sock_config_cb = cb;
2104-
channel->sock_config_cb_data = data;
2105-
}
2106-
21072093
int ares_set_sortlist(ares_channel channel, const char *sortstr)
21082094
{
21092095
int nsort = 0;

deps/cares/src/ares_private.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,9 +311,6 @@ struct ares_channeldata {
311311

312312
ares_sock_create_callback sock_create_cb;
313313
void *sock_create_cb_data;
314-
315-
ares_sock_config_callback sock_config_cb;
316-
void *sock_config_cb_data;
317314
};
318315

319316
/* Memory management functions */

deps/cares/src/ares_process.c

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1031,17 +1031,6 @@ static int open_tcp_socket(ares_channel channel, struct server_state *server)
10311031
}
10321032
#endif
10331033

1034-
if (channel->sock_config_cb)
1035-
{
1036-
int err = channel->sock_config_cb(s, SOCK_STREAM,
1037-
channel->sock_config_cb_data);
1038-
if (err < 0)
1039-
{
1040-
sclose(s);
1041-
return err;
1042-
}
1043-
}
1044-
10451034
/* Connect to the server. */
10461035
if (connect(s, sa, salen) == -1)
10471036
{
@@ -1126,17 +1115,6 @@ static int open_udp_socket(ares_channel channel, struct server_state *server)
11261115
return -1;
11271116
}
11281117

1129-
if (channel->sock_config_cb)
1130-
{
1131-
int err = channel->sock_config_cb(s, SOCK_DGRAM,
1132-
channel->sock_config_cb_data);
1133-
if (err < 0)
1134-
{
1135-
sclose(s);
1136-
return err;
1137-
}
1138-
}
1139-
11401118
/* Connect to the server. */
11411119
if (connect(s, sa, salen) == -1)
11421120
{

0 commit comments

Comments
 (0)