From 66e2dd5001f249bc5e2c89074df41f769f13bf07 Mon Sep 17 00:00:00 2001 From: Andreas Gustafsson Date: Thu, 6 Apr 2000 20:25:48 +0000 Subject: [PATCH] wired up view options: recursion, auth-nxdomain, transfer-format --- bin/named/query.c | 2 +- bin/named/server.c | 23 +++++++++++++++-------- bin/named/xfrout.c | 4 ++-- lib/dns/include/dns/view.h | 4 ++++ lib/dns/view.c | 6 ++++++ 5 files changed, 28 insertions(+), 11 deletions(-) diff --git a/bin/named/query.c b/bin/named/query.c index 0ffabb7a7f..50d8e195fc 100644 --- a/bin/named/query.c +++ b/bin/named/query.c @@ -2607,7 +2607,7 @@ query_find(ns_client_t *client, dns_fetchevent_t *event) { * response. */ if (client->message->rcode == dns_rcode_nxdomain && - ns_g_server->auth_nxdomain == ISC_TRUE) + client->view->auth_nxdomain == ISC_TRUE) client->message->flags |= DNS_MESSAGEFLAG_AA; ns_client_send(client); diff --git a/bin/named/server.c b/bin/named/server.c index 86c465886e..1e40918456 100644 --- a/bin/named/server.c +++ b/bin/named/server.c @@ -340,6 +340,21 @@ configure_view(dns_view_t *view, dns_c_ctx_t *cctx, dns_c_view_t *cview, dns_c_view_getmatchclients, NULL, &view->matchclients)); + /* + * Configure other configurable data. + */ + view->recursion = ISC_TRUE; + (void) dns_c_ctx_getrecursion(cctx, &view->recursion); + (void) dns_c_view_getrecursion(cview, &view->recursion); + + view->auth_nxdomain = ISC_FALSE; /* Was true in BIND 8 */ + (void) dns_c_ctx_getauthnxdomain(cctx, &view->auth_nxdomain); + (void) dns_c_view_getauthnxdomain(cview, &view->auth_nxdomain); + + view->transfer_format = dns_one_answer; + (void) dns_c_ctx_gettransferformat(cctx, &view->transfer_format); + (void) dns_c_view_gettransferformat(cview, &view->transfer_format); + cleanup: RWUNLOCK(&view->conflock, isc_rwlocktype_write); @@ -943,11 +958,6 @@ load_configuration(const char *filename, ns_server_t *server, /* * Configure various server options. */ - (void) dns_c_ctx_getrecursion(configctx, &server->recursion); - (void) dns_c_ctx_getauthnxdomain(configctx, &server->auth_nxdomain); - (void) dns_c_ctx_gettransferformat(configctx, - &server->transfer_format); - CHECK(configure_server_acl(configctx, &aclconfctx, ns_g_mctx, dns_c_ctx_getallowquery, &server->queryacl)); @@ -1286,9 +1296,6 @@ ns_server_create(isc_mem_t *mctx, ns_server_t **serverp) { "initializing server configuration lock"); /* Initialize configuration data with default values. */ - server->recursion = ISC_TRUE; - server->auth_nxdomain = ISC_FALSE; /* Was true in BIND 8 */ - server->transfer_format = dns_one_answer; server->queryacl = NULL; server->recursionacl = NULL; diff --git a/bin/named/xfrout.c b/bin/named/xfrout.c index 65c50b407f..8b1be11c1e 100644 --- a/bin/named/xfrout.c +++ b/bin/named/xfrout.c @@ -15,7 +15,7 @@ * SOFTWARE. */ -/* $Id: xfrout.c,v 1.51 2000/04/04 19:14:05 gson Exp $ */ +/* $Id: xfrout.c,v 1.52 2000/04/06 20:25:48 gson Exp $ */ #include @@ -805,7 +805,7 @@ ns_xfr_start(ns_client_t *client, dns_rdatatype_t reqtype) dns_message_t *request = client->message; xfrout_ctx_t *xfr = NULL; isc_quota_t *quota = NULL; - dns_transfer_format_t format = ns_g_server->transfer_format; + dns_transfer_format_t format = client->view->transfer_format; isc_netaddr_t na; dns_peer_t *peer = NULL; diff --git a/lib/dns/include/dns/view.h b/lib/dns/include/dns/view.h index dc11eb6f62..f2aaf9a048 100644 --- a/lib/dns/include/dns/view.h +++ b/lib/dns/include/dns/view.h @@ -95,6 +95,10 @@ struct dns_view { dns_tsig_keyring_t * statickeys; dns_tsig_keyring_t * dynamickeys; dns_peerlist_t * peers; + isc_boolean_t recursion; + isc_boolean_t auth_nxdomain; + dns_transfer_format_t transfer_format; + /* * Configurable data for server use only, * locked by server configuration lock. diff --git a/lib/dns/view.c b/lib/dns/view.c index c09dfcc162..be26aea9ed 100644 --- a/lib/dns/view.c +++ b/lib/dns/view.c @@ -134,6 +134,12 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass, if (result != DNS_R_SUCCESS) goto cleanup_trustedkeys; view->peers = NULL; + + /* Initialize configuration data with default values. */ + view->recursion = ISC_TRUE; + view->auth_nxdomain = ISC_FALSE; /* Was true in BIND 8 */ + view->transfer_format = dns_one_answer; + result = dns_peerlist_new(view->mctx, &view->peers); if (result != DNS_R_SUCCESS) goto cleanup_dynkeys;