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.

70 lines
1.7 KiB

4 years ago
  1. From ea1afcebbc2e1a87dddee231b48da5a891461ff9 Mon Sep 17 00:00:00 2001
  2. From: Brent Cook <busterb@gmail.com>
  3. Date: Mon, 8 Jun 2020 06:53:10 -0500
  4. Subject: [PATCH 16/18] Don't retry DNS if Checking Disable flag is not
  5. available.
  6. ---
  7. src/usr.sbin/ntpd/config.c | 4 +++-
  8. src/usr.sbin/ntpd/ntp_dns.c | 8 +++++---
  9. 2 files changed, 8 insertions(+), 4 deletions(-)
  10. diff --git a/src/usr.sbin/ntpd/config.c b/src/usr.sbin/ntpd/config.c
  11. index 856c3147cc..fc9df84bc4 100644
  12. --- a/src/usr.sbin/ntpd/config.c
  13. +++ b/src/usr.sbin/ntpd/config.c
  14. @@ -138,9 +138,10 @@ int
  15. host_dns(const char *s, int synced, struct ntp_addr **hn)
  16. {
  17. int error, save_opts;
  18. -
  19. +
  20. log_debug("trying to resolve %s", s);
  21. error = host_dns1(s, hn, 0);
  22. +#ifdef RES_USE_CD
  23. if (!synced && error <= 0) {
  24. log_debug("no luck, trying to resolve %s without checking", s);
  25. save_opts = _res.options;
  26. @@ -148,6 +149,7 @@ host_dns(const char *s, int synced, struct ntp_addr **hn)
  27. error = host_dns1(s, hn, 1);
  28. _res.options = save_opts;
  29. }
  30. +#endif
  31. log_debug("resolve %s done: %d", s, error);
  32. return error;
  33. }
  34. diff --git a/src/usr.sbin/ntpd/ntp_dns.c b/src/usr.sbin/ntpd/ntp_dns.c
  35. index 439e7ab8a9..e74a8abe4d 100644
  36. --- a/src/usr.sbin/ntpd/ntp_dns.c
  37. +++ b/src/usr.sbin/ntpd/ntp_dns.c
  38. @@ -226,14 +226,16 @@ probe_root_ns(void)
  39. old_options = _res.options;
  40. _res.retrans = 1;
  41. _res.retry = 1;
  42. +#ifdef RES_USE_CD
  43. _res.options |= RES_USE_CD;
  44. -
  45. +#endif
  46. +
  47. ret = res_query(".", C_IN, T_NS, buf, sizeof(buf));
  48. _res.retrans = old_retrans;
  49. _res.retry = old_retry;
  50. _res.options = old_options;
  51. -
  52. +
  53. return ret;
  54. }
  55. @@ -242,7 +244,7 @@ probe_root(void)
  56. {
  57. int n;
  58. - n = probe_root_ns();
  59. + n = probe_root_ns();
  60. if (n < 0) {
  61. /* give programs like unwind a second chance */
  62. sleep(1);
  63. --
  64. 2.27.0