#define MAX_TTL 8 /* max ttl mapping vector size */
#define BEACON 7200 /* manycast beacon interval */
#define NTP_MAXEXTEN 2048 /* max extension field size */
+#define NTP_ORPHWAIT 300 /* orphan wair (s) */
/*
* Miscellaneous stuff
#define PROTO_MAXHOP 24
#define PROTO_BEACON 25
#define PROTO_ORPHAN 26
+#define PROTO_ORPHWAIT 27
/*
* Configuration items for the loop filter
int sys_maxclock = NTP_MAXCLOCK; /* maximum candidates */
int sys_cohort = 0; /* cohort switch */
int sys_orphan = STRATUM_UNSPEC + 1; /* orphan stratum */
+int sys_orphwait = NTP_ORPHWAIT; /* orphan wait */
int sys_beacon = BEACON; /* manycast beacon interval */
int sys_ttlmax; /* max ttl mapping vector index */
u_char sys_ttl[MAX_TTL]; /* ttl mapping vector */
peer->outdate = current_time;
peer->unreach++;
peer->reach <<= 1;
- if (!(peer->reach & 0x0f))
- clock_filter(peer, 0., 0., MAXDISPERSE);
if (!peer->reach) {
/*
* previously reachable raise a trap. Send a
* burst if enabled.
*/
- if (oreach)
+ clock_filter(peer, 0., 0., MAXDISPERSE);
+ if (oreach) {
+ peer_unfit(peer);
report_event(PEVNT_UNREACH, peer, NULL);
+ }
if ((peer->flags & FLAG_IBURST) &&
peer->retry == 0)
peer->retry = NTP_RETRY;
}
/*
- * If the clock discipline has stabilized, sort the samples by
- * distance.
+ * If and the clock is synchronized,sort the samples by distance.
*/
if (sys_leap != LEAP_NOTINSYNC) {
for (i = 1; i < NTP_SHIFT; i++) {
* current statistics, but do not update the clock.
*/
if (typesystem == NULL) {
- if (osys_peer != NULL)
+ if (osys_peer != NULL) {
+ orphwait = current_time + sys_orphwait;
report_event(EVNT_NOPEER, NULL, NULL);
+ }
sys_peer = NULL;
return;
}
sys_bdelay = 0;
sys_authenticate = 1;
sys_stattime = current_time;
+ orphwait = current_time + sys_orphwait;
proto_clr_stats();
for (i = 0; i < MAX_TTL; i++) {
sys_ttl[i] = (u_char)((i * 256) / MAX_TTL);
sys_orphan = (int)dvalue;
break;
+ case PROTO_ORPHWAIT: /* orphan wait (orphwait) */
+ sys_orphwait = (int)dvalue;
+ break;
+
case PROTO_ADJ: /* tick increment (tick) */
sys_tick = dvalue;
break;
static u_long huffpuff_timer; /* huff-n'-puff timer */
u_long leapsec; /* leapseconds countdown */
u_long worker_idle_timer; /* next check for idle intres */
+u_long orphwait; /* orphan wait time */
#ifdef OPENSSL
static u_long revoke_timer; /* keys revoke timer */
static u_long keys_timer; /* session key timer */
* synchronization source is an orphan It shows offset zero and
* reference ID the loopback address.
*/
- if (sys_orphan < STRATUM_UNSPEC && sys_peer == NULL) {
+ if (sys_orphan < STRATUM_UNSPEC && sys_peer == NULL &&
+ current_time > orphwait) {
if (sys_leap == LEAP_NOTINSYNC) {
sys_leap = LEAP_NOWARNING;
#ifdef OPENSSL