From: Miroslav Lichvar Date: Thu, 7 Mar 2019 10:52:16 +0000 (+0100) Subject: cmdmon: add NTS support X-Git-Tag: 4.0-pre1~23 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=44aac84feb8c491412d18b708e2ccfe55a15d3ee;p=thirdparty%2Fchrony.git 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. --- diff --git a/candm.h b/candm.h index 575f1edb..2d669978 100644 --- a/candm.h +++ b/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; diff --git a/client.c b/client.c index b87c1a31..de08be23 100644 --- a/client.c +++ b/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) | diff --git a/cmdmon.c b/cmdmon.c index 5e3fc556..7950e7ab 100644 --- a/cmdmon.c +++ b/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) {