#define REQ_MODIFY_MINSTRATUM 45
#define REQ_MODIFY_POLLTARGET 46
#define REQ_MODIFY_MAXDELAYDEVRATIO 47
-#define N_REQUEST_TYPES 48
+#define REQ_RESELECT 48
+#define N_REQUEST_TYPES 49
/* Special utoken value used to log on with first exchange being the
password. (This time value has long since gone by) */
int32_t EOR;
} REQ_Activity;
+typedef struct {
+ int32_t EOR;
+} REQ_Reselect;
+
/* ================================================== */
#define PKT_TYPE_CMD_REQUEST 1
REQ_ManualDelete manual_delete;
REQ_MakeStep make_step;
REQ_Activity activity;
+ REQ_Reselect reselect;
} data; /* Command specific parameters */
} CMD_Request;
* password command:: Provide password needed for most commands
* polltarget command:: Set poll target for a source
* quit command:: Exit from chronyc
+* reselect command:: Reselect synchronisation source
* retries command:: Set maximum number of retries
* rtcdata command:: Display RTC parameters
* settime command:: Provide a manual input of the current time
The quit command exits from chronyc and returns the user to the shell
(same as the exit command).
@c }}}
+@c {{{ reselect command
+@node reselect command
+@subsubsection reselect
+To avoid excessive switching between sources, @code{chronyd} may stay
+synchronised to a source even when it is not currently the best one among the
+available sources.
+
+The @code{reselect} command can be used to force @code{chronyd} to
+reselect the best synchronisation source.
+@c }}}
@c {{{ retries
@node retries command
@subsubsection retries
printf("online [<mask>/<masked-address>] : Set sources in subnet to online status\n");
printf("password [<new-password>] : Set command authentication password\n");
printf("polltarget <address> <new-poll-target> : Modify poll target of source\n");
+ printf("reselect : Reselect synchronisation source\n");
printf("rtcdata : Print current RTC performance parameters\n");
printf("settime <date/time (e.g. Nov 21, 1997 16:30:05 or 16:30:05)> : Manually set the daemon time\n");
printf("sources [-v] : Display information about current sources\n");
/* ================================================== */
+static void
+process_cmd_reselect(CMD_Request *msg, char *line)
+{
+ msg->command = htons(REQ_RESELECT);
+}
+
+/* ================================================== */
+
static int
process_cmd_dns(const char *line)
{
} else if (!strncmp(p, "activity", 8)) {
ret = process_cmd_activity(p+8);
do_normal_submit = 0;
+ } else if (!strncmp(p, "reselect", 8)) {
+ process_cmd_reselect(&tx_message, p+8);
} else if (!strncmp(p, "dns ", 4)) {
ret = process_cmd_dns(p+4);
do_normal_submit = 0;
PERMIT_OPEN, /* ACTIVITY */
PERMIT_AUTH, /* MODIFY_MINSTRATUM */
PERMIT_AUTH, /* MODIFY_POLLTARGET */
- PERMIT_AUTH /* MODIFY_MAXDELAYDEVRATIO */
+ PERMIT_AUTH, /* MODIFY_MAXDELAYDEVRATIO */
+ PERMIT_AUTH /* RESELECT */
};
/* ================================================== */
/* ================================================== */
+static void
+handle_reselect(CMD_Request *rx_message, CMD_Reply *tx_message)
+{
+ SRC_ReselectSource();
+ tx_message->status = htons(STT_SUCCESS);
+ return;
+}
+
+/* ================================================== */
+
#if 0
/* ================================================== */
handle_activity(&rx_message, &tx_message);
break;
+ case REQ_RESELECT:
+ handle_reselect(&rx_message, &tx_message);
+ break;
+
case REQ_MODIFY_MINSTRATUM:
handle_modify_minstratum(&rx_message, &tx_message);
break;
return offsetof(CMD_Request, data.make_step.EOR);
case REQ_ACTIVITY:
return offsetof(CMD_Request, data.activity.EOR);
+ case REQ_RESELECT:
+ return offsetof(CMD_Request, data.reselect.EOR);
case REQ_MODIFY_MINSTRATUM:
return offsetof(CMD_Request, data.modify_minstratum.EOR);
case REQ_MODIFY_POLLTARGET:
}
+/* ================================================== */
+/* Force reselecting the best source */
+
+void
+SRC_ReselectSource(void)
+{
+ selected_source_index = INVALID_SOURCE;
+ SRC_SelectSource(0);
+}
+
/* ================================================== */
double
selected reference make a difference) */
extern void SRC_SelectSource(unsigned long match_addr);
+/* Force reselecting the best source */
+extern void SRC_ReselectSource(void);
+
/* Predict the offset of the local clock relative to a given source at
a given local cooked time. Positive indicates local clock is FAST
relative to reference. */