mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Make named a singleton process [RT#37908]
Conflicts: bin/tests/system/conf.sh.in lib/dns/win32/libdns.def.in lib/isc/win32/file.c The merge also needed to update files in legacy and tcp system tests (newly introduced in master after branch was created) to introduce use of lockfile.
This commit is contained in:
5
CHANGES
5
CHANGES
@@ -1,3 +1,8 @@
|
|||||||
|
4022. [func] Stop multiple spawns of named by limiting number of
|
||||||
|
processes to 1. This is done by using a lockfile and
|
||||||
|
checking whether we can listen on any configured
|
||||||
|
TCP interfaces. [RT #37908]
|
||||||
|
|
||||||
4021. [bug] Adjust max-recursion-queries to accommodate
|
4021. [bug] Adjust max-recursion-queries to accommodate
|
||||||
the need for more queries when the cache is
|
the need for more queries when the cache is
|
||||||
empty. [RT #38104]
|
empty. [RT #38104]
|
||||||
|
@@ -133,6 +133,9 @@ EXTERN const char * ns_g_logfile INIT(NULL);
|
|||||||
EXTERN const char * ns_g_defaultsessionkeyfile
|
EXTERN const char * ns_g_defaultsessionkeyfile
|
||||||
INIT(NS_LOCALSTATEDIR "/run/named/"
|
INIT(NS_LOCALSTATEDIR "/run/named/"
|
||||||
"session.key");
|
"session.key");
|
||||||
|
EXTERN const char * ns_g_singletonfile INIT(NS_LOCALSTATEDIR
|
||||||
|
"/run/named/"
|
||||||
|
"named.lock");
|
||||||
|
|
||||||
#if NS_RUN_PID_DIR
|
#if NS_RUN_PID_DIR
|
||||||
EXTERN const char * ns_g_defaultpidfile INIT(NS_LOCALSTATEDIR
|
EXTERN const char * ns_g_defaultpidfile INIT(NS_LOCALSTATEDIR
|
||||||
|
@@ -115,7 +115,14 @@ ns_interfacemgr_detach(ns_interfacemgr_t **targetp);
|
|||||||
void
|
void
|
||||||
ns_interfacemgr_shutdown(ns_interfacemgr_t *mgr);
|
ns_interfacemgr_shutdown(ns_interfacemgr_t *mgr);
|
||||||
|
|
||||||
void
|
isc_boolean_t
|
||||||
|
ns_interfacemgr_islistening(ns_interfacemgr_t *mgr);
|
||||||
|
/*%
|
||||||
|
* Return if the manager is listening on any interface. It can be called
|
||||||
|
* after a scan or adjust.
|
||||||
|
*/
|
||||||
|
|
||||||
|
isc_result_t
|
||||||
ns_interfacemgr_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose);
|
ns_interfacemgr_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose);
|
||||||
/*%
|
/*%
|
||||||
* Scan the operatings system's list of network interfaces
|
* Scan the operatings system's list of network interfaces
|
||||||
@@ -127,7 +134,7 @@ ns_interfacemgr_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose);
|
|||||||
* in named.conf.
|
* in named.conf.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void
|
isc_result_t
|
||||||
ns_interfacemgr_adjust(ns_interfacemgr_t *mgr, ns_listenlist_t *list,
|
ns_interfacemgr_adjust(ns_interfacemgr_t *mgr, ns_listenlist_t *list,
|
||||||
isc_boolean_t verbose);
|
isc_boolean_t verbose);
|
||||||
/*%
|
/*%
|
||||||
|
@@ -545,17 +545,19 @@ ns_interface_accepttcp(ns_interface_t *ifp) {
|
|||||||
tcp_bind_failure:
|
tcp_bind_failure:
|
||||||
isc_socket_detach(&ifp->tcpsocket);
|
isc_socket_detach(&ifp->tcpsocket);
|
||||||
tcp_socket_failure:
|
tcp_socket_failure:
|
||||||
return (ISC_R_SUCCESS);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
ns_interface_setup(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr,
|
ns_interface_setup(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr,
|
||||||
const char *name, ns_interface_t **ifpret,
|
const char *name, ns_interface_t **ifpret,
|
||||||
isc_boolean_t accept_tcp, isc_dscp_t dscp)
|
isc_boolean_t accept_tcp, isc_dscp_t dscp,
|
||||||
|
isc_boolean_t *tcp_addr_in_use)
|
||||||
{
|
{
|
||||||
isc_result_t result;
|
isc_result_t result;
|
||||||
ns_interface_t *ifp = NULL;
|
ns_interface_t *ifp = NULL;
|
||||||
REQUIRE(ifpret != NULL && *ifpret == NULL);
|
REQUIRE(ifpret != NULL && *ifpret == NULL);
|
||||||
|
REQUIRE(tcp_addr_in_use == NULL || *tcp_addr_in_use == ISC_FALSE);
|
||||||
|
|
||||||
result = ns_interface_create(mgr, addr, name, &ifp);
|
result = ns_interface_create(mgr, addr, name, &ifp);
|
||||||
if (result != ISC_R_SUCCESS)
|
if (result != ISC_R_SUCCESS)
|
||||||
@@ -570,6 +572,10 @@ ns_interface_setup(ns_interfacemgr_t *mgr, isc_sockaddr_t *addr,
|
|||||||
if (!ns_g_notcp && accept_tcp == ISC_TRUE) {
|
if (!ns_g_notcp && accept_tcp == ISC_TRUE) {
|
||||||
result = ns_interface_accepttcp(ifp);
|
result = ns_interface_accepttcp(ifp);
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
|
if ((result == ISC_R_ADDRINUSE) &&
|
||||||
|
(tcp_addr_in_use != NULL))
|
||||||
|
*tcp_addr_in_use = ISC_TRUE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXXRTH We don't currently have a way to easily stop
|
* XXXRTH We don't currently have a way to easily stop
|
||||||
* dispatch service, so we currently return
|
* dispatch service, so we currently return
|
||||||
@@ -807,6 +813,8 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen,
|
|||||||
isc_boolean_t log_explicit = ISC_FALSE;
|
isc_boolean_t log_explicit = ISC_FALSE;
|
||||||
isc_boolean_t dolistenon;
|
isc_boolean_t dolistenon;
|
||||||
char sabuf[ISC_SOCKADDR_FORMATSIZE];
|
char sabuf[ISC_SOCKADDR_FORMATSIZE];
|
||||||
|
isc_boolean_t tried_listening;
|
||||||
|
isc_boolean_t all_addresses_in_use;
|
||||||
|
|
||||||
if (ext_listen != NULL)
|
if (ext_listen != NULL)
|
||||||
adjusting = ISC_TRUE;
|
adjusting = ISC_TRUE;
|
||||||
@@ -883,7 +891,8 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen,
|
|||||||
result = ns_interface_setup(mgr, &listen_addr,
|
result = ns_interface_setup(mgr, &listen_addr,
|
||||||
"<any>", &ifp,
|
"<any>", &ifp,
|
||||||
ISC_TRUE,
|
ISC_TRUE,
|
||||||
le->dscp);
|
le->dscp,
|
||||||
|
NULL);
|
||||||
if (result == ISC_R_SUCCESS)
|
if (result == ISC_R_SUCCESS)
|
||||||
ifp->flags |= NS_INTERFACEFLAG_ANYADDR;
|
ifp->flags |= NS_INTERFACEFLAG_ANYADDR;
|
||||||
else
|
else
|
||||||
@@ -913,6 +922,8 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen,
|
|||||||
clearlistenon(mgr);
|
clearlistenon(mgr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tried_listening = ISC_FALSE;
|
||||||
|
all_addresses_in_use = ISC_TRUE;
|
||||||
for (result = isc_interfaceiter_first(iter);
|
for (result = isc_interfaceiter_first(iter);
|
||||||
result == ISC_R_SUCCESS;
|
result == ISC_R_SUCCESS;
|
||||||
result = isc_interfaceiter_next(iter))
|
result = isc_interfaceiter_next(iter))
|
||||||
@@ -1049,6 +1060,8 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen,
|
|||||||
sabuf, ifp->dscp);
|
sabuf, ifp->dscp);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
isc_boolean_t tcp_addr_in_use = ISC_FALSE;
|
||||||
|
|
||||||
if (adjusting == ISC_FALSE &&
|
if (adjusting == ISC_FALSE &&
|
||||||
ipv6_wildcard == ISC_TRUE)
|
ipv6_wildcard == ISC_TRUE)
|
||||||
continue;
|
continue;
|
||||||
@@ -1083,7 +1096,12 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen,
|
|||||||
&ifp,
|
&ifp,
|
||||||
(adjusting == ISC_TRUE) ?
|
(adjusting == ISC_TRUE) ?
|
||||||
ISC_FALSE : ISC_TRUE,
|
ISC_FALSE : ISC_TRUE,
|
||||||
le->dscp);
|
le->dscp,
|
||||||
|
&tcp_addr_in_use);
|
||||||
|
|
||||||
|
tried_listening = ISC_TRUE;
|
||||||
|
if (!tcp_addr_in_use)
|
||||||
|
all_addresses_in_use = ISC_FALSE;
|
||||||
|
|
||||||
if (result != ISC_R_SUCCESS) {
|
if (result != ISC_R_SUCCESS) {
|
||||||
isc_log_write(IFMGR_COMMON_LOGARGS,
|
isc_log_write(IFMGR_COMMON_LOGARGS,
|
||||||
@@ -1114,23 +1132,26 @@ do_scan(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen,
|
|||||||
"interface iteration failed: %s",
|
"interface iteration failed: %s",
|
||||||
isc_result_totext(result));
|
isc_result_totext(result));
|
||||||
else
|
else
|
||||||
result = ISC_R_SUCCESS;
|
result = ((tried_listening && all_addresses_in_use) ?
|
||||||
|
ISC_R_ADDRINUSE : ISC_R_SUCCESS);
|
||||||
cleanup_iter:
|
cleanup_iter:
|
||||||
isc_interfaceiter_destroy(&iter);
|
isc_interfaceiter_destroy(&iter);
|
||||||
return (result);
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static isc_result_t
|
||||||
ns_interfacemgr_scan0(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen,
|
ns_interfacemgr_scan0(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen,
|
||||||
isc_boolean_t verbose)
|
isc_boolean_t verbose)
|
||||||
{
|
{
|
||||||
|
isc_result_t result;
|
||||||
isc_boolean_t purge = ISC_TRUE;
|
isc_boolean_t purge = ISC_TRUE;
|
||||||
|
|
||||||
REQUIRE(NS_INTERFACEMGR_VALID(mgr));
|
REQUIRE(NS_INTERFACEMGR_VALID(mgr));
|
||||||
|
|
||||||
mgr->generation++; /* Increment the generation count. */
|
mgr->generation++; /* Increment the generation count. */
|
||||||
|
|
||||||
if (do_scan(mgr, ext_listen, verbose) != ISC_R_SUCCESS)
|
result = do_scan(mgr, ext_listen, verbose);
|
||||||
|
if ((result != ISC_R_SUCCESS) && (result != ISC_R_ADDRINUSE))
|
||||||
purge = ISC_FALSE;
|
purge = ISC_FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -1152,18 +1173,27 @@ ns_interfacemgr_scan0(ns_interfacemgr_t *mgr, ns_listenlist_t *ext_listen,
|
|||||||
isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_WARNING,
|
isc_log_write(IFMGR_COMMON_LOGARGS, ISC_LOG_WARNING,
|
||||||
"not listening on any interfaces");
|
"not listening on any interfaces");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
isc_boolean_t
|
||||||
|
ns_interfacemgr_islistening(ns_interfacemgr_t *mgr) {
|
||||||
|
REQUIRE(NS_INTERFACEMGR_VALID(mgr));
|
||||||
|
|
||||||
|
return (ISC_LIST_EMPTY(mgr->interfaces) ? ISC_FALSE : ISC_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
|
isc_result_t
|
||||||
ns_interfacemgr_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose) {
|
ns_interfacemgr_scan(ns_interfacemgr_t *mgr, isc_boolean_t verbose) {
|
||||||
ns_interfacemgr_scan0(mgr, NULL, verbose);
|
return (ns_interfacemgr_scan0(mgr, NULL, verbose));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
isc_result_t
|
||||||
ns_interfacemgr_adjust(ns_interfacemgr_t *mgr, ns_listenlist_t *list,
|
ns_interfacemgr_adjust(ns_interfacemgr_t *mgr, ns_listenlist_t *list,
|
||||||
isc_boolean_t verbose)
|
isc_boolean_t verbose)
|
||||||
{
|
{
|
||||||
ns_interfacemgr_scan0(mgr, list, verbose);
|
return (ns_interfacemgr_scan0(mgr, list, verbose));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@@ -424,7 +424,7 @@ parse_command_line(int argc, char *argv[]) {
|
|||||||
save_command_line(argc, argv);
|
save_command_line(argc, argv);
|
||||||
|
|
||||||
/* PLEASE keep options synchronized when main is hooked! */
|
/* PLEASE keep options synchronized when main is hooked! */
|
||||||
#define CMDLINE_FLAGS "46c:C:d:D:E:fFgi:lL:m:n:N:p:P:sS:t:T:U:u:vVx:"
|
#define CMDLINE_FLAGS "46c:C:d:D:E:fFgi:lL:m:n:N:p:P:sS:t:T:U:u:vVx:X:"
|
||||||
isc_commandline_errprint = ISC_FALSE;
|
isc_commandline_errprint = ISC_FALSE;
|
||||||
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
while ((ch = isc_commandline_parse(argc, argv, CMDLINE_FLAGS)) != -1) {
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
@@ -613,6 +613,12 @@ parse_command_line(int argc, char *argv[]) {
|
|||||||
LIBXML_DOTTED_VERSION);
|
LIBXML_DOTTED_VERSION);
|
||||||
#endif
|
#endif
|
||||||
exit(0);
|
exit(0);
|
||||||
|
case 'x':
|
||||||
|
/* Obsolete. No longer in use. Ignore. */
|
||||||
|
break;
|
||||||
|
case 'X':
|
||||||
|
ns_g_singletonfile = isc_commandline_argument;
|
||||||
|
break;
|
||||||
case 'F':
|
case 'F':
|
||||||
/* Reserved for FIPS mode */
|
/* Reserved for FIPS mode */
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
@@ -1215,6 +1221,11 @@ main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
parse_command_line(argc, argv);
|
parse_command_line(argc, argv);
|
||||||
|
|
||||||
|
if (!ns_os_issingleton(ns_g_singletonfile))
|
||||||
|
ns_main_earlyfatal("could not lock %s; "
|
||||||
|
"another named process may be running",
|
||||||
|
ns_g_singletonfile);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Warn about common configuration error.
|
* Warn about common configuration error.
|
||||||
*/
|
*/
|
||||||
|
@@ -77,6 +77,7 @@
|
|||||||
<arg><option>-u <replaceable class="parameter">user</replaceable></option></arg>
|
<arg><option>-u <replaceable class="parameter">user</replaceable></option></arg>
|
||||||
<arg><option>-v</option></arg>
|
<arg><option>-v</option></arg>
|
||||||
<arg><option>-V</option></arg>
|
<arg><option>-V</option></arg>
|
||||||
|
<arg><option>-X <replaceable class="parameter">lock-file</replaceable></option></arg>
|
||||||
<arg><option>-x <replaceable class="parameter">cache-file</replaceable></option></arg>
|
<arg><option>-x <replaceable class="parameter">cache-file</replaceable></option></arg>
|
||||||
</cmdsynopsis>
|
</cmdsynopsis>
|
||||||
</refsynopsisdiv>
|
</refsynopsisdiv>
|
||||||
@@ -378,6 +379,18 @@
|
|||||||
</listitem>
|
</listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
|
|
||||||
|
<varlistentry>
|
||||||
|
<term>-X <replaceable class="parameter">lock-file</replaceable></term>
|
||||||
|
<listitem>
|
||||||
|
<para>
|
||||||
|
Acquire a lock on the specified file at runtime; this
|
||||||
|
helps to prevent duplicate <command>named</command> instances
|
||||||
|
from running simultaneously. If not specified via this option,
|
||||||
|
the default lockfile is <filename>/var/run/named/named.lock</filename>.
|
||||||
|
</para>
|
||||||
|
</listitem>
|
||||||
|
</varlistentry>
|
||||||
|
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
<term>-x <replaceable class="parameter">cache-file</replaceable></term>
|
<term>-x <replaceable class="parameter">cache-file</replaceable></term>
|
||||||
<listitem>
|
<listitem>
|
||||||
|
@@ -4718,14 +4718,15 @@ directory_callback(const char *clausename, const cfg_obj_t *obj, void *arg) {
|
|||||||
return (ISC_R_SUCCESS);
|
return (ISC_R_SUCCESS);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static isc_result_t
|
||||||
scan_interfaces(ns_server_t *server, isc_boolean_t verbose) {
|
scan_interfaces(ns_server_t *server, isc_boolean_t verbose) {
|
||||||
|
isc_result_t result;
|
||||||
isc_boolean_t match_mapped = server->aclenv.match_mapped;
|
isc_boolean_t match_mapped = server->aclenv.match_mapped;
|
||||||
#ifdef HAVE_GEOIP
|
#ifdef HAVE_GEOIP
|
||||||
isc_boolean_t use_ecs = server->aclenv.geoip_use_ecs;
|
isc_boolean_t use_ecs = server->aclenv.geoip_use_ecs;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
ns_interfacemgr_scan(server->interfacemgr, verbose);
|
result = ns_interfacemgr_scan(server->interfacemgr, verbose);
|
||||||
/*
|
/*
|
||||||
* Update the "localhost" and "localnets" ACLs to match the
|
* Update the "localhost" and "localnets" ACLs to match the
|
||||||
* current set of network interfaces.
|
* current set of network interfaces.
|
||||||
@@ -4737,6 +4738,8 @@ scan_interfaces(ns_server_t *server, isc_boolean_t verbose) {
|
|||||||
#ifdef HAVE_GEOIP
|
#ifdef HAVE_GEOIP
|
||||||
server->aclenv.geoip_use_ecs = use_ecs;
|
server->aclenv.geoip_use_ecs = use_ecs;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
return (result);
|
||||||
}
|
}
|
||||||
|
|
||||||
static isc_result_t
|
static isc_result_t
|
||||||
@@ -5827,7 +5830,20 @@ load_configuration(const char *filename, ns_server_t *server,
|
|||||||
* to configure the query source, since the dispatcher we use might
|
* to configure the query source, since the dispatcher we use might
|
||||||
* be shared with an interface.
|
* be shared with an interface.
|
||||||
*/
|
*/
|
||||||
scan_interfaces(server, ISC_TRUE);
|
result = scan_interfaces(server, ISC_TRUE);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Check that named is able to TCP listen on at least one
|
||||||
|
* interface. Otherwise, another named process could be running
|
||||||
|
* and we should fail.
|
||||||
|
*/
|
||||||
|
if (first_time && (result == ISC_R_ADDRINUSE)) {
|
||||||
|
isc_log_write(ns_g_lctx, NS_LOGCATEGORY_GENERAL,
|
||||||
|
NS_LOGMODULE_SERVER, ISC_LOG_ERROR,
|
||||||
|
"unable to listen on any configured interfaces");
|
||||||
|
result = ISC_R_FAILURE;
|
||||||
|
goto cleanup;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Arrange for further interface scanning to occur periodically
|
* Arrange for further interface scanning to occur periodically
|
||||||
|
@@ -57,6 +57,9 @@ ns_os_openfile(const char *filename, mode_t mode, isc_boolean_t switch_user);
|
|||||||
void
|
void
|
||||||
ns_os_writepidfile(const char *filename, isc_boolean_t first_time);
|
ns_os_writepidfile(const char *filename, isc_boolean_t first_time);
|
||||||
|
|
||||||
|
isc_boolean_t
|
||||||
|
ns_os_issingleton(const char *filename);
|
||||||
|
|
||||||
void
|
void
|
||||||
ns_os_shutdown(void);
|
ns_os_shutdown(void);
|
||||||
|
|
||||||
|
@@ -55,6 +55,7 @@
|
|||||||
|
|
||||||
static char *pidfile = NULL;
|
static char *pidfile = NULL;
|
||||||
static int devnullfd = -1;
|
static int devnullfd = -1;
|
||||||
|
static int singletonfd = -1;
|
||||||
|
|
||||||
#ifndef ISC_FACILITY
|
#ifndef ISC_FACILITY
|
||||||
#define ISC_FACILITY LOG_DAEMON
|
#define ISC_FACILITY LOG_DAEMON
|
||||||
@@ -900,10 +901,47 @@ ns_os_writepidfile(const char *filename, isc_boolean_t first_time) {
|
|||||||
(void)fclose(lockfile);
|
(void)fclose(lockfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isc_boolean_t
|
||||||
|
ns_os_issingleton(const char *filename) {
|
||||||
|
struct flock lock;
|
||||||
|
|
||||||
|
if (singletonfd != -1)
|
||||||
|
return (ISC_TRUE);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ns_os_openfile() uses safeopen() which removes any existing
|
||||||
|
* files. We can't use that here.
|
||||||
|
*/
|
||||||
|
singletonfd = open(filename, O_WRONLY | O_CREAT,
|
||||||
|
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
|
||||||
|
if (singletonfd == -1)
|
||||||
|
return (ISC_FALSE);
|
||||||
|
|
||||||
|
memset(&lock, 0, sizeof(lock));
|
||||||
|
lock.l_type = F_WRLCK;
|
||||||
|
lock.l_whence = SEEK_SET;
|
||||||
|
lock.l_start = 0;
|
||||||
|
lock.l_len = 1;
|
||||||
|
|
||||||
|
/* Non-blocking (does not wait for lock) */
|
||||||
|
if (fcntl(singletonfd, F_SETLK, &lock) == -1) {
|
||||||
|
close(singletonfd);
|
||||||
|
singletonfd = -1;
|
||||||
|
return (ISC_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (ISC_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ns_os_shutdown(void) {
|
ns_os_shutdown(void) {
|
||||||
closelog();
|
closelog();
|
||||||
cleanup_pidfile();
|
cleanup_pidfile();
|
||||||
|
|
||||||
|
if (singletonfd != -1) {
|
||||||
|
close(singletonfd);
|
||||||
|
singletonfd = -1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
isc_result_t
|
isc_result_t
|
||||||
|
@@ -55,6 +55,9 @@ ns_os_openfile(const char *filename, int mode, isc_boolean_t switch_user);
|
|||||||
void
|
void
|
||||||
ns_os_writepidfile(const char *filename, isc_boolean_t first_time);
|
ns_os_writepidfile(const char *filename, isc_boolean_t first_time);
|
||||||
|
|
||||||
|
isc_boolean_t
|
||||||
|
ns_os_issingleton(const char *filename);
|
||||||
|
|
||||||
void
|
void
|
||||||
ns_os_shutdown(void);
|
ns_os_shutdown(void);
|
||||||
|
|
||||||
|
@@ -49,6 +49,7 @@
|
|||||||
|
|
||||||
static char *pidfile = NULL;
|
static char *pidfile = NULL;
|
||||||
static int devnullfd = -1;
|
static int devnullfd = -1;
|
||||||
|
static int singletonfd = -1;
|
||||||
|
|
||||||
static BOOL Initialized = FALSE;
|
static BOOL Initialized = FALSE;
|
||||||
|
|
||||||
@@ -282,10 +283,46 @@ ns_os_writepidfile(const char *filename, isc_boolean_t first_time) {
|
|||||||
(void)fclose(lockfile);
|
(void)fclose(lockfile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isc_boolean_t
|
||||||
|
ns_os_issingleton(const char *filename) {
|
||||||
|
OVERLAPPED o;
|
||||||
|
|
||||||
|
if (singletonfd != -1)
|
||||||
|
return (ISC_TRUE);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ns_os_openfile() uses safeopen() which removes any existing
|
||||||
|
* files. We can't use that here.
|
||||||
|
*/
|
||||||
|
singletonfd = open(filename, O_WRONLY | O_CREAT,
|
||||||
|
S_IRUSR|S_IWUSR|S_IRGRP|S_IROTH);
|
||||||
|
if (singletonfd == -1)
|
||||||
|
return (ISC_FALSE);
|
||||||
|
|
||||||
|
memset(&o, 0, sizeof(o));
|
||||||
|
/* Expect ERROR_LOCK_VIOLATION if already locked */
|
||||||
|
if (!LockFileEx((HANDLE) _get_osfhandle(singletonfd),
|
||||||
|
LOCKFILE_EXCLUSIVE_LOCK | LOCKFILE_FAIL_IMMEDIATELY,
|
||||||
|
0, 0, 1, &o)) {
|
||||||
|
close(singletonfd);
|
||||||
|
singletonfd = -1;
|
||||||
|
return (ISC_FALSE);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (ISC_TRUE);
|
||||||
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ns_os_shutdown(void) {
|
ns_os_shutdown(void) {
|
||||||
closelog();
|
closelog();
|
||||||
cleanup_pidfile();
|
cleanup_pidfile();
|
||||||
|
|
||||||
|
if (singletonfd != -1) {
|
||||||
|
(void) UnlockFile((HANDLE) _get_osfhandle(singletonfd),
|
||||||
|
0, 0, 0, 1);
|
||||||
|
close(singletonfd);
|
||||||
|
singletonfd = -1;
|
||||||
|
}
|
||||||
ntservice_shutdown(); /* This MUST be the last thing done */
|
ntservice_shutdown(); /* This MUST be the last thing done */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -23,3 +23,4 @@
|
|||||||
rm -f dig.out.*
|
rm -f dig.out.*
|
||||||
rm -f ns2/example.db ns2/tsigzone.db ns2/example.db.jnl ns2/named.conf
|
rm -f ns2/example.db ns2/tsigzone.db ns2/example.db.jnl ns2/named.conf
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -24,3 +24,4 @@ rm -f dig.out.*
|
|||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
rm -f */named.conf
|
rm -f */named.conf
|
||||||
rm -f */named.run
|
rm -f */named.run
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
# this server runs named with only one worker thread
|
# this server runs named with only one worker thread
|
||||||
-m record,size,mctx -c named.conf -d 99 -g -T clienttest -n 1
|
-m record,size,mctx -c named.conf -d 99 -X named.lock -g -T clienttest -n 1
|
||||||
|
@@ -25,3 +25,4 @@ rm -f ns2/core*
|
|||||||
rm -f ns2/inline.db.jbk
|
rm -f ns2/inline.db.jbk
|
||||||
rm -f ns2/inline.db.signed
|
rm -f ns2/inline.db.signed
|
||||||
rm -f ns2/inlineslave.bk*
|
rm -f ns2/inlineslave.bk*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -23,3 +23,4 @@
|
|||||||
rm -f dig.out.*
|
rm -f dig.out.*
|
||||||
rm -f ns2/named.conf
|
rm -f ns2/named.conf
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -53,3 +53,4 @@ rm -f ns3/ttl*.db
|
|||||||
rm -f signing.out.*
|
rm -f signing.out.*
|
||||||
rm -f ns3/*.nzf
|
rm -f ns3/*.nzf
|
||||||
rm -f digcomp.out.test*
|
rm -f digcomp.out.test*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -18,3 +18,4 @@ rm -f ns?/named.run
|
|||||||
rm -f ns?/named.memstats
|
rm -f ns?/named.memstats
|
||||||
rm -f rndc.status.ns*
|
rm -f rndc.status.ns*
|
||||||
rm -f dig.out.ns*
|
rm -f dig.out.ns*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -25,3 +25,4 @@ rm -f dig.out.ns2
|
|||||||
rm -f dig.out.expire
|
rm -f dig.out.expire
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
rm -f ns2/named_dump.db
|
rm -f ns2/named_dump.db
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -16,3 +16,4 @@
|
|||||||
|
|
||||||
rm -f dig.ns*.test*
|
rm -f dig.ns*.test*
|
||||||
rm -f ns2/example.bk
|
rm -f ns2/example.bk
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -17,3 +17,4 @@
|
|||||||
rm -f good.conf.in good.conf.out badzero.conf *.out
|
rm -f good.conf.in good.conf.out badzero.conf *.out
|
||||||
rm -rf test.keydir
|
rm -rf test.keydir
|
||||||
rm -f checkconf.out*
|
rm -f checkconf.out*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -17,3 +17,4 @@
|
|||||||
# $Id$
|
# $Id$
|
||||||
|
|
||||||
rm -f checkds.*
|
rm -f checkds.*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -24,3 +24,4 @@ rm -f ns1/*.update.db.jnl
|
|||||||
rm -f ns4/*.update.db
|
rm -f ns4/*.update.db
|
||||||
rm -f ns4/*.update.db.jnl
|
rm -f ns4/*.update.db.jnl
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -13,3 +13,4 @@
|
|||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
rm -f test.* good1.db.map good1.db.raw named-compilezone
|
rm -f test.* good1.db.map good1.db.raw named-compilezone
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -72,9 +72,9 @@ SUBDIRS="acl additional allow_query addzone autosign builtin
|
|||||||
legacy limits logfileconfig lwresd masterfile masterformat
|
legacy limits logfileconfig lwresd masterfile masterformat
|
||||||
metadata notify nslookup nsupdate pending @PKCS11_TEST@
|
metadata notify nslookup nsupdate pending @PKCS11_TEST@
|
||||||
reclimit redirect resolver rndc rpz rrl rrchecker rrsetorder
|
reclimit redirect resolver rndc rpz rrl rrchecker rrsetorder
|
||||||
rsabigexponent sit sfcache smartsign sortlist spf staticstub
|
rsabigexponent runtime sit sfcache smartsign sortlist spf
|
||||||
statistics stub tcp tkey tsig tsiggss unknown upforwd
|
staticstub statistics stub tcp tkey tsig tsiggss unknown
|
||||||
verify views wildcard xfer xferquota zero zonechecks"
|
upforwd verify views wildcard xfer xferquota zero zonechecks"
|
||||||
|
|
||||||
# Use the CONFIG_SHELL detected by configure for tests
|
# Use the CONFIG_SHELL detected by configure for tests
|
||||||
SHELL=@SHELL@
|
SHELL=@SHELL@
|
||||||
|
@@ -18,3 +18,4 @@ rm -f named-compilezone
|
|||||||
rm -f */K*.key
|
rm -f */K*.key
|
||||||
rm -f */K*.private
|
rm -f */K*.private
|
||||||
rm -rf coverage.*
|
rm -rf coverage.*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -18,3 +18,4 @@
|
|||||||
|
|
||||||
rm -f ns1/named.conf ns1/named.run ns1/named.memstats
|
rm -f ns1/named.conf ns1/named.run ns1/named.memstats
|
||||||
rm -f dig.out.*
|
rm -f dig.out.*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -17,3 +17,4 @@
|
|||||||
rm -f delv.out.test*
|
rm -f delv.out.test*
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
rm -f */named.run
|
rm -f */named.run
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -43,3 +43,4 @@ rm -f ns6/dsset-*
|
|||||||
rm -f ns6/signer.err
|
rm -f ns6/signer.err
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
rm -f dig.out.ns*.test*
|
rm -f dig.out.ns*.test*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -25,3 +25,4 @@ rm -f ns2/*.mkeys
|
|||||||
rm -f ns2/*.mkeys.jnl
|
rm -f ns2/*.mkeys.jnl
|
||||||
rm -f dig.out.ns?.test*
|
rm -f dig.out.ns?.test*
|
||||||
rm -f ns2/named.secroots
|
rm -f ns2/named.secroots
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -31,7 +31,7 @@ then
|
|||||||
ret=0
|
ret=0
|
||||||
$PERL $SYSTEMTESTTOP/stop.pl . ns2 || ret=1
|
$PERL $SYSTEMTESTTOP/stop.pl . ns2 || ret=1
|
||||||
sleep 1
|
sleep 1
|
||||||
(cd ns2; $NAMED -g -d 100 -c named.conf >> named.run 2>&1 & )
|
(cd ns2; $NAMED -g -d 100 -X named.lock -c named.conf >> named.run 2>&1 & )
|
||||||
sleep 2
|
sleep 2
|
||||||
$DIG $DIGOPTS soa . @10.53.0.2 > dig.out.ns2.test$n || ret=1
|
$DIG $DIGOPTS soa . @10.53.0.2 > dig.out.ns2.test$n || ret=1
|
||||||
grep "status: NOERROR" dig.out.ns2.test$n > /dev/null || ret=1
|
grep "status: NOERROR" dig.out.ns2.test$n > /dev/null || ret=1
|
||||||
|
@@ -19,3 +19,4 @@
|
|||||||
rm -f dig.out.*
|
rm -f dig.out.*
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
rm -f */named.run
|
rm -f */named.run
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -22,3 +22,4 @@ rm -f ns1/update.txt
|
|||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
rm -f ns1/ddns.key
|
rm -f ns1/ddns.key
|
||||||
rm -f dig.out*
|
rm -f dig.out*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -21,3 +21,4 @@
|
|||||||
#
|
#
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
rm -f dig.out.*
|
rm -f dig.out.*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -19,3 +19,4 @@ rm -f ns1/signed.db*
|
|||||||
rm -f ns1/dsset-signed.
|
rm -f ns1/dsset-signed.
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
rm -f dig.out.*
|
rm -f dig.out.*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -81,3 +81,4 @@ rm -f ns3/dnskey-nsec3-unknown.example.db
|
|||||||
rm -f ns3/dnskey-nsec3-unknown.example.db.tmp
|
rm -f ns3/dnskey-nsec3-unknown.example.db.tmp
|
||||||
rm -f ns3/dnskey-unknown.example.db
|
rm -f ns3/dnskey-unknown.example.db
|
||||||
rm -f ns3/dnskey-unknown.example.db.tmp
|
rm -f ns3/dnskey-unknown.example.db.tmp
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -c named.conf -d 99 -g -T nonearest -T clienttest
|
-m record,size,mctx -c named.conf -d 99 -X named.lock -g -T nonearest -T clienttest
|
||||||
|
@@ -14,3 +14,4 @@
|
|||||||
|
|
||||||
rm -f */root.bk
|
rm -f */root.bk
|
||||||
rm -f dig.out.10.53.0.?
|
rm -f dig.out.10.53.0.?
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -T clienttest -c named.conf -d 99 -g -U 4 -T dscp=46
|
-m record,size,mctx -T clienttest -c named.conf -d 99 -X named.lock -g -U 4 -T dscp=46
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -T clienttest -c named.conf -d 99 -g -U 4 -T dscp=46
|
-m record,size,mctx -T clienttest -c named.conf -d 99 -X named.lock -g -U 4 -T dscp=46
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -T clienttest -c named.conf -d 99 -g -U 4 -T dscp=46
|
-m record,size,mctx -T clienttest -c named.conf -d 99 -X named.lock -g -U 4 -T dscp=46
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -T clienttest -c named.conf -d 99 -g -U 4 -T dscp=46
|
-m record,size,mctx -T clienttest -c named.conf -d 99 -X named.lock -g -U 4 -T dscp=46
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -T clienttest -c named.conf -d 99 -g -U 4 -T dscp=46
|
-m record,size,mctx -T clienttest -c named.conf -d 99 -X named.lock -g -U 4 -T dscp=46
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -T clienttest -c named.conf -d 99 -g -U 4 -T dscp=46
|
-m record,size,mctx -T clienttest -c named.conf -d 99 -X named.lock -g -U 4 -T dscp=46
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -T clienttest -c named.conf -d 99 -g -U 4 -T dscp=46
|
-m record,size,mctx -T clienttest -c named.conf -d 99 -X named.lock -g -U 4 -T dscp=46
|
||||||
|
@@ -22,3 +22,4 @@ rm -f ns2/good.db ns2/bad.db
|
|||||||
rm -f dig.out*
|
rm -f dig.out*
|
||||||
rm -f */named.run
|
rm -f */named.run
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -20,3 +20,4 @@ rm -f ns1/signer.err
|
|||||||
rm -f dig.out*
|
rm -f dig.out*
|
||||||
rm -f */named.run
|
rm -f */named.run
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -15,3 +15,4 @@
|
|||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
rm -f dig.out*
|
rm -f dig.out*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -13,3 +13,4 @@
|
|||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
rm -f ns1/named.conf
|
rm -f ns1/named.conf
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -35,3 +35,4 @@ rm -f ns4/named.run ns4/named.conf
|
|||||||
rm -f ns4/named.memstats
|
rm -f ns4/named.memstats
|
||||||
|
|
||||||
rm -f dig.out.*
|
rm -f dig.out.*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -15,3 +15,4 @@
|
|||||||
rm -f nametoolong.out
|
rm -f nametoolong.out
|
||||||
rm -f twoquestions.out
|
rm -f twoquestions.out
|
||||||
rm -f noquestions.out
|
rm -f noquestions.out
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -20,3 +20,4 @@
|
|||||||
#
|
#
|
||||||
rm -f dig.out.*
|
rm -f dig.out.*
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -21,3 +21,4 @@ rm -f data2/*dat
|
|||||||
[ -d data2 ] && rmdir data2
|
[ -d data2 ] && rmdir data2
|
||||||
rm -f ns?/named.run
|
rm -f ns?/named.run
|
||||||
rm -f ns?/named.memstats
|
rm -f ns?/named.memstats
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -23,3 +23,4 @@
|
|||||||
|
|
||||||
rm -f dig.out ns1/cache
|
rm -f dig.out ns1/cache
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -20,3 +20,4 @@ rm -f ns1/signer.err
|
|||||||
rm -f dig.out*
|
rm -f dig.out*
|
||||||
rm -f */named.run
|
rm -f */named.run
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -88,3 +88,4 @@ rm -f ns3/test-?.bk.signed.jnl
|
|||||||
rm -f import.key Kimport*
|
rm -f import.key Kimport*
|
||||||
rm -f checkgost checkdsa checkecdsa
|
rm -f checkgost checkdsa checkecdsa
|
||||||
rm -f ns3/a-file
|
rm -f ns3/a-file
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -23,3 +23,4 @@ rm -f ns4/*.jnl ns4/*.db
|
|||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
rm -f dig.out dig.out1 dig.out2 dig.out3
|
rm -f dig.out dig.out1 dig.out2 dig.out3
|
||||||
rm -f ns3/large.db
|
rm -f ns3/large.db
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -16,6 +16,7 @@ rm -f dig.out.*
|
|||||||
rm -f ns1/named.conf
|
rm -f ns1/named.conf
|
||||||
rm -f ns?/named.memstats
|
rm -f ns?/named.memstats
|
||||||
rm -f ns?/named.run
|
rm -f ns?/named.run
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
|
||||||
# build.sh
|
# build.sh
|
||||||
rm -f ns6/K*
|
rm -f ns6/K*
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -T clienttest -c named.conf -d 99 -g -U 4 -T noedns
|
-m record,size,mctx -T clienttest -c named.conf -d 99 -X named.lock -g -U 4 -T noedns
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -T clienttest -c named.conf -d 99 -g -U 4 -T noedns
|
-m record,size,mctx -T clienttest -c named.conf -d 99 -X named.lock -g -U 4 -T noedns
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -T clienttest -c named.conf -d 99 -g -U 4 -T maxudp512
|
-m record,size,mctx -T clienttest -c named.conf -d 99 -X named.lock -g -U 4 -T maxudp512
|
||||||
|
@@ -1 +1 @@
|
|||||||
-m record,size,mctx -T clienttest -c named.conf -d 99 -g -U 4 -T maxudp512
|
-m record,size,mctx -T clienttest -c named.conf -d 99 -X named.lock -g -U 4 -T maxudp512
|
||||||
|
@@ -22,3 +22,4 @@
|
|||||||
#
|
#
|
||||||
rm -f dig.out.*
|
rm -f dig.out.*
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -25,3 +25,4 @@ rm -f ns1/named_log ns1/named_pipe ns1/named_sym
|
|||||||
rm -f ns1/named.conf
|
rm -f ns1/named.conf
|
||||||
rm -rf ns1/named_dir
|
rm -rf ns1/named_dir
|
||||||
rm -f ns1/named_deflog
|
rm -f ns1/named_deflog
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -32,7 +32,7 @@ SYMFILE="named_sym"
|
|||||||
DLFILE="named_deflog"
|
DLFILE="named_deflog"
|
||||||
PIDFILE="${THISDIR}/${CONFDIR}/named.pid"
|
PIDFILE="${THISDIR}/${CONFDIR}/named.pid"
|
||||||
myRNDC="$RNDC -c ${THISDIR}/${CONFDIR}/rndc.conf"
|
myRNDC="$RNDC -c ${THISDIR}/${CONFDIR}/rndc.conf"
|
||||||
myNAMED="$NAMED -c ${THISDIR}/${CONFDIR}/named.conf -m record,size,mctx -T clienttest -T nosyslog -d 99 -U 4"
|
myNAMED="$NAMED -c ${THISDIR}/${CONFDIR}/named.conf -m record,size,mctx -T clienttest -T nosyslog -d 99 -X named.lock -U 4"
|
||||||
|
|
||||||
waitforpidfile() {
|
waitforpidfile() {
|
||||||
for _w in 1 2 3 4 5 6 7 8 9 10
|
for _w in 1 2 3 4 5 6 7 8 9 10
|
||||||
|
@@ -22,3 +22,4 @@
|
|||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
rm -f dig.out
|
rm -f dig.out
|
||||||
rm -f lwresd1/lwresd.run.resolv
|
rm -f lwresd1/lwresd.run.resolv
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -19,3 +19,4 @@
|
|||||||
|
|
||||||
rm -f dig.out.*
|
rm -f dig.out.*
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -33,3 +33,4 @@ rm -f ns3/example.db.map ns3/dynamic.db.map
|
|||||||
rm -f baseline.txt text.1 text.2 raw.1 raw.2 map.1 map.2 map.5 text.5 badmap
|
rm -f baseline.txt text.1 text.2 raw.1 raw.2 map.1 map.2 map.5 text.5 badmap
|
||||||
rm -f ns1/Ksigned.* ns1/dsset-signed. ns1/signed.db.signed
|
rm -f ns1/Ksigned.* ns1/dsset-signed. ns1/signed.db.signed
|
||||||
rm -f rndc.out
|
rm -f rndc.out
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -20,3 +20,4 @@ rm -f pending.key rolling.key standby.key inact.key
|
|||||||
rm -f prerev.key postrev.key oldstyle.key
|
rm -f prerev.key postrev.key oldstyle.key
|
||||||
rm -f keys sigs
|
rm -f keys sigs
|
||||||
rm -f tmp.out
|
rm -f tmp.out
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -28,3 +28,4 @@ rm -f ns2/example.db
|
|||||||
rm -f ns2/x21.db*
|
rm -f ns2/x21.db*
|
||||||
rm -f ns3/example.bk
|
rm -f ns3/example.bk
|
||||||
rm -f ns4/x21.bk*
|
rm -f ns4/x21.bk*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -14,3 +14,4 @@
|
|||||||
|
|
||||||
rm -f ns1/example.db
|
rm -f ns1/example.db
|
||||||
rm -f nslookup.out*
|
rm -f nslookup.out*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -38,3 +38,4 @@ rm -f Kxxx.*
|
|||||||
rm -f typelist.out.*
|
rm -f typelist.out.*
|
||||||
rm -f ns1/many.test.db ns3/many.test.db.jnl
|
rm -f ns1/many.test.db ns3/many.test.db.jnl
|
||||||
rm -f ns3/many.test.bk ns3/many.test.bk.jnl
|
rm -f ns3/many.test.bk ns3/many.test.bk.jnl
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -25,3 +25,4 @@ rm -rf ns1/root.db
|
|||||||
rm -rf ns2/example.db
|
rm -rf ns2/example.db
|
||||||
rm -rf ns2/example.com.db
|
rm -rf ns2/example.com.db
|
||||||
rm -rf nsupdate.out.test
|
rm -rf nsupdate.out.test
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -18,3 +18,4 @@ rm -f K* ns1/K* keyset-* dsset-* ns1/*.db ns1/*.signed ns1/*.jnl
|
|||||||
rm -f dig.out pin
|
rm -f dig.out pin
|
||||||
rm -f ns1/*.key ns1/named.memstats
|
rm -f ns1/*.key ns1/named.memstats
|
||||||
rm -f supported
|
rm -f supported
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -18,3 +18,4 @@ rm -f K* ns1/K* keyset-* dsset-* ns1/*.db ns1/*.signed ns1/*.jnl
|
|||||||
rm -f dig.out pin
|
rm -f dig.out pin
|
||||||
rm -f ns1/*.key ns1/named.memstats
|
rm -f ns1/*.key ns1/named.memstats
|
||||||
rm -f supported
|
rm -f supported
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -20,3 +20,4 @@ rm -f ans2/ans.limit
|
|||||||
rm -f ns?/named.memstats
|
rm -f ns?/named.memstats
|
||||||
rm -f ns?/named.run
|
rm -f ns?/named.run
|
||||||
rm -f ns3/named.conf
|
rm -f ns3/named.conf
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -24,3 +24,4 @@ rm -f */named.run
|
|||||||
rm -f dig.out.*
|
rm -f dig.out.*
|
||||||
rm -f ns2/*.db
|
rm -f ns2/*.db
|
||||||
rm -f rndc.out
|
rm -f rndc.out
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -32,3 +32,4 @@ rm -f ns6/to-be-removed.tld.db ns6/to-be-removed.tld.db.jnl
|
|||||||
rm -f ns7/server.db ns7/server.db.jnl ns7/named.conf
|
rm -f ns7/server.db ns7/server.db.jnl ns7/named.conf
|
||||||
rm -f resolve.out
|
rm -f resolve.out
|
||||||
rm -f .digrc
|
rm -f .digrc
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -1,2 +1,2 @@
|
|||||||
# this server runs named with the "-T clienttest" option omitted
|
# this server runs named with the "-T clienttest" option omitted
|
||||||
-m record,size,mctx -c named.conf -d 99 -g
|
-m record,size,mctx -c named.conf -d 99 -X named.lock -g
|
||||||
|
@@ -23,3 +23,4 @@ rm -f ns*/named.run
|
|||||||
rm -f ns4/*.conf
|
rm -f ns4/*.conf
|
||||||
rm -f rndc.status
|
rm -f rndc.status
|
||||||
rm -f rndc.output
|
rm -f rndc.output
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -21,3 +21,4 @@ rm -f ns5/requests ns5/example.db ns5/bl.db ns5/*.perf
|
|||||||
rm -f */named.memstats */named.run */named.stats */session.key
|
rm -f */named.memstats */named.run */named.stats */session.key
|
||||||
rm -f */*.jnl */*.core */*.pid
|
rm -f */*.jnl */*.core */*.pid
|
||||||
rm -f */policy2.db
|
rm -f */policy2.db
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -1,3 +1,3 @@
|
|||||||
# run the performace test close to real life
|
# run the performace test close to real life
|
||||||
|
|
||||||
-c named.conf -gd3
|
-c named.conf -X named.lock -gd3
|
||||||
|
@@ -13,3 +13,4 @@
|
|||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
rm -f classlist.out privatelist.out typelist.out tempzone checker.out
|
rm -f classlist.out privatelist.out typelist.out tempzone checker.out
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -19,3 +19,4 @@
|
|||||||
rm -f dig.out*
|
rm -f dig.out*
|
||||||
rm -f */named.memstats */named.run */named.stats */log-* */session.key
|
rm -f */named.memstats */named.run */named.stats */log-* */session.key
|
||||||
rm -f ns3/bl*.db */*.jnl */*.core */*.pid
|
rm -f ns3/bl*.db */*.jnl */*.core */*.pid
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -23,3 +23,4 @@ rm -f dig.out.cyclic2
|
|||||||
rm -f ns2/root.bk
|
rm -f ns2/root.bk
|
||||||
rm -f ns?/named.run ns?/named.core
|
rm -f ns?/named.run ns?/named.core
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -20,3 +20,4 @@ rm -f ns*/named.memstats
|
|||||||
rm -f ns1/root.db
|
rm -f ns1/root.db
|
||||||
rm -f ns2/signer.err
|
rm -f ns2/signer.err
|
||||||
rm -f dig.out.*
|
rm -f dig.out.*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
5
bin/tests/system/runtime/README
Normal file
5
bin/tests/system/runtime/README
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
|
||||||
|
See COPYRIGHT in the source root or http://isc.org/copyright.html for terms.
|
||||||
|
|
||||||
|
Tests of runtime checks, e.g., that named prevents duplicate processes
|
||||||
|
from running.
|
19
bin/tests/system/runtime/clean.sh
Normal file
19
bin/tests/system/runtime/clean.sh
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
# purpose with or without fee is hereby granted, provided that the above
|
||||||
|
# copyright notice and this permission notice appear in all copies.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
|
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
rm -f */named.memstats
|
||||||
|
rm -f */named*.run
|
||||||
|
rm -f ns*/named.lock ns*/.nolock
|
31
bin/tests/system/runtime/ns2/named-alt.conf
Normal file
31
bin/tests/system/runtime/ns2/named-alt.conf
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// NS2
|
||||||
|
|
||||||
|
controls { /* empty */ };
|
||||||
|
|
||||||
|
options {
|
||||||
|
query-source address 10.53.0.2;
|
||||||
|
port 5300;
|
||||||
|
pid-file "named.pid";
|
||||||
|
listen-on { 10.53.0.2; 10.53.0.3; };
|
||||||
|
listen-on-v6 { fd92:7065:b8e:ffff::2; };
|
||||||
|
recursion no;
|
||||||
|
notify yes;
|
||||||
|
dnssec-enable no;
|
||||||
|
dnssec-validation no;
|
||||||
|
};
|
31
bin/tests/system/runtime/ns2/named.conf
Normal file
31
bin/tests/system/runtime/ns2/named.conf
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
|
||||||
|
*
|
||||||
|
* Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
* purpose with or without fee is hereby granted, provided that the above
|
||||||
|
* copyright notice and this permission notice appear in all copies.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
|
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
* PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
|
// NS2
|
||||||
|
|
||||||
|
controls { /* empty */ };
|
||||||
|
|
||||||
|
options {
|
||||||
|
query-source address 10.53.0.2;
|
||||||
|
port 5300;
|
||||||
|
pid-file "named.pid";
|
||||||
|
listen-on { 10.53.0.2; };
|
||||||
|
listen-on-v6 { fd92:7065:b8e:ffff::2; };
|
||||||
|
recursion no;
|
||||||
|
notify yes;
|
||||||
|
dnssec-enable no;
|
||||||
|
dnssec-validation no;
|
||||||
|
};
|
48
bin/tests/system/runtime/tests.sh
Normal file
48
bin/tests/system/runtime/tests.sh
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
# Copyright (C) 2014 Internet Systems Consortium, Inc. ("ISC")
|
||||||
|
#
|
||||||
|
# Permission to use, copy, modify, and/or distribute this software for any
|
||||||
|
# purpose with or without fee is hereby granted, provided that the above
|
||||||
|
# copyright notice and this permission notice appear in all copies.
|
||||||
|
#
|
||||||
|
# THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
|
||||||
|
# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||||
|
# AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
|
||||||
|
# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
||||||
|
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
|
||||||
|
# OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
||||||
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
|
SYSTEMTESTTOP=..
|
||||||
|
. $SYSTEMTESTTOP/conf.sh
|
||||||
|
|
||||||
|
status=0
|
||||||
|
n=0
|
||||||
|
|
||||||
|
n=`expr $n + 1`
|
||||||
|
echo "I:verifying that named started normally ($n)"
|
||||||
|
ret=0
|
||||||
|
[ -s ns2/named.pid ] || ret=1
|
||||||
|
grep "unable to listen on any configured interface" ns2/named.run > /dev/null && ret=1
|
||||||
|
grep "another named process" ns2/named.run > /dev/null && ret=1
|
||||||
|
if [ $ret != 0 ]; then echo "I:failed"; fi
|
||||||
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
|
n=`expr $n + 1`
|
||||||
|
echo "I:verifying that named checks for conflicting listeners ($n)"
|
||||||
|
ret=0
|
||||||
|
(cd ns2; $NAMED -c named.conf -D ns2-extra-1 -X .nolock -m record,size,mctx -d 99 -g -U 4 >> named2.run 2>&1 & )
|
||||||
|
sleep 2
|
||||||
|
grep "unable to listen on any configured interface" ns2/named2.run > /dev/null || ret=1
|
||||||
|
if [ $ret != 0 ]; then echo "I:failed"; fi
|
||||||
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
|
n=`expr $n + 1`
|
||||||
|
echo "I:verifying that named checks for conflicting named processes ($n)"
|
||||||
|
ret=0
|
||||||
|
(cd ns2; $NAMED -c named-alt.conf -D ns2-extra-1 -X named.lock -m record,size,mctx -d 99 -g -U 4 >> named3.run 2>&1 & )
|
||||||
|
sleep 2
|
||||||
|
grep "another named process" ns2/named3.run > /dev/null || ret=1
|
||||||
|
if [ $ret != 0 ]; then echo "I:failed"; fi
|
||||||
|
status=`expr $status + $ret`
|
||||||
|
|
||||||
|
exit $status
|
@@ -20,3 +20,4 @@ rm -f random.data
|
|||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
rm -f dig.*
|
rm -f dig.*
|
||||||
rm -f sfcache.*
|
rm -f sfcache.*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -14,3 +14,4 @@
|
|||||||
|
|
||||||
rm -f dig.out.*
|
rm -f dig.out.*
|
||||||
rm -f ns1/named_dump.db
|
rm -f ns1/named_dump.db
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -15,3 +15,4 @@
|
|||||||
# PERFORMANCE OF THIS SOFTWARE.
|
# PERFORMANCE OF THIS SOFTWARE.
|
||||||
|
|
||||||
rm -f K* dsset-* *.signed dnskey.sigs other.sigs dsset.out
|
rm -f K* dsset-* *.signed dnskey.sigs other.sigs dsset.out
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -19,3 +19,4 @@
|
|||||||
|
|
||||||
rm -f *.dig *.good *.out
|
rm -f *.dig *.good *.out
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -14,3 +14,4 @@
|
|||||||
|
|
||||||
rm -f ns1/named.run
|
rm -f ns1/named.run
|
||||||
rm -f ns1/named.memstats
|
rm -f ns1/named.memstats
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -170,6 +170,7 @@ sub start_server {
|
|||||||
$command .= "$options";
|
$command .= "$options";
|
||||||
} else {
|
} else {
|
||||||
$command .= "-D $server ";
|
$command .= "-D $server ";
|
||||||
|
$command .= "-X named.lock ";
|
||||||
$command .= "-m record,size,mctx ";
|
$command .= "-m record,size,mctx ";
|
||||||
$command .= "-T clienttest ";
|
$command .= "-T clienttest ";
|
||||||
$command .= "-T nosoa "
|
$command .= "-T nosoa "
|
||||||
|
@@ -26,3 +26,4 @@ rm -f ns3/named.conf
|
|||||||
rm -f ns3/example.db
|
rm -f ns3/example.db
|
||||||
rm -f ns4/sub.example.db
|
rm -f ns4/sub.example.db
|
||||||
rm -f dig.out.*
|
rm -f dig.out.*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -26,3 +26,4 @@ rm -f */named.memstats
|
|||||||
rm -f */named.run
|
rm -f */named.run
|
||||||
rm -f */named.stats
|
rm -f */named.stats
|
||||||
rm -f dig.out*
|
rm -f dig.out*
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
@@ -27,3 +27,4 @@ rm -f ns1/delegations.db
|
|||||||
rm -f ns2/zone0*.db
|
rm -f ns2/zone0*.db
|
||||||
rm -f ns2/zone0*.jnl
|
rm -f ns2/zone0*.jnl
|
||||||
rm -f */named.memstats
|
rm -f */named.memstats
|
||||||
|
rm -f ns*/named.lock
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user