From: Miroslav Lichvar Date: Fri, 17 Jan 2014 16:37:07 +0000 (+0100) Subject: Don't allow maxpoll to be set shorter than minpoll X-Git-Tag: 1.30-pre1~148 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=4b5f4650260245bc8f489fa861dc6a2f7a8baa0c;p=thirdparty%2Fchrony.git Don't allow maxpoll to be set shorter than minpoll --- diff --git a/ntp_core.c b/ntp_core.c index f2f67afa..58e8aae3 100644 --- a/ntp_core.c +++ b/ntp_core.c @@ -289,6 +289,8 @@ NCR_GetInstance(NTP_Remote_Address *remote_addr, NTP_Source_Type type, SourcePar result->minpoll = params->minpoll; result->maxpoll = params->maxpoll; + if (result->maxpoll < result->minpoll) + result->maxpoll = result->minpoll; result->min_stratum = params->min_stratum; result->presend_minpoll = params->presend_minpoll; @@ -1606,6 +1608,8 @@ NCR_ModifyMinpoll(NCR_Instance inst, int new_minpoll) { inst->minpoll = new_minpoll; LOG(LOGS_INFO, LOGF_NtpCore, "Source %s new minpoll %d", UTI_IPToString(&inst->remote_addr.ip_addr), new_minpoll); + if (inst->maxpoll < inst->minpoll) + NCR_ModifyMaxpoll(inst, inst->minpoll); } /* ================================================== */ @@ -1615,6 +1619,8 @@ NCR_ModifyMaxpoll(NCR_Instance inst, int new_maxpoll) { inst->maxpoll = new_maxpoll; LOG(LOGS_INFO, LOGF_NtpCore, "Source %s new maxpoll %d", UTI_IPToString(&inst->remote_addr.ip_addr), new_maxpoll); + if (inst->minpoll > inst->maxpoll) + NCR_ModifyMinpoll(inst, inst->maxpoll); } /* ================================================== */