Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
Ignore rogue DNS servers reported by windows
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Oct 20, 2011
1 parent 51e9dbc commit d6cf655
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/ares/ares_init.c
Expand Up @@ -696,17 +696,22 @@ static int get_iphlpapi_dns_info (char *ret_buf, size_t ret_size)
struct sockaddr_in6 *pIPv6Addr = ( struct sockaddr_in6 * ) pGenericAddr;
ares_inet_ntop( AF_INET6, &pIPv6Addr->sin6_addr, ret, ipv6_size - 1 ); /* -1 for comma */

stringlen = strlen( ret );

/* Windows apparently always reports some IPv6 DNS servers that
prefixed with fec0:0:0:ffff. These ususally do not point to
working DNS servers, we we ignore them. */
if (strncmp(ret, "fec0:0:0:ffff:", 14) == 0) {
continue;
}

/* Append a comma to the end, THEN NULL. Should be OK because we
already tested the size at the top of the if statement. */
stringlen = strlen( ret );
ret[ stringlen ] = ',';
ret[ stringlen + 1 ] = '\0';
ret += stringlen + 1;
left -= ret - ret_buf;
++count;

/* NB on Windows this also returns stuff in the fec0::/10 range,
seems to be hard-coded somehow. Do we need to ignore them? */
}
}
}
Expand Down

0 comments on commit d6cf655

Please sign in to comment.