@@ -90,8 +90,7 @@ static void natural_mask(struct apattern *pat);
90
90
!defined(ANDROID ) && !defined(__ANDROID__ ) && !defined(CARES_USE_LIBRESOLV )
91
91
static int config_domain (ares_channel channel , char * str );
92
92
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 );
95
94
static char * try_config (char * s , const char * opt , char scc );
96
95
#endif
97
96
@@ -165,8 +164,6 @@ int ares_init_options(ares_channel *channelptr, struct ares_options *options,
165
164
channel -> sock_state_cb_data = NULL ;
166
165
channel -> sock_create_cb = NULL ;
167
166
channel -> sock_create_cb_data = NULL ;
168
- channel -> sock_config_cb = NULL ;
169
- channel -> sock_config_cb_data = NULL ;
170
167
171
168
channel -> last_server = 0 ;
172
169
channel -> last_timeout_processed = (time_t )now .tv_sec ;
@@ -294,8 +291,6 @@ int ares_dup(ares_channel *dest, ares_channel src)
294
291
/* Now clone the options that ares_save_options() doesn't support. */
295
292
(* dest )-> sock_create_cb = src -> sock_create_cb ;
296
293
(* 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 ;
299
294
300
295
strncpy ((* dest )-> local_dev_name , src -> local_dev_name ,
301
296
sizeof (src -> local_dev_name ));
@@ -1030,6 +1025,11 @@ static int get_DNS_AdaptersAddresses(char **outptr)
1030
1025
}
1031
1026
else if (namesrvr .sa -> sa_family == AF_INET6 )
1032
1027
{
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 ;
1033
1033
if (memcmp (& namesrvr .sa6 -> sin6_addr , & ares_in6addr_any ,
1034
1034
sizeof (namesrvr .sa6 -> sin6_addr )) == 0 )
1035
1035
continue ;
@@ -1269,7 +1269,7 @@ static int init_by_resolv_conf(ares_channel channel)
1269
1269
if ((p = try_config (line , "domain" , ';' )) && update_domains )
1270
1270
status = config_domain (channel , p );
1271
1271
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" );
1273
1273
else if ((p = try_config (line , "search" , ';' )) && update_domains )
1274
1274
status = set_search (channel , p );
1275
1275
else if ((p = try_config (line , "nameserver" , ';' )) &&
@@ -1310,7 +1310,8 @@ static int init_by_resolv_conf(ares_channel channel)
1310
1310
ARES_SUCCESS )
1311
1311
{
1312
1312
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" );
1314
1315
}
1315
1316
fclose (fp );
1316
1317
}
@@ -1319,16 +1320,15 @@ static int init_by_resolv_conf(ares_channel channel)
1319
1320
switch (error ) {
1320
1321
case ENOENT :
1321
1322
case ESRCH :
1323
+ status = ARES_EOF ;
1322
1324
break ;
1323
1325
default :
1324
1326
DEBUGF (fprintf (stderr , "fopen() failed with error: %d %s\n" ,
1325
1327
error , strerror (error )));
1326
1328
DEBUGF (fprintf (stderr , "Error opening file: %s\n" ,
1327
1329
"/etc/nsswitch.conf" ));
1330
+ status = ARES_EFILE ;
1328
1331
}
1329
-
1330
- /* ignore error, maybe we will get luck in next if clause */
1331
- status = ARES_EOF ;
1332
1332
}
1333
1333
}
1334
1334
@@ -1341,7 +1341,7 @@ static int init_by_resolv_conf(ares_channel channel)
1341
1341
{
1342
1342
if ((p = try_config (line , "order" , '\0' )) && !channel -> lookups )
1343
1343
/* ignore errors */
1344
- (void )config_lookup (channel , p , "bind" , NULL , "hosts" );
1344
+ (void )config_lookup (channel , p , "bind" , "hosts" );
1345
1345
}
1346
1346
fclose (fp );
1347
1347
}
@@ -1350,16 +1350,15 @@ static int init_by_resolv_conf(ares_channel channel)
1350
1350
switch (error ) {
1351
1351
case ENOENT :
1352
1352
case ESRCH :
1353
+ status = ARES_EOF ;
1353
1354
break ;
1354
1355
default :
1355
1356
DEBUGF (fprintf (stderr , "fopen() failed with error: %d %s\n" ,
1356
1357
error , strerror (error )));
1357
1358
DEBUGF (fprintf (stderr , "Error opening file: %s\n" ,
1358
1359
"/etc/host.conf" ));
1360
+ status = ARES_EFILE ;
1359
1361
}
1360
-
1361
- /* ignore error, maybe we will get luck in next if clause */
1362
- status = ARES_EOF ;
1363
1362
}
1364
1363
}
1365
1364
@@ -1372,7 +1371,7 @@ static int init_by_resolv_conf(ares_channel channel)
1372
1371
{
1373
1372
if ((p = try_config (line , "hosts=" , '\0' )) && !channel -> lookups )
1374
1373
/* ignore errors */
1375
- (void )config_lookup (channel , p , "bind" , NULL , "local" );
1374
+ (void )config_lookup (channel , p , "bind" , "local" );
1376
1375
}
1377
1376
fclose (fp );
1378
1377
}
@@ -1381,15 +1380,14 @@ static int init_by_resolv_conf(ares_channel channel)
1381
1380
switch (error ) {
1382
1381
case ENOENT :
1383
1382
case ESRCH :
1383
+ status = ARES_EOF ;
1384
1384
break ;
1385
1385
default :
1386
1386
DEBUGF (fprintf (stderr , "fopen() failed with error: %d %s\n" ,
1387
1387
error , strerror (error )));
1388
1388
DEBUGF (fprintf (stderr , "Error opening file: %s\n" , "/etc/svc.conf" ));
1389
+ status = ARES_EFILE ;
1389
1390
}
1390
-
1391
- /* ignore error, default value will be chosen for `channel->lookups` */
1392
- status = ARES_EOF ;
1393
1391
}
1394
1392
}
1395
1393
@@ -1593,15 +1591,11 @@ static int config_domain(ares_channel channel, char *str)
1593
1591
#endif
1594
1592
1595
1593
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 )
1598
1595
{
1599
1596
char lookups [3 ], * l ;
1600
1597
const char * vqualifier p ;
1601
1598
1602
- if (altbindch == NULL )
1603
- altbindch = bindch ;
1604
-
1605
1599
/* Set the lookup order. Only the first letter of each work
1606
1600
* is relevant, and it has to be "b" for DNS or "f" for the
1607
1601
* host file. Ignore everything else.
@@ -1610,8 +1604,8 @@ static int config_lookup(ares_channel channel, const char *str,
1610
1604
p = str ;
1611
1605
while (* p )
1612
1606
{
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' ;
1615
1609
else * l ++ = 'f' ;
1616
1610
}
1617
1611
while (* p && !ISSPACE (* p ) && (* p != ',' ))
@@ -2096,14 +2090,6 @@ void ares_set_socket_callback(ares_channel channel,
2096
2090
channel -> sock_create_cb_data = data ;
2097
2091
}
2098
2092
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
-
2107
2093
int ares_set_sortlist (ares_channel channel , const char * sortstr )
2108
2094
{
2109
2095
int nsort = 0 ;
0 commit comments