Browse Source

figure out the refid to send to NTP v3 clients early and store it

first bits from a way to long flight
OPENBSD_4_0
henning 18 years ago
parent
commit
309a243757
3 changed files with 12 additions and 8 deletions
  1. +7
    -1
      src/usr.sbin/ntpd/client.c
  2. +3
    -6
      src/usr.sbin/ntpd/ntp.c
  3. +2
    -1
      src/usr.sbin/ntpd/ntpd.h

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

@ -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)


+ 3
- 6
src/usr.sbin/ntpd/ntp.c View File

@ -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);


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

@ -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;


Loading…
Cancel
Save