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.

39 lines
1.2 KiB

8 years ago
7 years ago
7 years ago
  1. From 1e633c87b63e0933c854f82b965a3bd686eb0c1c Mon Sep 17 00:00:00 2001
  2. From: Brent Cook <bcook@openbsd.org>
  3. Date: Sat, 13 Aug 2016 14:22:02 -0500
  4. Subject: [PATCH 13/13] set IPV6_V6ONLY if we are binding to an IPv6 address
  5. ---
  6. src/usr.sbin/ntpd/server.c | 9 +++++++++
  7. 1 file changed, 9 insertions(+)
  8. diff --git a/src/usr.sbin/ntpd/server.c b/src/usr.sbin/ntpd/server.c
  9. index 8c18eb761..9eab1a74b 100644
  10. --- a/src/usr.sbin/ntpd/server.c
  11. +++ b/src/usr.sbin/ntpd/server.c
  12. @@ -42,6 +42,9 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
  13. size_t sa6len = sizeof(struct in6_addr);
  14. u_int new_cnt = 0;
  15. int tos = IPTOS_LOWDELAY;
  16. +#ifdef IPV6_V6ONLY
  17. + int on = 1;
  18. +#endif
  19. #ifdef SO_RTABLE
  20. int rdomain = 0;
  21. #endif
  22. @@ -134,6 +137,12 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
  23. IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) == -1)
  24. log_warn("setsockopt IPTOS_LOWDELAY");
  25. +#ifdef IPV6_V6ONLY
  26. + if (la->sa.ss_family == AF_INET6 && setsockopt(la->fd,
  27. + IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) == -1)
  28. + log_warn("setsockopt IPV6_V6ONLY");
  29. +#endif
  30. +
  31. #ifdef SO_RTABLE
  32. if (la->rtable != -1 &&
  33. setsockopt(la->fd, SOL_SOCKET, SO_RTABLE, &la->rtable,
  34. --
  35. 2.13.0