Add minstratum option

Stratum in received packets is raised to the configured minimum.
This commit is contained in:
Benny Lyne Amorsen
2010-08-24 18:37:38 +02:00
committed by Miroslav Lichvar
parent fe4b661fe7
commit c8fe69c956
7 changed files with 35 additions and 1 deletions

View File

@@ -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)) {