Browse Source

log reason when not synced; ok henning@

OPENBSD_4_6
stevesk 15 years ago
parent
commit
41d74ba791
1 changed files with 19 additions and 3 deletions
  1. +19
    -3
      src/usr.sbin/ntpd/client.c

+ 19
- 3
src/usr.sbin/ntpd/client.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: client.c,v 1.81 2008/06/10 03:51:53 naddy Exp $ */
/* $OpenBSD: client.c,v 1.82 2009/03/04 18:46:44 stevesk Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -20,6 +20,7 @@
#include <sys/param.h> #include <sys/param.h>
#include <errno.h> #include <errno.h>
#include <md5.h> #include <md5.h>
#include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <time.h> #include <time.h>
@ -218,10 +219,25 @@ client_dispatch(struct ntp_peer *p, u_int8_t settime)
if ((msg.status & LI_ALARM) == LI_ALARM || msg.stratum == 0 || if ((msg.status & LI_ALARM) == LI_ALARM || msg.stratum == 0 ||
msg.stratum > NTP_MAXSTRATUM) { msg.stratum > NTP_MAXSTRATUM) {
char s[16];
if ((msg.status & LI_ALARM) == LI_ALARM) {
strlcpy(s, "alarm", sizeof(s));
} else if (msg.stratum == 0) {
/* Kiss-o'-Death (KoD) packet */
if (msg.refid != 0)
snprintf(s, sizeof(s), "KoD %.4s",
(char *)&msg.refid);
else
strlcpy(s, "KoD", sizeof(s));
} else if (msg.stratum > NTP_MAXSTRATUM) {
snprintf(s, sizeof(s), "stratum %d", msg.stratum);
}
interval = error_interval(); interval = error_interval();
set_next(p, interval); set_next(p, interval);
log_info("reply from %s: not synced, next query %ds",
log_sockaddr((struct sockaddr *)&p->addr->ss), interval);
log_info("reply from %s: not synced (%s), next query %ds",
log_sockaddr((struct sockaddr *)&p->addr->ss), s,
interval);
return (0); return (0);
} }


Loading…
Cancel
Save