diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2005-07-05 10:09:13 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2005-07-05 10:09:13 +0000 |
commit | b1997c33107df4f4ee7b9e2967d1b95c88825737 (patch) | |
tree | c62457c849ebbc5792b09ac539fef49e57810a47 /usr.sbin | |
parent | 45bf83270232e227d7dcae28eda6bb3e2585ebd6 (diff) |
Save transmit time for each peer for later use as refid for SNTPv4
replies. ok henning@
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ntpd/client.c | 3 | ||||
-rw-r--r-- | usr.sbin/ntpd/ntp.c | 6 | ||||
-rw-r--r-- | usr.sbin/ntpd/ntpd.h | 3 | ||||
-rw-r--r-- | usr.sbin/ntpd/server.c | 4 |
4 files changed, 11 insertions, 5 deletions
diff --git a/usr.sbin/ntpd/client.c b/usr.sbin/ntpd/client.c index 9e1cf68db19..336099a1e2b 100644 --- a/usr.sbin/ntpd/client.c +++ b/usr.sbin/ntpd/client.c @@ -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> @@ -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.rootdispersion = sfp_to_d(msg.dispersion); 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.poll = msg.ppoll; p->reply[p->shift].status.stratum = msg.stratum; diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c index 59f3284b97a..c3717b8fd4f 100644 --- a/usr.sbin/ntpd/ntp.c +++ b/usr.sbin/ntpd/ntp.c @@ -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> @@ -440,9 +440,13 @@ priv_adjtime(void) conf->status.stratum++; /* one more than selected peer */ 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) conf->status.refid = ((struct sockaddr_in *) &peers[offset_cnt / 2]->addr->ss)->sin_addr.s_addr; + else + conf->status.refid = conf->status.refid4; } free(peers); diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h index fe6598a7c32..b2ca5c651ad 100644 --- a/usr.sbin/ntpd/ntpd.h +++ b/usr.sbin/ntpd/ntpd.h @@ -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> @@ -89,6 +89,7 @@ struct ntp_status { double rootdispersion; double reftime; u_int32_t refid; + u_int32_t refid4; u_int8_t leap; int8_t precision; u_int8_t poll; diff --git a/usr.sbin/ntpd/server.c b/usr.sbin/ntpd/server.c index 27668c92406..1fdd39912db 100644 --- a/usr.sbin/ntpd/server.c +++ b/usr.sbin/ntpd/server.c @@ -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> @@ -145,7 +145,7 @@ server_dispatch(int fd, struct ntpd_conf *conf) reply.rootdelay = d_to_sfp(conf->status.rootdelay); if (version > 3) - reply.refid = reply.xmttime.fractionl; + reply.refid = conf->status.refid4; else reply.refid = conf->status.refid; |