ntp: disable presend in symmetric and interleaved modes

The presend packet can't be used in symmetric and interleaved modes as
it breaks the protocol with unexpected packets.
This commit is contained in:
Miroslav Lichvar 2016-11-03 08:06:26 +01:00
parent 227c7e60a4
commit 8662652192
2 changed files with 8 additions and 0 deletions

View file

@ -202,6 +202,9 @@ presend 9
when the polling interval is 512 seconds or more, an extra NTP client packet when the polling interval is 512 seconds or more, an extra NTP client packet
will be sent to the server a short time (4 seconds) before making the actual will be sent to the server a short time (4 seconds) before making the actual
measurement. measurement.
+
The *presend* option cannot be used in the *peer* directive or with the
*xleave* option.
*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

View file

@ -498,7 +498,12 @@ NCR_GetInstance(NTP_Remote_Address *remote_addr, NTP_Source_Type type, SourcePar
result->min_stratum = params->min_stratum; result->min_stratum = params->min_stratum;
if (result->min_stratum >= NTP_MAX_STRATUM) if (result->min_stratum >= NTP_MAX_STRATUM)
result->min_stratum = NTP_MAX_STRATUM - 1; result->min_stratum = NTP_MAX_STRATUM - 1;
/* Presend doesn't work in symmetric and interleaved modes */
result->presend_minpoll = params->presend_minpoll; result->presend_minpoll = params->presend_minpoll;
if (result->presend_minpoll &&
(result->mode != MODE_CLIENT || result->interleaved))
result->presend_minpoll = 0;
result->max_delay = params->max_delay; result->max_delay = params->max_delay;
result->max_delay_ratio = params->max_delay_ratio; result->max_delay_ratio = params->max_delay_ratio;