diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2020-04-12 14:20:57 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2020-04-12 14:20:57 +0000 |
commit | 416f85cd5b0c87f3abc639252d8bb3fee6658289 (patch) | |
tree | da512b53c56dd549df8c5ae18f0bfc99c5bab090 /usr.sbin/ntpd | |
parent | 361eaeceda93d9301d896a7c3b131ee1f9dcb79f (diff) |
If all addresses are numeric no use for dns probe; ok florian@ sthen@
Diffstat (limited to 'usr.sbin/ntpd')
-rw-r--r-- | usr.sbin/ntpd/config.c | 7 | ||||
-rw-r--r-- | usr.sbin/ntpd/ntp_dns.c | 8 |
2 files changed, 11 insertions, 4 deletions
diff --git a/usr.sbin/ntpd/config.c b/usr.sbin/ntpd/config.c index 9472a4616fb..0dd2978de3a 100644 --- a/usr.sbin/ntpd/config.c +++ b/usr.sbin/ntpd/config.c @@ -1,4 +1,4 @@ -/* $OpenBSD: config.c,v 1.32 2019/07/07 07:14:57 otto Exp $ */ +/* $OpenBSD: config.c,v 1.33 2020/04/12 14:20:56 otto Exp $ */ /* * Copyright (c) 2003, 2004 Henning Brauer <henning@openbsd.org> @@ -35,6 +35,7 @@ int host_dns1(const char *, struct ntp_addr **, int); static u_int32_t maxid = 0; static u_int32_t constraint_maxid = 0; +int non_numeric; void host(const char *s, struct ntp_addr **hn) @@ -45,8 +46,10 @@ host(const char *s, struct ntp_addr **hn) if ((h = calloc(1, sizeof(*h))) == NULL) fatal(NULL); } else { - if ((h = host_ip(s)) == NULL) + if ((h = host_ip(s)) == NULL) { + non_numeric = 1; return; + } } *hn = h; diff --git a/usr.sbin/ntpd/ntp_dns.c b/usr.sbin/ntpd/ntp_dns.c index 88391801c5e..439e7ab8a99 100644 --- a/usr.sbin/ntpd/ntp_dns.c +++ b/usr.sbin/ntpd/ntp_dns.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ntp_dns.c,v 1.25 2020/04/11 07:49:48 otto Exp $ */ +/* $OpenBSD: ntp_dns.c,v 1.26 2020/04/12 14:20:56 otto Exp $ */ /* * Copyright (c) 2003-2008 Henning Brauer <henning@openbsd.org> @@ -40,6 +40,7 @@ volatile sig_atomic_t quit_dns = 0; static struct imsgbuf *ibuf_dns; +extern int non_numeric; void sighdlr_dns(int); int dns_dispatch_imsg(struct ntpd_conf *); @@ -101,7 +102,10 @@ ntp_dns(struct ntpd_conf *nconf, struct passwd *pw) if (pledge("stdio dns", NULL) == -1) err(1, "pledge"); - probe_root(); + if (non_numeric) + probe_root(); + else + log_debug("all addresses numeric, no dns probe"); while (quit_dns == 0) { pfd[0].fd = ibuf_dns->fd; |