ntp: allow sub-second maxpoll
Remove the maxpoll-specific limit and allow both minpoll and maxpoll to be set to a negative value.
This commit is contained in:
parent
59d1b41716
commit
2c47602c33
1 changed files with 6 additions and 6 deletions
12
ntp_core.c
12
ntp_core.c
|
@ -264,8 +264,7 @@ static ARR_Instance broadcasts;
|
||||||
#define MAX_MAXDELAYDEVRATIO 1.0e6
|
#define MAX_MAXDELAYDEVRATIO 1.0e6
|
||||||
|
|
||||||
/* Minimum and maximum allowed poll interval */
|
/* Minimum and maximum allowed poll interval */
|
||||||
#define MIN_MINPOLL -4
|
#define MIN_POLL -4
|
||||||
#define MIN_MAXPOLL 0
|
|
||||||
#define MAX_POLL 24
|
#define MAX_POLL 24
|
||||||
|
|
||||||
/* Enable sub-second polling intervals only when the peer delay is not
|
/* Enable sub-second polling intervals only when the peer delay is not
|
||||||
|
@ -540,12 +539,13 @@ NCR_GetInstance(NTP_Remote_Address *remote_addr, NTP_Source_Type type, SourcePar
|
||||||
result->interleaved = params->interleaved;
|
result->interleaved = params->interleaved;
|
||||||
|
|
||||||
result->minpoll = params->minpoll;
|
result->minpoll = params->minpoll;
|
||||||
if (result->minpoll < MIN_MINPOLL)
|
if (result->minpoll < MIN_POLL)
|
||||||
result->minpoll = SRC_DEFAULT_MINPOLL;
|
result->minpoll = SRC_DEFAULT_MINPOLL;
|
||||||
else if (result->minpoll > MAX_POLL)
|
else if (result->minpoll > MAX_POLL)
|
||||||
result->minpoll = MAX_POLL;
|
result->minpoll = MAX_POLL;
|
||||||
|
|
||||||
result->maxpoll = params->maxpoll;
|
result->maxpoll = params->maxpoll;
|
||||||
if (result->maxpoll < MIN_MAXPOLL)
|
if (result->maxpoll < MIN_POLL)
|
||||||
result->maxpoll = SRC_DEFAULT_MAXPOLL;
|
result->maxpoll = SRC_DEFAULT_MAXPOLL;
|
||||||
else if (result->maxpoll > MAX_POLL)
|
else if (result->maxpoll > MAX_POLL)
|
||||||
result->maxpoll = MAX_POLL;
|
result->maxpoll = MAX_POLL;
|
||||||
|
@ -2349,7 +2349,7 @@ NCR_SetConnectivity(NCR_Instance inst, SRC_Connectivity connectivity)
|
||||||
void
|
void
|
||||||
NCR_ModifyMinpoll(NCR_Instance inst, int new_minpoll)
|
NCR_ModifyMinpoll(NCR_Instance inst, int new_minpoll)
|
||||||
{
|
{
|
||||||
if (new_minpoll < MIN_MINPOLL || new_minpoll > MAX_POLL)
|
if (new_minpoll < MIN_POLL || new_minpoll > MAX_POLL)
|
||||||
return;
|
return;
|
||||||
inst->minpoll = new_minpoll;
|
inst->minpoll = new_minpoll;
|
||||||
LOG(LOGS_INFO, "Source %s new minpoll %d", UTI_IPToString(&inst->remote_addr.ip_addr), new_minpoll);
|
LOG(LOGS_INFO, "Source %s new minpoll %d", UTI_IPToString(&inst->remote_addr.ip_addr), new_minpoll);
|
||||||
|
@ -2362,7 +2362,7 @@ NCR_ModifyMinpoll(NCR_Instance inst, int new_minpoll)
|
||||||
void
|
void
|
||||||
NCR_ModifyMaxpoll(NCR_Instance inst, int new_maxpoll)
|
NCR_ModifyMaxpoll(NCR_Instance inst, int new_maxpoll)
|
||||||
{
|
{
|
||||||
if (new_maxpoll < MIN_MAXPOLL || new_maxpoll > MAX_POLL)
|
if (new_maxpoll < MIN_POLL || new_maxpoll > MAX_POLL)
|
||||||
return;
|
return;
|
||||||
inst->maxpoll = new_maxpoll;
|
inst->maxpoll = new_maxpoll;
|
||||||
LOG(LOGS_INFO, "Source %s new maxpoll %d", UTI_IPToString(&inst->remote_addr.ip_addr), new_maxpoll);
|
LOG(LOGS_INFO, "Source %s new maxpoll %d", UTI_IPToString(&inst->remote_addr.ip_addr), new_maxpoll);
|
||||||
|
|
Loading…
Reference in a new issue