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

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. From d1f59b4cf6af36572dbd0414eab588e0222de8c5 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 | 7 +++++--
  8. src/usr.sbin/ntpd/ntp_dns.c | 8 +++++---
  9. 2 files changed, 10 insertions(+), 5 deletions(-)
  10. diff --git a/src/usr.sbin/ntpd/config.c b/src/usr.sbin/ntpd/config.c
  11. index 856c3147cc..f89742916a 100644
  12. --- a/src/usr.sbin/ntpd/config.c
  13. +++ b/src/usr.sbin/ntpd/config.c
  14. @@ -137,17 +137,20 @@ host_dns1(const char *s, struct ntp_addr **hn, int notauth)
  15. int
  16. host_dns(const char *s, int synced, struct ntp_addr **hn)
  17. {
  18. - int error, save_opts;
  19. -
  20. + int error;
  21. +
  22. log_debug("trying to resolve %s", s);
  23. error = host_dns1(s, hn, 0);
  24. +#ifdef RES_USE_CD
  25. if (!synced && error <= 0) {
  26. + int save_opts;
  27. log_debug("no luck, trying to resolve %s without checking", s);
  28. save_opts = _res.options;
  29. _res.options |= RES_USE_CD;
  30. error = host_dns1(s, hn, 1);
  31. _res.options = save_opts;
  32. }
  33. +#endif
  34. log_debug("resolve %s done: %d", s, error);
  35. return error;
  36. }
  37. diff --git a/src/usr.sbin/ntpd/ntp_dns.c b/src/usr.sbin/ntpd/ntp_dns.c
  38. index 439e7ab8a9..e74a8abe4d 100644
  39. --- a/src/usr.sbin/ntpd/ntp_dns.c
  40. +++ b/src/usr.sbin/ntpd/ntp_dns.c
  41. @@ -226,14 +226,16 @@ probe_root_ns(void)
  42. old_options = _res.options;
  43. _res.retrans = 1;
  44. _res.retry = 1;
  45. +#ifdef RES_USE_CD
  46. _res.options |= RES_USE_CD;
  47. -
  48. +#endif
  49. +
  50. ret = res_query(".", C_IN, T_NS, buf, sizeof(buf));
  51. _res.retrans = old_retrans;
  52. _res.retry = old_retry;
  53. _res.options = old_options;
  54. -
  55. +
  56. return ret;
  57. }
  58. @@ -242,7 +244,7 @@ probe_root(void)
  59. {
  60. int n;
  61. - n = probe_root_ns();
  62. + n = probe_root_ns();
  63. if (n < 0) {
  64. /* give programs like unwind a second chance */
  65. sleep(1);
  66. --
  67. 2.27.0