Use hardcoded IPv4/IPv6 addresses for google-public-dns-a.google.com instead

of freefall.freebsd.org to unbreak the DNS tests

The address allocations for freefall.freebsd.org have changed in the past 4 years.
Use a more stable set of hardcoded addresses for now to make the tests succeed
reliably.

The hostname should be resolved dynamically instead of hardcoding the addresses in
the future. This is just a bandaid.

MFC after:	1 week
This commit is contained in:
Enji Cooper 2017-08-13 00:56:43 +00:00
parent 737fb907a7
commit 191d976f61

View file

@ -297,32 +297,26 @@ runtest(cap_channel_t *capdns)
freeaddrinfo(aic);
}
/*
* 8.8.178.135 is IPv4 address of freefall.freebsd.org
* as of 27 October 2013.
*/
inet_pton(AF_INET, "8.8.178.135", &ip4);
/* XXX: hardcoded addresses for "google-public-dns-a.google.com". */
#define GOOGLE_DNS_IPV4 "8.8.8.8"
#define GOOGLE_DNS_IPV6 "2001:4860:4860::8888"
inet_pton(AF_INET, GOOGLE_DNS_IPV4, &ip4);
hps = gethostbyaddr(&ip4, sizeof(ip4), AF_INET);
if (hps == NULL)
fprintf(stderr, "Unable to resolve %s.\n", "8.8.178.135");
fprintf(stderr, "Unable to resolve %s.\n", GOOGLE_DNS_IPV4);
hpc = cap_gethostbyaddr(capdns, &ip4, sizeof(ip4), AF_INET);
if (hostent_compare(hps, hpc))
result |= GETHOSTBYADDR_AF_INET;
/*
* 2001:1900:2254:206c::16:87 is IPv6 address of freefall.freebsd.org
* as of 27 October 2013.
*/
inet_pton(AF_INET6, "2001:1900:2254:206c::16:87", &ip6);
inet_pton(AF_INET6, GOOGLE_DNS_IPV6, &ip6);
hps = gethostbyaddr(&ip6, sizeof(ip6), AF_INET6);
if (hps == NULL) {
fprintf(stderr, "Unable to resolve %s.\n",
"2001:1900:2254:206c::16:87");
fprintf(stderr, "Unable to resolve %s.\n", GOOGLE_DNS_IPV6);
}
hpc = cap_gethostbyaddr(capdns, &ip6, sizeof(ip6), AF_INET6);
if (hostent_compare(hps, hpc))
result |= GETHOSTBYADDR_AF_INET6;
return (result);
}