diff options
author | Henning Brauer <henning@cvs.openbsd.org> | 2004-07-09 10:53:34 +0000 |
---|---|---|
committer | Henning Brauer <henning@cvs.openbsd.org> | 2004-07-09 10:53:34 +0000 |
commit | 0264908561a9c56a148e053b0464128aa89d627a (patch) | |
tree | 73c76a62a551ba9de494792fd6ded471164dec4e /usr.sbin/ntpd/ntp.c | |
parent | 9d2a564965b2248467a5330aff3bcc4700d44f0d (diff) |
rework dns handling with all its cosequences...
we know have both a "server" and "servers" keyword. they differ when the
hostname resolves to more than one IP, server picks one and servers expands
to all.
that means no longer stuffing a sockaddr_storage into ntp_peer but a pointer
to a linked list of ntp_addr structs.
in the "servers" case the list of n addresses returned by host() is expanded
into n ntp_peer structs and thus n individual peers.
in the "server" case the whole list is attached to ntp_peer, and whenever we
do not receive a reply in time we traverse the list one further, so that
hosts with both AAAA and A records are first tried with the AAAA one but
we gracefully fall back to the A one.
semantics with theo; hacked up on the Montreal->Frankfurt flight.
again Air Canada surprised me, that older 767 hat pretty decent seats.
Diffstat (limited to 'usr.sbin/ntpd/ntp.c')
-rw-r--r-- | usr.sbin/ntpd/ntp.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/usr.sbin/ntpd/ntp.c b/usr.sbin/ntpd/ntp.c index 12c11869154..636bc2c4412 100644 --- a/usr.sbin/ntpd/ntp.c +++ b/usr.sbin/ntpd/ntp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp.c,v 1.18 2004/07/09 10:22:07 henning Exp $ */ +/* $OpenBSD: ntp.c,v 1.19 2004/07/09 10:53:33 henning Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -164,7 +164,6 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *conf) TAILQ_FOREACH(p, &conf->ntp_peers, entry) { if (p->next > 0 && p->next < nextaction) nextaction = p->next; - if (p->next > 0 && p->next <= time(NULL)) client_query(p); @@ -172,12 +171,14 @@ ntp_main(int pipe_prnt[2], struct ntpd_conf *conf) nextaction = p->deadline; if (p->deadline > 0 && p->deadline <= time(NULL)) { log_debug("no reply from %s received in time", - log_sockaddr((struct sockaddr *)&p->ss)); + log_sockaddr( + (struct sockaddr *)&p->addr->ss)); if (p->trustlevel >= TRUSTLEVEL_BADPEER && --p->trustlevel < TRUSTLEVEL_BADPEER) log_info("peer %s now invalid", log_sockaddr( - (struct sockaddr *)&p->ss)); + (struct sockaddr *)&p->addr->ss)); + client_nextaddr(p); client_query(p); } @@ -324,7 +325,7 @@ get_peer_update(struct ntp_peer *p, double *offset) if (good < 8 && p->trustlevel > 0) { if (p->trustlevel >= TRUSTLEVEL_BADPEER) log_info("peer %s now invalid", - log_sockaddr((struct sockaddr *)&p->ss)); + log_sockaddr((struct sockaddr *)&p->addr->ss)); p->trustlevel /= 2; } |