ntp: send two presend packets in interleaved mode
In a burst of three requests (two presend + one normal) the server can detect the client is using the interleaved mode and save the transmit timestamp of the second response for the third response. This shortens the interval in which the server has to keep the state.
This commit is contained in:
parent
d23c647e34
commit
2b3d64c31d
2 changed files with 10 additions and 9 deletions
|
@ -171,7 +171,9 @@ interleaved mode requires the servers to keep some state for each client and
|
||||||
the state can be dropped when there are too many clients (e.g.
|
the state can be dropped when there are too many clients (e.g.
|
||||||
<<clientloglimit,*clientloglimit*>> is too small), or it can be overwritten by
|
<<clientloglimit,*clientloglimit*>> is too small), or it can be overwritten by
|
||||||
other clients that have the same IP address (e.g. computers behind NAT or
|
other clients that have the same IP address (e.g. computers behind NAT or
|
||||||
someone sending requests with a spoofed source address).
|
someone sending requests with a spoofed source address). The *presend* option
|
||||||
|
can be used to shorten the interval in which the server has to keep the state
|
||||||
|
for this computer and be able to respond in the interleaved mode.
|
||||||
*polltarget* _target_:::
|
*polltarget* _target_:::
|
||||||
Target number of measurements to use for the regression algorithm which
|
Target number of measurements to use for the regression algorithm which
|
||||||
*chronyd* will try to maintain by adjusting the polling interval between
|
*chronyd* will try to maintain by adjusting the polling interval between
|
||||||
|
@ -203,7 +205,8 @@ when the polling interval is 512 seconds or more, an extra NTP client packet
|
||||||
will be sent to the server a short time (2 seconds) before making the actual
|
will be sent to the server a short time (2 seconds) before making the actual
|
||||||
measurement.
|
measurement.
|
||||||
+
|
+
|
||||||
The *presend* option cannot be used in the *peer* directive.
|
The *presend* option cannot be used in the *peer* directive. If it is used
|
||||||
|
with the *xleave* option, *chronyd* will send two extra packets instead of one.
|
||||||
*minstratum* _stratum_:::
|
*minstratum* _stratum_:::
|
||||||
When the synchronisation source is selected from available sources, sources
|
When the synchronisation source is selected from available sources, sources
|
||||||
with lower stratum are normally slightly preferred. This option can be used to
|
with lower stratum are normally slightly preferred. This option can be used to
|
||||||
|
|
12
ntp_core.c
12
ntp_core.c
|
@ -1050,16 +1050,14 @@ transmit_timeout(void *arg)
|
||||||
|
|
||||||
/* Check whether we need to 'warm up' the link to the other end by
|
/* Check whether we need to 'warm up' the link to the other end by
|
||||||
sending an NTP exchange to ensure both ends' ARP caches are
|
sending an NTP exchange to ensure both ends' ARP caches are
|
||||||
primed. On loaded systems this might also help ensure that bits
|
primed or whether we need to send two packets first to ensure a
|
||||||
of the program are paged in properly before we start. */
|
server in the interleaved mode has a fresh timestamp for us. */
|
||||||
|
|
||||||
if ((inst->presend_minpoll > 0) &&
|
if ((inst->presend_minpoll > 0) &&
|
||||||
(inst->presend_minpoll <= inst->local_poll) &&
|
(inst->presend_minpoll <= inst->local_poll) &&
|
||||||
!inst->presend_done) {
|
!inst->presend_done) {
|
||||||
inst->presend_done = 1;
|
inst->presend_done = inst->interleaved ? 2 : 1;
|
||||||
} else {
|
} else if (inst->presend_done > 0) {
|
||||||
/* Reset for next time */
|
inst->presend_done--;
|
||||||
inst->presend_done = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sent = transmit_packet(inst->mode, inst->interleaved, inst->local_poll,
|
sent = transmit_packet(inst->mode, inst->interleaved, inst->local_poll,
|
||||||
|
|
Loading…
Reference in a new issue