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

From fc27d536a1ce4eec8b5cfc689d7b8671b5ae58ef Mon Sep 17 00:00:00 2001
From: Brent Cook <bcook@openbsd.org>
Date: Sat, 13 Aug 2016 14:22:02 -0500
Subject: [PATCH 13/15] set IPV6_V6ONLY if we are binding to an IPv6 address
---
src/usr.sbin/ntpd/server.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/usr.sbin/ntpd/server.c b/src/usr.sbin/ntpd/server.c
index 8c18eb7610..9eab1a74bf 100644
--- a/src/usr.sbin/ntpd/server.c
+++ b/src/usr.sbin/ntpd/server.c
@@ -42,6 +42,9 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
size_t sa6len = sizeof(struct in6_addr);
u_int new_cnt = 0;
int tos = IPTOS_LOWDELAY;
+#ifdef IPV6_V6ONLY
+ int on = 1;
+#endif
#ifdef SO_RTABLE
int rdomain = 0;
#endif
@@ -134,6 +137,12 @@ setup_listeners(struct servent *se, struct ntpd_conf *lconf, u_int *cnt)
IPPROTO_IP, IP_TOS, &tos, sizeof(tos)) == -1)
log_warn("setsockopt IPTOS_LOWDELAY");
+#ifdef IPV6_V6ONLY
+ if (la->sa.ss_family == AF_INET6 && setsockopt(la->fd,
+ IPPROTO_IPV6, IPV6_V6ONLY, &on, sizeof(on)) == -1)
+ log_warn("setsockopt IPV6_V6ONLY");
+#endif
+
#ifdef SO_RTABLE
if (la->rtable != -1 &&
setsockopt(la->fd, SOL_SOCKET, SO_RTABLE, &la->rtable,
--
2.21.0