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.

55 lines
1.8 KiB

  1. From e6c8f113fb20f3768e3c35b2f23c694a61c7c5f2 Mon Sep 17 00:00:00 2001
  2. From: Brent Cook <busterb@gmail.com>
  3. Date: Tue, 30 Dec 2014 09:02:50 -0600
  4. Subject: [PATCH 11/16] conditionally fill in sin_len/sin6_len if they exist
  5. Should we even be setting these at all? Does anything really rely in
  6. this anymore?
  7. ---
  8. src/usr.sbin/ntpd/config.c | 8 ++++++++
  9. 1 file changed, 8 insertions(+)
  10. diff --git a/src/usr.sbin/ntpd/config.c b/src/usr.sbin/ntpd/config.c
  11. index d660750..b651c62 100644
  12. --- a/src/usr.sbin/ntpd/config.c
  13. +++ b/src/usr.sbin/ntpd/config.c
  14. @@ -75,7 +75,9 @@ host_v4(const char *s)
  15. if ((h = calloc(1, sizeof(struct ntp_addr))) == NULL)
  16. fatal(NULL);
  17. sa_in = (struct sockaddr_in *)&h->ss;
  18. +#ifdef SIN_LEN
  19. sa_in->sin_len = sizeof(struct sockaddr_in);
  20. +#endif
  21. sa_in->sin_family = AF_INET;
  22. sa_in->sin_addr.s_addr = ina.s_addr;
  23. @@ -97,7 +99,9 @@ host_v6(const char *s)
  24. if ((h = calloc(1, sizeof(struct ntp_addr))) == NULL)
  25. fatal(NULL);
  26. sa_in6 = (struct sockaddr_in6 *)&h->ss;
  27. +#ifdef SIN6_LEN
  28. sa_in6->sin6_len = sizeof(struct sockaddr_in6);
  29. +#endif
  30. sa_in6->sin6_family = AF_INET6;
  31. memcpy(&sa_in6->sin6_addr,
  32. &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr,
  33. @@ -141,12 +145,16 @@ host_dns(const char *s, struct ntp_addr **hn)
  34. h->ss.ss_family = res->ai_family;
  35. if (res->ai_family == AF_INET) {
  36. sa_in = (struct sockaddr_in *)&h->ss;
  37. +#ifdef SIN_LEN
  38. sa_in->sin_len = sizeof(struct sockaddr_in);
  39. +#endif
  40. sa_in->sin_addr.s_addr = ((struct sockaddr_in *)
  41. res->ai_addr)->sin_addr.s_addr;
  42. } else {
  43. sa_in6 = (struct sockaddr_in6 *)&h->ss;
  44. +#ifdef SIN6_LEN
  45. sa_in6->sin6_len = sizeof(struct sockaddr_in6);
  46. +#endif
  47. memcpy(&sa_in6->sin6_addr, &((struct sockaddr_in6 *)
  48. res->ai_addr)->sin6_addr, sizeof(struct in6_addr));
  49. }
  50. --
  51. 1.9.1