"cyclelogs\0Close and re-open log files\0"
"dump\0Dump measurements and NTS keys/cookies\0"
"rekey\0Re-read keys\0"
- "reset\0Drop all measurements\0"
+ "reset sources\0Drop all measurements\0"
"shutdown\0Stop daemon\0"
"\0\0"
"Client commands:\0\0"
TAB_COMPLETE_BASE_CMDS,
TAB_COMPLETE_ADD_OPTS,
TAB_COMPLETE_MANUAL_OPTS,
+ TAB_COMPLETE_RESET_OPTS,
TAB_COMPLETE_SOURCES_OPTS,
TAB_COMPLETE_SOURCESTATS_OPTS,
TAB_COMPLETE_MAX_INDEX
};
const char *add_options[] = { "peer", "pool", "server", NULL };
const char *manual_options[] = { "on", "off", "delete", "list", "reset", NULL };
+ const char *reset_options[] = { "sources", NULL };
const char *sources_options[] = { "-a", "-v", NULL };
const char *sourcestats_options[] = { "-a", "-v", NULL };
static int list_index, len;
names[TAB_COMPLETE_BASE_CMDS] = base_commands;
names[TAB_COMPLETE_ADD_OPTS] = add_options;
names[TAB_COMPLETE_MANUAL_OPTS] = manual_options;
+ names[TAB_COMPLETE_RESET_OPTS] = reset_options;
names[TAB_COMPLETE_SOURCES_OPTS] = sources_options;
names[TAB_COMPLETE_SOURCESTATS_OPTS] = sourcestats_options;
tab_complete_index = TAB_COMPLETE_ADD_OPTS;
} else if (!strcmp(first, "manual ")) {
tab_complete_index = TAB_COMPLETE_MANUAL_OPTS;
+ } else if (!strcmp(first, "reset ")) {
+ tab_complete_index = TAB_COMPLETE_RESET_OPTS;
} else if (!strcmp(first, "sources ")) {
tab_complete_index = TAB_COMPLETE_SOURCES_OPTS;
} else if (!strcmp(first, "sourcestats ")) {
/* ================================================== */
-static void
+static int
process_cmd_reset(CMD_Request *msg, char *line)
{
- msg->command = htons(REQ_RESET);
+ if (!strcmp(line, "sources")) {
+ msg->command = htons(REQ_RESET_SOURCES);
+ } else {
+ LOG(LOGS_ERR, "Invalid syntax for reset command");
+ return 0;
+ }
+
+ return 1;
}
/* ================================================== */
} else if (!strcmp(command, "reselectdist")) {
do_normal_submit = process_cmd_reselectdist(&tx_message, line);
} else if (!strcmp(command, "reset")) {
- process_cmd_reset(&tx_message, line);
+ do_normal_submit = process_cmd_reset(&tx_message, line);
} else if (!strcmp(command, "retries")) {
ret = process_cmd_retries(line);
do_normal_submit = 0;
PERMIT_AUTH, /* ONOFFLINE */
PERMIT_AUTH, /* ADD_SOURCE */
PERMIT_OPEN, /* NTP_SOURCE_NAME */
- PERMIT_AUTH, /* RESET */
+ PERMIT_AUTH, /* RESET_SOURCES */
};
/* ================================================== */
/* ================================================== */
static void
-handle_reset(CMD_Request *rx_message, CMD_Reply *tx_message)
+handle_reset_sources(CMD_Request *rx_message, CMD_Reply *tx_message)
{
struct timespec cooked_now, now;
handle_ntp_source_name(&rx_message, &tx_message);
break;
- case REQ_RESET:
- handle_reset(&rx_message, &tx_message);
+ case REQ_RESET_SOURCES:
+ handle_reset_sources(&rx_message, &tx_message);
break;
default:
<<chrony.conf.adoc#ntsrotate,automatic rotation>> is disabled in the
configuration file.
-[[reset]]*reset*::
-The *reset* command causes *chronyd* to drop all measurements and switch to the
-unsynchronised state. This command can help *chronyd* with recovery when the
-measurements are known to be no longer valid or accurate, e.g. due to moving
-the computer to a different network, or resuming the computer from a low-power
-state (which resets the system clock).
+[[reset]]*reset* *sources*::
+The *reset sources* command causes *chronyd* to drop all measurements and
+switch to the unsynchronised state. This command can help *chronyd* with
+recovery when the measurements are known to be no longer valid or accurate,
+e.g. due to moving the computer to a different network, or resuming the
+computer from a low-power state (which resets the system clock).
[[shutdown]]*shutdown*::
The *shutdown* command causes *chronyd* to exit. This is equivalent to sending