summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2007-05-01 07:40:46 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2007-05-01 07:40:46 +0000
commit41a9996335c08755dfa176cd22e13930809e52fe (patch)
treef82ce8cf3b3ad98995593fa495295b3df7c90509
parent4b8daee369ccfa98eb9091b04a1835e5819ffab1 (diff)
if resolving a name fails, be more aggressive retrying, but with care:
do not have more than one dns request outstanding per peer. resolves slow recovery when resolving fails initially, without clogging the pipe with lots of dns requests; tested by Jason George; ok deraadt@
-rw-r--r--usr.sbin/ntpd/client.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/ntpd/client.c b/usr.sbin/ntpd/client.c
index 4b40442284b..9cc558eb79d 100644
--- a/usr.sbin/ntpd/client.c
+++ b/usr.sbin/ntpd/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.75 2007/04/30 01:33:33 deraadt Exp $ */
+/* $OpenBSD: client.c,v 1.76 2007/05/01 07:40:45 otto Exp $ */
/*
* Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org>
@@ -99,6 +99,9 @@ client_nextaddr(struct ntp_peer *p)
p->query->fd = -1;
}
+ if (p->state == STATE_DNS_INPROGRESS)
+ return (-1);
+
if (p->addr_head.a == NULL) {
priv_host_dns(p->addr_head.name, p->id);
p->state = STATE_DNS_INPROGRESS;
@@ -120,7 +123,7 @@ client_query(struct ntp_peer *p)
int tos = IPTOS_LOWDELAY;
if (p->addr == NULL && client_nextaddr(p) == -1) {
- set_next(p, error_interval());
+ set_next(p, scale_interval(INTERVAL_QUERY_AGGRESSIVE));
return (0);
}
@@ -137,7 +140,8 @@ client_query(struct ntp_peer *p)
if (errno == ECONNREFUSED || errno == ENETUNREACH ||
errno == EHOSTUNREACH || errno == EADDRNOTAVAIL) {
client_nextaddr(p);
- set_next(p, error_interval());
+ set_next(p,
+ scale_interval(INTERVAL_QUERY_AGGRESSIVE));
return (-1);
} else
fatal("client_query connect");