NTP users are strongly urged to take immediate action to ensure that their NTP daemons are not susceptible to being used in distributed denial-of-service (DDoS) attacks. Please also take this opportunity to defeat denial-of-service attacks by implementing Ingress and Egress filtering through BCP38.

ntp-4.2.8p8 was released on 02 June 2016 and addresses 1 high- and 4 low-severity security issues, 4 bugfixes, and contains other improvements over 4.2.8p7.

Please see the NTP Security Notice for vulnerability and mitigation details.

Bug 2697 - IN6_IS_ADDR_LOOPBACK build problems on some OSes
: IN6_IS_ADDR_LOOPBACK build problems on some OSes
Status: RESOLVED FIXED
Product: ntp
Classification: Unclassified
Component: build
: 4.2.8
: N/A N/A
: P5 blocker
: 4.2.8
Assigned To: Harlan Stenn
:
:
:
:
  Show dependency treegraph
 
Reported: 2014-12-20 17:42 UTC by Marius Schamschula
Modified: 2015-01-02 01:18 UTC (History)
9 users (show)

See Also:
stenn: blocking4.2.8+


Attachments
Patch for ntpd_io.c (814 bytes, patch)
2014-12-20 23:24 UTC, Marius Schamschula
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Marius Schamschula 2014-12-20 17:42:13 UTC
ntp 4.2.8 fails to build under Mac OS X 10.10 with the following error:

  CC     ntp_io.o
ntp_io.c:762:16: warning: cast from 'struct sockaddr *' to 'struct sockaddr_in6
*' increases required alignment from 1 to 4 [-Wcast-align]
                                resaddr6 = (struct sockaddr_in6
*)result->ai_addr;
                                          
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ntp_io.c:3316:11: warning: cast from 'unsigned char *' to 'struct timeval *'
increases required alignment from 1 to 8 [-Wcast-align]
                                tvp = (struct timeval *)CMSG_DATA(cmsghdr);
                                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
ntp_io.c:3325:23: warning: format specifies type 'long' but the argument has
type '__darwin_suseconds_t' (aka 'int') [-Wformat]
                                            tvp->tv_sec, tvp->tv_usec));
                                                         ^~~~~~~~~~~~
../include/ntpd.h:44:12: note: expanded from macro 'DPRINTF'
                        mprintf arg;                    \
                                ^
