From: Miroslav Lichvar Date: Wed, 22 Jul 2026 14:31:46 +0000 (+0200) Subject: cmdmon: reorder fields and flags in new source command X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=aa4b91d87cb1eacc4ad5b9633bacd23a7eafd8a6;p=thirdparty%2Fchrony.git cmdmon: reorder fields and flags in new source command With the new request number, reorder the fields to better follow the order of source parameters and reorder the flags to have those that enable extension fields in the upper part of the 32-bit field. --- diff --git a/candm.h b/candm.h index f9eb043f..4323e06a 100644 --- a/candm.h +++ b/candm.h @@ -277,10 +277,10 @@ typedef struct { #define REQ_ADDSRC_BURST 0x100 #define REQ_ADDSRC_NTS 0x200 #define REQ_ADDSRC_COPY 0x400 -#define REQ_ADDSRC_EF_EXP_MONO_ROOT 0x800 -#define REQ_ADDSRC_EF_NET_CORRECTION 0x1000 -#define REQ_ADDSRC_IPV4 0x2000 -#define REQ_ADDSRC_IPV6 0x4000 +#define REQ_ADDSRC_IPV4 0x800 +#define REQ_ADDSRC_IPV6 0x1000 +#define REQ_ADDSRC_EF_NET_CORRECTION 0x10000 +#define REQ_ADDSRC_EF_EXP_MONO_ROOT 0x80000000 typedef struct { uint32_t type; @@ -295,20 +295,20 @@ typedef struct { uint32_t max_sources; int32_t min_samples; int32_t max_samples; + int32_t max_unreach; + int32_t filter_length; uint32_t authkey; uint32_t nts_port; + uint32_t cert_set; int32_t max_nts_retry; Float max_delay; Float max_delay_ratio; Float max_delay_dev_ratio; + Float max_delay_quant; Float min_delay; Float asymmetry; Float offset; uint32_t flags; - int32_t filter_length; - uint32_t cert_set; - Float max_delay_quant; - int32_t max_unreach; uint32_t reserved[8]; int32_t EOR; } REQ_NTP_Source; diff --git a/client.c b/client.c index 503b025c..bd1350b3 100644 --- a/client.c +++ b/client.c @@ -1078,13 +1078,18 @@ process_cmd_add_source(CMD_Request *msg, char *line) msg->data.ntp_source.max_sources = htonl(data.params.max_sources); 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.max_unreach = htonl(data.params.max_unreach); + msg->data.ntp_source.filter_length = htonl(data.params.filter_length); msg->data.ntp_source.authkey = htonl(data.params.authkey); msg->data.ntp_source.nts_port = htonl(data.params.nts_port); + msg->data.ntp_source.cert_set = htonl(data.params.cert_set); msg->data.ntp_source.max_nts_retry = htonl(data.params.max_nts_retry); 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 = UTI_FloatHostToNetwork(data.params.max_delay_dev_ratio); + msg->data.ntp_source.max_delay_quant = + UTI_FloatHostToNetwork(data.params.max_delay_quant); msg->data.ntp_source.min_delay = UTI_FloatHostToNetwork(data.params.min_delay); msg->data.ntp_source.asymmetry = UTI_FloatHostToNetwork(data.params.asymmetry); msg->data.ntp_source.offset = UTI_FloatHostToNetwork(data.params.offset); @@ -1103,11 +1108,6 @@ process_cmd_add_source(CMD_Request *msg, char *line) (data.family == IPADDR_INET4 ? REQ_ADDSRC_IPV4 : 0) | (data.family == IPADDR_INET6 ? REQ_ADDSRC_IPV6 : 0) | convert_addsrc_sel_options(data.params.sel_options)); - msg->data.ntp_source.filter_length = htonl(data.params.filter_length); - msg->data.ntp_source.cert_set = htonl(data.params.cert_set); - msg->data.ntp_source.max_delay_quant = - UTI_FloatHostToNetwork(data.params.max_delay_quant); - msg->data.ntp_source.max_unreach = htonl(data.params.max_unreach); memset(msg->data.ntp_source.reserved, 0, sizeof (msg->data.ntp_source.reserved)); result = 1;