]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
Add iburst server option
authorMiroslav Lichvar <mlichvar@redhat.com>
Fri, 23 Apr 2010 10:40:50 +0000 (12:40 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Tue, 27 Apr 2010 12:35:27 +0000 (14:35 +0200)
candm.h
chrony.texi
client.c
cmdmon.c
cmdparse.c
ntp_core.c
srcparams.h

diff --git a/candm.h b/candm.h
index 25f16c18d34e7fbd3591fb7863399a270a371192..49c68f41055843989ed15afbfb1a6e3ca698651e 100644 (file)
--- a/candm.h
+++ b/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;
index e0ab4f1d04a4bf3fa4adfb8ad5e2dddff4963ca3..7c8eeec51bd3ca1c1bd88c0cf770802bde07834f 100644 (file)
@@ -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
index c6a66df3757e790209437f42f437c3d0f261577d..55d17e7f237788da23b724c1e9b7e92fa07b5a85 100644 (file)
--- a/client.c
+++ b/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;
index 5f0e9eb09ed0a30978c0a094fe38bf8ef819996d..26ea72ea2a847731a052c85985ffa9cc639ff078 100644 (file)
--- a/cmdmon.c
+++ b/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, &params);
@@ -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, &params);
index ddb84a1ca47ee20c3ca2d0932b5af52ee7532f90..ae301dd1ee074722b20655a219642bcdd677a702 100644 (file)
@@ -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;
index ae54bc613277c12577339c8a656610333208db4f..daeacb10e025975809fde3028d2a7f7cba7eae2c 100644 (file)
@@ -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;
index bdcb33c3c33645e8141848ed711f4ee21e366a3e..c4bccf05cf1d47bda553ba55fd7f14e3046b85f1 100644 (file)
@@ -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;