Browse Source

Start collecting the remote server state along with the calculated

offsets, in preparation for having correct server statistics in
responses to client queries.  ok henning@
OPENBSD_3_6
alexander 20 years ago
parent
commit
ce8c1ff72e
2 changed files with 28 additions and 7 deletions
  1. +10
    -1
      src/usr.sbin/ntpd/client.c
  2. +18
    -6
      src/usr.sbin/ntpd/ntpd.h

+ 10
- 1
src/usr.sbin/ntpd/client.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: client.c,v 1.23 2004/07/10 19:16:06 henning Exp $ */
/* $OpenBSD: client.c,v 1.24 2004/07/11 00:15:10 alexander Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -169,6 +169,15 @@ client_dispatch(struct ntp_peer *p)
p->reply[p->shift].rcvd = time(NULL);
p->reply[p->shift].good = 1;
p->reply[p->shift].status.leap = (msg.status & LIMASK) >> 6;
p->reply[p->shift].status.stratum = msg.stratum;
p->reply[p->shift].status.precision = msg.precision;
p->reply[p->shift].status.rootdelay = sfp_to_d(msg.distance);
p->reply[p->shift].status.rootdispersion = sfp_to_d(msg.dispersion);
p->reply[p->shift].status.refid = htonl(msg.refid);
p->reply[p->shift].status.reftime = lfp_to_d(msg.reftime);
p->reply[p->shift].status.poll = msg.ppoll;
if (p->trustlevel < TRUSTLEVEL_PATHETIC)
interval = INTERVAL_QUERY_PATHETIC;
else if (p->trustlevel < TRUSTLEVEL_AGRESSIVE)


+ 18
- 6
src/usr.sbin/ntpd/ntpd.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntpd.h,v 1.23 2004/07/10 23:12:57 alexander Exp $ */
/* $OpenBSD: ntpd.h,v 1.24 2004/07/11 00:15:10 alexander Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -70,12 +70,24 @@ struct ntp_addr {
struct sockaddr_storage ss;
};
struct ntp_status {
u_int8_t leap;
u_int8_t stratum;
int8_t precision;
double rootdelay;
double rootdispersion;
u_int32_t refid;
double reftime;
u_int8_t poll;
};
struct ntp_offset {
u_int8_t good;
double offset;
double delay;
double error;
time_t rcvd;
u_int8_t good;
double offset;
double delay;
double error;
time_t rcvd;
struct ntp_status status;
};
struct ntp_peer {


Loading…
Cancel
Save