summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorHenning Brauer <henning@cvs.openbsd.org>2006-05-25 19:25:47 +0000
committerHenning Brauer <henning@cvs.openbsd.org>2006-05-25 19:25:47 +0000
commit1cd88ffd3158d8887fe129456980df5f9570f47a (patch)
tree470cc4a700f52499d7e9a227b334dacb86163120 /usr.sbin
parent05db4784aa716355b5befa3d1b63f27980433a8c (diff)
figure out the refid to send to NTP v3 clients early and store it
first bits from a way to long flight
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/ntpd/client.c8
-rw-r--r--usr.sbin/ntpd/ntp.c9
-rw-r--r--usr.sbin/ntpd/ntpd.h3
3 files changed, 12 insertions, 8 deletions
diff --git a/usr.sbin/ntpd/client.c b/usr.sbin/ntpd/client.c
index 208672bfa8e..4e30f465bb7 100644
--- a/usr.sbin/ntpd/client.c
+++ b/usr.sbin/ntpd/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.66 2005/09/24 00:32:03 dtucker Exp $ */
+/* $OpenBSD: client.c,v 1.67 2006/05/25 19:25:46 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -256,6 +256,12 @@ client_dispatch(struct ntp_peer *p, u_int8_t settime)
p->reply[p->shift].status.poll = msg.ppoll;
p->reply[p->shift].status.stratum = msg.stratum;
+ if (p->addr->ss.ss_family == AF_INET)
+ p->reply[p->shift].status.send_refid =
+ ((struct sockaddr_in *)&p->addr->ss)->sin_addr.s_addr;
+ else
+ p->reply[p->shift].status.send_refid = msg.xmttime.fractionl;
+
if (p->trustlevel < TRUSTLEVEL_PATHETIC)
interval = scale_interval(INTERVAL_QUERY_PATHETIC);
else if (p->trustlevel < TRUSTLEVEL_AGRESSIVE)
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c
index f27e42a4c15..1a476c611b0 100644
--- a/usr.sbin/ntpd/ntp.c
+++ b/usr.sbin/ntpd/ntp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntp.c,v 1.68 2006/05/14 22:33:51 henning Exp $ */
+/* $OpenBSD: ntp.c,v 1.69 2006/05/25 19:25:46 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -444,11 +444,8 @@ priv_adjtime(void)
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;
+ conf->status.refid =
+ peers[offset_cnt / 2]->update.status.send_refid;
}
free(peers);
diff --git a/usr.sbin/ntpd/ntpd.h b/usr.sbin/ntpd/ntpd.h
index fabca3a3033..7466a69a6be 100644
--- a/usr.sbin/ntpd/ntpd.h
+++ b/usr.sbin/ntpd/ntpd.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: ntpd.h,v 1.61 2005/09/24 00:32:03 dtucker Exp $ */
+/* $OpenBSD: ntpd.h,v 1.62 2006/05/25 19:25:46 henning Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -90,6 +90,7 @@ struct ntp_status {
double reftime;
u_int32_t refid;
u_int32_t refid4;
+ u_int32_t send_refid;
u_int8_t synced;
u_int8_t leap;
int8_t precision;