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.

53 lines
1.7 KiB

10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
  1. From 1c97bf8f63a68525d343216fec27565192c001e0 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 08/12] conditionally fill in sin_len/sin6_len if they exist
  5. ---
  6. src/usr.sbin/ntpd/config.c | 8 ++++++++
  7. 1 file changed, 8 insertions(+)
  8. diff --git a/src/usr.sbin/ntpd/config.c b/src/usr.sbin/ntpd/config.c
  9. index 22b692b..c01df83 100644
  10. --- a/src/usr.sbin/ntpd/config.c
  11. +++ b/src/usr.sbin/ntpd/config.c
  12. @@ -75,7 +75,9 @@ host_v4(const char *s)
  13. if ((h = calloc(1, sizeof(struct ntp_addr))) == NULL)
  14. fatal(NULL);
  15. sa_in = (struct sockaddr_in *)&h->ss;
  16. +#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
  17. sa_in->sin_len = sizeof(struct sockaddr_in);
  18. +#endif
  19. sa_in->sin_family = AF_INET;
  20. sa_in->sin_addr.s_addr = ina.s_addr;
  21. @@ -97,7 +99,9 @@ host_v6(const char *s)
  22. if ((h = calloc(1, sizeof(struct ntp_addr))) == NULL)
  23. fatal(NULL);
  24. sa_in6 = (struct sockaddr_in6 *)&h->ss;
  25. +#ifdef SIN6_LEN
  26. sa_in6->sin6_len = sizeof(struct sockaddr_in6);
  27. +#endif
  28. sa_in6->sin6_family = AF_INET6;
  29. memcpy(&sa_in6->sin6_addr,
  30. &((struct sockaddr_in6 *)res->ai_addr)->sin6_addr,
  31. @@ -147,12 +151,16 @@ host_dns(const char *s, struct ntp_addr **hn)
  32. h->ss.ss_family = res->ai_family;
  33. if (res->ai_family == AF_INET) {
  34. sa_in = (struct sockaddr_in *)&h->ss;
  35. +#ifdef HAVE_STRUCT_SOCKADDR_IN_SIN_LEN
  36. sa_in->sin_len = sizeof(struct sockaddr_in);
  37. +#endif
  38. sa_in->sin_addr.s_addr = ((struct sockaddr_in *)
  39. res->ai_addr)->sin_addr.s_addr;
  40. } else {
  41. sa_in6 = (struct sockaddr_in6 *)&h->ss;
  42. +#ifdef SIN6_LEN
  43. sa_in6->sin6_len = sizeof(struct sockaddr_in6);
  44. +#endif
  45. memcpy(&sa_in6->sin6_addr, &((struct sockaddr_in6 *)
  46. res->ai_addr)->sin6_addr, sizeof(struct in6_addr));
  47. }
  48. --
  49. 1.9.1