configure: include IPV6_PKTINFO in struct in6_pktinfo check
This commit is contained in:
parent
01965d147a
commit
85f7a4054d
2 changed files with 7 additions and 5 deletions
4
configure
vendored
4
configure
vendored
|
@ -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
|
||||
|
|
8
ntp_io.c
8
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;
|
||||
|
|
Loading…
Reference in a new issue