Commit 7457bbd8 authored by Bob Halley's avatar Bob Halley
Browse files

secroots is now a keytable; add trustedkeys keytable

parent f187c911
......@@ -83,7 +83,8 @@ struct dns_view {
dns_cache_t * cache;
dns_db_t * cachedb;
dns_db_t * hints;
dns_rbt_t * secroots;
dns_keytable_t * secroots;
dns_keytable_t * trustedkeys;
isc_mutex_t lock;
isc_rwlock_t conflock;
isc_boolean_t frozen;
......
......@@ -33,6 +33,7 @@
#include <dns/db.h>
#include <dns/events.h>
#include <dns/fixedname.h>
#include <dns/keytable.h>
#include <dns/peer.h>
#include <dns/rbt.h>
#include <dns/rdataset.h>
......@@ -96,14 +97,23 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
goto cleanup_rwlock;
}
view->secroots = NULL;
result = dns_rbt_create(mctx, NULL, NULL, &view->secroots);
result = dns_keytable_create(mctx, &view->secroots);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"dns_rbt_create() failed: %s",
"dns_keytable_create() failed: %s",
isc_result_totext(result));
result = ISC_R_UNEXPECTED;
goto cleanup_zt;
}
view->trustedkeys = NULL;
result = dns_keytable_create(mctx, &view->trustedkeys);
if (result != ISC_R_SUCCESS) {
UNEXPECTED_ERROR(__FILE__, __LINE__,
"dns_keytable_create() failed: %s",
isc_result_totext(result));
result = ISC_R_UNEXPECTED;
goto cleanup_secroots;
}
view->cache = NULL;
view->cachedb = NULL;
......@@ -120,7 +130,7 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
view->dynamickeys = NULL;
result = dns_tsigkeyring_create(view->mctx, &view->dynamickeys);
if (result != DNS_R_SUCCESS)
goto cleanup_secroots;
goto cleanup_trustedkeys;
view->peers = NULL;
result = dns_peerlist_new(view->mctx, &view->peers);
if (result != DNS_R_SUCCESS)
......@@ -141,8 +151,11 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
cleanup_dynkeys:
dns_tsigkeyring_destroy(&view->dynamickeys);
cleanup_trustedkeys:
dns_keytable_detach(&view->trustedkeys);
cleanup_secroots:
dns_rbt_destroy(&view->secroots);
dns_keytable_detach(&view->secroots);
cleanup_zt:
dns_zt_detach(&view->zonetable);
......@@ -209,7 +222,8 @@ destroy(dns_view_t *view) {
if (view->cache != NULL)
dns_cache_detach(&view->cache);
dns_zt_detach(&view->zonetable);
dns_rbt_destroy(&view->secroots);
dns_keytable_detach(&view->trustedkeys);
dns_keytable_detach(&view->secroots);
isc_mutex_destroy(&view->lock);
isc_mem_free(view->mctx, view->name);
isc_mem_put(view->mctx, view, sizeof *view);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment