Portable build framework for OpenNTPD
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

73 lines
1.8 KiB

From d1f59b4cf6af36572dbd0414eab588e0222de8c5 Mon Sep 17 00:00:00 2001
From: Brent Cook <busterb@gmail.com>
Date: Mon, 8 Jun 2020 06:53:10 -0500
Subject: [PATCH 16/18] Don't retry DNS if Checking Disable flag is not
available.
---
src/usr.sbin/ntpd/config.c | 7 +++++--
src/usr.sbin/ntpd/ntp_dns.c | 8 +++++---
2 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/src/usr.sbin/ntpd/config.c b/src/usr.sbin/ntpd/config.c
index 856c3147cc..f89742916a 100644
--- a/src/usr.sbin/ntpd/config.c
+++ b/src/usr.sbin/ntpd/config.c
@@ -137,17 +137,20 @@ host_dns1(const char *s, struct ntp_addr **hn, int notauth)
int
host_dns(const char *s, int synced, struct ntp_addr **hn)
{
- int error, save_opts;
-
+ int error;
+
log_debug("trying to resolve %s", s);
error = host_dns1(s, hn, 0);
+#ifdef RES_USE_CD
if (!synced && error <= 0) {
+ int save_opts;
log_debug("no luck, trying to resolve %s without checking", s);
save_opts = _res.options;
_res.options |= RES_USE_CD;
error = host_dns1(s, hn, 1);
_res.options = save_opts;
}
+#endif
log_debug("resolve %s done: %d", s, error);
return error;
}
diff --git a/src/usr.sbin/ntpd/ntp_dns.c b/src/usr.sbin/ntpd/ntp_dns.c
index 439e7ab8a9..e74a8abe4d 100644
--- a/src/usr.sbin/ntpd/ntp_dns.c
+++ b/src/usr.sbin/ntpd/ntp_dns.c
@@ -226,14 +226,16 @@ probe_root_ns(void)
old_options = _res.options;
_res.retrans = 1;
_res.retry = 1;
+#ifdef RES_USE_CD
_res.options |= RES_USE_CD;
-
+#endif
+
ret = res_query(".", C_IN, T_NS, buf, sizeof(buf));
_res.retrans = old_retrans;
_res.retry = old_retry;
_res.options = old_options;
-
+
return ret;
}
@@ -242,7 +244,7 @@ probe_root(void)
{
int n;
- n = probe_root_ns();
+ n = probe_root_ns();
if (n < 0) {
/* give programs like unwind a second chance */
sleep(1);
--
2.27.0