summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhenning <henning@openbsd.org>2018-07-12 19:31:05 +0000
committerhenning <henning@openbsd.org>2018-07-12 19:31:05 +0000
commit6ccb4b8df3fa1a5845241b5e3597634cfbfc58a3 (patch)
tree06d6e91dd12aa79c107d8ce7c6423961e47e1963
parentmissing .Ek; (diff)
downloadwireguard-openbsd-6ccb4b8df3fa1a5845241b5e3597634cfbfc58a3.tar.xz
wireguard-openbsd-6ccb4b8df3fa1a5845241b5e3597634cfbfc58a3.zip
if we couldn't update the clock for ~1h due to lack of data from peers and
sensors, mark us unsynced again. ok reyk krw, pt out / discussion / help naddy
-rw-r--r--usr.sbin/ntpd/ntp.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c
index f7a6edec79b..cbc70723d7f 100644
--- a/usr.sbin/ntpd/ntp.c
+++ b/usr.sbin/ntpd/ntp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntp.c,v 1.146 2017/05/30 23:30:48 benno Exp $ */
+/* $OpenBSD: ntp.c,v 1.147 2018/07/12 19:31:05 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -316,6 +316,14 @@ ntp_main(struct ntpd_conf *nconf, struct passwd *pw, int argc, char **argv)
(peer_cnt == 0 && sensors_cnt == 0)))
priv_settime(0); /* no good peers, don't wait */
+ if (conf->status.synced && gettime() - conf->status.reftime >
+ INTERVAL_QUERY_PATHETIC * QSCALE_OFF_MAX / QSCALE_OFF_MIN *
+ 1.2) {
+ /* no update seen for ~1h */
+ log_info("clock is now unsynced");
+ conf->status.synced = 0;
+ }
+
if (ibuf_main->w.queued > 0)
pfd[PFD_PIPE_MAIN].events |= POLLOUT;
if (ibuf_dns->w.queued > 0)