Add maxdelaydevratio command
This commit is contained in:
parent
b977c95be4
commit
6ed5a65064
9 changed files with 108 additions and 2 deletions
10
candm.h
10
candm.h
|
@ -88,7 +88,8 @@
|
||||||
#define REQ_ACTIVITY 44
|
#define REQ_ACTIVITY 44
|
||||||
#define REQ_MODIFY_MINSTRATUM 45
|
#define REQ_MODIFY_MINSTRATUM 45
|
||||||
#define REQ_MODIFY_POLLTARGET 46
|
#define REQ_MODIFY_POLLTARGET 46
|
||||||
#define N_REQUEST_TYPES 47
|
#define REQ_MODIFY_MAXDELAYDEVRATIO 47
|
||||||
|
#define N_REQUEST_TYPES 48
|
||||||
|
|
||||||
/* Special utoken value used to log on with first exchange being the
|
/* Special utoken value used to log on with first exchange being the
|
||||||
password. (This time value has long since gone by) */
|
password. (This time value has long since gone by) */
|
||||||
|
@ -164,6 +165,12 @@ typedef struct {
|
||||||
int32_t EOR;
|
int32_t EOR;
|
||||||
} REQ_Modify_Maxdelayratio;
|
} REQ_Modify_Maxdelayratio;
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
IPAddr address;
|
||||||
|
Float new_max_delay_dev_ratio;
|
||||||
|
int32_t EOR;
|
||||||
|
} REQ_Modify_Maxdelaydevratio;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
IPAddr address;
|
IPAddr address;
|
||||||
int32_t new_min_stratum;
|
int32_t new_min_stratum;
|
||||||
|
@ -386,6 +393,7 @@ typedef struct {
|
||||||
REQ_Dump dump;
|
REQ_Dump dump;
|
||||||
REQ_Modify_Maxdelay modify_maxdelay;
|
REQ_Modify_Maxdelay modify_maxdelay;
|
||||||
REQ_Modify_Maxdelayratio modify_maxdelayratio;
|
REQ_Modify_Maxdelayratio modify_maxdelayratio;
|
||||||
|
REQ_Modify_Maxdelaydevratio modify_maxdelaydevratio;
|
||||||
REQ_Modify_Minstratum modify_minstratum;
|
REQ_Modify_Minstratum modify_minstratum;
|
||||||
REQ_Modify_Polltarget modify_polltarget;
|
REQ_Modify_Polltarget modify_polltarget;
|
||||||
REQ_Modify_Maxupdateskew modify_maxupdateskew;
|
REQ_Modify_Maxupdateskew modify_maxupdateskew;
|
||||||
|
|
17
chrony.texi
17
chrony.texi
|
@ -2874,6 +2874,7 @@ interface.
|
||||||
* manual command:: Enable/disable/configure options for settime
|
* manual command:: Enable/disable/configure options for settime
|
||||||
* maxdelay command:: Set max measurement delay for a source
|
* maxdelay command:: Set max measurement delay for a source
|
||||||
* maxdelayratio command:: Set max measurement delay for a source as ratio
|
* maxdelayratio command:: Set max measurement delay for a source as ratio
|
||||||
|
* maxdelaydevratio command:: Set max measurement delay for a source as ratio to deviation
|
||||||
* maxpoll command:: Set maximum polling interval for a source
|
* maxpoll command:: Set maximum polling interval for a source
|
||||||
* maxupdateskew command:: Set safety threshold for clock gain/loss rate
|
* maxupdateskew command:: Set safety threshold for clock gain/loss rate
|
||||||
* minpoll command:: Set minimum polling interval for a source
|
* minpoll command:: Set minimum polling interval for a source
|
||||||
|
@ -3438,6 +3439,22 @@ address @code{2001:db8::1} to be double the retained minimum.
|
||||||
As for @code{maxdelay}, any measurement whose network delay is too large
|
As for @code{maxdelay}, any measurement whose network delay is too large
|
||||||
will be discarded.
|
will be discarded.
|
||||||
@c }}}
|
@c }}}
|
||||||
|
@c {{{ maxdelaydevratio
|
||||||
|
@node maxdelaydevratio command
|
||||||
|
@subsubsection maxdelaydevratio
|
||||||
|
This allows the @code{maxdelaydevratio} option for one of the sources to be
|
||||||
|
modified, in the same way as specifying the @code{maxdelaydevratio} option
|
||||||
|
for the @code{server} directive in the configuration file (@pxref{server
|
||||||
|
directive}).
|
||||||
|
|
||||||
|
The following examples illustrate the syntax
|
||||||
|
|
||||||
|
@example
|
||||||
|
maxdelaydevratio foo.bar.com 0.1
|
||||||
|
maxdelaydevratio 1.2.3.4 1.0
|
||||||
|
maxdelaydevratio 2001:db8::1 100.0
|
||||||
|
@end example
|
||||||
|
@c }}}
|
||||||
@c {{{ maxpoll
|
@c {{{ maxpoll
|
||||||
@node maxpoll command
|
@node maxpoll command
|
||||||
@subsubsection maxpoll
|
@subsubsection maxpoll
|
||||||
|
|
24
client.c
24
client.c
|
@ -436,6 +436,28 @@ process_cmd_maxdelay(CMD_Request *msg, char *line)
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
||||||
|
static int
|
||||||
|
process_cmd_maxdelaydevratio(CMD_Request *msg, char *line)
|
||||||
|
{
|
||||||
|
IPAddr address;
|
||||||
|
double max_delay_dev_ratio;
|
||||||
|
int ok;
|
||||||
|
|
||||||
|
if (read_address_double(line, &address, &max_delay_dev_ratio)) {
|
||||||
|
UTI_IPHostToNetwork(&address, &msg->data.modify_maxdelaydevratio.address);
|
||||||
|
msg->data.modify_maxdelayratio.new_max_delay_ratio = UTI_FloatHostToNetwork(max_delay_dev_ratio);
|
||||||
|
msg->command = htons(REQ_MODIFY_MAXDELAYDEVRATIO);
|
||||||
|
ok = 1;
|
||||||
|
} else {
|
||||||
|
ok = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================================================== */
|
||||||
|
|
||||||
static int
|
static int
|
||||||
process_cmd_maxdelayratio(CMD_Request *msg, char *line)
|
process_cmd_maxdelayratio(CMD_Request *msg, char *line)
|
||||||
{
|
{
|
||||||
|
@ -2439,6 +2461,8 @@ process_line(char *line, int *quit)
|
||||||
do_normal_submit = process_cmd_maxpoll(&tx_message, p+7);
|
do_normal_submit = process_cmd_maxpoll(&tx_message, p+7);
|
||||||
} else if (!strncmp(p, "dump", 4)) {
|
} else if (!strncmp(p, "dump", 4)) {
|
||||||
process_cmd_dump(&tx_message, p+4);
|
process_cmd_dump(&tx_message, p+4);
|
||||||
|
} else if (!strncmp(p, "maxdelaydevratio", 16)) {
|
||||||
|
do_normal_submit = process_cmd_maxdelaydevratio(&tx_message, p+16);
|
||||||
} else if (!strncmp(p, "maxdelayratio", 13)) {
|
} else if (!strncmp(p, "maxdelayratio", 13)) {
|
||||||
do_normal_submit = process_cmd_maxdelayratio(&tx_message, p+13);
|
do_normal_submit = process_cmd_maxdelayratio(&tx_message, p+13);
|
||||||
} else if (!strncmp(p, "maxdelay", 8)) {
|
} else if (!strncmp(p, "maxdelay", 8)) {
|
||||||
|
|
24
cmdmon.c
24
cmdmon.c
|
@ -160,7 +160,8 @@ static int permissions[] = {
|
||||||
PERMIT_AUTH, /* MAKESTEP */
|
PERMIT_AUTH, /* MAKESTEP */
|
||||||
PERMIT_OPEN, /* ACTIVITY */
|
PERMIT_OPEN, /* ACTIVITY */
|
||||||
PERMIT_AUTH, /* MODIFY_MINSTRATUM */
|
PERMIT_AUTH, /* MODIFY_MINSTRATUM */
|
||||||
PERMIT_AUTH /* MODIFY_POLLTARGET */
|
PERMIT_AUTH, /* MODIFY_POLLTARGET */
|
||||||
|
PERMIT_AUTH /* MODIFY_MAXDELAYDEVRATIO */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
@ -904,6 +905,23 @@ handle_modify_maxdelayratio(CMD_Request *rx_message, CMD_Reply *tx_message)
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
||||||
|
static void
|
||||||
|
handle_modify_maxdelaydevratio(CMD_Request *rx_message, CMD_Reply *tx_message)
|
||||||
|
{
|
||||||
|
int status;
|
||||||
|
IPAddr address;
|
||||||
|
UTI_IPNetworkToHost(&rx_message->data.modify_maxdelaydevratio.address, &address);
|
||||||
|
status = NSR_ModifyMaxdelaydevratio(&address,
|
||||||
|
UTI_FloatNetworkToHost(rx_message->data.modify_maxdelaydevratio.new_max_delay_dev_ratio));
|
||||||
|
if (status) {
|
||||||
|
tx_message->status = htons(STT_SUCCESS);
|
||||||
|
} else {
|
||||||
|
tx_message->status = htons(STT_NOSUCHSOURCE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================================================== */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
handle_modify_minstratum(CMD_Request *rx_message, CMD_Reply *tx_message)
|
handle_modify_minstratum(CMD_Request *rx_message, CMD_Reply *tx_message)
|
||||||
{
|
{
|
||||||
|
@ -2052,6 +2070,10 @@ read_from_cmd_socket(void *anything)
|
||||||
handle_modify_maxdelayratio(&rx_message, &tx_message);
|
handle_modify_maxdelayratio(&rx_message, &tx_message);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case REQ_MODIFY_MAXDELAYDEVRATIO:
|
||||||
|
handle_modify_maxdelaydevratio(&rx_message, &tx_message);
|
||||||
|
break;
|
||||||
|
|
||||||
case REQ_MODIFY_MAXUPDATESKEW:
|
case REQ_MODIFY_MAXUPDATESKEW:
|
||||||
handle_modify_maxupdateskew(&rx_message, &tx_message);
|
handle_modify_maxupdateskew(&rx_message, &tx_message);
|
||||||
break;
|
break;
|
||||||
|
|
10
ntp_core.c
10
ntp_core.c
|
@ -1751,6 +1751,16 @@ NCR_ModifyMaxdelayratio(NCR_Instance inst, double new_max_delay_ratio)
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
||||||
|
void
|
||||||
|
NCR_ModifyMaxdelaydevratio(NCR_Instance inst, double new_max_delay_dev_ratio)
|
||||||
|
{
|
||||||
|
inst->max_delay_dev_ratio = new_max_delay_dev_ratio;
|
||||||
|
LOG(LOGS_INFO, LOGF_NtpCore, "Source %s new max delay dev ratio %f",
|
||||||
|
UTI_IPToString(&inst->remote_addr.ip_addr), new_max_delay_dev_ratio);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================================================== */
|
||||||
|
|
||||||
void
|
void
|
||||||
NCR_ModifyMinstratum(NCR_Instance inst, int new_min_stratum)
|
NCR_ModifyMinstratum(NCR_Instance inst, int new_min_stratum)
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,6 +91,8 @@ extern void NCR_ModifyMaxdelay(NCR_Instance inst, double new_max_delay);
|
||||||
|
|
||||||
extern void NCR_ModifyMaxdelayratio(NCR_Instance inst, double new_max_delay_ratio);
|
extern void NCR_ModifyMaxdelayratio(NCR_Instance inst, double new_max_delay_ratio);
|
||||||
|
|
||||||
|
extern void NCR_ModifyMaxdelaydevratio(NCR_Instance inst, double new_max_delay_dev_ratio);
|
||||||
|
|
||||||
extern void NCR_ModifyMinstratum(NCR_Instance inst, int new_min_stratum);
|
extern void NCR_ModifyMinstratum(NCR_Instance inst, int new_min_stratum);
|
||||||
|
|
||||||
extern void NCR_ModifyPolltarget(NCR_Instance inst, int new_poll_target);
|
extern void NCR_ModifyPolltarget(NCR_Instance inst, int new_poll_target);
|
||||||
|
|
|
@ -555,6 +555,25 @@ NSR_ModifyMaxdelayratio(IPAddr *address, double new_max_delay_ratio)
|
||||||
|
|
||||||
/* ================================================== */
|
/* ================================================== */
|
||||||
|
|
||||||
|
int
|
||||||
|
NSR_ModifyMaxdelaydevratio(IPAddr *address, double new_max_delay_dev_ratio)
|
||||||
|
{
|
||||||
|
int slot, found;
|
||||||
|
NTP_Remote_Address addr;
|
||||||
|
addr.ip_addr = *address;
|
||||||
|
addr.port = 0;
|
||||||
|
|
||||||
|
find_slot(&addr, &slot, &found);
|
||||||
|
if (found == 0) {
|
||||||
|
return 0;
|
||||||
|
} else {
|
||||||
|
NCR_ModifyMaxdelaydevratio(records[slot].data, new_max_delay_dev_ratio);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* ================================================== */
|
||||||
|
|
||||||
int
|
int
|
||||||
NSR_ModifyMinstratum(IPAddr *address, int new_min_stratum)
|
NSR_ModifyMinstratum(IPAddr *address, int new_min_stratum)
|
||||||
{
|
{
|
||||||
|
|
|
@ -91,6 +91,8 @@ extern int NSR_ModifyMaxdelay(IPAddr *address, double new_max_delay);
|
||||||
|
|
||||||
extern int NSR_ModifyMaxdelayratio(IPAddr *address, double new_max_delay_ratio);
|
extern int NSR_ModifyMaxdelayratio(IPAddr *address, double new_max_delay_ratio);
|
||||||
|
|
||||||
|
extern int NSR_ModifyMaxdelaydevratio(IPAddr *address, double new_max_delay_ratio);
|
||||||
|
|
||||||
extern int NSR_ModifyMinstratum(IPAddr *address, int new_min_stratum);
|
extern int NSR_ModifyMinstratum(IPAddr *address, int new_min_stratum);
|
||||||
|
|
||||||
extern int NSR_ModifyPolltarget(IPAddr *address, int new_poll_target);
|
extern int NSR_ModifyPolltarget(IPAddr *address, int new_poll_target);
|
||||||
|
|
|
@ -65,6 +65,8 @@ PKL_CommandLength(CMD_Request *r)
|
||||||
return offsetof(CMD_Request, data.modify_maxdelay.EOR);
|
return offsetof(CMD_Request, data.modify_maxdelay.EOR);
|
||||||
case REQ_MODIFY_MAXDELAYRATIO:
|
case REQ_MODIFY_MAXDELAYRATIO:
|
||||||
return offsetof(CMD_Request, data.modify_maxdelayratio.EOR);
|
return offsetof(CMD_Request, data.modify_maxdelayratio.EOR);
|
||||||
|
case REQ_MODIFY_MAXDELAYDEVRATIO:
|
||||||
|
return offsetof(CMD_Request, data.modify_maxdelaydevratio.EOR);
|
||||||
case REQ_MODIFY_MAXUPDATESKEW:
|
case REQ_MODIFY_MAXUPDATESKEW:
|
||||||
return offsetof(CMD_Request, data.modify_maxupdateskew.EOR);
|
return offsetof(CMD_Request, data.modify_maxupdateskew.EOR);
|
||||||
case REQ_LOGON :
|
case REQ_LOGON :
|
||||||
|
|
Loading…
Reference in a new issue