mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-03 17:35:06 -05:00
Add iburst server option
This commit is contained in:
1
candm.h
1
candm.h
@@ -215,6 +215,7 @@ typedef struct {
|
||||
/* Flags used in NTP source requests */
|
||||
#define REQ_ADDSRC_ONLINE 0x1
|
||||
#define REQ_ADDSRC_AUTOOFFLINE 0x2
|
||||
#define REQ_ADDSRC_IBURST 0x4
|
||||
|
||||
typedef struct {
|
||||
IPAddr ip_addr;
|
||||
|
||||
@@ -2597,6 +2597,10 @@ chrony when disconnecting the dial-up link. (It will still be necessary to use
|
||||
chronyc's @code{online} (@pxref{online command}) command when the link has been
|
||||
established, to enable measurements to start.)
|
||||
|
||||
@item iburst
|
||||
On start, make four measurements over a short duration (rather than
|
||||
the usual periodic measurements).
|
||||
|
||||
@end table
|
||||
@c }}}
|
||||
@c {{{ tempcomp
|
||||
|
||||
3
client.c
3
client.c
@@ -912,7 +912,8 @@ process_cmd_add_server_or_peer(CMD_Request *msg, char *line)
|
||||
msg->data.ntp_source.max_delay_ratio = UTI_FloatHostToNetwork(data.params.max_delay_ratio);
|
||||
msg->data.ntp_source.flags = htonl(
|
||||
(data.params.online ? REQ_ADDSRC_ONLINE : 0) |
|
||||
(data.params.auto_offline ? REQ_ADDSRC_AUTOOFFLINE : 0));
|
||||
(data.params.auto_offline ? REQ_ADDSRC_AUTOOFFLINE : 0) |
|
||||
(data.params.iburst ? REQ_ADDSRC_IBURST : 0));
|
||||
result = 1;
|
||||
|
||||
break;
|
||||
|
||||
2
cmdmon.c
2
cmdmon.c
@@ -1230,6 +1230,7 @@ handle_add_server(CMD_Request *rx_message, CMD_Reply *tx_message)
|
||||
params.authkey = ntohl(rx_message->data.ntp_source.authkey);
|
||||
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.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);
|
||||
status = NSR_AddServer(&rem_addr, ¶ms);
|
||||
@@ -1270,6 +1271,7 @@ handle_add_peer(CMD_Request *rx_message, CMD_Reply *tx_message)
|
||||
params.authkey = ntohl(rx_message->data.ntp_source.authkey);
|
||||
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.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);
|
||||
status = NSR_AddPeer(&rem_addr, ¶ms);
|
||||
|
||||
@@ -56,6 +56,7 @@ CPS_ParseNTPSourceAdd(const char *line, CPS_NTP_Source *src)
|
||||
src->params.max_delay_ratio = 16384.0;
|
||||
src->params.online = 1;
|
||||
src->params.auto_offline = 0;
|
||||
src->params.iburst = 0;
|
||||
|
||||
result = CPS_Success;
|
||||
|
||||
@@ -143,6 +144,9 @@ CPS_ParseNTPSourceAdd(const char *line, CPS_NTP_Source *src)
|
||||
} else if (!strncasecmp(cmd, "auto_offline", 12)) {
|
||||
src->params.auto_offline = 1;
|
||||
|
||||
} else if (!strncasecmp(cmd, "iburst", 6)) {
|
||||
src->params.iburst = 1;
|
||||
|
||||
} else {
|
||||
result = CPS_BadOption;
|
||||
ok = 0;
|
||||
|
||||
@@ -290,6 +290,10 @@ create_instance(NTP_Remote_Address *remote_addr, NTP_Mode mode, SourceParameters
|
||||
result->opmode = MD_OFFLINE;
|
||||
}
|
||||
|
||||
if (params->iburst) {
|
||||
NCR_InitiateSampleBurst(result, 4, 8);
|
||||
}
|
||||
|
||||
result->auto_offline = params->auto_offline;
|
||||
|
||||
result->local_poll = params->minpoll;
|
||||
|
||||
@@ -37,6 +37,7 @@ typedef struct {
|
||||
int online;
|
||||
int auto_offline;
|
||||
int presend_minpoll;
|
||||
int iburst;
|
||||
unsigned long authkey;
|
||||
double max_delay;
|
||||
double max_delay_ratio;
|
||||
|
||||
Reference in New Issue
Block a user