From: Dave Hart Date: Wed, 28 Oct 2009 07:35:54 +0000 (+0000) Subject: [Bug 1358] AIX 4.3 sntp/networking.c IPV6_JOIN_GROUP undeclared. X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=42a46e89499be4e98833f935aed38c5eccd8aa21;p=thirdparty%2Fntp.git [Bug 1358] AIX 4.3 sntp/networking.c IPV6_JOIN_GROUP undeclared. bk: 4ae7f45a1XSfdlZdSHa4Ijn0IflJgA --- diff --git a/ChangeLog b/ChangeLog index de2f3bd653..7633bdfa40 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,4 @@ +* [Bug 1358] AIX 4.3 sntp/networking.c IPV6_JOIN_GROUP undeclared. (4.2.5p238-RC) 2009/10/27 Released by Harlan Stenn * Changes from Dave Mills. * driver4.html updates from Dave Mills. diff --git a/include/ntp_rfc2553.h b/include/ntp_rfc2553.h index ef3374c9e1..4ed1b657cb 100644 --- a/include/ntp_rfc2553.h +++ b/include/ntp_rfc2553.h @@ -134,7 +134,7 @@ struct sockaddr_storage { /* * Flag values for getaddrinfo() */ -#ifndef AI_NUMERICHOST +#ifndef AI_PASSIVE #define AI_PASSIVE 0x00000001 /* get address to use bind() */ #define AI_CANONNAME 0x00000002 /* fill ai_canonname */ #define AI_NUMERICHOST 0x00000004 /* prevent name resolution */ @@ -143,6 +143,10 @@ struct sockaddr_storage { (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST | AI_ADDRCONFIG) #define AI_ADDRCONFIG 0x00000400 /* only if any address is assigned */ +#endif /* !AI_PASSIVE */ + +#ifndef AI_NUMERICHOST /* such as AIX 4.3 */ +#define AI_NUMERICHOST 0 #endif #ifndef ISC_PLATFORM_HAVEIPV6 @@ -208,6 +212,17 @@ char *gai_strerror (int); #define NI_WITHSCOPEID 0x00000020 #endif -#endif /* ISC_PLATFORM_HAVEIPV6 */ +#endif /* !ISC_PLATFORM_HAVEIPV6 */ + +/* + * Set up some macros to look for IPv6 and IPv6 multicast + */ + +#if defined(ISC_PLATFORM_HAVEIPV6) && defined(WANT_IPV6) +# define INCLUDE_IPV6_SUPPORT +# if defined(IPV6_JOIN_GROUP) && defined(IPV6_LEAVE_GROUP) +# define INCLUDE_IPV6_MULTICAST_SUPPORT +# endif /* IPV6 Multicast Support */ +#endif /* IPv6 Support */ #endif /* !NTP_RFC2553_H */ diff --git a/ntpd/ntp_io.c b/ntpd/ntp_io.c index 8f0c220a43..0d380c72d9 100644 --- a/ntpd/ntp_io.c +++ b/ntpd/ntp_io.c @@ -64,20 +64,6 @@ #define SETSOCKOPT_ARG_CAST #endif -/* - * Set up some macros to look for IPv6 and IPv6 multicast - */ - -#if defined(ISC_PLATFORM_HAVEIPV6) && defined(WANT_IPV6) - -#define INCLUDE_IPV6_SUPPORT - -#if defined(INCLUDE_IPV6_SUPPORT) && defined(IPV6_JOIN_GROUP) && defined(IPV6_LEAVE_GROUP) -#define INCLUDE_IPV6_MULTICAST_SUPPORT - -#endif /* IPV6 Multicast Support */ -#endif /* IPv6 Support */ - extern int listen_to_virtual_ips; /* diff --git a/sntp/networking.c b/sntp/networking.c index 93b78f902a..a78eec16d6 100644 --- a/sntp/networking.c +++ b/sntp/networking.c @@ -214,7 +214,7 @@ recv_bcst_data ( } - if(setsockopt(rsock, IPPROTO_IP, IP_MULTICAST_LOOP, &btrue, sizeof(btrue)) < 0) { + if (setsockopt(rsock, IPPROTO_IP, IP_MULTICAST_LOOP, &btrue, sizeof(btrue)) < 0) { /* some error message regarding setting up multicast loop */ return BROADCAST_FAILED; } @@ -245,6 +245,9 @@ recv_bcst_data ( } #ifdef ISC_PLATFORM_HAVEIPV6 else if (IS_IPV6(sas)) { +#ifndef INCLUDE_IPV6_MULTICAST_SUPPORT + return BROADCAST_FAILED; +#else struct ipv6_mreq mdevadr; if (bind(rsock, &sas->sa, SOCKLEN(sas)) < 0) { @@ -252,7 +255,7 @@ recv_bcst_data ( printf("sntp recv_bcst_data: Couldn't bind() address.\n"); } - if(setsockopt(rsock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &btrue, sizeof (btrue)) < 0) { + if (setsockopt(rsock, IPPROTO_IPV6, IPV6_MULTICAST_LOOP, &btrue, sizeof (btrue)) < 0) { /* some error message regarding setting up multicast loop */ return BROADCAST_FAILED; } @@ -283,6 +286,7 @@ recv_bcst_data ( return BROADCAST_FAILED; } } +#endif /* INCLUDE_IPV6_MULTICAST_SUPPORT */ } #endif /* ISC_PLATFORM_HAVEIPV6 */ @@ -306,7 +310,8 @@ recv_bcst_data ( case 0: if(ENABLED_OPT(NORMALVERBOSE)) - printf("sntp recv_bcst_data: select() reached timeout (%li sec), aborting.\n", timeout_tv.tv_sec); + printf("sntp recv_bcst_data: select() reached timeout (%u sec), aborting.\n", + (unsigned)timeout_tv.tv_sec); return BROADCAST_FAILED; break; diff --git a/sntp/networking.h b/sntp/networking.h index 0d5fecf120..c8a0870cfa 100644 --- a/sntp/networking.h +++ b/sntp/networking.h @@ -29,6 +29,7 @@ #include #include +#include #include #include #include