Lines Matching refs:view
93 #include <dns/view.h>
237 struct viewlistentry *view;
247 dns_view_t *view;
258 * Configuration context to retain for each view that allows
273 * specified in 'view'. Maybe called by delete_zoneconf().
275 typedef isc_result_t (*nzfwriter_t)(const cfg_obj_t *config, dns_view_t *view);
280 * with pending zone loads, dereferencing as each view finishes.
296 dns_view_t *view;
435 configure_forward(const cfg_obj_t *config, dns_view_t *view, dns_name_t *origin,
439 configure_alternates(const cfg_obj_t *config, dns_view_t *view,
444 const cfg_obj_t *vconfig, isc_mem_t *mctx, dns_view_t *view,
450 configure_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
454 add_keydata_zone(dns_view_t *view, const char *directory, isc_mem_t *mctx);
479 migrate_nzf(dns_view_t *view);
482 nzd_writable(dns_view_t *view);
485 nzd_open(dns_view_t *view, unsigned int flags, MDB_txn **txnp, MDB_dbi *dbi);
488 nzd_env_reopen(dns_view_t *view);
491 nzd_env_close(dns_view_t *view);
497 nzd_count(dns_view_t *view, int *countp);
500 nzf_append(dns_view_t *view, const cfg_obj_t *zconfig);
504 * Configure a single view ACL at '*aclp'. Get its configuration from
505 * 'vconfig' (for per-view configuration) and maybe from 'config'
811 dns_view_t *view, isc_boolean_t managed,
820 CHECK(dns_view_getsecroots(view, &secroots));
868 keyloaded(dns_view_t *view, dns_name_t *name) {
873 result = dns_view_getsecroots(view, &secroots);
888 * Configure DNSSEC keys for a view.
890 * The per-view configuration values and the server-global defaults are read
894 configure_view_dnsseckeys(dns_view_t *view, const cfg_obj_t *vconfig,
911 /* We don't need trust anchors for the _bind view */
912 if (strcmp(view->name, "_bind") == 0 &&
913 view->rdclass == dns_rdataclass_chaos) {
940 result = dns_view_initsecroots(view, mctx);
948 result = dns_view_initntatable(view, ns_g_taskmgr, ns_g_timermgr);
956 if (auto_root && view->rdclass == dns_rdataclass_in) {
967 "obtaining root key for view %s "
969 view->name, ns_g_server->bindkeysfile);
992 "using built-in root key for view %s",
993 view->name);
1002 CHECK(load_view_keys(builtin_keys, vconfig, view,
1006 view, ISC_TRUE, dns_rootname,
1009 if (!keyloaded(view, dns_rootname)) {
1018 CHECK(load_view_keys(view_keys, vconfig, view, ISC_FALSE,
1020 CHECK(load_view_keys(view_managed_keys, vconfig, view, ISC_TRUE,
1023 if (view->rdclass == dns_rdataclass_in) {
1024 CHECK(load_view_keys(global_keys, vconfig, view, ISC_FALSE,
1026 CHECK(load_view_keys(global_managed_keys, vconfig, view,
1079 CHECK(add_keydata_zone(view, directory, ns_g_mctx));
1118 * Get a dispatch appropriate for the resolver of a given view.
1685 cache_reusable(dns_view_t *originview, dns_view_t *view,
1688 if (originview->rdclass != view->rdclass ||
1689 originview->checknames != view->checknames ||
1692 originview->acceptexpired != view->acceptexpired ||
1693 originview->enablevalidation != view->enablevalidation ||
1694 originview->maxcachettl != view->maxcachettl ||
1695 originview->maxncachettl != view->maxncachettl) {
1703 cache_sharable(dns_view_t *originview, dns_view_t *view,
1709 * If the cache cannot even reused for the same view, it cannot be
1712 if (!cache_reusable(originview, view, new_zero_no_soattl))
1732 dlzconfigure_callback(dns_view_t *view, dns_dlzdb_t *dlzdb, dns_zone_t *zone) {
1734 dns_rdataclass_t zclass = view->rdclass;
1746 dns64_reverse(dns_view_t *view, isc_mem_t *mctx, isc_netaddr_t *na,
1753 const char *sep = ": view ";
1754 const char *viewname = view->name;
1797 dns_zone_setview(zone, view);
1799 dns_zone_setclass(zone, view->rdclass);
1803 if (view->queryacl != NULL)
1804 dns_zone_setqueryacl(zone, view->queryacl);
1805 if (view->queryonacl != NULL)
1806 dns_zone_setqueryonacl(zone, view->queryonacl);
1811 CHECK(dns_view_addzone(view, zone));
1823 configure_rpz_name(dns_view_t *view, const cfg_obj_t *obj, dns_name_t *name,
1828 result = dns_name_fromstring(name, str, DNS_NAME_DOWNCASE, view->mctx);
1836 configure_rpz_name2(dns_view_t *view, const cfg_obj_t *obj, dns_name_t *name,
1842 view->mctx);
1850 configure_rpz_zone(dns_view_t *view, const cfg_listelt_t *element,
1864 if (view->rpzs->p.num_zones >= DNS_RPZ_MAX_ZONES) {
1871 new = isc_mem_get(view->rpzs->mctx, sizeof(*new));
1881 isc_mem_put(view->rpzs->mctx, new, sizeof(*new));
1893 new->num = view->rpzs->p.num_zones++;
1894 view->rpzs->zones[new->num] = new;
1898 view->rpzs->p.no_rd_ok &= ~DNS_RPZ_ZBIT(new->num);
1900 view->rpzs->p.no_rd_ok |= DNS_RPZ_ZBIT(new->num);
1905 view->rpzs->p.no_log |= DNS_RPZ_ZBIT(new->num);
1907 view->rpzs->p.no_log &= ~DNS_RPZ_ZBIT(new->num);
1920 result = configure_rpz_name(view, rpz_obj, &new->origin, str, "zone");
1928 for (rpz_num = 0; rpz_num < view->rpzs->p.num_zones-1; ++rpz_num) {
1929 if (dns_name_equal(&view->rpzs->zones[rpz_num]->origin,
1940 result = configure_rpz_name2(view, rpz_obj, &new->client_ip,
1945 result = configure_rpz_name2(view, rpz_obj, &new->ip,
1950 result = configure_rpz_name2(view, rpz_obj, &new->nsdname,
1955 result = configure_rpz_name2(view, rpz_obj, &new->nsip,
1960 result = configure_rpz_name(view, rpz_obj, &new->passthru,
1965 result = configure_rpz_name(view, rpz_obj, &new->drop,
1970 result = configure_rpz_name(view, rpz_obj, &new->tcp_only,
1984 result = configure_rpz_name(view, rpz_obj, &new->cname,
1998 configure_rpz(dns_view_t *view, const cfg_obj_t *rpz_obj,
2018 result = dns_rpz_new_zones(&view->rpzs, view->mctx);
2021 new = view->rpzs;
2063 view->name, view->rdclass, &pview);
2084 result = configure_rpz_zone(view, zone_element,
2102 dns_rpz_detach_rpzs(&view->rpzs);
2103 dns_rpz_attach_rpzs(pview->rpzs, &view->rpzs);
2106 view->rpzs->rpz_ver = pview->rpzs->rpz_ver;
2109 view->rpzs->rpz_ver);
2131 cfg = (ns_cfgctx_t *) ev->view->new_zone_config;
2145 result = dns_zt_find(ev->view->zonetable,
2223 /* Mark view unfrozen so that zone can be added */
2227 dns_view_thaw(ev->view);
2229 ev->cbd->server->mctx, ev->view,
2232 dns_view_freeze(ev->view);
2244 CHECK(dns_zt_find(ev->view->zonetable,
2267 dns_zt_unmount(ev->view->zonetable, zone);
2282 dns_view_detach(&ev->view);
2300 result = dns_zt_find(ev->view->zonetable,
2334 CHECK(dns_zt_unmount(ev->view->zonetable, zone));
2349 dns_view_detach(&ev->view);
2355 dns_view_t *view, isc_taskmgr_t *taskmgr, void *udata,
2375 event = (catz_chgzone_event_t *) isc_event_allocate(view->mctx, origin,
2384 event->view = NULL;
2388 dns_view_attach(view, &event->view);
2401 dns_view_t *view, isc_taskmgr_t *taskmgr, void *udata)
2403 return (catz_create_chg_task(entry, origin, view, taskmgr, udata,
2409 dns_view_t *view, isc_taskmgr_t *taskmgr, void *udata)
2411 return (catz_create_chg_task(entry, origin, view, taskmgr, udata,
2417 dns_view_t *view, isc_taskmgr_t *taskmgr, void *udata)
2419 return (catz_create_chg_task(entry, origin, view, taskmgr, udata,
2424 configure_catz_zone(dns_view_t *view, const cfg_obj_t *config,
2441 view->mctx);
2451 result = dns_catz_add_zone(view->catzs, &origin, &zone);
2464 view->name,
2465 view->rdclass, &pview);
2476 * them to current view
2500 dns_zone_setview(dnszone, view);
2501 if (view->acache != NULL)
2502 dns_zone_setacache(dnszone, view->acache);
2503 dns_view_addzone(view, dnszone);
2526 view->mctx, &opts->masters);
2534 opts->zonedir = isc_mem_strdup(view->mctx,
2552 dns_name_free(&origin, view->mctx);
2566 configure_catz(dns_view_t *view, const cfg_obj_t *config,
2581 CHECK(dns_catz_new_zones(&view->catzs, &ns_catz_zonemodmethods,
2582 view->mctx, ns_g_taskmgr, ns_g_timermgr));
2584 result = dns_viewlist_find(&ns_g_server->viewlist, view->name,
2585 view->rdclass, &pview);
2590 dns_catz_catzs_detach(&view->catzs);
2591 dns_catz_catzs_attach(pview->catzs, &view->catzs);
2592 dns_catz_prereconfig(view->catzs);
2596 CHECK(configure_catz_zone(view, config, zone_element));
2601 dns_catz_postreconfig(view->catzs);
2639 configure_rrl(dns_view_t *view, const cfg_obj_t *config, const cfg_obj_t *map) {
2659 result = dns_rrl_init(&rrl, view, min_entries);
2770 dns_rrl_view_destroy(view);
2846 create_empty_zone(dns_zone_t *zone, dns_name_t *name, dns_view_t *view,
2856 const char *sep = ": view ";
2858 const char *viewname = view->name;
2910 CHECK(dns_db_create(view->mctx, "rbt", name,
2911 dns_dbtype_zone, view->rdclass,
2942 result = check_dbtype(zone, typec, dbargv, view->mctx);
2967 dns_zone_setclass(zone, view->rdclass);
2977 if (view->queryacl != NULL)
2978 dns_zone_setqueryacl(zone, view->queryacl);
2981 if (view->queryonacl != NULL)
2982 dns_zone_setqueryonacl(zone, view->queryonacl);
2986 if (view->transferacl != NULL)
2987 dns_zone_setxfracl(zone, view->transferacl);
2991 CHECK(setquerystats(zone, view->mctx, statlevel));
2997 dns_zone_setview(zone, view);
2998 CHECK(dns_view_addzone(view, zone));
3024 configure_dnstap(const cfg_obj_t **maps, dns_view_t *view) {
3194 dns_dt_attach(ns_g_server->dtenv, &view->dtenv);
3195 view->dttypes = dttypes;
3229 * Configure 'view' according to 'vconfig', taking defaults from 'config'
3232 * When configuring the default view, 'vconfig' will be NULL and the
3236 configure_view(dns_view_t *view, dns_viewlist_t *viewlist,
3270 dns_view_t *pview = NULL; /* Production view */
3298 REQUIRE(DNS_VIEW_VALID(view));
3304 * maps: view options, options, defaults
3305 * cfgmaps: view options, config
3306 * optionmaps: view options, options
3327 * Set the view's port number for outgoing queries.
3330 dns_view_setdstport(view, port);
3333 * Create additional cache for this view and zones under the view
3342 CHECK(dns_acache_create(&view->acache, cmctx, ns_g_taskmgr,
3347 if (view->acache != NULL) {
3351 dns_acache_setcleaninginterval(view->acache,
3376 dns_acache_setcachesize(view->acache, max_acache_size);
3381 ns_g_mctx, &view->queryacl));
3384 * Make the list of response policy zone names for a view that
3388 if (view->rdclass == dns_rdataclass_in && need_hints &&
3390 CHECK(configure_rpz(view, obj, &old_rpz_ok));
3394 if (view->rdclass == dns_rdataclass_in && need_hints &&
3396 CHECK(configure_catz(view, config, obj));
3416 CHECK(configure_zone(config, zconfig, vconfig, mctx, view,
3426 CHECK(configure_newzones(view, config, vconfig, mctx, actx));
3480 result = dns_dlzconfigure(view, dlzdb,
3484 ISC_LIST_APPEND(view->dlz_searched,
3488 ISC_LIST_APPEND(view->dlz_unsearched,
3562 view->checknames = ISC_TRUE;
3565 view->checknames = ISC_FALSE;
3567 view->checknames = ISC_FALSE;
3578 if (result == ISC_R_SUCCESS && strcmp(view->name, "_bind") &&
3579 strcmp(view->name, "_meta")) {
3670 dns_dns64_append(&view->dns64, dns64);
3671 view->dns64cnt++;
3672 result = dns64_reverse(view, mctx, &na, prefixlen,
3688 view->acceptexpired = cfg_obj_asboolean(obj);
3694 view->enablevalidation = cfg_obj_asboolean(obj);
3697 view->enablevalidation = ISC_TRUE;
3704 view->maxcachettl = cfg_obj_asuint32(obj);
3709 view->maxncachettl = cfg_obj_asuint32(obj);
3710 if (view->maxncachettl > 7 * 24 * 3600)
3711 view->maxncachettl = 7 * 24 * 3600;
3714 * Configure the view's cache.
3717 * attempt to lookup an existing cache at attach it to the view. If
3723 * When a matching view is found, the associated statistics are also
3727 * When the view's configuration changes, the cached data may become
3728 * invalid because it reflects our old view of the world. We check
3731 * options that should be checked. For example, if a view uses a
3741 cachename = view->name;
3743 nsc = cachelist_find(cachelist, cachename, view->rdclass);
3745 if (!cache_sharable(nsc->primaryview, view, zero_no_soattl,
3751 nsc->primaryview->name, view->name);
3758 if (strcmp(cachename, view->name) == 0) {
3760 cachename, view->rdclass,
3765 if (!cache_reusable(pview, view,
3772 "for view %s due to "
3774 "mismatch", view->name);
3794 * equals the view name, but may also be a forward
3795 * reference to a view that share the cache with this
3796 * view but is not yet configured. If it is not the
3797 * view name but not a forward reference either, then it
3809 ns_g_timermgr, view->rdclass,
3822 nsc->primaryview = view;
3825 nsc->rdclass = view->rdclass;
3829 dns_view_setcache2(view, cache, shared_cache);
3837 if (result == ISC_R_SUCCESS && strcmp(view->name, "_bind") != 0) {
3854 ISC_TF(ISC_LIST_PREV(view, link)
3857 ISC_TF(ISC_LIST_PREV(view, link)
3871 dns_view_setresstats(view, resstats);
3874 dns_view_setresquerystats(view, resquerystats);
3877 CHECK(dns_view_createresolver(view, ns_g_taskmgr, RESOLVER_NTASKS,
3887 dns_resolver_setquerydscp4(view->resolver, dscp4);
3889 dns_resolver_setquerydscp6(view->resolver, dscp6);
3900 if (view != nsc->primaryview &&
3910 dns_adb_setadbsize(view->adb, max_adb_size);
3936 dns_resolver_setquotaresponse(view->resolver,
3956 dns_adb_setquota(view->adb, fps, freq, low, high, discount);
3968 dns_resolver_setlamettl(view->resolver, lame_ttl);
3977 dns_resolver_settimeout(view->resolver, query_timeout);
3980 dns_resolver_setzeronosoattl(view->resolver, zero_no_soattl);
3993 dns_resolver_setudpsize(view->resolver, (isc_uint16_t)udpsize);
4006 view->maxudp = udpsize;
4017 if (udpsize > view->maxudp)
4018 udpsize = view->maxudp;
4019 view->nocookieudp = udpsize;
4032 view->maxbits = maxbits;
4037 dns_resolver_reset_algorithms(view->resolver);
4045 view->resolver));
4051 dns_resolver_reset_ds_digests(view->resolver);
4059 view->resolver));
4063 * A global or view "forwarders" option, if present,
4071 CHECK(configure_forward(config, view, dns_rootname,
4080 CHECK(configure_alternates(config, view, alternates));
4085 if (view->rdclass == dns_rdataclass_in && view->hints == NULL)
4086 dns_view_sethints(view, ns_g_server->in_roothints);
4089 * If we still have no hints, this is a non-IN view with no
4095 if (view->hints == NULL) {
4097 (void)dns_view_findzone(view, dns_rootname, &rootzone);
4105 "no root hints for view '%s'",
4106 view->name);
4110 * Configure the view's TSIG keys.
4112 CHECK(ns_tsigkeyring_fromconfig(config, vconfig, view->mctx, &ring));
4117 dns_view_setkeyring(view, ring);
4123 result = dns_viewlist_find(&ns_g_server->viewlist, view->name,
4124 view->rdclass, &pview);
4130 dns_view_setdynamickeyring(view, ring);
4134 dns_view_restorekeyring(view);
4137 * Configure the view's peer list.
4156 dns_peerlist_detach(&view->peers);
4157 view->peers = newpeers; /* Transfer ownership. */
4176 if (view->order != NULL)
4177 dns_order_detach(&view->order);
4178 dns_order_attach(order, &view->order);
4184 dns_aclenv_copy(&view->aclenv, &ns_g_server->aclenv);
4188 * (These are only meaningful at the view level, but 'config'
4194 &view->matchclients));
4197 &view->matchdestinations));
4205 view->matchrecursiveonly = ISC_TRUE;
4207 view->matchrecursiveonly = ISC_FALSE;
4215 view->recursion = cfg_obj_asboolean(obj);
4220 view->auth_nxdomain = cfg_obj_asboolean(obj);
4225 view->minimal_any = cfg_obj_asboolean(obj);
4232 view->minimalresponses = dns_minimal_yes;
4234 view->minimalresponses = dns_minimal_no;
4238 view->minimalresponses = dns_minimal_noauth;
4240 view->minimalresponses = dns_minimal_noauthrec;
4250 view->transfer_format = dns_many_answers;
4252 view->transfer_format = dns_one_answer;
4259 view->trust_anchor_telemetry = cfg_obj_asboolean(obj);
4263 ns_g_mctx, &view->cacheonacl));
4271 view->additionalfromauth = cfg_obj_asboolean(obj);
4272 if (view->recursion && ! view->additionalfromauth) {
4276 view->additionalfromauth = ISC_TRUE;
4282 view->additionalfromcache = cfg_obj_asboolean(obj);
4283 if (view->recursion && ! view->additionalfromcache) {
4287 view->additionalfromcache = ISC_TRUE;
4295 * the options/view level.)
4298 NULL, actx, ns_g_mctx, &view->cacheacl));
4300 if (strcmp(view->name, "_bind") != 0 &&
4301 view->rdclass != dns_rdataclass_chaos)
4305 ns_g_mctx, &view->recursionacl));
4308 ns_g_mctx, &view->recursiononacl));
4311 if (view->recursion) {
4318 if (view->cacheacl == NULL) {
4319 if (view->recursionacl != NULL) {
4320 dns_acl_attach(view->recursionacl,
4321 &view->cacheacl);
4322 } else if (view->queryacl != NULL) {
4323 dns_acl_attach(view->queryacl,
4324 &view->cacheacl);
4327 if (view->recursionacl == NULL) {
4328 if (view->cacheacl != NULL) {
4329 dns_acl_attach(view->cacheacl,
4330 &view->recursionacl);
4331 } else if (view->queryacl != NULL) {
4332 dns_acl_attach(view->queryacl,
4333 &view->recursionacl);
4342 if (view->recursionacl == NULL) {
4346 &view->recursionacl));
4348 if (view->recursiononacl == NULL) {
4352 &view->recursiononacl));
4354 if (view->cacheacl == NULL) {
4358 &view->cacheacl));
4360 } else if (view->cacheacl == NULL) {
4363 * set at the options/view level, set it to none.
4365 CHECK(dns_acl_none(mctx, &view->cacheacl));
4375 ns_g_mctx, &view->nocasecompress));
4384 view->msgcompression = cfg_obj_asboolean(obj);
4392 &view->denyansweracl));
4395 &view->answeracl_exclude));
4402 &view->denyanswernames));
4405 &view->answernames_exclude));
4411 &view->sortlist));
4417 * options/view level.)
4419 if (view->notifyacl == NULL) {
4422 ns_g_mctx, &view->notifyacl));
4424 if (view->updateacl == NULL) {
4427 ns_g_mctx, &view->updateacl));
4429 if (view->upfwdacl == NULL) {
4432 ns_g_mctx, &view->upfwdacl));
4437 * by zones. (Note this *can* be set at options or view level.)
4439 if (view->transferacl == NULL) {
4442 ns_g_mctx, &view->transferacl));
4448 view->provideixfr = cfg_obj_asboolean(obj);
4453 view->requestnsid = cfg_obj_asboolean(obj);
4458 view->sendcookie = cfg_obj_asboolean(obj);
4463 view->requireservercookie = cfg_obj_asboolean(obj);
4468 view->v6bias = cfg_obj_asuint32(obj) * 1000;
4478 dns_resolver_setclientsperquery(view->resolver,
4485 dns_resolver_setmaxdepth(view->resolver, cfg_obj_asuint32(obj));
4490 dns_resolver_setmaxqueries(view->resolver, cfg_obj_asuint32(obj));
4496 dns_resolver_setfetchesperzone(view->resolver, cfg_obj_asuint32(obj2));
4509 dns_resolver_setquotaresponse(view->resolver,
4519 view->v4_aaaa = dns_aaaa_filter;
4521 view->v4_aaaa = dns_aaaa_ok;
4525 view->v4_aaaa = dns_aaaa_break_dnssec;
4535 view->v6_aaaa = dns_aaaa_filter;
4537 view->v6_aaaa = dns_aaaa_ok;
4541 view->v6_aaaa = dns_aaaa_break_dnssec;
4548 ns_g_mctx, &view->aaaa_acl));
4556 view->prefetch_trigger = cfg_obj_asuint32(trigger);
4557 if (view->prefetch_trigger > 10)
4558 view->prefetch_trigger = 10;
4573 view->prefetch_eligible = cfg_obj_asuint32(eligible);
4574 if (view->prefetch_eligible < view->prefetch_trigger + 6)
4575 view->prefetch_eligible = view->prefetch_trigger + 6;
4581 view->enablednssec = cfg_obj_asboolean(obj);
4619 dlv = dns_fixedname_name(&view->dlv_fixed);
4626 view->dlv = NULL;
4628 view->dlv = dlv;
4632 view->dlv = NULL;
4639 CHECK(configure_view_dnsseckeys(view, vconfig, config, bindkeys,
4641 dns_resolver_resetmustbesecure(view->resolver);
4645 CHECK(mustbesecure(obj, view->resolver));
4650 view->nta_recheck = cfg_obj_asuint32(obj);
4655 view->nta_lifetime = cfg_obj_asuint32(obj);
4662 view->preferred_glue = dns_rdatatype_a;
4664 view->preferred_glue = dns_rdatatype_aaaa;
4666 view->preferred_glue = 0;
4668 view->preferred_glue = 0;
4673 dns_view_setrootdelonly(view, ISC_TRUE);
4689 CHECK(dns_view_excludedelegationonly(view, name));
4692 dns_view_setrootdelonly(view, ISC_FALSE);
4713 ns_g_lctx, view,
4731 view->rdclass == dns_rdataclass_in) {
4732 empty_zones_enable = view->recursion;
4733 } else if (view->rdclass == dns_rdataclass_in) {
4737 empty_zones_enable = view->recursion;
4819 (void)dns_view_findzone(view, name, &zone);
4829 result = dns_fwdtable_find(view->fwdtable, name,
4839 view->name, view->rdclass,
4850 CHECK(create_empty_zone(zone, name, view, zonelist,
4861 result = configure_rrl(view, config, obj);
4875 dns_view_setfailttl(view, fail_ttl);
4883 dns_name_t *name = dns_fixedname_name(&view->redirectfixed);
4886 view->redirectzone = name;
4888 view->redirectzone = NULL;
4895 CHECK(configure_dnstap(maps, view));
4935 configure_hints(dns_view_t *view, const char *filename) {
4940 result = dns_rootns_create(view->mctx, view->rdclass, filename, &db);
4942 dns_view_sethints(view, db);
4950 configure_alternates(const cfg_obj_t *config, dns_view_t *view,
5018 CHECK(dns_resolver_addalternate(view->resolver, NULL,
5026 CHECK(dns_resolver_addalternate(view->resolver, &sa,
5035 configure_forward(const cfg_obj_t *config, dns_view_t *view, dns_name_t *origin,
5097 fwd = isc_mem_get(view->mctx, sizeof(dns_forwarder_t));
5132 result = dns_fwdtable_addfwd(view->fwdtable, origin, &fwdlist,
5150 isc_mem_put(view->mctx, fwd, sizeof(dns_forwarder_t));
5177 "view '%s': class must not be meta",
5194 * Find a view based on its configuration info and attach to it.
5196 * If 'vconfig' is NULL, attach to the default view.
5205 dns_view_t *view = NULL;
5211 result = dns_viewlist_find(viewlist, viewname, viewclass, &view);
5215 *viewp = view;
5220 * Create a new view and add it to the list.
5222 * If 'vconfig' is NULL, create the default view.
5224 * The view created is attached to '*viewp'.
5233 dns_view_t *view = NULL;
5239 result = dns_viewlist_find(viewlist, viewname, viewclass, &view);
5244 INSIST(view == NULL);
5246 result = dns_view_create(ns_g_mctx, viewclass, viewname, &view);
5250 result = isc_entropy_getdata(ns_g_entropy, view->secret,
5251 sizeof(view->secret), NULL, 0);
5253 dns_view_detach(&view);
5258 view->aclenv.geoip = ns_g_geoip;
5261 ISC_LIST_APPEND(*viewlist, view, link);
5262 dns_view_attach(view, viewp);
5271 const cfg_obj_t *vconfig, isc_mem_t *mctx, dns_view_t *view,
5276 dns_view_t *pview = NULL; /* Production view */
5316 view->rdclass, &zclass));
5317 if (zclass != view->rdclass) {
5323 vname = "<default view>";
5327 "zone '%s': wrong class for view '%s'",
5333 (void)cfg_map_get(zoptions, "in-view", &viewobj);
5340 "'in-view' option is not permitted in "
5346 result = dns_viewlist_find(viewlist, inview, view->rdclass,
5350 "view '%s' is not yet defined.", inview);
5359 "zone '%s' not defined in view '%s'",
5365 CHECK(dns_view_addzone(view, zone));
5371 * other view.
5378 CHECK(configure_forward(config, view, origin,
5411 CHECK(configure_hints(view, hintsfile));
5420 CHECK(dns_view_adddelegationonly(view, origin));
5442 CHECK(configure_forward(config, view, origin, forwarders,
5451 CHECK(dns_view_adddelegationonly(view, origin));
5459 result = dns_view_adddelegationonly(view, origin);
5467 if (view->redirect != NULL) {
5473 result = dns_viewlist_find(viewlist, view->name,
5474 view->rdclass, &pview);
5479 dns_zone_setview(zone, view);
5484 dns_zone_setview(zone, view);
5491 dns_zone_attach(zone, &view->redirect);
5499 result = dns_view_findzone(view, origin, &dupzone);
5517 if (view->rpzs == NULL || rpz_num >= view->rpzs->p.num_zones) {
5521 if (dns_name_equal(&view->rpzs->zones[rpz_num]->origin, origin))
5525 if (view->catzs != NULL &&
5526 dns_catz_get_zone(view->catzs, origin) != NULL)
5532 * - The zone's view exists
5533 * - A zone with the right name exists in the view
5541 result = dns_viewlist_find(&ns_g_server->viewlist, view->name,
5542 view->rdclass, &pview);
5560 * new view.
5562 dns_zone_setview(zone, view);
5563 if (view->acache != NULL)
5564 dns_zone_setacache(zone, view->acache);
5572 dns_zone_setview(zone, view);
5573 if (view->acache != NULL)
5574 dns_zone_setacache(zone, view->acache);
5579 result = dns_zone_rpz_enable(zone, view->rpzs, rpz_num);
5592 dns_zone_catz_enable(zone, view->catzs);
5603 CHECK(configure_forward(config, view, origin, forwarders,
5614 CHECK(dns_view_adddelegationonly(view, origin));
5632 dns_zone_setview(raw, view);
5633 if (view->acache != NULL)
5634 dns_zone_setacache(raw, view->acache);
5646 * Add the zone to its view in the new view list.
5649 CHECK(dns_view_addzone(view, zone));
5660 dns_catz_dbupdate_callback(db, view->catzs);
5688 add_keydata_zone(dns_view_t *view, const char *directory, isc_mem_t *mctx) {
5696 REQUIRE(view != NULL);
5700 view->name, view->rdclass,
5707 dns_zone_attach(pview->managed_keys, &view->managed_keys);
5708 dns_zone_setview(pview->managed_keys, view);
5710 dns_zone_synckeyzone(view->managed_keys);
5718 defaultview = ISC_TF(strcmp(view->name, "_default") == 0);
5720 defaultview ? "managed-keys" : view->name,
5725 dns_zone_setview(zone, view);
5727 dns_zone_setclass(zone, view->rdclass);
5731 if (view->acache != NULL)
5732 dns_zone_setacache(zone, view->acache);
5747 if (view->managed_keys != NULL)
5748 dns_zone_detach(&view->managed_keys);
5749 dns_zone_attach(zone, &view->managed_keys);
5753 "set up managed keys zone for view %s, file '%s'",
5754 view->name, filename);
5891 dns_view_t *view;
5900 for (view = ISC_LIST_HEAD(server->viewlist);
5901 view != NULL;
5902 view = ISC_LIST_NEXT(view, link)) {
5905 dispatch6 = dns_resolver_dispatchv6(view->resolver);
5935 * check if the corresponding view is in our current view list.
5937 * of shutting down and have detached from their old view
5943 for (view = ISC_LIST_HEAD(server->viewlist);
5944 view != NULL && view != zoneview;
5945 view = ISC_LIST_NEXT(view, link))
5947 if (view == NULL)
6009 dns_view_t *view;
6013 view = ISC_LIST_HEAD(server->viewlist);
6014 while (view != NULL) {
6015 dns_view_dialup(view);
6016 view = ISC_LIST_NEXT(view, link);
6068 dns_view_t *view;
6086 dns_view_t *view;
6094 view = dotat_arg->view;
6146 view->name, namebuf);
6148 tat = isc_mem_get(dotat_arg->view->mctx, sizeof(*tat));
6157 isc_mem_attach(dotat_arg->view->mctx, &tat->mctx);
6160 result = dns_resolver_createfetch(view->resolver, tatname,
6177 dns_view_t *view;
6182 for (view = ISC_LIST_HEAD(server->viewlist);
6183 view != NULL;
6184 view = ISC_LIST_NEXT(view, link))
6186 if (!view->trust_anchor_telemetry ||
6187 !view->enablevalidation)
6192 result = dns_view_getsecroots(view, &secroots);
6197 arg.view = view;
6590 count_newzones(dns_view_t *view, ns_cfgctx_t *nzcfg, int *num_zonesp) {
6594 if (!isc_file_exists(view->new_zone_file)) {
6607 result = cfg_parse_file(ns_g_addparser, view->new_zone_file,
6617 view->new_zone_file, num_zones);
6625 view->new_zone_file,
6635 count_newzones(dns_view_t *view, ns_cfgctx_t *nzcfg, int *num_zonesp) {
6643 CHECK(migrate_nzf(view));
6648 "for view '%s'",
6649 view->new_zone_db, view->name);
6651 CHECK(nzd_count(view, &n));
6659 view->new_zone_db, n);
6671 setup_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
6742 dns_view_setnewzones(view, ISC_FALSE, NULL, NULL, 0ULL);
6748 nzcfg = isc_mem_get(view->mctx, sizeof(*nzcfg));
6750 dns_view_setnewzones(view, ISC_FALSE, NULL, NULL, 0ULL);
6762 isc_mem_attach(view->mctx, &nzcfg->mctx);
6765 result = dns_view_setnewzones(view, allow, nzcfg,
6768 dns_view_setnewzones(view, ISC_FALSE, NULL, NULL, 0ULL);
6776 result = count_newzones(view, nzcfg, num_zones);
6782 dns_view_t *view)
6801 result2 = dns_viewlist_find(&ns_g_server->viewlist, view->name,
6802 view->rdclass, &pview);
6836 configure_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
6844 nzctx = view->new_zone_config;
6851 "loading additional zones for view '%s'",
6852 view->name);
6863 view, &ns_g_server->viewlist, actx,
6875 configure_zone_setviewcommit(result, zconfig, view);
6884 data_to_cfg(dns_view_t *view, MDB_val *key, MDB_val *data,
6894 REQUIRE(view != NULL);
6901 result = isc_buffer_allocate(view->mctx, text, 256);
6938 view->new_zone_db);
6959 isc_mem_t *mctx, dns_view_t *view,
6965 * object, "config", "vconfig", "mctx", "view" and "actx" as arguments (all
6973 cfg_obj_t *vconfig, isc_mem_t *mctx, dns_view_t *view,
6996 result = data_to_cfg(view, &key, &data, &text, &zconfigobj);
7017 result = callback(zconfig, config, vconfig, mctx, view, actx);
7044 cfg_obj_t *vconfig, isc_mem_t *mctx, dns_view_t *view,
7047 return (configure_zone(config, zconfig, vconfig, mctx, view,
7053 * Revert new view assignment for a zone found in NZD.
7057 cfg_obj_t *vconfig, isc_mem_t *mctx, dns_view_t *view,
7065 configure_zone_setviewcommit(ISC_R_FAILURE, zconfig, view);
7071 configure_newzones(dns_view_t *view, cfg_obj_t *config, cfg_obj_t *vconfig,
7078 if (view->new_zone_config == NULL) {
7082 result = nzd_open(view, MDB_RDONLY, &txn, &dbi);
7090 "for view '%s'",
7091 view->new_zone_db, view->name);
7094 view, actx, txn, dbi);
7100 * by reattaching all zones found in NZD to the old view. If
7105 vconfig, mctx, view, actx, txn,
7114 get_newzone_config(dns_view_t *view, const char *zonename,
7131 CHECK(nzd_open(view, MDB_RDONLY, &txn, &dbi));
7137 view->new_zone_db, zonename);
7156 CHECK(data_to_cfg(view, &key, &data, &text, &zoneconf));
7286 dns_view_t *view = NULL;
7632 * Set the EDNS UDP size when we don't match a view.
7881 (void)cfg_map_get(config, "view", &views);
7887 * "bind" view can be ignored as it only adds a negligible
7892 * zone configuration context, but otherwise view configuration
7903 view = NULL;
7905 CHECK(create_view(vconfig, &viewlist, &view));
7906 INSIST(view != NULL);
7910 CHECK(setup_newzones(view, config, vconfig, conf_parser,
7914 dns_view_detach(&view);
7919 * view here.
7924 CHECK(create_view(NULL, &viewlist, &view));
7925 INSIST(view != NULL);
7929 CHECK(setup_newzones(view, config, NULL, conf_parser,
7933 dns_view_detach(&view);
7955 view = NULL;
7956 CHECK(find_view(vconfig, &viewlist, &view));
7957 CHECK(configure_view(view, &viewlist, config, vconfig,
7960 dns_view_freeze(view);
7961 dns_view_detach(&view);
7965 * Make sure we have a default view if and only if there
7969 view = NULL;
7970 CHECK(find_view(NULL, &viewlist, &view));
7971 CHECK(configure_view(view, &viewlist, config, NULL,
7974 dns_view_freeze(view);
7975 dns_view_detach(&view);
7982 RUNTIME_CHECK(cfg_map_get(ns_g_config, "view",
7990 CHECK(create_view(vconfig, &builtin_viewlist, &view));
7991 CHECK(configure_view(view, &viewlist, config, vconfig,
7994 dns_view_freeze(view);
7995 dns_view_detach(&view);
7996 view = NULL;
8004 * view.
8006 for (view = ISC_LIST_HEAD(viewlist);
8007 view != NULL;
8008 view = ISC_LIST_NEXT(view, link))
8010 dns_view_setviewcommit(view);
8013 /* Swap our new view list with the production one. */
8018 /* Make the view list available to each of the views */
8019 view = ISC_LIST_HEAD(server->viewlist);
8020 while (view != NULL) {
8021 view->viewlist = &server->viewlist;
8022 view = ISC_LIST_NEXT(view, link);
8113 for (view = ISC_LIST_HEAD(server->viewlist);
8114 view != NULL;
8115 view = ISC_LIST_NEXT(view, link))
8117 nzd_env_close(view);
8143 for (view = ISC_LIST_HEAD(server->viewlist);
8144 view != NULL;
8145 view = ISC_LIST_NEXT(view, link))
8147 nzd_env_reopen(view);
8427 if (view != NULL) {
8428 dns_view_detach(&view);
8434 * This cleans up either the old production view list
8438 for (view = ISC_LIST_HEAD(viewlist);
8439 view != NULL;
8440 view = view_next) {
8441 view_next = ISC_LIST_NEXT(view, link);
8442 ISC_LIST_UNLINK(viewlist, view, link);
8444 strcmp(view->name, "_bind") != 0)
8446 dns_view_setviewrevert(view);
8447 (void)dns_zt_apply(view->zonetable, ISC_FALSE,
8448 removed, view);
8450 dns_view_detach(&view);
8541 dns_view_t *view;
8559 for (view = ISC_LIST_HEAD(server->viewlist);
8560 view != NULL;
8561 view = ISC_LIST_NEXT(view, link))
8563 if (view->managed_keys != NULL) {
8564 result = dns_zone_load(view->managed_keys);
8570 if (view->redirect != NULL) {
8571 result = dns_zone_load(view->redirect);
8583 CHECK(dns_view_asyncload(view, view_loaded, zl));
8682 dns_view_t *view, *view_next;
8711 for (view = ISC_LIST_HEAD(server->viewlist);
8712 view != NULL;
8713 view = view_next) {
8714 view_next = ISC_LIST_NEXT(view, link);
8715 ISC_LIST_UNLINK(server->viewlist, view, link);
8717 dns_view_flushanddetach(&view);
8719 dns_view_detach(&view);
9323 dns_view_t *view = NULL;
9360 /* Look for the optional view name. */
9371 "no matching zone '%s' in any view",
9379 rdclass, &view);
9382 "no matching view '%s'", viewtxt);
9386 result = dns_zt_find(view->zonetable, name, 0, NULL, zonep);
9389 "no matching zone '%s' in view '%s'",
9408 if (view != NULL)
9409 dns_view_detach(&view);
9766 add_view_tolist(struct dumpcontext *dctx, dns_view_t *view) {
9776 if (vle->view == view)
9782 vle->view = NULL;
9783 dns_view_attach(view, &vle->view);
9788 result = dns_zt_apply(view->zonetable, ISC_TRUE,
9808 dns_view_detach(&vle->view);
9837 if (dctx->view == NULL) {
9838 dctx->view = ISC_LIST_HEAD(dctx->viewlist);
9839 if (dctx->view == NULL)
9845 fprintf(dctx->fp, ";\n; Start view %s\n;\n", dctx->view->view->name);
9847 if (dctx->dumpcache && dns_view_iscacheshared(dctx->view->view)) {
9849 ";\n; Cache of view '%s' is shared as '%s'\n",
9850 dctx->view->view->name,
9851 dns_cache_getname(dctx->view->view->cache));
9857 if (dctx->view->view->cachedb != NULL)
9858 dns_db_attach(dctx->view->view->cachedb, &dctx->cache);
9861 ";\n; Cache dump of view '%s' (cache %s)\n;\n",
9862 dctx->view->view->name,
9863 dns_cache_getname(dctx->view->view->cache));
9881 dctx->cache == NULL && dctx->view->view->cachedb != NULL)
9882 dns_db_attach(dctx->view->view->cachedb, &dctx->cache);
9886 dns_adb_dump(dctx->view->view->adb, dctx->fp);
9888 dns_resolver_printbadcache(dctx->view->view->resolver,
9891 dns_badcache_print(dctx->view->view->failcache,
9904 dctx->zone = ISC_LIST_HEAD(dctx->view->zonelist);
9938 if (dctx->view != NULL)
9939 dctx->view = ISC_LIST_NEXT(dctx->view, link);
9940 if (dctx->view != NULL)
9960 dns_view_t *view;
9983 dctx->view = NULL;
10039 for (view = ISC_LIST_HEAD(server->viewlist);
10040 view != NULL;
10041 view = ISC_LIST_NEXT(view, link))
10043 if (ptr != NULL && strcmp(view->name, ptr) != 0)
10046 CHECK(add_view_tolist(dctx, view));
10050 putstr(text, "view '");
10075 dns_view_t *view;
10110 for (view = ISC_LIST_HEAD(server->viewlist);
10111 view != NULL;
10112 view = ISC_LIST_NEXT(view, link))
10114 if (ptr != NULL && strcmp(view->name, ptr) != 0)
10118 result = dns_view_getsecroots(view, &secroots);
10123 CHECK(putstr(text, "\n Start view "));
10124 CHECK(putstr(text, view->name));
10130 result = dns_view_getntatable(view, &ntatable);
10174 dns_view_t *view;
10182 for (view = ISC_LIST_HEAD(server->viewlist);
10183 view != NULL;
10184 view = ISC_LIST_NEXT(view, link))
10186 fprintf(fp, ";\n; Active fetch domains [view: %s]\n;\n",
10187 view->name);
10188 dns_resolver_dumpfetches(view->resolver,
10245 dns_view_t *view;
10272 /* Look for the view name. */
10277 for (view = ISC_LIST_HEAD(server->viewlist);
10278 view != NULL;
10279 view = ISC_LIST_NEXT(view, link))
10281 if (ptr != NULL && strcasecmp(ptr, view->name) != 0)
10283 CHECK(dns_view_flushcache(view));
10286 view->enablevalidation = enable;
10292 CHECK(putstr(text, view->enablevalidation
10294 CHECK(putstr(text, " (view "));
10295 CHECK(putstr(text, view->name));
10316 dns_view_t *view;
10327 /* Look for the view name. */
10343 * Mark caches that need to be flushed. This is an O(#view^2)
10348 for (view = ISC_LIST_HEAD(server->viewlist);
10349 view != NULL;
10350 view = ISC_LIST_NEXT(view, link))
10352 if (strcasecmp(ptr, view->name) != 0)
10358 if (nsc->cache == view->cache)
10379 "flushing cache in view '%s' failed: %s",
10394 for (view = ISC_LIST_HEAD(server->viewlist);
10395 view != NULL;
10396 view = ISC_LIST_NEXT(view, link))
10398 if (!dns_view_iscacheshared(view))
10403 if (!nsc->needflush || nsc->cache != view->cache)
10405 result = dns_view_flushcache2(view, ISC_TRUE);
10410 "fixing cache in view '%s' "
10411 "failed: %s", view->name,
10428 "flushing cache in view '%s' succeeded",
10439 "flushing cache in view '%s' failed: "
10440 "view not found", ptr);
10453 dns_view_t *view;
10480 /* Look for the view name. */
10487 for (view = ISC_LIST_HEAD(server->viewlist);
10488 view != NULL;
10489 view = ISC_LIST_NEXT(view, link))
10491 if (viewname != NULL && strcasecmp(viewname, view->name) != 0)
10499 result = dns_view_flushnode(view, name, tree);
10504 "flushing %s '%s' in cache view '%s' "
10507 target, view->name,
10515 "flushing %s '%s' in cache view '%s' "
10531 "flushing %s '%s' in cache view '%s' "
10532 "failed: view not found",
10752 dns_view_t *view;
10769 for (view = ISC_LIST_HEAD(server->viewlist);
10770 view != NULL;
10771 view = ISC_LIST_NEXT(view, link)) {
10772 if (viewname == NULL || strcmp(view->name, viewname) == 0) {
10773 RWLOCK(&view->dynamickeys->lock, isc_rwlocktype_write);
10774 result = delete_keynames(view->dynamickeys, target,
10776 RWUNLOCK(&view->dynamickeys->lock,
10797 list_keynames(dns_view_t *view, dns_tsig_keyring_t *ring, isc_buffer_t **text,
10811 if (view != NULL)
10812 viewname = view->name;
10843 CHECK(putstr(text, "view \""));
10854 CHECK(putstr(text, "view \""));
10877 dns_view_t *view;
10882 for (view = ISC_LIST_HEAD(server->viewlist);
10883 view != NULL;
10884 view = ISC_LIST_NEXT(view, link)) {
10885 RWLOCK(&view->statickeys->lock, isc_rwlocktype_read);
10886 result = list_keynames(view, view->statickeys, text,
10888 RWUNLOCK(&view->statickeys->lock, isc_rwlocktype_read);
10893 RWLOCK(&view->dynamickeys->lock, isc_rwlocktype_read);
10894 result = list_keynames(view, view->dynamickeys, text,
10896 RWUNLOCK(&view->dynamickeys->lock, isc_rwlocktype_read);
10991 dns_view_t *view;
11016 for (view = ISC_LIST_HEAD(server->viewlist);
11017 view != NULL;
11018 view = ISC_LIST_NEXT(view, link)) {
11019 result = dns_zt_apply(view->zonetable, ISC_FALSE,
11039 view = dns_zone_getview(zone);
11040 if (strcmp(view->name, "_default") == 0 ||
11041 strcmp(view->name, "_bind") == 0)
11046 vname = view->name;
11075 dns_view_t *view;
11088 for (view = ISC_LIST_HEAD(server->viewlist);
11089 view != NULL;
11090 view = ISC_LIST_NEXT(view, link)) {
11091 result = dns_view_freezezones(view, freeze);
11164 view = dns_zone_getview(zone);
11165 if (strcmp(view->name, "_default") == 0 ||
11166 strcmp(view->name, "_bind") == 0)
11171 vname = view->name;
11205 #define HEADER1 "# New zone file for view: "
11226 nzf_append(dns_view_t *view, const cfg_obj_t *zconfig) {
11232 LOCK(&view->new_zone_lock);
11234 CHECK(isc_stdio_open(view->new_zone_file, "a", &fp));
11240 CHECK(add_comment(fp, view->name));
11255 result2 = isc_file_truncate(view->new_zone_file,
11265 view->new_zone_file,
11270 UNLOCK(&view->new_zone_lock);
11275 nzf_writeconf(const cfg_obj_t *config, dns_view_t *view) {
11296 CHECK(add_comment(fp, view->name)); /* force a comment */
11314 CHECK(isc_file_rename(tmp, view->new_zone_file));
11351 dns_view_t *view;
11357 view = dns_zone_getview(zone);
11361 LOCK(&view->new_zone_lock);
11383 result = isc_buffer_allocate(view->mctx, &text, 256);
11448 UNLOCK(&view->new_zone_lock);
11458 nzd_writable(dns_view_t *view) {
11464 REQUIRE(view != NULL);
11466 status = mdb_txn_begin((MDB_env *) view->new_zone_dbenv, 0, 0, &txn);
11489 nzd_open(dns_view_t *view, unsigned int flags, MDB_txn **txnp, MDB_dbi *dbi) {
11493 REQUIRE(view != NULL);
11497 status = mdb_txn_begin((MDB_env *) view->new_zone_dbenv, 0,
11535 nzd_env_close(dns_view_t *view) {
11541 if (view->new_zone_dbenv == NULL) {
11545 status = mdb_env_get_path(view->new_zone_dbenv, &dbpath);
11549 mdb_env_close((MDB_env *) view->new_zone_dbenv);
11563 view->new_zone_dbenv = NULL;
11567 nzd_env_reopen(dns_view_t *view) {
11572 if (view->new_zone_db == NULL) {
11576 nzd_env_close(view);
11587 if (view->new_zone_mapsize != 0ULL) {
11588 status = mdb_env_set_mapsize(env, view->new_zone_mapsize);
11598 status = mdb_env_open(env, view->new_zone_db, DNS_LMDB_FLAGS, 0600);
11603 view->new_zone_db, mdb_strerror(status));
11607 view->new_zone_dbenv = env;
11641 nzd_count(dns_view_t *view, int *countp) {
11650 result = nzd_open(view, MDB_RDONLY, &txn, &dbi);
11674 migrate_nzf(dns_view_t *view) {
11691 if (!isc_file_exists(view->new_zone_file)) {
11696 result = nzd_count(view, &n);
11707 view->new_zone_file, view->new_zone_db);
11715 result = cfg_parse_file(ns_g_addparser, view->new_zone_file,
11722 view->new_zone_file,
11733 CHECK(nzd_open(view, 0, &txn, &dbi));
11735 CHECK(isc_buffer_allocate(view->mctx, &text, 256));
11801 * if an NZD database is found for the view. But we rename NZF file
11804 strlcpy(tempname, view->new_zone_file, sizeof(tempname));
11807 isc_file_rename(view->new_zone_file, tempname);
11844 dns_view_t *view = NULL;
11884 (void) cfg_map_get(zoptions, "in-view", &obj);
11887 "'in-view' zones not supported by ");
11910 /* Make sense of optional view argument */
11911 obj = cfg_tuple_get(zoneobj, "view");
11917 &view);
11919 (void) putstr(text, "no matching view found for '");
11927 *viewp = view;
11936 if (view != NULL)
11937 dns_view_detach(&view);
11943 delete_zoneconf(dns_view_t *view, cfg_parser_t *pctx,
11954 REQUIRE(view != NULL);
11959 LOCK(&view->new_zone_lock);
11996 if (nzfwriter != NULL && view->new_zone_file != NULL)
11997 result = nzfwriter(config, view);
12000 UNLOCK(&view->new_zone_lock);
12005 do_addzone(ns_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view,
12022 result = dns_zt_find(view->zonetable, name, 0, NULL, &zone);
12037 result = isc_stdio_open(view->new_zone_file, "a", &fp);
12040 TCHECK(putstr(text, view->new_zone_file));
12050 result = nzd_writable(view);
12053 TCHECK(putstr(text, view->new_zone_db));
12063 /* Mark view unfrozen and configure zone */
12064 dns_view_thaw(view);
12066 server->mctx, view, &server->viewlist,
12068 dns_view_freeze(view);
12079 result = dns_zt_find(view->zonetable, name, 0, NULL, &zone);
12129 dns_zt_unmount(view->zonetable, zone);
12138 CHECK(nzd_open(view, 0, &txn, &dbi));
12142 result = nzf_append(view, zoneobj);
12151 tresult = delete_zoneconf(view, cfg->add_parser,
12168 do_modzone(ns_server_t *server, ns_cfgctx_t *cfg, dns_view_t *view,
12185 result = dns_zt_find(view->zonetable, name, 0, NULL, &zone);
12193 cfg = (ns_cfgctx_t *) view->new_zone_config;
12206 result = isc_stdio_open(view->new_zone_file, "a", &fp);
12209 TCHECK(putstr(text, view->new_zone_file));
12218 result = nzd_writable(view);
12221 TCHECK(putstr(text, view->new_zone_db));
12229 dns_view_thaw(view);
12231 server->mctx, view, &server->viewlist,
12233 dns_view_freeze(view);
12245 CHECK(dns_zt_find(view->zonetable, name, 0, NULL, &zone));
12250 result = delete_zoneconf(view, cfg->add_parser,
12265 result = delete_zoneconf(view, cfg->conf_parser,
12272 result = delete_zoneconf(view, cfg->conf_parser,
12317 dns_zt_unmount(view->zonetable, zone);
12329 CHECK(nzd_open(view, 0, &txn, &dbi));
12332 result = nzf_append(view, zoneobj);
12380 dns_view_t *view = NULL;
12392 CHECK(newzone_parse(server, command, &view, &zoneconf,
12395 /* Are we accepting new zones in this view? */
12397 if (view->new_zone_db == NULL)
12399 if (view->new_zone_file == NULL)
12402 (void) putstr(text, "Not allowing new zones in view '");
12403 (void) putstr(text, view->name);
12409 cfg = (ns_cfgctx_t *) view->new_zone_config;
12424 CHECK(do_addzone(server, cfg, view, dnsname, zoneconf,
12427 CHECK(do_modzone(server, cfg, view, dnsname, zonename,
12432 "%s zone %s in view %s via %s",
12434 zonename, view->name,
12445 if (view != NULL)
12446 dns_view_detach(&view);
12480 dns_view_t *view;
12496 view = dns_zone_getview(zone);
12497 cfg = (ns_cfgctx_t *) view->new_zone_config;
12502 "deleting zone %s in view %s via delzone",
12503 zonename, view->name);
12511 result = nzd_open(view, 0, &txn, &dbi);
12517 view->new_zone_db);
12530 result = delete_zoneconf(view, cfg->add_parser,
12548 result = delete_zoneconf(view, cfg->conf_parser,
12553 result = delete_zoneconf(view, cfg->conf_parser,
12641 dns_view_t *view = NULL;
12684 view = dns_zone_getview(zone);
12685 CHECK(dns_zt_unmount(view->zonetable, zone));
12835 dns_view_t *view = NULL;
12851 view = dns_zone_getview(zone);
12854 cfg = (ns_cfgctx_t *) view->new_zone_config;
12864 /* Find the view statement */
12865 vconfig = find_name_in_list_from_map(cfg->config, "view", view->name);
12882 CHECK(get_newzone_config(view, zonename, &nzconfig));
13498 dns_view_t *view;
13571 for (view = ISC_LIST_HEAD(server->viewlist);
13572 view != NULL;
13573 view = ISC_LIST_NEXT(view, link))
13577 result = dns_view_getntatable(view, &ntatable);
13613 /* Look for the view name. */
13621 for (view = ISC_LIST_HEAD(server->viewlist);
13622 view != NULL;
13623 view = ISC_LIST_NEXT(view, link))
13626 strcmp(view->name, viewname) != 0)
13629 if (view->nta_lifetime == 0)
13633 ntattl = view->nta_lifetime;
13638 result = dns_view_getntatable(view, &ntatable);
13644 result = dns_view_flushnode(view, ntaname, ISC_TRUE);
13647 "flush tree '%s' in cache view '%s': %s",
13648 namebuf, view->name,
13662 CHECK(putstr(text, view->name));
13668 "added NTA '%s' (%d sec) in view '%s'",
13669 namebuf, ntattl, view->name);
13676 CHECK(putstr(text, view->name));
13680 "removed NTA '%s' in view %s",
13681 namebuf, view->name);
13684 result = dns_view_saventa(view);
13689 "for view '%s': %s",
13690 view->name, isc_result_totext(result));
13711 dns_view_t *view;
13713 for (view = ISC_LIST_HEAD(server->viewlist);
13714 view != NULL;
13715 view = ISC_LIST_NEXT(view, link))
13717 isc_result_t result = dns_view_saventa(view);
13723 "for view '%s': %s",
13724 view->name, isc_result_totext(result));
13733 dns_view_t *view;
13735 for (view = ISC_LIST_HEAD(server->viewlist);
13736 view != NULL;
13737 view = ISC_LIST_NEXT(view, link))
13739 isc_result_t result = dns_view_loadnta(view);
13748 "for view '%s': %s",
13749 view->name, isc_result_totext(result));
13757 mkey_refresh(dns_view_t *view, isc_buffer_t **text) {
13762 "refreshing managed keys for '%s'", view->name);
13764 CHECK(dns_zone_synckeyzone(view->managed_keys));
13771 mkey_dumpzone(dns_view_t *view, isc_buffer_t **text) {
13781 CHECK(dns_zone_getdb(view->managed_keys, &db));
13890 mkey_status(dns_view_t *view, isc_buffer_t **text) {
13895 CHECK(putstr(text, "view: "));
13896 CHECK(putstr(text, view->name));
13900 dns_zone_getrefreshkeytime(view->managed_keys, &t);
13908 CHECK(mkey_dumpzone(view, text));
13918 dns_view_t *view = NULL;
13951 /* Look for the optional view name. */
13976 for (view = ISC_LIST_HEAD(server->viewlist);
13977 view != NULL;
13978 view = ISC_LIST_NEXT(view, link))
13981 (rdclass != view->rdclass ||
13982 strcmp(view->name, viewtxt) != 0))
13985 if (view->managed_keys == NULL) {
13988 "view '%s': no managed keys", viewtxt);
13999 CHECK(mkey_refresh(view, text));
14004 CHECK(mkey_status(view, text));
14008 CHECK(dns_zone_flush(view->managed_keys));