mirror of
https://gitlab.com/chrony/chrony.git
synced 2025-12-04 22:45:06 -05:00
Add minstratum option
Stratum in received packets is raised to the configured minimum.
This commit is contained in:
committed by
Miroslav Lichvar
parent
fe4b661fe7
commit
c8fe69c956
@@ -107,6 +107,9 @@ struct NCR_Instance_Record {
|
||||
int minpoll; /* Log2 of minimum defined polling interval */
|
||||
int maxpoll; /* Log2 of maximum defined polling interval */
|
||||
|
||||
int min_stratum; /* Increase stratum in received packets to the
|
||||
minimum */
|
||||
|
||||
double max_delay; /* Maximum round-trip delay to the
|
||||
peer that we can tolerate and still
|
||||
use the sample for generating
|
||||
@@ -268,6 +271,7 @@ NCR_GetInstance(NTP_Remote_Address *remote_addr, NTP_Source_Type type, SourcePar
|
||||
|
||||
result->minpoll = params->minpoll;
|
||||
result->maxpoll = params->maxpoll;
|
||||
result->min_stratum = params->min_stratum;
|
||||
|
||||
result->presend_minpoll = params->presend_minpoll;
|
||||
result->presend_done = 0;
|
||||
@@ -981,6 +985,11 @@ receive_packet(NTP_Packet *message, struct timeval *now, double now_err, NCR_Ins
|
||||
message->stratum = NTP_MAX_STRATUM + 1;
|
||||
}
|
||||
|
||||
/* Increase stratum to the configured minimum */
|
||||
if (message->stratum < inst->min_stratum) {
|
||||
message->stratum = inst->min_stratum;
|
||||
}
|
||||
|
||||
/* Test 7 checks that the stratum in the packet is appropriate */
|
||||
if ((message->stratum > REF_GetOurStratum()) ||
|
||||
(message->stratum > NTP_MAX_STRATUM)) {
|
||||
|
||||
Reference in New Issue
Block a user