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