@@ -90,8 +90,7 @@ static void natural_mask(struct apattern *pat);
9090 !defined(ANDROID ) && !defined(__ANDROID__ ) && !defined(CARES_USE_LIBRESOLV )
9191static int config_domain (ares_channel channel , char * str );
9292static 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 );
9594static 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
15951593static 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-
21072093int ares_set_sortlist (ares_channel channel , const char * sortstr )
21082094{
21092095 int nsort = 0 ;
0 commit comments