client: add second form of makestep command

The second form configures the automatic stepping, similarly to the
makestep directive. It has two parameters, stepping threshold (in
seconds) and number of future clock updates for which will be the
threshold active. This can be used with the burst command to quickly
make a new measurement and correct the clock by stepping if needed,
without waiting for chronyd to complete the measurement and update the
clock.
This commit is contained in:
Miroslav Lichvar
2014-12-08 17:54:08 +01:00
parent 4b81cda521
commit 513e65900c
7 changed files with 80 additions and 15 deletions

View File

@@ -160,7 +160,8 @@ static const char permissions[] = {
PERMIT_AUTH, /* MODIFY_POLLTARGET */
PERMIT_AUTH, /* MODIFY_MAXDELAYDEVRATIO */
PERMIT_AUTH, /* RESELECT */
PERMIT_AUTH /* RESELECTDISTANCE */
PERMIT_AUTH, /* RESELECTDISTANCE */
PERMIT_AUTH, /* MODIFY_MAKESTEP */
};
/* ================================================== */
@@ -908,6 +909,16 @@ handle_modify_maxupdateskew(CMD_Request *rx_message, CMD_Reply *tx_message)
/* ================================================== */
static void
handle_modify_makestep(CMD_Request *rx_message, CMD_Reply *tx_message)
{
REF_ModifyMakestep(ntohl(rx_message->data.modify_makestep.limit),
UTI_FloatNetworkToHost(rx_message->data.modify_makestep.threshold));
tx_message->status = htons(STT_SUCCESS);
}
/* ================================================== */
static void
handle_settime(CMD_Request *rx_message, CMD_Reply *tx_message)
{
@@ -1940,6 +1951,10 @@ read_from_cmd_socket(void *anything)
handle_modify_maxupdateskew(&rx_message, &tx_message);
break;
case REQ_MODIFY_MAKESTEP:
handle_modify_makestep(&rx_message, &tx_message);
break;
case REQ_LOGON:
/* If the log-on fails, record the reason why */
if (!issue_token) {