Browse Source

Save transmit time for each peer for later use as refid for SNTPv4

replies.  ok henning@
OPENBSD_3_8
dtucker 19 years ago
parent
commit
f9299bb123
4 changed files with 11 additions and 5 deletions
  1. +2
    -1
      src/usr.sbin/ntpd/client.c
  2. +5
    -1
      src/usr.sbin/ntpd/ntp.c
  3. +2
    -1
      src/usr.sbin/ntpd/ntpd.h
  4. +2
    -2
      src/usr.sbin/ntpd/server.c

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

@ -1,4 +1,4 @@
/* $OpenBSD: client.c,v 1.61 2005/06/19 16:42:57 henning Exp $ */
/* $OpenBSD: client.c,v 1.62 2005/07/05 10:09:12 dtucker Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -251,6 +251,7 @@ client_dispatch(struct ntp_peer *p, u_int8_t settime)
p->reply[p->shift].status.rootdelay = sfp_to_d(msg.rootdelay); p->reply[p->shift].status.rootdelay = sfp_to_d(msg.rootdelay);
p->reply[p->shift].status.rootdispersion = sfp_to_d(msg.dispersion); p->reply[p->shift].status.rootdispersion = sfp_to_d(msg.dispersion);
p->reply[p->shift].status.refid = ntohl(msg.refid); p->reply[p->shift].status.refid = ntohl(msg.refid);
p->reply[p->shift].status.refid4 = msg.xmttime.fractionl;
p->reply[p->shift].status.reftime = lfp_to_d(msg.reftime); p->reply[p->shift].status.reftime = lfp_to_d(msg.reftime);
p->reply[p->shift].status.poll = msg.ppoll; p->reply[p->shift].status.poll = msg.ppoll;
p->reply[p->shift].status.stratum = msg.stratum; p->reply[p->shift].status.stratum = msg.stratum;


+ 5
- 1
src/usr.sbin/ntpd/ntp.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntp.c,v 1.61 2005/06/19 16:42:57 henning Exp $ */
/* $OpenBSD: ntp.c,v 1.62 2005/07/05 10:09:12 dtucker Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -440,9 +440,13 @@ priv_adjtime(void)
conf->status.stratum++; /* one more than selected peer */ conf->status.stratum++; /* one more than selected peer */
update_scale(offset_median); update_scale(offset_median);
conf->status.refid4 =
peers[offset_cnt / 2]->update.status.refid4;
if (peers[offset_cnt / 2]->addr->ss.ss_family == AF_INET) if (peers[offset_cnt / 2]->addr->ss.ss_family == AF_INET)
conf->status.refid = ((struct sockaddr_in *) conf->status.refid = ((struct sockaddr_in *)
&peers[offset_cnt / 2]->addr->ss)->sin_addr.s_addr; &peers[offset_cnt / 2]->addr->ss)->sin_addr.s_addr;
else
conf->status.refid = conf->status.refid4;
} }
free(peers); free(peers);


+ 2
- 1
src/usr.sbin/ntpd/ntpd.h View File

@ -1,4 +1,4 @@
/* $OpenBSD: ntpd.h,v 1.57 2005/06/19 17:11:13 henning Exp $ */
/* $OpenBSD: ntpd.h,v 1.58 2005/07/05 10:09:12 dtucker Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -89,6 +89,7 @@ struct ntp_status {
double rootdispersion; double rootdispersion;
double reftime; double reftime;
u_int32_t refid; u_int32_t refid;
u_int32_t refid4;
u_int8_t leap; u_int8_t leap;
int8_t precision; int8_t precision;
u_int8_t poll; u_int8_t poll;


+ 2
- 2
src/usr.sbin/ntpd/server.c View File

@ -1,4 +1,4 @@
/* $OpenBSD: server.c,v 1.22 2005/05/24 20:10:50 henning Exp $ */
/* $OpenBSD: server.c,v 1.23 2005/07/05 10:09:12 dtucker Exp $ */
/* /*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@ -145,7 +145,7 @@ server_dispatch(int fd, struct ntpd_conf *conf)
reply.rootdelay = d_to_sfp(conf->status.rootdelay); reply.rootdelay = d_to_sfp(conf->status.rootdelay);
if (version > 3) if (version > 3)
reply.refid = reply.xmttime.fractionl;
reply.refid = conf->status.refid4;
else else
reply.refid = conf->status.refid; reply.refid = conf->status.refid;


Loading…
Cancel
Save