the view now has a peer list
This commit is contained in:
@@ -224,6 +224,20 @@ configure_view(dns_view_t *view, dns_c_ctx_t *cctx, isc_mem_t *mctx,
|
||||
CHECK(dns_tsigkeyring_fromconfig(cctx, view->mctx, &ring));
|
||||
dns_view_setkeyring(view, ring);
|
||||
|
||||
/*
|
||||
* Configure the view's peer list.
|
||||
*/
|
||||
{
|
||||
dns_peerlist_t *newpeers = NULL;
|
||||
if (cctx->peers != NULL) {
|
||||
dns_peerlist_attach(cctx->peers, &newpeers);
|
||||
} else {
|
||||
CHECK(dns_peerlist_new(mctx, &newpeers));
|
||||
}
|
||||
dns_peerlist_detach(&view->peers);
|
||||
view->peers = newpeers; /* Transfer ownership. */
|
||||
}
|
||||
|
||||
cleanup:
|
||||
RWUNLOCK(&view->conflock, isc_rwlocktype_write);
|
||||
|
||||
|
||||
@@ -93,6 +93,7 @@ struct dns_view {
|
||||
/* Configurable data, locked by conflock. */
|
||||
dns_tsig_keyring_t * statickeys;
|
||||
dns_tsig_keyring_t * dynamickeys;
|
||||
dns_peerlist_t * peers;
|
||||
/* Locked by lock. */
|
||||
unsigned int references;
|
||||
unsigned int attributes;
|
||||
|
||||
@@ -33,6 +33,7 @@
|
||||
#include <dns/db.h>
|
||||
#include <dns/events.h>
|
||||
#include <dns/fixedname.h>
|
||||
#include <dns/peer.h>
|
||||
#include <dns/rbt.h>
|
||||
#include <dns/rdataset.h>
|
||||
#include <dns/resolver.h>
|
||||
@@ -120,6 +121,10 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
|
||||
result = dns_tsigkeyring_create(view->mctx, &view->dynamickeys);
|
||||
if (result != DNS_R_SUCCESS)
|
||||
goto cleanup_secroots;
|
||||
view->peers = NULL;
|
||||
result = dns_peerlist_new(view->mctx, &view->peers);
|
||||
if (result != DNS_R_SUCCESS)
|
||||
goto cleanup_dynkeys;
|
||||
ISC_LINK_INIT(view, link);
|
||||
ISC_EVENT_INIT(&view->resevent, sizeof view->resevent, 0, NULL,
|
||||
DNS_EVENT_VIEWRESSHUTDOWN, resolver_shutdown,
|
||||
@@ -133,6 +138,9 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
|
||||
|
||||
return (ISC_R_SUCCESS);
|
||||
|
||||
cleanup_dynkeys:
|
||||
dns_tsigkeyring_destroy(&view->dynamickeys);
|
||||
|
||||
cleanup_secroots:
|
||||
dns_rbt_destroy(&view->secroots);
|
||||
|
||||
@@ -182,6 +190,8 @@ destroy(dns_view_t *view) {
|
||||
REQUIRE(RESSHUTDOWN(view));
|
||||
REQUIRE(ADBSHUTDOWN(view));
|
||||
|
||||
if (view->peers != NULL)
|
||||
dns_peerlist_detach(&view->peers);
|
||||
if (view->dynamickeys != NULL)
|
||||
dns_tsigkeyring_destroy(&view->dynamickeys);
|
||||
if (view->statickeys != NULL)
|
||||
|
||||
Reference in New Issue
Block a user