mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-09-03 08:05:21 +00:00
Refactor
Reviewed on Jabber by Evan.
This commit is contained in:
@@ -8104,14 +8104,15 @@ load_configuration(const char *filename, named_server_t *server,
|
|||||||
* Write the PID file.
|
* Write the PID file.
|
||||||
*/
|
*/
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
if (named_config_get(maps, "pid-file", &obj) == ISC_R_SUCCESS)
|
if (named_config_get(maps, "pid-file", &obj) == ISC_R_SUCCESS) {
|
||||||
if (cfg_obj_isvoid(obj))
|
if (cfg_obj_isvoid(obj))
|
||||||
named_os_writepidfile(NULL, first_time);
|
named_os_writepidfile(NULL, first_time);
|
||||||
else
|
else
|
||||||
named_os_writepidfile(cfg_obj_asstring(obj),
|
named_os_writepidfile(cfg_obj_asstring(obj),
|
||||||
first_time);
|
first_time);
|
||||||
else
|
} else {
|
||||||
named_os_writepidfile(named_g_defaultpidfile, first_time);
|
named_os_writepidfile(named_g_defaultpidfile, first_time);
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Configure the server-wide session key. This must be done before
|
* Configure the server-wide session key. This must be done before
|
||||||
|
@@ -903,14 +903,14 @@ setup_system(void) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
isc_sockaddr_t *sa;
|
isc_sockaddr_t *sa;
|
||||||
int i = 0;
|
int i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Count the nameservers (skipping any that we can't use
|
* Count the nameservers (skipping any that we can't use
|
||||||
* because of address family restrictions) and allocate
|
* because of address family restrictions) and allocate
|
||||||
* the servers array.
|
* the servers array.
|
||||||
*/
|
*/
|
||||||
ns_total = ns_alloc = 0;
|
ns_total = 0;
|
||||||
for (sa = ISC_LIST_HEAD(*nslist);
|
for (sa = ISC_LIST_HEAD(*nslist);
|
||||||
sa != NULL;
|
sa != NULL;
|
||||||
sa = ISC_LIST_NEXT(sa, link))
|
sa = ISC_LIST_NEXT(sa, link))
|
||||||
@@ -919,13 +919,11 @@ setup_system(void) {
|
|||||||
case AF_INET:
|
case AF_INET:
|
||||||
if (have_ipv4) {
|
if (have_ipv4) {
|
||||||
ns_total++;
|
ns_total++;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
if (have_ipv6) {
|
if (have_ipv6) {
|
||||||
ns_total++;
|
ns_total++;
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -938,22 +936,21 @@ setup_system(void) {
|
|||||||
if (servers == NULL)
|
if (servers == NULL)
|
||||||
fatal("out of memory");
|
fatal("out of memory");
|
||||||
|
|
||||||
|
i = 0;
|
||||||
for (sa = ISC_LIST_HEAD(*nslist);
|
for (sa = ISC_LIST_HEAD(*nslist);
|
||||||
sa != NULL;
|
sa != NULL;
|
||||||
sa = ISC_LIST_NEXT(sa, link))
|
sa = ISC_LIST_NEXT(sa, link))
|
||||||
{
|
{
|
||||||
switch (sa->type.sa.sa_family) {
|
switch (sa->type.sa.sa_family) {
|
||||||
case AF_INET:
|
case AF_INET:
|
||||||
if (!have_ipv4) {
|
if (have_ipv4) {
|
||||||
continue;
|
sa->type.sin.sin_port = htons(dnsport);
|
||||||
}
|
}
|
||||||
sa->type.sin.sin_port = htons(dnsport);
|
|
||||||
break;
|
break;
|
||||||
case AF_INET6:
|
case AF_INET6:
|
||||||
if (!have_ipv6) {
|
if (have_ipv6) {
|
||||||
continue;
|
sa->type.sin6.sin6_port = htons(dnsport);
|
||||||
}
|
}
|
||||||
sa->type.sin6.sin6_port = htons(dnsport);
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fatal("bad family");
|
fatal("bad family");
|
||||||
|
Reference in New Issue
Block a user