rootns.c revision 7dbeb5e7f067585abfb12fac314a0d2a8f0dd040
/*
* Copyright (C) 1999-2002, 2004, 2005, 2007, 2008, 2010, 2012-2017 Internet Systems Consortium, Inc. ("ISC")
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
/* $Id: rootns.c,v 1.40.476.1 2012/02/07 00:44:14 each Exp $ */
/*! \file */
#include <config.h>
#include <dns/callbacks.h>
#include <dns/dbiterator.h>
#include <dns/fixedname.h>
#include <dns/rdataset.h>
#include <dns/rdatasetiter.h>
#include <dns/rdatastruct.h>
#include <dns/rdatatype.h>
static char root_ns[] =
";\n"
"; Internet Root Nameservers\n"
";\n"
"$TTL 518400\n"
". 518400 IN NS A.ROOT-SERVERS.NET.\n"
". 518400 IN NS B.ROOT-SERVERS.NET.\n"
". 518400 IN NS C.ROOT-SERVERS.NET.\n"
". 518400 IN NS D.ROOT-SERVERS.NET.\n"
". 518400 IN NS E.ROOT-SERVERS.NET.\n"
". 518400 IN NS F.ROOT-SERVERS.NET.\n"
". 518400 IN NS G.ROOT-SERVERS.NET.\n"
". 518400 IN NS H.ROOT-SERVERS.NET.\n"
". 518400 IN NS I.ROOT-SERVERS.NET.\n"
". 518400 IN NS J.ROOT-SERVERS.NET.\n"
". 518400 IN NS K.ROOT-SERVERS.NET.\n"
". 518400 IN NS L.ROOT-SERVERS.NET.\n"
". 518400 IN NS M.ROOT-SERVERS.NET.\n"
"A.ROOT-SERVERS.NET. 3600000 IN A 198.41.0.4\n"
"A.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:503:BA3E::2:30\n"
"B.ROOT-SERVERS.NET. 3600000 IN A 192.228.79.201\n"
"B.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:200::b\n"
"C.ROOT-SERVERS.NET. 3600000 IN A 192.33.4.12\n"
"C.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:2::c\n"
"D.ROOT-SERVERS.NET. 3600000 IN A 199.7.91.13\n"
"D.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:2d::d\n"
"E.ROOT-SERVERS.NET. 3600000 IN A 192.203.230.10\n"
"E.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:a8::e\n"
"F.ROOT-SERVERS.NET. 3600000 IN A 192.5.5.241\n"
"F.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:2F::F\n"
"G.ROOT-SERVERS.NET. 3600000 IN A 192.112.36.4\n"
"G.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:12::d0d\n"
"H.ROOT-SERVERS.NET. 3600000 IN A 198.97.190.53\n"
"H.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:1::53\n"
"I.ROOT-SERVERS.NET. 3600000 IN A 192.36.148.17\n"
"I.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:7fe::53\n"
"J.ROOT-SERVERS.NET. 3600000 IN A 192.58.128.30\n"
"J.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:503:C27::2:30\n"
"K.ROOT-SERVERS.NET. 3600000 IN A 193.0.14.129\n"
"K.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:7FD::1\n"
"L.ROOT-SERVERS.NET. 3600000 IN A 199.7.83.42\n"
"L.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:9f::42\n"
"M.ROOT-SERVERS.NET. 3600000 IN A 202.12.27.33\n"
"M.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:DC3::35\n";
static isc_result_t
if (!dns_rdataset_isassociated(rootns))
return (ISC_R_NOTFOUND);
while (result == ISC_R_SUCCESS) {
if (result != ISC_R_SUCCESS)
return (result);
return (ISC_R_SUCCESS);
}
if (result == ISC_R_NOMORE)
return (result);
}
static isc_result_t
while (result == ISC_R_SUCCESS) {
case dns_rdatatype_a:
case dns_rdatatype_aaaa:
if (result != ISC_R_SUCCESS)
goto cleanup;
break;
case dns_rdatatype_ns:
break;
/* FALLTHROUGH */
default:
goto cleanup;
}
}
if (result == ISC_R_NOMORE)
return (result);
}
static isc_result_t
if (result != ISC_R_SUCCESS)
goto cleanup;
while (result == ISC_R_SUCCESS) {
if (result != ISC_R_SUCCESS)
goto cleanup;
if (result != ISC_R_SUCCESS)
goto cleanup;
if (result != ISC_R_SUCCESS)
goto cleanup;
}
if (result == ISC_R_NOMORE)
if (dns_rdataset_isassociated(&rootns))
return (result);
}
{
unsigned int len;
if (result != ISC_R_SUCCESS)
goto failure;
if (result != ISC_R_SUCCESS)
goto failure;
/*
* Load the hints from the specified filename.
*/
} else if (rdclass == dns_rdataclass_in) {
/*
* Default to using the Internet root servers.
*/
} else
goto failure;
"extra data in root hints '%s'",
return (ISC_R_SUCCESS);
ISC_LOG_ERROR, "could not configure root hints from "
dns_db_detach(&db);
return (result);
}
static void
{
char namebuf[DNS_NAME_FORMATSIZE];
char typebuf[DNS_RDATATYPE_FORMATSIZE];
char databuf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:123.123.123.123")];
sep = ": view ";
}
if (missing)
"checkhints%s%s: %s/%s (%s) missing from hints",
else
"checkhints%s%s: %s/%s (%s) extra record "
databuf);
}
static isc_boolean_t
while (result == ISC_R_SUCCESS) {
return (ISC_TRUE);
}
return (ISC_FALSE);
}
/*
* Check that the address RRsets match.
*
* Note we don't complain about missing glue records.
*/
static void
{
if (hresult == ISC_R_SUCCESS &&
while (result == ISC_R_SUCCESS) {
}
while (result == ISC_R_SUCCESS) {
}
}
if (hresult == ISC_R_NOTFOUND &&
while (result == ISC_R_SUCCESS) {
}
}
/*
* Check AAAA records.
*/
if (hresult == ISC_R_SUCCESS &&
while (result == ISC_R_SUCCESS) {
}
while (result == ISC_R_SUCCESS) {
}
}
if (hresult == ISC_R_NOTFOUND &&
while (result == ISC_R_SUCCESS) {
}
}
}
void
sep = ": view ";
}
if (result != ISC_R_SUCCESS) {
"checkhints%s%s: unable to get root NS rrset "
goto cleanup;
}
if (result != ISC_R_SUCCESS) {
"checkhints%s%s: unable to get root NS rrset "
goto cleanup;
}
/*
* Look for missing root NS names.
*/
while (result == ISC_R_SUCCESS) {
if (result != ISC_R_SUCCESS) {
char namebuf[DNS_NAME_FORMATSIZE];
/* missing from hints */
"checkhints%s%s: unable to find root "
namebuf);
} else
}
if (result != ISC_R_NOMORE) {
goto cleanup;
}
/*
* Look for extra root NS names.
*/
while (result == ISC_R_SUCCESS) {
if (result != ISC_R_SUCCESS) {
char namebuf[DNS_NAME_FORMATSIZE];
/* extra entry in hints */
"checkhints%s%s: extra NS '%s' in hints",
}
}
if (result != ISC_R_NOMORE) {
goto cleanup;
}
if (dns_rdataset_isassociated(&rootns))
if (dns_rdataset_isassociated(&hintns))
}