ntp_io.c:3457:4: error: no member named '__u6_addr' in 'sockaddr_u'
                        IN6_IS_ADDR_LOOPBACK(&rb->recv_srcadr),
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/netinet6/in6.h:247:46: note: expanded from macro
'IN6_IS_ADDR_LOOPBACK'
        ((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
                                                    ^
/usr/include/netinet6/in6.h:160:19: note: expanded from macro 's6_addr'
#define s6_addr   __u6_addr.__u6_addr8
                  ^
../include/ntpd.h:44:12: note: expanded from macro 'DPRINTF'
                        mprintf arg;                    \
                                ^
ntp_io.c:3457:4: error: no member named '__u6_addr' in 'sockaddr_u'
                        IN6_IS_ADDR_LOOPBACK(&rb->recv_srcadr),
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/netinet6/in6.h:248:45: note: expanded from macro
'IN6_IS_ADDR_LOOPBACK'
        (*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
                                                   ^
/usr/include/netinet6/in6.h:160:19: note: expanded from macro 's6_addr'
#define s6_addr   __u6_addr.__u6_addr8
                  ^
../include/ntpd.h:44:12: note: expanded from macro 'DPRINTF'
                        mprintf arg;                    \
                                ^
ntp_io.c:3457:4: error: no member named '__u6_addr' in 'sockaddr_u'
                        IN6_IS_ADDR_LOOPBACK(&rb->recv_srcadr),
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/netinet6/in6.h:249:45: note: expanded from macro
'IN6_IS_ADDR_LOOPBACK'
        (*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
                                                   ^
/usr/include/netinet6/in6.h:160:19: note: expanded from macro 's6_addr'
#define s6_addr   __u6_addr.__u6_addr8
                  ^
../include/ntpd.h:44:12: note: expanded from macro 'DPRINTF'
                        mprintf arg;                    \
                                ^
ntp_io.c:3457:4: error: no member named '__u6_addr' in 'sockaddr_u'
                        IN6_IS_ADDR_LOOPBACK(&rb->recv_srcadr),
                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/netinet6/in6.h:250:45: note: expanded from macro
'IN6_IS_ADDR_LOOPBACK'
        (*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1)))
                                                   ^
/usr/include/netinet6/in6.h:160:19: note: expanded from macro 's6_addr'
#define s6_addr   __u6_addr.__u6_addr8
                  ^
../include/ntpd.h:44:12: note: expanded from macro 'DPRINTF'
                        mprintf arg;                    \
                                ^
ntp_io.c:3464:9: error: no member named '__u6_addr' in 'sockaddr_u'
            && IN6_IS_ADDR_LOOPBACK(&rb->recv_srcadr)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/netinet6/in6.h:247:46: note: expanded from macro
'IN6_IS_ADDR_LOOPBACK'
        ((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
                                               ~~~  ^
/usr/include/netinet6/in6.h:160:19: note: expanded from macro 's6_addr'
#define s6_addr   __u6_addr.__u6_addr8
                  ^
ntp_io.c:3464:9: error: no member named '__u6_addr' in 'sockaddr_u'
            && IN6_IS_ADDR_LOOPBACK(&rb->recv_srcadr)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/netinet6/in6.h:248:45: note: expanded from macro
'IN6_IS_ADDR_LOOPBACK'
        (*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
                                              ~~~  ^
/usr/include/netinet6/in6.h:160:19: note: expanded from macro 's6_addr'
#define s6_addr   __u6_addr.__u6_addr8
                  ^
ntp_io.c:3464:9: error: no member named '__u6_addr' in 'sockaddr_u'
            && IN6_IS_ADDR_LOOPBACK(&rb->recv_srcadr)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/netinet6/in6.h:249:45: note: expanded from macro
'IN6_IS_ADDR_LOOPBACK'
        (*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
                                              ~~~  ^
/usr/include/netinet6/in6.h:160:19: note: expanded from macro 's6_addr'
#define s6_addr   __u6_addr.__u6_addr8
                  ^
ntp_io.c:3464:9: error: no member named '__u6_addr' in 'sockaddr_u'
            && IN6_IS_ADDR_LOOPBACK(&rb->recv_srcadr)
               ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/netinet6/in6.h:250:45: note: expanded from macro
'IN6_IS_ADDR_LOOPBACK'
        (*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1)))
                                              ~~~  ^
/usr/include/netinet6/in6.h:160:19: note: expanded from macro 's6_addr'
#define s6_addr   __u6_addr.__u6_addr8
                  ^
ntp_io.c:3465:10: error: no member named '__u6_addr' in 'sockaddr_u'
            && !IN6_IS_ADDR_LOOPBACK(&itf->sin)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/netinet6/in6.h:247:46: note: expanded from macro
'IN6_IS_ADDR_LOOPBACK'
        ((*(const __uint32_t *)(const void *)(&(a)->s6_addr[0]) == 0) && \
                                               ~~~  ^
/usr/include/netinet6/in6.h:160:19: note: expanded from macro 's6_addr'
#define s6_addr   __u6_addr.__u6_addr8
                  ^
ntp_io.c:3465:10: error: no member named '__u6_addr' in 'sockaddr_u'
            && !IN6_IS_ADDR_LOOPBACK(&itf->sin)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/netinet6/in6.h:248:45: note: expanded from macro
'IN6_IS_ADDR_LOOPBACK'
        (*(const __uint32_t *)(const void *)(&(a)->s6_addr[4]) == 0) && \
                                              ~~~  ^
/usr/include/netinet6/in6.h:160:19: note: expanded from macro 's6_addr'
#define s6_addr   __u6_addr.__u6_addr8
                  ^
ntp_io.c:3465:10: error: no member named '__u6_addr' in 'sockaddr_u'
            && !IN6_IS_ADDR_LOOPBACK(&itf->sin)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/netinet6/in6.h:249:45: note: expanded from macro
'IN6_IS_ADDR_LOOPBACK'
        (*(const __uint32_t *)(const void *)(&(a)->s6_addr[8]) == 0) && \
                                              ~~~  ^
/usr/include/netinet6/in6.h:160:19: note: expanded from macro 's6_addr'
#define s6_addr   __u6_addr.__u6_addr8
                  ^
ntp_io.c:3465:10: error: no member named '__u6_addr' in 'sockaddr_u'
            && !IN6_IS_ADDR_LOOPBACK(&itf->sin)
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/netinet6/in6.h:250:45: note: expanded from macro
'IN6_IS_ADDR_LOOPBACK'
        (*(const __uint32_t *)(const void *)(&(a)->s6_addr[12]) == ntohl(1)))
                                              ~~~  ^
/usr/include/netinet6/in6.h:160:19: note: expanded from macro 's6_addr'
#define s6_addr   __u6_addr.__u6_addr8
                  ^
3 warnings and 12 errors generated.
make[3]: *** [ntp_io.o] Error 1

I have tried to include netinet6/in6.h, where __u6_addr is defined, by
including netinet/in.h. This did not help.
Comment 1 Marius Schamschula 2014-12-20 23:24:48 UTC
Created attachment 1165 [details]
Patch for ntpd_io.c

Patch to permit building ntpd under Mac OS X.
Comment 2 John Marshall 2014-12-22 03:57:05 UTC
Same for FreeBSD 10.1 and FreeBSD 8.4.

ntp_io.c:3464: error: 'sockaddr_u' has no member named '__u6_addr'
ntp_io.c:3465: error: 'sockaddr_u' has no member named '__u6_addr'

I tried building on FreeBSD with Marius' patch and 'it works' - but I am not
competent to assess the patch in any way - I'm only a sysadmin.

I can confirm the build failure on:

FreeBSD/i386 10.1
FreeBSD/amd64 10.1
FreeBSD/amd/64 8.4

Patch tested (builds and runs) on:

FreeBSD/i386 10.1
FreeBSD/amd64 10.1
Comment 3 Harlan Stenn 2014-12-22 05:23:33 UTC
*** Bug 2698 has been marked as a duplicate of this bug. ***
Comment 4 Harlan Stenn 2014-12-22 05:53:27 UTC
Marius (et al),

Thanks for the report and patches.

Please check the next/first 4.2.8 patch tarball (likely a -BETA release) and
mark this bug as VERIFIED or IN_PROGRESS, as appropriate.
Comment 5 Harlan Stenn 2014-12-23 02:20:46 UTC
*** Bug 2702 has been marked as a duplicate of this bug. ***
Comment 6 Harlan Stenn 2014-12-23 02:21:14 UTC
*** Bug 2701 has been marked as a duplicate of this bug. ***
Comment 7 Harlan Stenn 2014-12-24 07:41:41 UTC
Until 4.2.8p1 is released, please see:

 http://people.ntp.org/stenn/ntp4-4.2.8-bug2650.tar.gz
Comment 8 Harlan Stenn 2014-12-24 07:42:30 UTC
*** Bug 2703 has been marked as a duplicate of this bug. ***
Comment 9 Harlan Stenn 2014-12-24 07:55:45 UTC
This bug is now fixed in ntp-4.2.8p1-beta1.tar.gz, available from 
http://www.ntp.org/downloads.html and http://support.ntp.org/download.
Comment 10 Harlan Stenn 2014-12-25 10:08:33 UTC
*** Bug 2708 has been marked as a duplicate of this bug. ***
Comment 11 Harlan Stenn 2014-12-30 00:15:03 UTC
*** Bug 2717 has been marked as a duplicate of this bug. ***
Comment 12 Harlan Stenn 2015-01-02 01:18:22 UTC
*** Bug 2723 has been marked as a duplicate of this bug. ***