From 4b4dd01e9adc2c6f8facd7e6fb4ac6facc527c4f Mon Sep 17 00:00:00 2001 From: otto <> Date: Sun, 12 Apr 2020 14:20:56 +0000 Subject: [PATCH] If all addresses are numeric no use for dns probe; ok florian@ sthen@ --- src/usr.sbin/ntpd/config.c | 7 +++++-- src/usr.sbin/ntpd/ntp_dns.c | 8 ++++++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/usr.sbin/ntpd/config.c b/src/usr.sbin/ntpd/config.c index 9472a461..0dd2978d 100644 --- a/src/usr.sbin/ntpd/config.c +++ b/src/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 @@ -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/src/usr.sbin/ntpd/ntp_dns.c b/src/usr.sbin/ntpd/ntp_dns.c index 88391801..439e7ab8 100644 --- a/src/usr.sbin/ntpd/ntp_dns.c +++ b/src/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 @@ -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;