From 4116dad0a1ec1417a737d7c73bdd961dcd0bd467 Mon Sep 17 00:00:00 2001 From: otto <> Date: Sun, 14 Jan 2007 19:20:09 +0000 Subject: [PATCH] Esape from the Mouth of Madness by adjusting stored sensor offsets when we adjust time. This prevents ntpd from going wild when using sensor time sources; ok henning@ (on an earlier version) and a LOT of testing by naddy@ --- src/usr.sbin/ntpd/ntp.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/usr.sbin/ntpd/ntp.c b/src/usr.sbin/ntpd/ntp.c index 62baf61b..316f35af 100644 --- a/src/usr.sbin/ntpd/ntp.c +++ b/src/usr.sbin/ntpd/ntp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp.c,v 1.96 2006/12/20 16:50:13 henning Exp $ */ +/* $OpenBSD: ntp.c,v 1.97 2007/01/14 19:20:09 otto Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer @@ -564,6 +564,11 @@ priv_adjtime(void) p->reply[i].offset -= offset_median; p->update.good = 0; } + TAILQ_FOREACH(s, &conf->ntp_sensors, entry) { + for (i = 0; i < SENSOR_OFFSETS; i++) + s->offsets[i].offset -= offset_median; + s->update.offset -= offset_median; + } return (0); }