Merge branch '4046-rndc-t-option' into 'main'

add 'rndc -t' option to set timeout

Closes #4046

See merge request isc-projects/bind9!7889
This commit is contained in:
Evan Hunt 2023-05-12 19:37:36 +00:00
commit 5673c9912e
4 changed files with 30 additions and 4 deletions

View file

@ -1,3 +1,9 @@
6170. [func] The 'rndc -t' option allows a timeout to be set in
seconds, so that commands that take a long time to
complete (e.g., reloading a very large configuration)
can be given time to do so. The default is 60
seconds. [GL #4046]
6169. [bug] named could crash when deleting inline-signing zones
with "rndc delzone". [GL #4054]

View file

@ -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);

View file

@ -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.

View file

@ -24,6 +24,10 @@ New Features
allows you to enable or disable the publication of CDNSKEY records.
:gl:`#4050`
- The read timeout in ``rndc`` can now be specified on the command line
using the ``-t`` option, allowing commands that take a long time to
complete sufficient time to do so. :gl:`#4046`
Removed Features
~~~~~~~~~~~~~~~~