Commit ed71ea51 authored by David Lawrence's avatar David Lawrence

Silence a few more warnings:

 + missing sigwait prototype on BSD/OS 4.0/4.0.1
 + PTHREAD_ONCE_INIT unbraced initializer warnings on Solaris 2.8.
 + IN6ADDR_ANY_INIT unbraced initializer warnings on BSD/OS 4.*, Linux and
   Solaris 2.8.
parent 446aa1ec
238. [cleanup] A few more compilation warnings have been quieted:
+ missing sigwait prototype on BSD/OS 4.0/4.0.1.
+ PTHREAD_ONCE_INIT unbraced initializer warnings on
Solaris 2.8.
+ IN6ADDR_ANY_INIT unbraced initializer warnings on
BSD/OS 4.*, Linux and Solaris 2.8.
237. [bug] If connect() returned ENOBUFS when the resolver was
initiating a TCP query, the socket didn't get destroyed,
and the server did not shut down cleanly.
initiating a TCP query, the socket didn't get
destroyed, and the server did not shut down cleanly.
236. [func] Added new listen-on-v6 config file statement.
......
......@@ -63,6 +63,12 @@ struct __sFILE;
extern __inline int __sputaux(int _c, struct __sFILE *_p);
#endif
/* Shut up warnings about missing sigwait prototype on BSD/OS 4.0* */
#undef SHUTUP_SIGWAIT
#ifdef SHUTUP_SIGWAIT
int sigwait(const unsigned int *set, int *sig);
#endif
/* Shut up warnings from gcc -Wcast-qual on BSD/OS 4.1. */
#undef SHUTUP_STDARG_CAST
#if defined(SHUTUP_STDARG_CAST) && defined(__GNUC__)
......
......@@ -70,6 +70,12 @@ struct __sFILE;
extern __inline int __sputaux(int _c, struct __sFILE *_p);
#endif
/* Shut up warnings about missing sigwait prototype on BSD/OS 4.0* */
#undef SHUTUP_SIGWAIT
#ifdef SHUTUP_SIGWAIT
int sigwait(const unsigned int *set, int *sig);
#endif
/* Shut up warnings from gcc -Wcast-qual on BSD/OS 4.1. */
#undef SHUTUP_STDARG_CAST
#if defined(SHUTUP_STDARG_CAST) && defined(__GNUC__)
......
#! /bin/sh
# From configure.in Revision: 1.143
# From configure.in Revision: 1.144
......@@ -3441,18 +3441,20 @@ if { (eval echo configure:3441: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && t
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
else
echo "configure: failed program was:" >&5
cat conftest.$ac_ext >&5
rm -rf conftest*
echo "$ac_t""no" 1>&6
ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"
LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"
fi
rm -f conftest*
echo $ac_n "checking for in6_pktinfo""... $ac_c" 1>&6
echo "configure:3454: checking for in6_pktinfo" >&5
echo "configure:3456: checking for in6_pktinfo" >&5
cat > conftest.$ac_ext <<EOF
#line 3456 "configure"
#line 3458 "configure"
#include "confdefs.h"
#include <sys/types.h>
......@@ -3465,7 +3467,7 @@ int main() {
struct in6_pktinfo xyzzy; return (0);
; return 0; }
EOF
if { (eval echo configure:3469: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
if { (eval echo configure:3471: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_HAVEIN6PKTINFO="#define ISC_PLATFORM_HAVEIN6PKTINFO 1"
......@@ -3482,6 +3484,7 @@ rm -f conftest*
ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6"
LWRES_PLATFORM_HAVEIPV6="#undef LWRES_PLATFORM_HAVEIPV6"
ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
ISC_IPV6_H="ipv6.h"
ISC_IPV6_O="ipv6.$O"
......@@ -3503,15 +3506,16 @@ esac
#
# Check for network functions that are often missing. We do this
# after the libtool checking, so we can put the right suffix on
# the files.
#
echo $ac_n "checking for inet_ntop""... $ac_c" 1>&6
echo "configure:3513: checking for inet_ntop" >&5
echo "configure:3517: checking for inet_ntop" >&5
cat > conftest.$ac_ext <<EOF
#line 3515 "configure"
#line 3519 "configure"
#include "confdefs.h"
#include <sys/types.h>
......@@ -3521,7 +3525,7 @@ int main() {
inet_ntop(0, 0, 0, 0); return (0);
; return 0; }
EOF
if { (eval echo configure:3525: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3529: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_NEEDNTOP="#undef ISC_PLATFORM_NEEDNTOP"
......@@ -3536,9 +3540,9 @@ else
fi
rm -f conftest*
echo $ac_n "checking for inet_pton""... $ac_c" 1>&6
echo "configure:3540: checking for inet_pton" >&5
echo "configure:3544: checking for inet_pton" >&5
cat > conftest.$ac_ext <<EOF
#line 3542 "configure"
#line 3546 "configure"
#include "confdefs.h"
#include <sys/types.h>
......@@ -3548,7 +3552,7 @@ int main() {
inet_pton(0, 0, 0); return (0);
; return 0; }
EOF
if { (eval echo configure:3552: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3556: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_NEEDPTON="#undef ISC_PLATFORM_NEEDPTON"
......@@ -3563,9 +3567,9 @@ else
fi
rm -f conftest*
echo $ac_n "checking for inet_aton""... $ac_c" 1>&6
echo "configure:3567: checking for inet_aton" >&5
echo "configure:3571: checking for inet_aton" >&5
cat > conftest.$ac_ext <<EOF
#line 3569 "configure"
#line 3573 "configure"
#include "confdefs.h"
#include <sys/types.h>
......@@ -3575,7 +3579,7 @@ int main() {
struct in_addr in; inet_aton(0, &in); return (0);
; return 0; }
EOF
if { (eval echo configure:3579: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3583: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_NEEDATON="#undef ISC_PLATFORM_NEEDATON"
......@@ -3596,12 +3600,12 @@ rm -f conftest*
# Check for some other useful functions that are not ever-present.
echo $ac_n "checking for strsep""... $ac_c" 1>&6
echo "configure:3600: checking for strsep" >&5
echo "configure:3604: checking for strsep" >&5
if eval "test \"`echo '$''{'ac_cv_func_strsep'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3605 "configure"
#line 3609 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char strsep(); below. */
......@@ -3624,7 +3628,7 @@ strsep();
; return 0; }
EOF
if { (eval echo configure:3628: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_strsep=yes"
else
......@@ -3645,12 +3649,12 @@ ISC_PLATFORM_NEEDSTRSEP="#define ISC_PLATFORM_NEEDSTRSEP 1"
fi
echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6
echo "configure:3649: checking for vsnprintf" >&5
echo "configure:3653: checking for vsnprintf" >&5
if eval "test \"`echo '$''{'ac_cv_func_vsnprintf'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3654 "configure"
#line 3658 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char vsnprintf(); below. */
......@@ -3673,7 +3677,7 @@ vsnprintf();
; return 0; }
EOF
if { (eval echo configure:3677: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3681: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_vsnprintf=yes"
else
......@@ -3702,17 +3706,17 @@ fi
echo $ac_n "checking for sizeof(long long int) == sizeof(long int)""... $ac_c" 1>&6
echo "configure:3706: checking for sizeof(long long int) == sizeof(long int)" >&5
echo "configure:3710: checking for sizeof(long long int) == sizeof(long int)" >&5
if test "$cross_compiling" = yes; then
echo "$ac_t""default yes" 1>&6
ISC_PLATFORM_LONGLONGEQUALLONG="#define ISC_PLATFORM_LONGLONGEQUALLONG 1"
else
cat > conftest.$ac_ext <<EOF
#line 3712 "configure"
#line 3716 "configure"
#include "confdefs.h"
main() { exit(!(sizeof(long long int) == sizeof(long int))); }
EOF
if { (eval echo configure:3716: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
if { (eval echo configure:3720: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
then
echo "$ac_t""yes" 1>&6
ISC_PLATFORM_LONGLONGEQUALLONG="#define ISC_PLATFORM_LONGLONGEQUALLONG 1"
......@@ -3732,12 +3736,12 @@ fi
# Security Stuff
#
echo $ac_n "checking for chroot""... $ac_c" 1>&6
echo "configure:3736: checking for chroot" >&5
echo "configure:3740: checking for chroot" >&5
if eval "test \"`echo '$''{'ac_cv_func_chroot'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3741 "configure"
#line 3745 "configure"
#include "confdefs.h"
/* System header to define __stub macros and hopefully few prototypes,
which can conflict with char chroot(); below. */
......@@ -3760,7 +3764,7 @@ chroot();
; return 0; }
EOF
if { (eval echo configure:3764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
if { (eval echo configure:3768: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
rm -rf conftest*
eval "ac_cv_func_chroot=yes"
else
......@@ -3786,17 +3790,17 @@ for ac_hdr in linux/capability.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3790: checking for $ac_hdr" >&5
echo "configure:3794: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3795 "configure"
#line 3799 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3800: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:3804: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -3826,17 +3830,17 @@ for ac_hdr in linux/prctl.h
do
ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'`
echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6
echo "configure:3830: checking for $ac_hdr" >&5
echo "configure:3834: checking for $ac_hdr" >&5
if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
cat > conftest.$ac_ext <<EOF
#line 3835 "configure"
#line 3839 "configure"
#include "confdefs.h"
#include <$ac_hdr>
EOF
ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
{ (eval echo configure:3840: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
{ (eval echo configure:3844: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
if test -z "$ac_err"; then
rm -rf conftest*
......@@ -3865,26 +3869,70 @@ done
#
# Random remaining OS-specific issues.
# XXXDCL print messages to indicate some compensation is being done?
#
ISC_PLATFORM_BRACEPTHREADONCEINIT="#undef ISC_PLATFORM_BRACEPTHREADONCEINIT"
case "$host" in
*-bsdi3.1*|*-bsdi4.0*)
#
# Shut up a -Wmissing-prototypes warning from <stdio.h>.
#
*-bsdi3.1*)
hack_shutup_sputaux=yes
;;
*-bsdi4.0*)
hack_shutup_sigwait=yes
hack_shutup_sputaux=yes
;;
*-bsdi4.1*)
hack_shutup_stdargcast=yes
;;
*-solaris2.8)
hack_shutup_pthreadonceinit=yes
;;
esac
case "$hack_shutup_pthreadonceinit" in
yes)
#
# Shut up PTHREAD_ONCE_INIT unbraced initializer warnings.
#
ISC_PLATFORM_BRACEPTHREADONCEINIT="#define ISC_PLATFORM_BRACEPTHREADONCEINIT 1"
;;
esac
case "$hack_shutup_sigwait" in
yes)
#
# Shut up a -Wmissing-prototypes warning for sigwait().
#
cat >> confdefs.h <<\EOF
#define SHUTUP_SIGWAIT 1
EOF
;;
esac
case "$hack_shutup_sputaux" in
yes)
#
# Shut up a -Wmissing-prototypes warning from <stdio.h>.
#
cat >> confdefs.h <<\EOF
#define SHUTUP_SPUTAUX 1
EOF
;;
*-bsdi4.1*)
#
# Shut up a -Wcast-qual warning from va_start().
#
cat >> confdefs.h <<\EOF
esac
case "$hack_shutup_stdargcast" in
yes)
#
# Shut up a -Wcast-qual warning from va_start().
#
cat >> confdefs.h <<\EOF
#define SHUTUP_STDARG_CAST 1
EOF
;;
;;
esac
#
......@@ -4186,6 +4234,7 @@ s%@LWRES_PLATFORM_NEEDNETINETIN6H@%$LWRES_PLATFORM_NEEDNETINETIN6H%g
s%@ISC_PLATFORM_NEEDNETINET6IN6H@%$ISC_PLATFORM_NEEDNETINET6IN6H%g
s%@LWRES_PLATFORM_NEEDNETINET6IN6H@%$LWRES_PLATFORM_NEEDNETINET6IN6H%g
s%@ISC_PLATFORM_NEEDIN6ADDRANY@%$ISC_PLATFORM_NEEDIN6ADDRANY%g
s%@LWRES_PLATFORM_NEEDIN6ADDRANY@%$LWRES_PLATFORM_NEEDIN6ADDRANY%g
s%@ISC_PLATFORM_HAVEIN6PKTINFO@%$ISC_PLATFORM_HAVEIN6PKTINFO%g
s%@ISC_IPV6_H@%$ISC_IPV6_H%g
s%@ISC_IPV6_O@%$ISC_IPV6_O%g
......@@ -4199,6 +4248,7 @@ s%@ISC_PLATFORM_NEEDVSNPRINTF@%$ISC_PLATFORM_NEEDVSNPRINTF%g
s%@ISC_EXTRA_OBJS@%$ISC_EXTRA_OBJS%g
s%@ISC_EXTRA_SRCS@%$ISC_EXTRA_SRCS%g
s%@ISC_PLATFORM_LONGLONGEQUALLONG@%$ISC_PLATFORM_LONGLONGEQUALLONG%g
s%@ISC_PLATFORM_BRACEPTHREADONCEINIT@%$ISC_PLATFORM_BRACEPTHREADONCEINIT%g
s%@BIND9_TOP_BUILDDIR@%$BIND9_TOP_BUILDDIR%g
s%@BIND9_ISC_BUILDINCLUDE@%$BIND9_ISC_BUILDINCLUDE%g
s%@BIND9_DNS_BUILDINCLUDE@%$BIND9_DNS_BUILDINCLUDE%g
......
......@@ -13,7 +13,7 @@ dnl PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
dnl ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
dnl SOFTWARE.
AC_REVISION($Revision: 1.143 $)
AC_REVISION($Revision: 1.144 $)
AC_PREREQ(2.13)
......@@ -710,9 +710,11 @@ case "$found_ipv6" in
$isc_netinetin6_hack],
[struct in6_addr in6; in6 = in6addr_any; return (0);],
[AC_MSG_RESULT(yes)
ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"],
ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"],
[AC_MSG_RESULT(no)
ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"])
ISC_PLATFORM_NEEDIN6ADDRANY="#define ISC_PLATFORM_NEEDIN6ADDRANY 1"
LWRES_PLATFORM_NEEDIN6ADDRANY="#define LWRES_PLATFORM_NEEDIN6ADDRANY 1"])
AC_MSG_CHECKING(for in6_pktinfo)
AC_TRY_COMPILE([
#include <sys/types.h>
......@@ -731,6 +733,7 @@ $isc_netinet6in6_hack
ISC_PLATFORM_HAVEIPV6="#undef ISC_PLATFORM_HAVEIPV6"
LWRES_PLATFORM_HAVEIPV6="#undef LWRES_PLATFORM_HAVEIPV6"
ISC_PLATFORM_NEEDIN6ADDRANY="#undef ISC_PLATFORM_NEEDIN6ADDRANY"
LWRES_PLATFORM_NEEDIN6ADDRANY="#undef LWRES_PLATFORM_NEEDIN6ADDRANY"
ISC_PLATFORM_HAVEIN6PKTINFO="#undef ISC_PLATFORM_HAVEIN6PKTINFO"
ISC_IPV6_H="ipv6.h"
ISC_IPV6_O="ipv6.$O"
......@@ -746,6 +749,7 @@ AC_SUBST(LWRES_PLATFORM_NEEDNETINETIN6H)
AC_SUBST(ISC_PLATFORM_NEEDNETINET6IN6H)
AC_SUBST(LWRES_PLATFORM_NEEDNETINET6IN6H)
AC_SUBST(ISC_PLATFORM_NEEDIN6ADDRANY)
AC_SUBST(LWRES_PLATFORM_NEEDIN6ADDRANY)
AC_SUBST(ISC_PLATFORM_HAVEIN6PKTINFO)
AC_SUBST(ISC_IPV6_H)
AC_SUBST(ISC_IPV6_O)
......@@ -835,20 +839,61 @@ AC_CHECK_HEADERS(linux/prctl.h)
#
# Random remaining OS-specific issues.
# XXXDCL print messages to indicate some compensation is being done?
#
AC_SUBST(ISC_PLATFORM_BRACEPTHREADONCEINIT)
ISC_PLATFORM_BRACEPTHREADONCEINIT="#undef ISC_PLATFORM_BRACEPTHREADONCEINIT"
case "$host" in
*-bsdi3.1*|*-bsdi4.0*)
#
# Shut up a -Wmissing-prototypes warning from <stdio.h>.
#
*-bsdi3.1*)
hack_shutup_sputaux=yes
;;
*-bsdi4.0*)
hack_shutup_sigwait=yes
hack_shutup_sputaux=yes
;;
*-bsdi4.1*)
hack_shutup_stdargcast=yes
;;
*-solaris2.8)
hack_shutup_pthreadonceinit=yes
;;
esac
case "$hack_shutup_pthreadonceinit" in
yes)
#
# Shut up PTHREAD_ONCE_INIT unbraced initializer warnings.
#
ISC_PLATFORM_BRACEPTHREADONCEINIT="#define ISC_PLATFORM_BRACEPTHREADONCEINIT 1"
;;
esac
case "$hack_shutup_sigwait" in
yes)
#
# Shut up a -Wmissing-prototypes warning for sigwait().
#
AC_DEFINE(SHUTUP_SIGWAIT)
;;
esac
case "$hack_shutup_sputaux" in
yes)
#
# Shut up a -Wmissing-prototypes warning from <stdio.h>.
#
AC_DEFINE(SHUTUP_SPUTAUX)
;;
*-bsdi4.1*)
#
# Shut up a -Wcast-qual warning from va_start().
#
AC_DEFINE(SHUTUP_STDARG_CAST)
;;
esac
case "$hack_shutup_stdargcast" in
yes)
#
# Shut up a -Wcast-qual warning from va_start().
#
AC_DEFINE(SHUTUP_STDARG_CAST)
;;
esac
#
......
......@@ -88,10 +88,15 @@
@ISC_PLATFORM_NEEDSTRSEP@
/*
* Define either ISC_PLATFORM_BSD44MSGHDR or ISC_PLATFORM_BSD43MSGHDR
* Define either ISC_PLATFORM_BSD44MSGHDR or ISC_PLATFORM_BSD43MSGHDR.
*/
@ISC_PLATFORM_MSGHDRFLAVOR@
/*
* Define if PTHREAD_ONCE_INIT should be surrounded by braces to
* prevent compiler warnings (such as with gcc on Solaris 2.8).
*/
@ISC_PLATFORM_BRACEPTHREADONCEINIT@
/***
*** Printing.
......
......@@ -20,11 +20,22 @@
#include <pthread.h>
#include <isc/platform.h>
#include <isc/result.h>
typedef pthread_once_t isc_once_t;
typedef pthread_once_t isc_once_t;
#ifdef ISC_PLATFORM_BRACEPTHREADONCEINIT
/*
* This accomodates systems that define PTHRAD_ONCE_INIT improperly.
*/
#define ISC_ONCE_INIT { PTHREAD_ONCE_INIT }
#else
/*
* This is the usual case.
*/
#define ISC_ONCE_INIT PTHREAD_ONCE_INIT
#endif
/* XXX We could do fancier error handling... */
......
......@@ -41,11 +41,14 @@
#define IN6ADDRSZ 16
#endif
const struct in6_addr lwres_in6addr_any = IN6ADDR_ANY_INIT;
#ifdef LWRES_PLATFORM_NEEDIN6ADDRANY
const struct in6_addr in6addr_any = IN6ADDR_ANY_INIT;
#endif
#ifndef IN6_IS_ADDR_V4COMPAT
static const unsigned char in6addr_compat[12] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
#define IN6_IS_ADDR_V4COMPAT(x) (!memcmp((x)->s6_addr, in6addr_compat, 12) && \
((x)->s6_addr[12] != 0 || \
(x)->s6_addr[13] != 0 || \
......@@ -58,7 +61,8 @@ static const unsigned char in6addr_compat[12] = {
#endif
static const unsigned char in6addr_mapped[12] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff };
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff
};
/***
*** Forward declarations.
......@@ -213,7 +217,10 @@ lwres_getipnodebyaddr(const void *src, size_t len, int af, int *error_num) {
lwres_context_t *lwrctx = NULL;
lwres_gnbaresponse_t *by = NULL;
int n;
union {
const void *konst;
struct in6_addr *in6;
} u;
/*
* Sanity checks.
......@@ -242,12 +249,21 @@ lwres_getipnodebyaddr(const void *src, size_t len, int af, int *error_num) {
}
/*
* Lookup IPv4 and IPv4 mapped/compatible addresses
* The de-"const"-ing game is done because at least one
* vendor's system (RedHat 6.0) defines the IN6_IS_ADDR_*
* macros in such a way that they discard the const with
* internal casting, and gcc ends up complaining. Rather
* than replacing their own (possibly optimized) definitions
* with our own, cleanly discarding the const is the easiest
* thing to do.
*/
u.konst = src;
/*
* Look up IPv4 and IPv4 mapped/compatible addresses.
*/
if ((af == AF_INET6 &&
IN6_IS_ADDR_V4COMPAT((const struct in6_addr *)src)) ||
(af == AF_INET6 &&
IN6_IS_ADDR_V4MAPPED((const struct in6_addr *)src)) ||
if ((af == AF_INET6 && IN6_IS_ADDR_V4COMPAT(u.in6)) ||
(af == AF_INET6 && IN6_IS_ADDR_V4MAPPED(u.in6)) ||
(af == AF_INET)) {
const unsigned char *cp = src;
......@@ -285,7 +301,7 @@ lwres_getipnodebyaddr(const void *src, size_t len, int af, int *error_num) {
/*
* Lookup IPv6 address.
*/
if (memcmp(src, &lwres_in6addr_any, IN6ADDRSZ) == 0) {
if (memcmp(src, &in6addr_any, IN6ADDRSZ) == 0) {
*error_num = HOST_NOT_FOUND;
return (NULL);
}
......@@ -466,7 +482,7 @@ scan_interfaces(int *have_v4, int *have_v6) {
&((struct sockaddr_in6 *)
&ifreq.ifr_addr)->sin6_addr,
sizeof(in6));
if (memcmp(&in6, &lwres_in6addr_any,
if (memcmp(&in6, &in6addr_any,
sizeof(in6)) == 0)
break;
n = ioctl(s, SIOCGIFFLAGS, (char *)&ifreq);
......
......@@ -48,4 +48,10 @@
*/
@LWRES_PLATFORM_HAVEIPV6@
/*
* If this system is missing in6addr_any, LWRES_PLATFORM_NEEDIN6ADDRANY will
* be defined.
*/
@LWRES_PLATFORM_NEEDIN6ADDRANY@
#endif /* LWRES_PLATFORM_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment