mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-01 15:05:23 +00:00
eliminated global variable ns_g_interfacemgr;
rescan interface list on reconfiguration
This commit is contained in:
@@ -219,26 +219,11 @@ create_managers() {
|
|||||||
return (ISC_R_UNEXPECTED);
|
return (ISC_R_UNEXPECTED);
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ns_interfacemgr_create(ns_g_mctx, ns_g_taskmgr,
|
|
||||||
ns_g_socketmgr, ns_g_clientmgr,
|
|
||||||
&ns_g_interfacemgr);
|
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
|
||||||
"ns_interfacemgr_create() failed: %s\n",
|
|
||||||
isc_result_totext(result));
|
|
||||||
return (ISC_R_UNEXPECTED);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
destroy_managers(void) {
|
destroy_managers(void) {
|
||||||
/*
|
|
||||||
* The interface manager owns tasks, so we have to destroy it before
|
|
||||||
* we destroy the task manager.
|
|
||||||
*/
|
|
||||||
ns_interfacemgr_destroy(&ns_g_interfacemgr);
|
|
||||||
/*
|
/*
|
||||||
* isc_taskmgr_destroy() will block until all tasks have exited,
|
* isc_taskmgr_destroy() will block until all tasks have exited,
|
||||||
*/
|
*/
|
||||||
|
@@ -64,6 +64,7 @@
|
|||||||
#include <named/log.h>
|
#include <named/log.h>
|
||||||
#include <named/rootns.h>
|
#include <named/rootns.h>
|
||||||
#include <named/server.h>
|
#include <named/server.h>
|
||||||
|
#include <named/interfacemgr.h>
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
isc_mem_t * mctx;
|
isc_mem_t * mctx;
|
||||||
@@ -567,6 +568,12 @@ load_configuration(const char *filename, ns_server_t *server) {
|
|||||||
isc_result_totext(result));
|
isc_result_totext(result));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Rescan the interface list to pick up changes in the
|
||||||
|
* listen-on option.
|
||||||
|
*/
|
||||||
|
ns_interfacemgr_scan(server->interfacemgr);
|
||||||
|
|
||||||
dns_aclconfctx_destroy(&aclconfctx);
|
dns_aclconfctx_destroy(&aclconfctx);
|
||||||
|
|
||||||
dns_c_ctx_delete(&configctx);
|
dns_c_ctx_delete(&configctx);
|
||||||
@@ -581,8 +588,6 @@ run_server(isc_task_t *task, isc_event_t *event) {
|
|||||||
|
|
||||||
load_configuration(ns_g_conffile, server);
|
load_configuration(ns_g_conffile, server);
|
||||||
|
|
||||||
ns_interfacemgr_scan(ns_g_interfacemgr);
|
|
||||||
|
|
||||||
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
|
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL, NS_LOGMODULE_SERVER,
|
||||||
ISC_LOG_INFO, "running");
|
ISC_LOG_INFO, "running");
|
||||||
}
|
}
|
||||||
@@ -647,6 +652,17 @@ ns_server_create(isc_mem_t *mctx, ns_server_t **serverp) {
|
|||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
return (result);
|
return (result);
|
||||||
|
|
||||||
|
server->interfacemgr = NULL;
|
||||||
|
result = ns_interfacemgr_create(ns_g_mctx, ns_g_taskmgr,
|
||||||
|
ns_g_socketmgr, ns_g_clientmgr,
|
||||||
|
&server->interfacemgr);
|
||||||
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
UNEXPECTED_ERROR(__FILE__, __LINE__,
|
||||||
|
"ns_interfacemgr_create() failed: %s\n",
|
||||||
|
isc_result_totext(result));
|
||||||
|
return (ISC_R_UNEXPECTED);
|
||||||
|
}
|
||||||
|
|
||||||
server->magic = NS_SERVER_MAGIC;
|
server->magic = NS_SERVER_MAGIC;
|
||||||
*serverp = server;
|
*serverp = server;
|
||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
@@ -657,6 +673,12 @@ ns_server_destroy(ns_server_t **serverp) {
|
|||||||
ns_server_t *server = *serverp;
|
ns_server_t *server = *serverp;
|
||||||
REQUIRE(NS_SERVER_VALID(server));
|
REQUIRE(NS_SERVER_VALID(server));
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The interface manager owns tasks, so we have to destroy it before
|
||||||
|
* we destroy the task manager.
|
||||||
|
*/
|
||||||
|
ns_interfacemgr_destroy(&server->interfacemgr);
|
||||||
|
|
||||||
INSIST(ISC_LIST_EMPTY(server->viewlist));
|
INSIST(ISC_LIST_EMPTY(server->viewlist));
|
||||||
isc_rwlock_destroy(&server->viewlock);
|
isc_rwlock_destroy(&server->viewlock);
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user