mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-02 07:35:26 +00:00
Load default listen-on[-v6] values from config.c
Stop using ns_listenlist_default() to set the default listen-on and listen-on-v6 configuration. Instead, configure these options using the default values in config.c.
This commit is contained in:
@@ -8511,30 +8511,16 @@ load_configuration(const char *filename, named_server_t *server,
|
|||||||
const cfg_obj_t *clistenon = NULL;
|
const cfg_obj_t *clistenon = NULL;
|
||||||
ns_listenlist_t *listenon = NULL;
|
ns_listenlist_t *listenon = NULL;
|
||||||
|
|
||||||
/*
|
result = named_config_get(maps, "listen-on", &clistenon);
|
||||||
* Even though listen-on is present in the default
|
if (result != ISC_R_SUCCESS) {
|
||||||
* configuration, this way is easier.
|
goto cleanup_v6portset;
|
||||||
*/
|
}
|
||||||
if (options != NULL) {
|
result = listenlist_fromconfig(
|
||||||
(void)cfg_map_get(options, "listen-on", &clistenon);
|
clistenon, config, named_g_aclconfctx, named_g_mctx,
|
||||||
}
|
AF_INET, server->tlsctx_server_cache, &listenon);
|
||||||
if (clistenon != NULL) {
|
|
||||||
result = listenlist_fromconfig(
|
|
||||||
clistenon, config, named_g_aclconfctx,
|
|
||||||
named_g_mctx, AF_INET,
|
|
||||||
server->tlsctx_server_cache, &listenon);
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* Not specified, use default.
|
|
||||||
*/
|
|
||||||
result = ns_listenlist_default(named_g_mctx,
|
|
||||||
listen_port, true,
|
|
||||||
AF_INET, &listenon);
|
|
||||||
}
|
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
goto cleanup_v6portset;
|
goto cleanup_v6portset;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listenon != NULL) {
|
if (listenon != NULL) {
|
||||||
ns_interfacemgr_setlistenon4(server->interfacemgr,
|
ns_interfacemgr_setlistenon4(server->interfacemgr,
|
||||||
listenon);
|
listenon);
|
||||||
@@ -8549,22 +8535,13 @@ load_configuration(const char *filename, named_server_t *server,
|
|||||||
const cfg_obj_t *clistenon = NULL;
|
const cfg_obj_t *clistenon = NULL;
|
||||||
ns_listenlist_t *listenon = NULL;
|
ns_listenlist_t *listenon = NULL;
|
||||||
|
|
||||||
if (options != NULL) {
|
result = named_config_get(maps, "listen-on-v6", &clistenon);
|
||||||
(void)cfg_map_get(options, "listen-on-v6", &clistenon);
|
if (result != ISC_R_SUCCESS) {
|
||||||
}
|
goto cleanup_v6portset;
|
||||||
if (clistenon != NULL) {
|
|
||||||
result = listenlist_fromconfig(
|
|
||||||
clistenon, config, named_g_aclconfctx,
|
|
||||||
named_g_mctx, AF_INET6,
|
|
||||||
server->tlsctx_server_cache, &listenon);
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* Not specified, use default.
|
|
||||||
*/
|
|
||||||
result = ns_listenlist_default(named_g_mctx,
|
|
||||||
listen_port, true,
|
|
||||||
AF_INET6, &listenon);
|
|
||||||
}
|
}
|
||||||
|
result = listenlist_fromconfig(
|
||||||
|
clistenon, config, named_g_aclconfctx, named_g_mctx,
|
||||||
|
AF_INET6, server->tlsctx_server_cache, &listenon);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
goto cleanup_v6portset;
|
goto cleanup_v6portset;
|
||||||
}
|
}
|
||||||
|
@@ -85,8 +85,6 @@ scan_interfaces(void *arg) {
|
|||||||
int
|
int
|
||||||
setup_server(void **state) {
|
setup_server(void **state) {
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
ns_listenlist_t *listenon = NULL;
|
|
||||||
in_port_t port = 5300 + isc_random8();
|
|
||||||
|
|
||||||
setup_managers(state);
|
setup_managers(state);
|
||||||
|
|
||||||
@@ -103,14 +101,6 @@ setup_server(void **state) {
|
|||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
result = ns_listenlist_default(mctx, port, true, AF_INET, &listenon);
|
|
||||||
if (result != ISC_R_SUCCESS) {
|
|
||||||
goto cleanup;
|
|
||||||
}
|
|
||||||
|
|
||||||
ns_interfacemgr_setlistenon4(interfacemgr, listenon);
|
|
||||||
ns_listenlist_detach(&listenon);
|
|
||||||
|
|
||||||
isc_loop_setup(mainloop, scan_interfaces, NULL);
|
isc_loop_setup(mainloop, scan_interfaces, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Reference in New Issue
Block a user