cmdmon: add NTS support
Allow the nts and ntsport options to be specified for sources added from chronyc. This is an incompatible change in the request, but there was no release using the new REQ_ADD_SOURCE command yet.
This commit is contained in:
parent
c41508723f
commit
44aac84feb
3 changed files with 6 additions and 2 deletions
2
candm.h
2
candm.h
|
@ -262,6 +262,7 @@ typedef struct {
|
|||
#define REQ_ADDSRC_REQUIRE 0x40
|
||||
#define REQ_ADDSRC_INTERLEAVED 0x80
|
||||
#define REQ_ADDSRC_BURST 0x100
|
||||
#define REQ_ADDSRC_NTS 0x200
|
||||
|
||||
typedef struct {
|
||||
uint32_t type;
|
||||
|
@ -277,6 +278,7 @@ typedef struct {
|
|||
int32_t min_samples;
|
||||
int32_t max_samples;
|
||||
uint32_t authkey;
|
||||
uint32_t nts_port;
|
||||
Float max_delay;
|
||||
Float max_delay_ratio;
|
||||
Float max_delay_dev_ratio;
|
||||
|
|
2
client.c
2
client.c
|
@ -1131,6 +1131,7 @@ process_cmd_add_source(CMD_Request *msg, char *line)
|
|||
msg->data.ntp_source.min_samples = htonl(data.params.min_samples);
|
||||
msg->data.ntp_source.max_samples = htonl(data.params.max_samples);
|
||||
msg->data.ntp_source.authkey = htonl(data.params.authkey);
|
||||
msg->data.ntp_source.nts_port = htonl(data.params.nts_port);
|
||||
msg->data.ntp_source.max_delay = UTI_FloatHostToNetwork(data.params.max_delay);
|
||||
msg->data.ntp_source.max_delay_ratio = UTI_FloatHostToNetwork(data.params.max_delay_ratio);
|
||||
msg->data.ntp_source.max_delay_dev_ratio =
|
||||
|
@ -1144,6 +1145,7 @@ process_cmd_add_source(CMD_Request *msg, char *line)
|
|||
(data.params.iburst ? REQ_ADDSRC_IBURST : 0) |
|
||||
(data.params.interleaved ? REQ_ADDSRC_INTERLEAVED : 0) |
|
||||
(data.params.burst ? REQ_ADDSRC_BURST : 0) |
|
||||
(data.params.nts ? REQ_ADDSRC_NTS : 0) |
|
||||
(data.params.sel_options & SRC_SELECT_PREFER ? REQ_ADDSRC_PREFER : 0) |
|
||||
(data.params.sel_options & SRC_SELECT_NOSELECT ? REQ_ADDSRC_NOSELECT : 0) |
|
||||
(data.params.sel_options & SRC_SELECT_TRUST ? REQ_ADDSRC_TRUST : 0) |
|
||||
|
|
4
cmdmon.c
4
cmdmon.c
|
@ -723,6 +723,7 @@ handle_add_source(CMD_Request *rx_message, CMD_Reply *tx_message)
|
|||
params.max_samples = ntohl(rx_message->data.ntp_source.max_samples);
|
||||
params.filter_length = ntohl(rx_message->data.ntp_source.filter_length);
|
||||
params.authkey = ntohl(rx_message->data.ntp_source.authkey);
|
||||
params.nts_port = ntohl(rx_message->data.ntp_source.nts_port);
|
||||
params.max_delay = UTI_FloatNetworkToHost(rx_message->data.ntp_source.max_delay);
|
||||
params.max_delay_ratio =
|
||||
UTI_FloatNetworkToHost(rx_message->data.ntp_source.max_delay_ratio);
|
||||
|
@ -738,13 +739,12 @@ handle_add_source(CMD_Request *rx_message, CMD_Reply *tx_message)
|
|||
params.iburst = ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_IBURST ? 1 : 0;
|
||||
params.interleaved = ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_INTERLEAVED ? 1 : 0;
|
||||
params.burst = ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_BURST ? 1 : 0;
|
||||
params.nts = ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_NTS ? 1 : 0;
|
||||
params.sel_options =
|
||||
(ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_PREFER ? SRC_SELECT_PREFER : 0) |
|
||||
(ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_NOSELECT ? SRC_SELECT_NOSELECT : 0) |
|
||||
(ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_TRUST ? SRC_SELECT_TRUST : 0) |
|
||||
(ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_REQUIRE ? SRC_SELECT_REQUIRE : 0);
|
||||
params.nts = 0;
|
||||
params.nts_port = 0;
|
||||
|
||||
status = NSR_AddSourceByName(name, port, pool, type, ¶ms);
|
||||
switch (status) {
|
||||
|
|
Loading…
Reference in a new issue