Support prefer and noselect options in chronyc
This commit is contained in:
parent
ddb2cf3b8b
commit
5b8835f46b
3 changed files with 7 additions and 5 deletions
2
candm.h
2
candm.h
|
@ -223,6 +223,8 @@ typedef struct {
|
|||
#define REQ_ADDSRC_ONLINE 0x1
|
||||
#define REQ_ADDSRC_AUTOOFFLINE 0x2
|
||||
#define REQ_ADDSRC_IBURST 0x4
|
||||
#define REQ_ADDSRC_PREFER 0x8
|
||||
#define REQ_ADDSRC_NOSELECT 0x10
|
||||
|
||||
typedef struct {
|
||||
IPAddr ip_addr;
|
||||
|
|
7
client.c
7
client.c
|
@ -934,9 +934,6 @@ process_cmd_add_server_or_peer(CMD_Request *msg, char *line)
|
|||
if (data.params.min_stratum) {
|
||||
fprintf(stderr, "Option minstratum not supported\n");
|
||||
break;
|
||||
} else if (data.params.sel_option != SRC_SelectNormal) {
|
||||
fprintf(stderr, "Options noselect and prefer not supported\n");
|
||||
break;
|
||||
}
|
||||
|
||||
msg->data.ntp_source.port = htonl((unsigned long) data.port);
|
||||
|
@ -950,7 +947,9 @@ process_cmd_add_server_or_peer(CMD_Request *msg, char *line)
|
|||
msg->data.ntp_source.flags = htonl(
|
||||
(data.params.online ? REQ_ADDSRC_ONLINE : 0) |
|
||||
(data.params.auto_offline ? REQ_ADDSRC_AUTOOFFLINE : 0) |
|
||||
(data.params.iburst ? REQ_ADDSRC_IBURST : 0));
|
||||
(data.params.iburst ? REQ_ADDSRC_IBURST : 0) |
|
||||
(data.params.sel_option == SRC_SelectPrefer ? REQ_ADDSRC_PREFER : 0) |
|
||||
(data.params.sel_option == SRC_SelectNoselect ? REQ_ADDSRC_NOSELECT : 0));
|
||||
result = 1;
|
||||
|
||||
break;
|
||||
|
|
3
cmdmon.c
3
cmdmon.c
|
@ -1244,12 +1244,13 @@ handle_add_source(NTP_Source_Type type, CMD_Request *rx_message, CMD_Reply *tx_m
|
|||
params.online = ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_ONLINE ? 1 : 0;
|
||||
params.auto_offline = ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_AUTOOFFLINE ? 1 : 0;
|
||||
params.iburst = ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_IBURST ? 1 : 0;
|
||||
params.sel_option = ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_PREFER ? SRC_SelectPrefer :
|
||||
ntohl(rx_message->data.ntp_source.flags) & REQ_ADDSRC_NOSELECT ? SRC_SelectNoselect : SRC_SelectNormal;
|
||||
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);
|
||||
|
||||
/* not transmitted in cmdmon protocol yet */
|
||||
params.min_stratum = 0;
|
||||
params.sel_option = SRC_SelectNormal;
|
||||
|
||||
status = NSR_AddSource(&rem_addr, type, ¶ms);
|
||||
switch (status) {
|
||||
|
|
Loading…
Reference in a new issue