remove need_hints parameters to configure_view

The `configure_view()` `need_hints` is removed as it this function was
always called with the value `true`.

The `need_hints` wasn't even used in the function. The only thing it was
actually used was to throw a warning which can be done simply in an
`else` condition branch.

Moreoever, in the case of catalog zones and response-policy, it fixes a
possible bug that would affect root zones, as those wouldn't be reverted
back to their previous version in case of the view fails to load
(during a server reconfiguration).
This commit is contained in:
Colin Vidal 2025-11-17 15:23:58 +01:00
parent 9027889bc8
commit 6b5f714e53

View file

@ -3716,8 +3716,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
named_cachelist_t *oldcachelist, dns_kasplist_t *kasplist,
const cfg_obj_t *bindkeys, isc_mem_t *mctx,
cfg_aclconfctx_t *aclctx,
isc_tlsctx_cache_t *tlsctx_client_cache, bool need_hints,
bool first_time) {
isc_tlsctx_cache_t *tlsctx_client_cache, bool first_time) {
const cfg_obj_t *maps[4] = { 0 };
const cfg_obj_t *cfgmaps[3] = { 0 };
const cfg_obj_t *options = NULL;
@ -3813,7 +3812,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
* is used for real lookups and so cares about hints.
*/
obj = NULL;
if (view->rdclass == dns_rdataclass_in && need_hints &&
if (view->rdclass == dns_rdataclass_in &&
named_config_get(maps, "response-policy", &obj) == ISC_R_SUCCESS)
{
CHECK(configure_rpz(view, NULL, obj, &old_rpz_ok, first_time));
@ -3821,7 +3820,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
}
obj = NULL;
if (view->rdclass != dns_rdataclass_in && need_hints &&
if (view->rdclass != dns_rdataclass_in &&
named_config_get(maps, "catalog-zones", &obj) == ISC_R_SUCCESS)
{
cfg_obj_log(obj, ISC_LOG_WARNING,
@ -3830,7 +3829,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
}
obj = NULL;
if (view->rdclass == dns_rdataclass_in && need_hints &&
if (view->rdclass == dns_rdataclass_in &&
named_config_get(maps, "catalog-zones", &obj) == ISC_R_SUCCESS)
{
CHECK(configure_catz(view, NULL, config, obj));
@ -4662,9 +4661,7 @@ configure_view(dns_view_t *view, dns_viewlist_t *viewlist, cfg_obj_t *config,
&rootzone);
if (rootzone != NULL) {
dns_zone_detach(&rootzone);
need_hints = false;
}
if (need_hints) {
} else {
isc_log_write(NAMED_LOGCATEGORY_GENERAL,
NAMED_LOGMODULE_SERVER, ISC_LOG_WARNING,
"no root hints for view '%s'",
@ -5558,7 +5555,7 @@ cleanup:
obj = NULL;
if (rpz_configured &&
pview->rdclass == dns_rdataclass_in && need_hints &&
pview->rdclass == dns_rdataclass_in &&
named_config_get(maps, "response-policy", &obj) ==
ISC_R_SUCCESS)
{
@ -5584,7 +5581,7 @@ cleanup:
obj = NULL;
if (catz_configured &&
pview->rdclass == dns_rdataclass_in && need_hints &&
pview->rdclass == dns_rdataclass_in &&
named_config_get(maps, "catalog-zones", &obj) ==
ISC_R_SUCCESS)
{
@ -7791,7 +7788,7 @@ configure_views(cfg_obj_t *config, const cfg_obj_t *bindkeys,
result = configure_view(view, viewlist, config, vconfig,
cachelist, &server->cachelist, kasplist,
bindkeys, isc_g_mctx, aclctx,
tlsctx_client_cache, true, first_time);
tlsctx_client_cache, first_time);
if (result != ISC_R_SUCCESS) {
dns_view_detach(&view);
return result;
@ -7820,7 +7817,7 @@ configure_views(cfg_obj_t *config, const cfg_obj_t *bindkeys,
result = configure_view(view, viewlist, config, NULL, cachelist,
&server->cachelist, kasplist, bindkeys,
isc_g_mctx, aclctx, tlsctx_client_cache,
true, first_time);
first_time);
if (result != ISC_R_SUCCESS) {
dns_view_detach(&view);
return result;