summaryrefslogtreecommitdiff
path: root/lib/dns/view.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/dns/view.c')
-rw-r--r--lib/dns/view.c37
1 files changed, 23 insertions, 14 deletions
diff --git a/lib/dns/view.c b/lib/dns/view.c
index 30b87a01..b348ce54 100644
--- a/lib/dns/view.c
+++ b/lib/dns/view.c
@@ -142,6 +142,9 @@ dns_view_create(isc_mem_t *mctx, dns_rdataclass_t rdclass,
view->recursionacl = NULL;
view->requestixfr = ISC_TRUE;
view->provideixfr = ISC_TRUE;
+ view->maxcachettl = 7 * 24 * 3600;
+ view->maxncachettl = 3 * 3600;
+ view->dstport = 53;
result = dns_peerlist_new(view->mctx, &view->peers);
if (result != ISC_R_SUCCESS)
@@ -449,11 +452,11 @@ dns_view_createresolver(dns_view_t *view,
view->attributes &= ~DNS_VIEWATTR_ADBSHUTDOWN;
result = dns_requestmgr_create(view->mctx, timermgr, socketmgr,
- dns_resolver_taskmgr(view->resolver),
- dns_resolver_dispatchmgr(view->resolver),
- dns_resolver_dispatchv4(view->resolver),
- dns_resolver_dispatchv6(view->resolver),
- &view->requestmgr);
+ dns_resolver_taskmgr(view->resolver),
+ dns_resolver_dispatchmgr(view->resolver),
+ dns_resolver_dispatchv4(view->resolver),
+ dns_resolver_dispatchv6(view->resolver),
+ &view->requestmgr);
if (result != ISC_R_SUCCESS) {
dns_adb_shutdown(view->adb);
dns_resolver_shutdown(view->resolver);
@@ -512,6 +515,12 @@ dns_view_setkeyring(dns_view_t *view, dns_tsig_keyring_t *ring) {
view->statickeys = ring;
}
+void
+dns_view_setdstport(dns_view_t *view, in_port_t dstport) {
+ REQUIRE(DNS_VIEW_VALID(view));
+ view->dstport = dstport;
+}
+
isc_result_t
dns_view_addzone(dns_view_t *view, dns_zone_t *zone) {
isc_result_t result;
@@ -568,7 +577,7 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
{
isc_result_t result;
dns_db_t *db;
- isc_boolean_t is_zone;
+ isc_boolean_t is_cache;
dns_rdataset_t zrdataset, zsigrdataset;
dns_zone_t *zone;
@@ -604,7 +613,7 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
else
goto cleanup;
- is_zone = dns_db_iszone(db);
+ is_cache = dns_db_iscache(db);
db_find:
/*
@@ -620,13 +629,13 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
if (sigrdataset != NULL &&
dns_rdataset_isassociated(sigrdataset))
dns_rdataset_disassociate(sigrdataset);
- if (is_zone) {
+ if (!is_cache) {
if (view->cachedb != NULL) {
/*
* Either the answer is in the cache, or we
* don't know it.
*/
- is_zone = ISC_FALSE;
+ is_cache = ISC_TRUE;
dns_db_detach(&db);
dns_db_attach(view->cachedb, &db);
goto db_find;
@@ -656,7 +665,7 @@ dns_view_find(dns_view_t *view, dns_name_t *name, dns_rdatatype_t type,
* We found an answer, but the cache may be better.
* Remember what we've got and go look in the cache.
*/
- is_zone = ISC_FALSE;
+ is_cache = ISC_TRUE;
dns_rdataset_clone(rdataset, &zrdataset);
dns_rdataset_disassociate(rdataset);
if (sigrdataset != NULL &&
@@ -771,7 +780,7 @@ dns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
{
isc_result_t result;
dns_db_t *db;
- isc_boolean_t is_zone, use_zone, try_hints;
+ isc_boolean_t is_cache, use_zone, try_hints;
dns_zone_t *zone;
dns_name_t *zfname;
dns_rdataset_t zrdataset, zsigrdataset;
@@ -827,13 +836,13 @@ dns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
*/
goto cleanup;
}
- is_zone = dns_db_iszone(db);
+ is_cache = dns_db_iscache(db);
db_find:
/*
* Look for the zonecut.
*/
- if (is_zone) {
+ if (!is_cache) {
result = dns_db_find(db, name, NULL, dns_rdatatype_ns, options,
now, NULL, fname, rdataset, sigrdataset);
if (result == DNS_R_DELEGATION)
@@ -858,7 +867,7 @@ dns_view_findzonecut(dns_view_t *view, dns_name_t *name, dns_name_t *fname,
}
dns_db_detach(&db);
dns_db_attach(view->cachedb, &db);
- is_zone = ISC_FALSE;
+ is_cache = ISC_TRUE;
goto db_find;
}
} else {