]> git.ipfire.org Git - thirdparty/chrony.git/commitdiff
configure: include IPV6_PKTINFO in struct in6_pktinfo check
authorMiroslav Lichvar <mlichvar@redhat.com>
Mon, 12 Oct 2015 09:22:27 +0000 (11:22 +0200)
committerMiroslav Lichvar <mlichvar@redhat.com>
Mon, 12 Oct 2015 11:40:02 +0000 (13:40 +0200)
configure
ntp_io.c

index c33c2a57912788679d8b3e41a7043d5f302289f1..453c4e55eedaa8379fb47b437623651bcb64f911 100755 (executable)
--- a/configure
+++ b/configure
@@ -528,12 +528,12 @@ if [ $feat_ipv6 = "1" ] && \
 then
   add_def FEAT_IPV6
   if test_code 'in6_pktinfo' 'sys/socket.h netinet/in.h' '' '' '
-    return sizeof(struct in6_pktinfo);'
+    return sizeof (struct in6_pktinfo) + IPV6_PKTINFO;'
   then
     add_def HAVE_IN6_PKTINFO
   else
     if test_code 'in6_pktinfo with _GNU_SOURCE' 'sys/socket.h netinet/in.h' \
-      '-D_GNU_SOURCE' '' 'return sizeof(struct in6_pktinfo);'
+      '-D_GNU_SOURCE' '' 'return sizeof (struct in6_pktinfo) + IPV6_PKTINFO;'
     then
       add_def _GNU_SOURCE
       add_def HAVE_IN6_PKTINFO
index 68d677d4dd2010161a04786510d7a3237e0de4ea..68741ec75007c8cf99a7f413d6f90ce22639cf29 100644 (file)
--- a/ntp_io.c
+++ b/ntp_io.c
@@ -206,14 +206,16 @@ prepare_socket(int family, int port_number, int client_only)
     }
 #endif
 
+#ifdef HAVE_IN6_PKTINFO
 #ifdef IPV6_RECVPKTINFO
     if (setsockopt(sock_fd, IPPROTO_IPV6, IPV6_RECVPKTINFO, (char *)&on_off, sizeof(on_off)) < 0) {
       LOG(LOGS_ERR, LOGF_NtpIO, "Could not set IPv6 packet info socket option");
     }
-#elif defined(IPV6_PKTINFO)
+#else
     if (setsockopt(sock_fd, IPPROTO_IPV6, IPV6_PKTINFO, (char *)&on_off, sizeof(on_off)) < 0) {
       LOG(LOGS_ERR, LOGF_NtpIO, "Could not set IPv6 packet info socket option");
     }
+#endif
 #endif
   }
 #endif
@@ -541,7 +543,7 @@ read_from_socket(void *anything)
       }
 #endif
 
-#if defined(IPV6_PKTINFO) && defined(HAVE_IN6_PKTINFO)
+#ifdef HAVE_IN6_PKTINFO
       if (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) {
         struct in6_pktinfo ipi;
 
@@ -647,7 +649,7 @@ send_packet(void *packet, int packetlen, NTP_Remote_Address *remote_addr, NTP_Lo
   }
 #endif
 
-#if defined(IPV6_PKTINFO) && defined(HAVE_IN6_PKTINFO)
+#ifdef HAVE_IN6_PKTINFO
   if (local_addr->ip_addr.family == IPADDR_INET6) {
     struct cmsghdr *cmsg;
     struct in6_pktinfo *ipi;