rootns.c revision 63b0524b961b6dce1aa18488d7175ca4ee17778f
1fdd2470b625a58b57d0b155e6caf8c4fc0afe8aAutomatic Updater * Copyright (C) 2004, 2005, 2007, 2008, 2010, 2012-2015 Internet Systems Consortium, Inc. ("ISC")
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * Copyright (C) 1999-2002 Internet Software Consortium.
4a14ce5ba00ab7bc55c99ffdcf59c7a4ab902721Automatic Updater * Permission to use, copy, modify, and/or distribute this software for any
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * purpose with or without fee is hereby granted, provided that the above
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * copyright notice and this permission notice appear in all copies.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * PERFORMANCE OF THIS SOFTWARE.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews/* $Id: rootns.c,v 1.40.476.1 2012/02/07 00:44:14 each Exp $ */
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews#include <isc/string.h> /* Required for HP/UX (and others?) */
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsstatic char root_ns[] =
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"; Internet Root Nameservers\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"$TTL 518400\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews". 518400 IN NS A.ROOT-SERVERS.NET.\n"
e2e4d321999340802f77adaacd19c797d04b4b95Automatic Updater". 518400 IN NS B.ROOT-SERVERS.NET.\n"
e2e4d321999340802f77adaacd19c797d04b4b95Automatic Updater". 518400 IN NS C.ROOT-SERVERS.NET.\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews". 518400 IN NS D.ROOT-SERVERS.NET.\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews". 518400 IN NS E.ROOT-SERVERS.NET.\n"
e2e4d321999340802f77adaacd19c797d04b4b95Automatic Updater". 518400 IN NS F.ROOT-SERVERS.NET.\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews". 518400 IN NS G.ROOT-SERVERS.NET.\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews". 518400 IN NS H.ROOT-SERVERS.NET.\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews". 518400 IN NS I.ROOT-SERVERS.NET.\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews". 518400 IN NS J.ROOT-SERVERS.NET.\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews". 518400 IN NS K.ROOT-SERVERS.NET.\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews". 518400 IN NS L.ROOT-SERVERS.NET.\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews". 518400 IN NS M.ROOT-SERVERS.NET.\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"A.ROOT-SERVERS.NET. 3600000 IN A 198.41.0.4\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"A.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:503:BA3E::2:30\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"B.ROOT-SERVERS.NET. 3600000 IN A 192.228.79.201\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"C.ROOT-SERVERS.NET. 3600000 IN A 192.33.4.12\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"C.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:2::c\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"D.ROOT-SERVERS.NET. 3600000 IN A 199.7.91.13\n"
f6da30bb5447c23d880b09f601441e70c5313557Mark Andrews"D.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:2d::d\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"E.ROOT-SERVERS.NET. 3600000 IN A 192.203.230.10\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"F.ROOT-SERVERS.NET. 3600000 IN A 192.5.5.241\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"F.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:2F::F\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"G.ROOT-SERVERS.NET. 3600000 IN A 192.112.36.4\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"H.ROOT-SERVERS.NET. 3600000 IN A 128.63.2.53\n"
e2e4d321999340802f77adaacd19c797d04b4b95Automatic Updater"H.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:500:1::803F:235\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"I.ROOT-SERVERS.NET. 3600000 IN A 192.36.148.17\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"I.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:7fe::53\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"J.ROOT-SERVERS.NET. 3600000 IN A 192.58.128.30\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"J.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:503:C27::2:30\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"K.ROOT-SERVERS.NET. 3600000 IN A 193.0.14.129\n"
f7b41fd9291b8f4dba27e2b57e1d93f0913a4f1dMark Andrews"K.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:7FD::1\n"
f7b41fd9291b8f4dba27e2b57e1d93f0913a4f1dMark Andrews"L.ROOT-SERVERS.NET. 3600000 IN A 199.7.83.42\n"
f7b41fd9291b8f4dba27e2b57e1d93f0913a4f1dMark Andrews"L.ROOT-SERVERS.NET. 604800 IN AAAA 2001:500:3::42\n"
f7b41fd9291b8f4dba27e2b57e1d93f0913a4f1dMark Andrews"M.ROOT-SERVERS.NET. 3600000 IN A 202.12.27.33\n"
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews"M.ROOT-SERVERS.NET. 3600000 IN AAAA 2001:DC3::35\n";
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsin_rootns(dns_rdataset_t *rootns, dns_name_t *name) {
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews result = dns_rdata_tostruct(&rdata, &ns, NULL);
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewscheck_node(dns_rdataset_t *rootns, dns_name_t *name,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews /*FALLTHROUGH*/
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews (void)dns_db_find(db, dns_rootname, NULL, dns_rdatatype_ns, 0,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews result = dns_db_createiterator(db, 0, &dbiter);
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews result = dns_dbiterator_current(dbiter, &node, name);
3b4098640dd85040270f39b9a5ee5e22de99d3d6Mark Andrews result = dns_db_allrdatasets(db, node, NULL, now, &rdsiter);
e2e4d321999340802f77adaacd19c797d04b4b95Automatic Updaterdns_rootns_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
e2e4d321999340802f77adaacd19c797d04b4b95Automatic Updater unsigned int len;
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews result = dns_db_create(mctx, "rbt", dns_rootname, dns_dbtype_zone,
3b4098640dd85040270f39b9a5ee5e22de99d3d6Mark Andrews * Load the hints from the specified filename.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews result = dns_master_loadfile(filename, &db->origin,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews * Default to using the Internet root servers.
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews result = dns_master_loadbuffer(&source, &db->origin,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews if (result == ISC_R_SUCCESS || result == DNS_R_SEENINCLUDE)
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews if (result != ISC_R_SUCCESS && result != DNS_R_SEENINCLUDE)
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews "extra data in root hints '%s'",
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL, DNS_LOGMODULE_HINTS,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews ISC_LOG_ERROR, "could not configure root hints from "
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews "'%s': %s", (filename != NULL) ? filename : "<BUILT-IN>",
e2e4d321999340802f77adaacd19c797d04b4b95Automatic Updaterreport(dns_view_t *view, dns_name_t *name, isc_boolean_t missing,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews char databuf[sizeof("xxxx:xxxx:xxxx:xxxx:xxxx:xxxx:123.123.123.123")];
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews dns_name_format(name, namebuf, sizeof(namebuf));
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews dns_rdatatype_format(rdata->type, typebuf, sizeof(typebuf));
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews isc_buffer_init(&buffer, databuf, sizeof(databuf) - 1);
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews result = dns_rdata_totext(rdata, NULL, &buffer);
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews databuf[isc_buffer_usedlength(&buffer)] = '\0';
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews "checkhints%s%s: %s/%s (%s) missing from hints",
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrews isc_log_write(dns_lctx, DNS_LOGCATEGORY_GENERAL,
4abdfc917e6635a7c81d1f931a0c79227e72d025Mark Andrews "checkhints%s%s: %s/%s (%s) extra record "
5a4557e8de2951a2796676b5ec4b6a90caa5be14Mark Andrewsinrrset(dns_rdataset_t *rrset, dns_rdata_t *rdata) {
return (ISC_TRUE);
return (ISC_FALSE);
goto cleanup;
goto cleanup;
namebuf);
goto cleanup;
goto cleanup;