mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
add 'rndc -t' option to set timeout
Allow an arbitrary TCP timeout value to be specified when running rndc, so that commands that take a long time to execute (for example, reloading a very large configuration) can be given time to do so.
This commit is contained in:
@@ -82,6 +82,7 @@ static char program[256];
|
||||
static uint32_t serial;
|
||||
static bool quiet = false;
|
||||
static bool showresult = false;
|
||||
static int32_t timeout = RNDC_TIMEOUT;
|
||||
|
||||
static void
|
||||
rndc_startconnect(isc_sockaddr_t *addr);
|
||||
@@ -222,7 +223,7 @@ Version: %s\n",
|
||||
exit(status);
|
||||
}
|
||||
|
||||
#define CMDLINE_FLAGS "46b:c:hk:Mmp:qrs:Vy:"
|
||||
#define CMDLINE_FLAGS "46b:c:hk:Mmp:qrs:t:Vy:"
|
||||
|
||||
static void
|
||||
preparse_args(int argc, char **argv) {
|
||||
@@ -527,7 +528,7 @@ rndc_startconnect(isc_sockaddr_t *addr) {
|
||||
}
|
||||
|
||||
isc_nm_tcpconnect(netmgr, local, addr, rndc_connected, &rndc_ccmsg,
|
||||
RNDC_TIMEOUT);
|
||||
timeout);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -827,7 +828,7 @@ main(int argc, char **argv) {
|
||||
const char *keyname = NULL;
|
||||
struct in_addr in;
|
||||
struct in6_addr in6;
|
||||
char *p;
|
||||
char *p = NULL;
|
||||
size_t argslen;
|
||||
int ch;
|
||||
int i;
|
||||
@@ -913,6 +914,15 @@ main(int argc, char **argv) {
|
||||
servername = isc_commandline_argument;
|
||||
break;
|
||||
|
||||
case 't':
|
||||
timeout = strtol(isc_commandline_argument, &p, 10);
|
||||
if (*p != '\0' || timeout < 0 || timeout > 86400) {
|
||||
fatal("invalid timeout '%s'",
|
||||
isc_commandline_argument);
|
||||
}
|
||||
timeout *= 1000;
|
||||
break;
|
||||
|
||||
case 'V':
|
||||
verbose = true;
|
||||
break;
|
||||
@@ -956,7 +966,7 @@ main(int argc, char **argv) {
|
||||
isc_managers_create(&rndc_mctx, 1, &loopmgr, &netmgr);
|
||||
isc_loopmgr_setup(loopmgr, rndc_start, NULL);
|
||||
|
||||
isc_nm_settimeouts(netmgr, RNDC_TIMEOUT, RNDC_TIMEOUT, RNDC_TIMEOUT, 0);
|
||||
isc_nm_settimeouts(netmgr, timeout, timeout, timeout, 0);
|
||||
|
||||
isc_log_create(rndc_mctx, &log, &logconfig);
|
||||
isc_log_setcontext(log);
|
||||
|
@@ -97,6 +97,12 @@ Options
|
||||
after executing the requested command (e.g., ISC_R_SUCCESS,
|
||||
ISC_R_FAILURE, etc.).
|
||||
|
||||
.. option:: -t timeout
|
||||
|
||||
This option sets the idle timeout period for :program:`rndc` to
|
||||
``timeout`` seconds. The default is 60 seconds, and the maximum settable
|
||||
value is 86400 seconds (1 day). If set to 0, there is no timeout.
|
||||
|
||||
.. option:: -V
|
||||
|
||||
This option enables verbose logging.
|
||||
|
Reference in New Issue
Block a user