|
@ -1,4 +1,4 @@ |
|
|
/* $OpenBSD: ntp.c,v 1.79 2006/06/01 04:42:23 henning Exp $ */ |
|
|
|
|
|
|
|
|
/* $OpenBSD: ntp.c,v 1.80 2006/06/01 05:44:35 henning Exp $ */ |
|
|
|
|
|
|
|
|
/* |
|
|
/* |
|
|
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> |
|
|
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> |
|
@ -429,27 +429,18 @@ priv_adjtime(void) |
|
|
int offset_cnt = 0, i = 0, j; |
|
|
int offset_cnt = 0, i = 0, j; |
|
|
struct ntp_offset **offsets; |
|
|
struct ntp_offset **offsets; |
|
|
double offset_median; |
|
|
double offset_median; |
|
|
u_int8_t priority = 0; |
|
|
|
|
|
|
|
|
|
|
|
TAILQ_FOREACH(p, &conf->ntp_peers, entry) { |
|
|
TAILQ_FOREACH(p, &conf->ntp_peers, entry) { |
|
|
if (p->trustlevel < TRUSTLEVEL_BADPEER) |
|
|
if (p->trustlevel < TRUSTLEVEL_BADPEER) |
|
|
continue; |
|
|
continue; |
|
|
if (!p->update.good) |
|
|
if (!p->update.good) |
|
|
return; |
|
|
return; |
|
|
if (p->priority > priority) { |
|
|
|
|
|
priority = p->priority; |
|
|
|
|
|
offset_cnt = 0; |
|
|
|
|
|
} |
|
|
|
|
|
offset_cnt += p->weight; |
|
|
offset_cnt += p->weight; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
TAILQ_FOREACH(s, &conf->ntp_sensors, entry) { |
|
|
TAILQ_FOREACH(s, &conf->ntp_sensors, entry) { |
|
|
if (!s->update.good) |
|
|
if (!s->update.good) |
|
|
continue; |
|
|
continue; |
|
|
if (s->priority > priority) { |
|
|
|
|
|
priority = s->priority; |
|
|
|
|
|
offset_cnt = 0; |
|
|
|
|
|
} |
|
|
|
|
|
offset_cnt += p->weight; |
|
|
offset_cnt += p->weight; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -459,8 +450,6 @@ priv_adjtime(void) |
|
|
TAILQ_FOREACH(p, &conf->ntp_peers, entry) { |
|
|
TAILQ_FOREACH(p, &conf->ntp_peers, entry) { |
|
|
if (p->trustlevel < TRUSTLEVEL_BADPEER) |
|
|
if (p->trustlevel < TRUSTLEVEL_BADPEER) |
|
|
continue; |
|
|
continue; |
|
|
if (p->priority < priority) |
|
|
|
|
|
continue; |
|
|
|
|
|
for (j = 0; j < p->weight; j++) |
|
|
for (j = 0; j < p->weight; j++) |
|
|
offsets[i++] = &p->update; |
|
|
offsets[i++] = &p->update; |
|
|
} |
|
|
} |
|
@ -468,8 +457,6 @@ priv_adjtime(void) |
|
|
TAILQ_FOREACH(s, &conf->ntp_sensors, entry) { |
|
|
TAILQ_FOREACH(s, &conf->ntp_sensors, entry) { |
|
|
if (!s->update.good) |
|
|
if (!s->update.good) |
|
|
continue; |
|
|
continue; |
|
|
if (s->priority < priority) |
|
|
|
|
|
continue; |
|
|
|
|
|
for (j = 0; j < s->weight; j++) |
|
|
for (j = 0; j < s->weight; j++) |
|
|
offsets[i++] = &s->update; |
|
|
offsets[i++] = &s->update; |
|
|
} |
|
|
} |
|
|