]> git.ipfire.org Git - thirdparty/bind9.git/commitdiff
Assume always working getaddrinfo/getnameinfo implemenation
authorOndřej Surý <ondrej@sury.org>
Tue, 21 Aug 2018 12:54:36 +0000 (14:54 +0200)
committerOndřej Surý <ondrej@sury.org>
Tue, 28 Aug 2018 08:31:48 +0000 (10:31 +0200)
18 files changed:
acconfig.h
bin/check/check-tool.c
bin/nsupdate/nsupdate.c
config.h.in
config.h.win32
configure
configure.in
contrib/queryperf/config.h.in
contrib/queryperf/configure
contrib/queryperf/configure.in
contrib/queryperf/missing/addrinfo.h [deleted file]
contrib/queryperf/missing/getaddrinfo.c [deleted file]
contrib/queryperf/missing/getnameinfo.c [deleted file]
contrib/queryperf/queryperf.c
lib/bind9/getaddresses.c
lib/irs/gai_strerror.c
lib/irs/getnameinfo.c
lib/irs/include/irs/netdb.h.in

index 2be46d28783e58036813ea4009bfbcf1eb876771..1a1579c49bbe95e6d9a24f8b304ae432441e37cc 100644 (file)
 /** define if tzset() is available */
 #undef HAVE_TZSET
 
-/** define if struct addrinfo exists */
-#undef HAVE_ADDRINFO
-
-/** define if getaddrinfo() exists */
-#undef HAVE_GETADDRINFO
-
-/** define if gai_strerror() exists */
-#undef HAVE_GAISTRERROR
-
 /**
  * define if pthread_setconcurrency() should be called to tell the
  * OS how many threads we might want to run.
index 1902fd303d7462cbfbe19e19e29154b4ce7c8475..8af81900365cc4c7b641c6809b0d5c4768ca047a 100644 (file)
 #define CHECK_LOCAL 1
 #endif
 
-#ifdef HAVE_ADDRINFO
-#ifdef HAVE_GETADDRINFO
-#ifdef HAVE_GAISTRERROR
-#define USE_GETADDRINFO
-#endif
-#endif
-#endif
-
 #define CHECK(r) \
        do { \
                result = (r); \
@@ -177,7 +169,6 @@ static bool
 checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
        dns_rdataset_t *a, dns_rdataset_t *aaaa)
 {
-#ifdef USE_GETADDRINFO
        dns_rdataset_t *rdataset;
        dns_rdata_t rdata = DNS_RDATA_INIT;
        struct addrinfo hints, *ai, *cur;
@@ -373,14 +364,10 @@ checkns(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner,
        }
        freeaddrinfo(ai);
        return (answer);
-#else
-       return (true);
-#endif
 }
 
 static bool
 checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
-#ifdef USE_GETADDRINFO
        struct addrinfo hints, *ai, *cur;
        char namebuf[DNS_NAME_FORMATSIZE + 1];
        char ownerbuf[DNS_NAME_FORMATSIZE];
@@ -459,14 +446,10 @@ checkmx(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
                }
                return (true);
        }
-#else
-       return (true);
-#endif
 }
 
 static bool
 checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
-#ifdef USE_GETADDRINFO
        struct addrinfo hints, *ai, *cur;
        char namebuf[DNS_NAME_FORMATSIZE + 1];
        char ownerbuf[DNS_NAME_FORMATSIZE];
@@ -544,9 +527,6 @@ checksrv(dns_zone_t *zone, const dns_name_t *name, const dns_name_t *owner) {
                }
                return (true);
        }
-#else
-       return (true);
-#endif
 }
 
 isc_result_t
@@ -791,4 +771,3 @@ DestroySockets(void) {
        WSACleanup();
 }
 #endif
-
index 39083fb49642f5626654790d47d875bdb886b8da..4245dca302804d4dddffd217372bc07e8d89618d 100644 (file)
 #endif
 #endif
 
-#ifdef HAVE_ADDRINFO
-#ifdef HAVE_GETADDRINFO
-#ifdef HAVE_GAISTRERROR
-#define USE_GETADDRINFO
-#endif
-#endif
-#endif
-
-#ifndef USE_GETADDRINFO
-#ifndef ISC_PLATFORM_NONSTDHERRNO
-extern int h_errno;
-#endif
-#endif
-
 #define MAXCMD (128 * 1024)
 #define MAXWIRE (64 * 1024)
 #define PACKETSIZE ((64 * 1024) - 1)
index f94ef6ea3b888d665b3a2c738ede8ba6a5a67f65..ae9a89cc7b572e336e39c8fc50599a33d4a12bdb 100644 (file)
 /** define if tzset() is available */
 #undef HAVE_TZSET
 
-/** define if struct addrinfo exists */
-#undef HAVE_ADDRINFO
-
-/** define if getaddrinfo() exists */
-#undef HAVE_GETADDRINFO
-
-/** define if gai_strerror() exists */
-#undef HAVE_GAISTRERROR
-
 /**
  * define if pthread_setconcurrency() should be called to tell the
  * OS how many threads we might want to run.
 /* Use HMAC-SHA256 for Client Cookie generation */
 #undef HMAC_SHA256_CC
 
-/* return type of gai_strerror */
-#undef IRS_GAISTRERROR_RETURN_T
-
-/* Define to the buffer length type used by getnameinfo(3). */
-#undef IRS_GETNAMEINFO_BUFLEN_T
-
-/* Define to the flags type used by getnameinfo(3). */
-#undef IRS_GETNAMEINFO_FLAGS_T
-
-/* Define to the sockaddr length type used by getnameinfo(3). */
-#undef IRS_GETNAMEINFO_SOCKLEN_T
-
 /* Define if you want to use inline buffers */
 #undef ISC_BUFFER_USEINLINE
 
index 85510eeb0d456682f8559b5e5ee39d582e88b976..5ad82bc368d41fecf67a36458ac439485a4b88ac 100644 (file)
@@ -289,27 +289,6 @@ typedef __int64 off_t;
  */
 @HAVE_LIBXML2@
 
-/** define if struct addrinfo exists */
-#define HAVE_ADDRINFO
-
-/** define if getaddrinfo() exists */
-#define HAVE_GETADDRINFO
-
-/** define if gai_strerror() exists */
-#define HAVE_GAISTRERROR
-
-/* return type of gai_strerror */
-#define IRS_GAISTRERROR_RETURN_T char *
-
-/* Define to the buffer length type used by getnameinfo(3). */
-#define IRS_GETNAMEINFO_BUFLEN_T DWORD
-
-/* Define to the flags type used by getnameinfo(3). */
-#define IRS_GETNAMEINFO_FLAGS_T int
-
-/* Define to the sockaddr length type used by getnameinfo(3). */
-#define IRS_GETNAMEINFO_SOCKLEN_T socklen_t
-
 /* Define to enable "rrset-order fixed" syntax. */
 @DNS_RDATASET_FIXED@
 
index e9b21a2089e658680de6be2d3d774f3035d64719..62bc03e878ee61f2ac8b4200d21098843859e8ef 100755 (executable)
--- a/configure
+++ b/configure
@@ -735,8 +735,6 @@ ISC_PLATFORM_NEEDSTRLCPY
 GENRANDOMLIB
 ISC_PLATFORM_NEEDSTRTOUL
 ISC_PLATFORM_NEEDMEMMOVE
-ISC_IRS_GETNAMEINFOSOCKLEN
-ISC_IRS_NEEDADDRINFO
 ISC_PLATFORM_HAVETFO
 ISC_PLATFORM_HAVEIF_LADDRCONF
 ISC_PLATFORM_HAVEIF_LADDRREQ
@@ -17964,187 +17962,6 @@ $as_echo "disabled" >&6; }
 esac
 
 
-#
-# Check for addrinfo
-#
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct addrinfo" >&5
-$as_echo_n "checking for struct addrinfo... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <netdb.h>
-int
-main ()
-{
-struct addrinfo a; return (0);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-       ISC_IRS_NEEDADDRINFO="#undef ISC_IRS_NEEDADDRINFO"
-       $as_echo "#define HAVE_ADDRINFO 1" >>confdefs.h
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-       ISC_IRS_NEEDADDRINFO="#define ISC_IRS_NEEDADDRINFO 1"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-
-#
-# Sadly, the definitions of system-supplied getnameinfo(3) vary.  Try to catch
-# known variations here:
-#
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for getnameinfo prototype definitions" >&5
-$as_echo_n "checking for getnameinfo prototype definitions... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-int getnameinfo(const struct sockaddr *, socklen_t, char *,
-               socklen_t, char *, socklen_t, unsigned int);
-int
-main ()
-{
- return (0);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: socklen_t for buflen; u_int for flags" >&5
-$as_echo "socklen_t for buflen; u_int for flags" >&6; }
-
-$as_echo "#define IRS_GETNAMEINFO_SOCKLEN_T socklen_t" >>confdefs.h
-
-
-$as_echo "#define IRS_GETNAMEINFO_BUFLEN_T socklen_t" >>confdefs.h
-
-
-$as_echo "#define IRS_GETNAMEINFO_FLAGS_T unsigned int" >>confdefs.h
-
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-int getnameinfo(const struct sockaddr *, socklen_t, char *,
-               size_t, char *, size_t, int);
-int
-main ()
-{
- return (0);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: size_t for buflen; int for flags" >&5
-$as_echo "size_t for buflen; int for flags" >&6; }
-        $as_echo "#define IRS_GETNAMEINFO_SOCKLEN_T socklen_t" >>confdefs.h
-
-        $as_echo "#define IRS_GETNAMEINFO_BUFLEN_T size_t" >>confdefs.h
-
-        $as_echo "#define IRS_GETNAMEINFO_FLAGS_T int" >>confdefs.h
-
-else
-  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-int getnameinfo(const struct sockaddr *, size_t, char *,
-               size_t, char *, size_t, int);
-int
-main ()
-{
- return (0);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: size_t for buflen; int for flags" >&5
-$as_echo "size_t for buflen; int for flags" >&6; }
-        $as_echo "#define IRS_GETNAMEINFO_SOCKLEN_T size_t" >>confdefs.h
-
-        $as_echo "#define IRS_GETNAMEINFO_BUFLEN_T size_t" >>confdefs.h
-
-        $as_echo "#define IRS_GETNAMEINFO_FLAGS_T int" >>confdefs.h
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: not match any subspecies; assume standard definition" >&5
-$as_echo "not match any subspecies; assume standard definition" >&6; }
-$as_echo "#define IRS_GETNAMEINFO_SOCKLEN_T socklen_t" >>confdefs.h
-
-$as_echo "#define IRS_GETNAMEINFO_BUFLEN_T socklen_t" >>confdefs.h
-
-$as_echo "#define IRS_GETNAMEINFO_FLAGS_T int" >>confdefs.h
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-#
-# ...and same for gai_strerror().
-#
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gai_strerror prototype definitions" >&5
-$as_echo_n "checking for gai_strerror prototype definitions... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h.  */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-char *gai_strerror(int ecode);
-int
-main ()
-{
- return (0);
-  ;
-  return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: returning char *" >&5
-$as_echo "returning char *" >&6; }
-
-$as_echo "#define IRS_GAISTRERROR_RETURN_T char *" >>confdefs.h
-
-else
-  { $as_echo "$as_me:${as_lineno-$LINENO}: result: not match any subspecies; assume standard definition" >&5
-$as_echo "not match any subspecies; assume standard definition" >&6; }
-$as_echo "#define IRS_GAISTRERROR_RETURN_T const char *" >>confdefs.h
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo"
-if test "x$ac_cv_func_getaddrinfo" = xyes; then :
-  $as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h
-
-fi
-
-ac_fn_c_check_func "$LINENO" "gai_strerror" "ac_cv_func_gai_strerror"
-if test "x$ac_cv_func_gai_strerror" = xyes; then :
-  $as_echo "#define HAVE_GAISTRERROR 1" >>confdefs.h
-
-fi
-
-
-
 # Check whether --enable-getifaddrs was given.
 if test "${enable_getifaddrs+set}" = set; then :
   enableval=$enable_getifaddrs; want_getifaddrs="$enableval"
index 35c618a19e986d98584ff96e337cdcff967c72ad..e7fe188ec1769a015d1493ecd70c9c18a981a963 100644 (file)
@@ -2011,86 +2011,6 @@ int has_tfo() { return (0); }
 esac
 AC_SUBST(ISC_PLATFORM_HAVETFO)
 
-#
-# Check for addrinfo
-#
-AC_MSG_CHECKING(for struct addrinfo)
-AC_TRY_COMPILE([
-#include <netdb.h>],
-[struct addrinfo a; return (0);],
-       [AC_MSG_RESULT(yes)
-       ISC_IRS_NEEDADDRINFO="#undef ISC_IRS_NEEDADDRINFO"
-       AC_DEFINE(HAVE_ADDRINFO)],
-       [AC_MSG_RESULT(no)
-       ISC_IRS_NEEDADDRINFO="#define ISC_IRS_NEEDADDRINFO 1"])
-AC_SUBST(ISC_IRS_NEEDADDRINFO)
-
-#
-# Sadly, the definitions of system-supplied getnameinfo(3) vary.  Try to catch
-# known variations here:
-#
-AC_MSG_CHECKING(for getnameinfo prototype definitions)
-AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-int getnameinfo(const struct sockaddr *, socklen_t, char *,
-               socklen_t, char *, socklen_t, unsigned int);],
-[ return (0);],
-       [AC_MSG_RESULT(socklen_t for buflen; u_int for flags)
-        AC_DEFINE(IRS_GETNAMEINFO_SOCKLEN_T, socklen_t,
-                  [Define to the sockaddr length type used by getnameinfo(3).])
-        AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t,
-                  [Define to the buffer length type used by getnameinfo(3).])
-        AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, unsigned int,
-                  [Define to the flags type used by getnameinfo(3).])],
-[AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-int getnameinfo(const struct sockaddr *, socklen_t, char *,
-               size_t, char *, size_t, int);],
-[ return (0);],
-       [AC_MSG_RESULT(size_t for buflen; int for flags)
-        AC_DEFINE(IRS_GETNAMEINFO_SOCKLEN_T, socklen_t)
-        AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, size_t)
-        AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)],
-[AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-int getnameinfo(const struct sockaddr *, size_t, char *,
-               size_t, char *, size_t, int);],
-[ return (0);],
-       [AC_MSG_RESULT(size_t for buflen; int for flags)
-        AC_DEFINE(IRS_GETNAMEINFO_SOCKLEN_T, size_t)
-        AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, size_t)
-        AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)],
-[AC_MSG_RESULT(not match any subspecies; assume standard definition)
-AC_DEFINE(IRS_GETNAMEINFO_SOCKLEN_T, socklen_t)
-AC_DEFINE(IRS_GETNAMEINFO_BUFLEN_T, socklen_t)
-AC_DEFINE(IRS_GETNAMEINFO_FLAGS_T, int)])])])
-
-#
-# ...and same for gai_strerror().
-#
-AC_MSG_CHECKING(for gai_strerror prototype definitions)
-AC_TRY_COMPILE([
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netdb.h>
-char *gai_strerror(int ecode);],
-[ return (0); ],
-       [AC_MSG_RESULT(returning char *)
-        AC_DEFINE([IRS_GAISTRERROR_RETURN_T], [char *],
-        [return type of gai_strerror])],
-[AC_MSG_RESULT(not match any subspecies; assume standard definition)
-AC_DEFINE([IRS_GAISTRERROR_RETURN_T], [const char *])])
-
-AC_CHECK_FUNC(getaddrinfo, AC_DEFINE(HAVE_GETADDRINFO))
-AC_CHECK_FUNC(gai_strerror, AC_DEFINE(HAVE_GAISTRERROR))
-AC_SUBST(ISC_IRS_GETNAMEINFOSOCKLEN)
-
 AC_ARG_ENABLE(getifaddrs,
              AS_HELP_STRING([--enable-getifaddrs],
                             [enable the use of getifaddrs() [yes|no].]),
index 744afdde31a374ffa20875ce22302bb43d8fed17..d25bc55fe2d748d675b41080fe6c74579808319b 100644 (file)
@@ -1,14 +1,8 @@
 /* config.h.in.  Generated from configure.in by autoheader.  */
 
-/* Define to 1 if you have the `getaddrinfo' function. */
-#undef HAVE_GETADDRINFO
-
 /* Define to 1 if you have the `gethostbyname2' function. */
 #undef HAVE_GETHOSTBYNAME2
 
-/* Define to 1 if you have the `getnameinfo' function. */
-#undef HAVE_GETNAMEINFO
-
 /* Define to 1 if you have the `nsl' library (-lnsl). */
 #undef HAVE_LIBNSL
 
@@ -30,6 +24,9 @@
 /* Define to the one symbol short name of this package. */
 #undef PACKAGE_TARNAME
 
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
 /* Define to the version of this package. */
 #undef PACKAGE_VERSION
 
index 4de92ee8980e38d967e5ee48bdc1179e9f3a1a2c..2c0071b1b9bb516e6fa65deb908c636b14c0a0ed 100755 (executable)
@@ -1,11 +1,9 @@
 #! /bin/sh
 # Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.68.
+# Generated by GNU Autoconf 2.69.
 #
 #
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
 #
 #
 # This configure script is free software; the Free Software Foundation
@@ -134,6 +132,31 @@ export LANGUAGE
 # CDPATH.
 (unset CDPATH) >/dev/null 2>&1 && unset CDPATH
 
+# Use a proper internal environment variable to ensure we don't fall
+  # into an infinite loop, continuously re-executing ourselves.
+  if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
+    _as_can_reexec=no; export _as_can_reexec;
+    # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+as_fn_exit 255
+  fi
+  # We don't want this to propagate to other subprocesses.
+          { _as_can_reexec=; unset _as_can_reexec;}
 if test "x$CONFIG_SHELL" = x; then
   as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then :
   emulate sh
@@ -167,7 +190,8 @@ if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
 else
   exitcode=1; echo positional parameters were not saved.
 fi
-test x\$exitcode = x0 || exit 1"
+test x\$exitcode = x0 || exit 1
+test -x / || exit 1"
   as_suggested="  as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
   as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
   eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
@@ -211,21 +235,25 @@ IFS=$as_save_IFS
 
 
       if test "x$CONFIG_SHELL" != x; then :
-  # We cannot yet assume a decent shell, so we have to provide a
-       # neutralization value for shells without unset; and this also
-       # works around shells that cannot unset nonexistent variables.
-       # Preserve -v and -x to the replacement shell.
-       BASH_ENV=/dev/null
-       ENV=/dev/null
-       (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-       export CONFIG_SHELL
-       case $- in # ((((
-         *v*x* | *x*v* ) as_opts=-vx ;;
-         *v* ) as_opts=-v ;;
-         *x* ) as_opts=-x ;;
-         * ) as_opts= ;;
-       esac
-       exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"}
+  export CONFIG_SHELL
+             # We cannot yet assume a decent shell, so we have to provide a
+# neutralization value for shells without unset; and this also
+# works around shells that cannot unset nonexistent variables.
+# Preserve -v and -x to the replacement shell.
+BASH_ENV=/dev/null
+ENV=/dev/null
+(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
+case $- in # ((((
+  *v*x* | *x*v* ) as_opts=-vx ;;
+  *v* ) as_opts=-v ;;
+  *x* ) as_opts=-x ;;
+  * ) as_opts= ;;
+esac
+exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
+# Admittedly, this is quite paranoid, since all the known shells bail
+# out after a failed `exec'.
+$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
+exit 255
 fi
 
     if test x$as_have_required = xno; then :
@@ -327,6 +355,14 @@ $as_echo X"$as_dir" |
 
 
 } # as_fn_mkdir_p
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
 # as_fn_append VAR VALUE
 # ----------------------
 # Append the text in VALUE to the end of the definition contained in VAR. Take
@@ -448,6 +484,10 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
   chmod +x "$as_me.lineno" ||
     { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
 
+  # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
+  # already done that, so ensure we don't try to do so again and fall
+  # in an infinite loop.  This has already happened in practice.
+  _as_can_reexec=no; export _as_can_reexec
   # Don't try to exec as it changes $[0], causing all sort of problems
   # (the dirname of $[0] is not the place where we might find the
   # original and so on.  Autoconf is especially sensitive to this).
@@ -482,16 +522,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -503,28 +543,8 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-       test -d "$1/.";
-      else
-       case $1 in #(
-       -*)set "./$1";;
-       esac;
-       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-       ???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -1076,8 +1096,6 @@ target=$target_alias
 if test "x$host_alias" != x; then
   if test "x$build_alias" = x; then
     cross_compiling=maybe
-    $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used" >&2
   elif test "x$build_alias" != "x$host_alias"; then
     cross_compiling=yes
   fi
@@ -1302,9 +1320,9 @@ test -n "$ac_init_help" && exit $ac_status
 if $ac_init_version; then
   cat <<\_ACEOF
 configure
-generated by GNU Autoconf 2.68
+generated by GNU Autoconf 2.69
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This configure script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it.
 _ACEOF
@@ -1380,7 +1398,7 @@ $as_echo "$ac_try_echo"; } >&5
         test ! -s conftest.err
        } && test -s conftest$ac_exeext && {
         test "$cross_compiling" = yes ||
-        $as_test_x conftest$ac_exeext
+        test -x conftest$ac_exeext
        }; then :
   ac_retval=0
 else
@@ -1470,7 +1488,7 @@ This file contains any messages produced by compilers while
 running configure, to aid debugging if configure makes a mistake.
 
 It was created by $as_me, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   $ $0 $@
 
@@ -1842,7 +1860,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -1882,7 +1900,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="gcc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -1935,7 +1953,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="${ac_tool_prefix}cc"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -1976,7 +1994,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
        ac_prog_rejected=yes
        continue
@@ -2034,7 +2052,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2078,7 +2096,7 @@ do
   IFS=$as_save_IFS
   test -z "$as_dir" && as_dir=.
     for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+  if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
     ac_cv_prog_ac_ct_CC="$ac_prog"
     $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
     break 2
@@ -2524,8 +2542,7 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
 /* end confdefs.h.  */
 #include <stdarg.h>
 #include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
+struct stat;
 /* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
 struct buf { int x; };
 FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -2887,34 +2904,6 @@ _ACEOF
 fi
 done
 
-ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo"
-if test "x$ac_cv_func_getaddrinfo" = xyes; then :
-
-$as_echo "#define HAVE_GETADDRINFO 1" >>confdefs.h
-
-else
-  case " $LIBOBJS " in
-  *" getaddrinfo.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS getaddrinfo.$ac_objext"
- ;;
-esac
-
-fi
-
-ac_fn_c_check_func "$LINENO" "getnameinfo" "ac_cv_func_getnameinfo"
-if test "x$ac_cv_func_getnameinfo" = xyes; then :
-
-$as_echo "#define HAVE_GETNAMEINFO 1" >>confdefs.h
-
-else
-  case " $LIBOBJS " in
-  *" getnameinfo.$ac_objext "* ) ;;
-  *) LIBOBJS="$LIBOBJS getnameinfo.$ac_objext"
- ;;
-esac
-
-fi
-
 
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for socklen_t" >&5
 $as_echo_n "checking for socklen_t... " >&6; }
@@ -3394,16 +3383,16 @@ if (echo >conf$$.file) 2>/dev/null; then
     # ... but there are two gotchas:
     # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
     # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-    # In both cases, we have to default to `cp -p'.
+    # In both cases, we have to default to `cp -pR'.
     ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-      as_ln_s='cp -p'
+      as_ln_s='cp -pR'
   elif ln conf$$.file conf$$ 2>/dev/null; then
     as_ln_s=ln
   else
-    as_ln_s='cp -p'
+    as_ln_s='cp -pR'
   fi
 else
-  as_ln_s='cp -p'
+  as_ln_s='cp -pR'
 fi
 rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
 rmdir conf$$.dir 2>/dev/null
@@ -3463,28 +3452,16 @@ else
   as_mkdir_p=false
 fi
 
-if test -x / >/dev/null 2>&1; then
-  as_test_x='test -x'
-else
-  if ls -dL / >/dev/null 2>&1; then
-    as_ls_L_option=L
-  else
-    as_ls_L_option=
-  fi
-  as_test_x='
-    eval sh -c '\''
-      if test -d "$1"; then
-       test -d "$1/.";
-      else
-       case $1 in #(
-       -*)set "./$1";;
-       esac;
-       case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #((
-       ???[sx]*):;;*)false;;esac;fi
-    '\'' sh
-  '
-fi
-as_executable_p=$as_test_x
+
+# as_fn_executable_p FILE
+# -----------------------
+# Test if FILE is an executable regular file.
+as_fn_executable_p ()
+{
+  test -f "$1" && test -x "$1"
+} # as_fn_executable_p
+as_test_x='test -x'
+as_executable_p=as_fn_executable_p
 
 # Sed expression to map a string onto a valid CPP name.
 as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -3506,7 +3483,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
 # values after options handling.
 ac_log="
 This file was extended by $as_me, which was
-generated by GNU Autoconf 2.68.  Invocation command line was
+generated by GNU Autoconf 2.69.  Invocation command line was
 
   CONFIG_FILES    = $CONFIG_FILES
   CONFIG_HEADERS  = $CONFIG_HEADERS
@@ -3568,10 +3545,10 @@ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
 ac_cs_version="\\
 config.status
-configured by $0, generated by GNU Autoconf 2.68,
+configured by $0, generated by GNU Autoconf 2.69,
   with options \\"\$ac_cs_config\\"
 
-Copyright (C) 2010 Free Software Foundation, Inc.
+Copyright (C) 2012 Free Software Foundation, Inc.
 This config.status script is free software; the Free Software Foundation
 gives unlimited permission to copy, distribute and modify it."
 
@@ -3659,7 +3636,7 @@ fi
 _ACEOF
 cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
 if \$ac_cs_recheck; then
-  set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
+  set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
   shift
   \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
   CONFIG_SHELL='$SHELL'
index 442e8199db01c1b6b04321b53551b9151efa1477..beb5bf965611ddcb346d8749250dd86ef03d618f 100644 (file)
@@ -58,12 +58,6 @@ AC_SEARCH_LIBS(res_9_mkquery, resolv bind)
 AC_CHECK_LIB(socket, socket)
 AC_CHECK_LIB(nsl, inet_ntoa)
 AC_CHECK_FUNCS(gethostbyname2)
-AC_CHECK_FUNC(getaddrinfo,
-    AC_DEFINE(HAVE_GETADDRINFO, 1, [Define to 1 if you have the `getaddrinfo' function.]),
-    [AC_LIBOBJ(getaddrinfo)])
-AC_CHECK_FUNC(getnameinfo,
-    AC_DEFINE(HAVE_GETNAMEINFO, 1, [Define to 1 if you have the `getnameinfo' function.]),
-    [AC_LIBOBJ(getnameinfo)])
 
 AC_TYPE_SOCKLEN_T
 AC_SA_LEN
diff --git a/contrib/queryperf/missing/addrinfo.h b/contrib/queryperf/missing/addrinfo.h
deleted file mode 100644 (file)
index 54a5e85..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 1995, 1996, 1997, 1998, and 1999 WIDE Project.
- * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#ifndef HAVE_GETADDRINFO
-
-/*
- * Error return codes from getaddrinfo()
- */
-#define        EAI_ADDRFAMILY   1      /* address family for hostname not supported */
-#define        EAI_AGAIN        2      /* temporary failure in name resolution */
-#define        EAI_BADFLAGS     3      /* invalid value for ai_flags */
-#define        EAI_FAIL         4      /* non-recoverable failure in name resolution */
-#define        EAI_FAMILY       5      /* ai_family not supported */
-#define        EAI_MEMORY       6      /* memory allocation failure */
-#define        EAI_NODATA       7      /* no address associated with hostname */
-#define        EAI_NONAME       8      /* hostname nor servname provided, or not known */
-#define        EAI_SERVICE      9      /* servname not supported for ai_socktype */
-#define        EAI_SOCKTYPE    10      /* ai_socktype not supported */
-#define        EAI_SYSTEM      11      /* system error returned in errno */
-#define EAI_BADHINTS   12
-#define EAI_PROTOCOL   13
-#define EAI_MAX                14
-
-/*
- * Flag values for getaddrinfo()
- */
-#define        AI_PASSIVE      0x00000001 /* get address to use bind() */
-#define        AI_CANONNAME    0x00000002 /* fill ai_canonname */
-#define        AI_NUMERICHOST  0x00000004 /* prevent name resolution */
-/* valid flags for addrinfo */
-#define        AI_MASK         (AI_PASSIVE | AI_CANONNAME | AI_NUMERICHOST)
-
-#define        AI_ALL          0x00000100 /* IPv6 and IPv4-mapped (with AI_V4MAPPED) */
-#define        AI_V4MAPPED_CFG 0x00000200 /* accept IPv4-mapped if kernel supports */
-#define        AI_ADDRCONFIG   0x00000400 /* only if any address is assigned */
-#define        AI_V4MAPPED     0x00000800 /* accept IPv4-mapped IPv6 address */
-/* special recommended flags for getipnodebyname */
-#define        AI_DEFAULT      (AI_V4MAPPED_CFG | AI_ADDRCONFIG)
-
-/*
- * Constants for getnameinfo()
- */
-#define        NI_MAXHOST      1025
-#define        NI_MAXSERV      32
-
-/*
- * Flag values for getnameinfo()
- */
-#define        NI_NOFQDN       0x00000001
-#define        NI_NUMERICHOST  0x00000002
-#define        NI_NAMEREQD     0x00000004
-#define        NI_NUMERICSERV  0x00000008
-#define        NI_DGRAM        0x00000010
-
-struct addrinfo {
-       int     ai_flags;       /* AI_PASSIVE, AI_CANONNAME */
-       int     ai_family;      /* PF_xxx */
-       int     ai_socktype;    /* SOCK_xxx */
-       int     ai_protocol;    /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
-       size_t  ai_addrlen;     /* length of ai_addr */
-       char    *ai_canonname;  /* canonical name for hostname */
-       struct sockaddr *ai_addr;       /* binary address */
-       struct addrinfo *ai_next;       /* next structure in linked list */
-};
-
-struct sockaddr_storage {
-       u_char __ss_len;
-       u_char __ss_family;
-       u_char fill[126];
-};
-
-extern void freehostent(struct hostent *);
-extern char *gai_strerror(int);
-#endif
diff --git a/contrib/queryperf/missing/getaddrinfo.c b/contrib/queryperf/missing/getaddrinfo.c
deleted file mode 100644 (file)
index 69eb748..0000000
+++ /dev/null
@@ -1,632 +0,0 @@
-/*
- * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
- * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-#include <sys/types.h>
-#include <sys/param.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-#include <netdb.h>
-#include <resolv.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stddef.h>
-#include <ctype.h>
-#include <unistd.h>
-
-#include "addrinfo.h"
-
-#define SUCCESS 0
-#define ANY 0
-#define YES 1
-#define NO  0
-
-static const char in_addrany[] = { 0, 0, 0, 0 };
-static const char in6_addrany[] = {
-       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-};
-static const char in_loopback[] = { 127, 0, 0, 1 }; 
-static const char in6_loopback[] = {
-       0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1
-};
-
-struct sockinet {
-       u_char  si_len;
-       u_char  si_family;
-       u_short si_port;
-};
-
-static struct afd {
-       int a_af;
-       int a_addrlen;
-       int a_socklen;
-       int a_off;
-       const char *a_addrany;
-       const char *a_loopback; 
-} afdl [] = {
-#ifdef INET6
-#define N_INET6 0
-       {PF_INET6, sizeof(struct in6_addr),
-        sizeof(struct sockaddr_in6),
-        offsetof(struct sockaddr_in6, sin6_addr),
-        in6_addrany, in6_loopback},
-#define N_INET  1
-#else
-#define N_INET  0
-#endif
-       {PF_INET, sizeof(struct in_addr),
-        sizeof(struct sockaddr_in),
-        offsetof(struct sockaddr_in, sin_addr),
-        in_addrany, in_loopback},
-       {0, 0, 0, 0, NULL, NULL},
-};
-
-#ifdef INET6
-#define PTON_MAX       16
-#else
-#define PTON_MAX       4
-#endif
-
-
-static int get_name(const char *, struct afd *,
-                   struct addrinfo **, char *, struct addrinfo *,
-                   int);
-static int get_addr(const char *, int, struct addrinfo **,
-                   struct addrinfo *, int);
-static int get_addr0(const char *, int, struct addrinfo **,
-                    struct addrinfo *, int);
-static int str_isnumber(const char *);
-       
-static char *ai_errlist[] = {
-       "Success",
-       "Address family for hostname not supported",    /* EAI_ADDRFAMILY */
-       "Temporary failure in name resolution",         /* EAI_AGAIN      */
-       "Invalid value for ai_flags",                   /* EAI_BADFLAGS   */
-       "Non-recoverable failure in name resolution",   /* EAI_FAIL       */
-       "ai_family not supported",                      /* EAI_FAMILY     */
-       "Memory allocation failure",                    /* EAI_MEMORY     */
-       "No address associated with hostname",          /* EAI_NODATA     */
-       "hostname nor servname provided, or not known",/* EAI_NONAME     */
-       "servname not supported for ai_socktype",       /* EAI_SERVICE    */
-       "ai_socktype not supported",                    /* EAI_SOCKTYPE   */
-       "System error returned in errno",               /* EAI_SYSTEM     */
-       "Invalid value for hints",                      /* EAI_BADHINTS   */
-       "Resolved protocol is unknown",                 /* EAI_PROTOCOL   */
-       "Unknown error",                                /* EAI_MAX        */
-};
-
-#define GET_CANONNAME(ai, str) \
-if (pai->ai_flags & AI_CANONNAME) {\
-       if (((ai)->ai_canonname = (char *)malloc(strlen(str) + 1)) != NULL) {\
-               strcpy((ai)->ai_canonname, (str));\
-       } else {\
-               error = EAI_MEMORY;\
-               goto free;\
-       }\
-}
-
-#ifdef HAVE_SA_LEN
-#define        SET_AILEN(ai,l) (ai)->ai_addr->sa_len = (ai)->ai_addrlen = (l)
-#else
-#define        SET_AILEN(ai,l) (ai)->ai_addrlen = (l)
-#endif
-
-#define GET_AI(ai, afd, addr, port) {\
-       char *p;\
-       if (((ai) = (struct addrinfo *)malloc(sizeof(struct addrinfo) +\
-                                             ((afd)->a_socklen)))\
-           == NULL) {\
-               error = EAI_MEMORY;\
-               goto free;\
-       }\
-       memcpy(ai, pai, sizeof(struct addrinfo));\
-       (ai)->ai_addr = (struct sockaddr *)((ai) + 1);\
-       memset((ai)->ai_addr, 0, (afd)->a_socklen);\
-       SET_AILEN((ai), (afd)->a_socklen);\
-       (ai)->ai_addr->sa_family = (ai)->ai_family = (afd)->a_af;\
-       ((struct sockinet *)(ai)->ai_addr)->si_port = port;\
-       p = (char *)((ai)->ai_addr);\
-       memcpy(p + (afd)->a_off, (addr), (afd)->a_addrlen);\
-}
-
-#define ERR(err) { error = (err); goto bad; }
-
-char *
-gai_strerror(ecode)
-       int ecode;
-{
-       if (ecode < 0 || ecode > EAI_MAX)
-               ecode = EAI_MAX;
-       return ai_errlist[ecode];
-}
-
-void
-freeaddrinfo(ai)
-       struct addrinfo *ai;
-{
-       struct addrinfo *next;
-
-       do {
-               next = ai->ai_next;
-               if (ai->ai_canonname)
-                       free(ai->ai_canonname);
-               /* no need to free(ai->ai_addr) */
-               free(ai);
-       } while ((ai = next) != NULL);
-}
-
-static int
-str_isnumber(p)
-       const char *p;
-{
-       char *q = (char *)p;
-       while (*q) {
-               if (! isdigit(*q))
-                       return NO;
-               q++;
-       }
-       return YES;
-}
-
-int
-getaddrinfo(hostname, servname, hints, res)
-       const char *hostname, *servname;
-       const struct addrinfo *hints;
-       struct addrinfo **res;
-{
-       struct addrinfo sentinel;
-       struct addrinfo *top = NULL;
-       struct addrinfo *cur;
-       int i, error = 0;
-       char pton[PTON_MAX];
-       struct addrinfo ai;
-       struct addrinfo *pai;
-       u_short port;
-
-       /* initialize file static vars */
-       sentinel.ai_next = NULL;
-       cur = &sentinel;
-       pai = &ai;
-       pai->ai_flags = 0;
-       pai->ai_family = PF_UNSPEC;
-       pai->ai_socktype = ANY;
-       pai->ai_protocol = ANY;
-       pai->ai_addrlen = 0;
-       pai->ai_canonname = NULL;
-       pai->ai_addr = NULL;
-       pai->ai_next = NULL;
-       port = ANY;
-       
-       if (hostname == NULL && servname == NULL)
-               return EAI_NONAME;
-       if (hints) {
-               /* error check for hints */
-               if (hints->ai_addrlen || hints->ai_canonname ||
-                   hints->ai_addr || hints->ai_next)
-                       ERR(EAI_BADHINTS); /* xxx */
-               if (hints->ai_flags & ~AI_MASK)
-                       ERR(EAI_BADFLAGS);
-               switch (hints->ai_family) {
-               case PF_UNSPEC:
-               case PF_INET:
-#ifdef INET6
-               case PF_INET6:
-#endif
-                       break;
-               default:
-                       ERR(EAI_FAMILY);
-               }
-               memcpy(pai, hints, sizeof(*pai));
-               switch (pai->ai_socktype) {
-               case ANY:
-                       switch (pai->ai_protocol) {
-                       case ANY:
-                               break;
-                       case IPPROTO_UDP:
-                               pai->ai_socktype = SOCK_DGRAM;
-                               break;
-                       case IPPROTO_TCP:
-                               pai->ai_socktype = SOCK_STREAM;
-                               break;
-                       default:
-                               pai->ai_socktype = SOCK_RAW;
-                               break;
-                       }
-                       break;
-               case SOCK_RAW:
-                       break;
-               case SOCK_DGRAM:
-                       if (pai->ai_protocol != IPPROTO_UDP &&
-                           pai->ai_protocol != ANY)
-                               ERR(EAI_BADHINTS);      /*xxx*/
-                       pai->ai_protocol = IPPROTO_UDP;
-                       break;
-               case SOCK_STREAM:
-                       if (pai->ai_protocol != IPPROTO_TCP &&
-                           pai->ai_protocol != ANY)
-                               ERR(EAI_BADHINTS);      /*xxx*/
-                       pai->ai_protocol = IPPROTO_TCP;
-                       break;
-               default:
-                       ERR(EAI_SOCKTYPE);
-                       break;
-               }
-       }
-
-       /*
-        * service port
-        */
-       if (servname) {
-               if (str_isnumber(servname)) {
-                       if (pai->ai_socktype == ANY) {
-                               /* caller accept *ANY* socktype */
-                               pai->ai_socktype = SOCK_DGRAM;
-                               pai->ai_protocol = IPPROTO_UDP;
-                       }
-                       port = htons(atoi(servname));
-               } else {
-                       struct servent *sp;
-                       char *proto;
-
-                       proto = NULL;
-                       switch (pai->ai_socktype) {
-                       case ANY:
-                               proto = NULL;
-                               break;
-                       case SOCK_DGRAM:
-                               proto = "udp";
-                               break;
-                       case SOCK_STREAM:
-                               proto = "tcp";
-                               break;
-                       default:
-                               fprintf(stderr, "panic!\n");
-                               break;
-                       }
-                       if ((sp = getservbyname(servname, proto)) == NULL)
-                               ERR(EAI_SERVICE);
-                       port = sp->s_port;
-                       if (pai->ai_socktype == ANY) {
-                               if (strcmp(sp->s_proto, "udp") == 0) {
-                                       pai->ai_socktype = SOCK_DGRAM;
-                                       pai->ai_protocol = IPPROTO_UDP;
-                               } else if (strcmp(sp->s_proto, "tcp") == 0) {
-                                       pai->ai_socktype = SOCK_STREAM;
-                                       pai->ai_protocol = IPPROTO_TCP;
-                               } else
-                                       ERR(EAI_PROTOCOL);      /*xxx*/
-                       }
-               }
-       }
-       
-       /*
-        * hostname == NULL.
-        * passive socket -> anyaddr (0.0.0.0 or ::)
-        * non-passive socket -> localhost (127.0.0.1 or ::1)
-        */
-       if (hostname == NULL) {
-               struct afd *afd;
-               int s;
-
-               for (afd = &afdl[0]; afd->a_af; afd++) {
-                       if (!(pai->ai_family == PF_UNSPEC
-                          || pai->ai_family == afd->a_af)) {
-                               continue;
-                       }
-
-                       /*
-                        * filter out AFs that are not supported by the kernel
-                        * XXX errno?
-                        */
-                       s = socket(afd->a_af, SOCK_DGRAM, 0);
-                       if (s < 0)
-                               continue;
-                       close(s);
-
-                       if (pai->ai_flags & AI_PASSIVE) {
-                               GET_AI(cur->ai_next, afd, afd->a_addrany, port);
-                               /* xxx meaningless?
-                                * GET_CANONNAME(cur->ai_next, "anyaddr");
-                                */
-                       } else {
-                               GET_AI(cur->ai_next, afd, afd->a_loopback,
-                                       port);
-                               /* xxx meaningless?
-                                * GET_CANONNAME(cur->ai_next, "localhost");
-                                */
-                       }
-                       cur = cur->ai_next;
-               }
-               top = sentinel.ai_next;
-               if (top)
-                       goto good;
-               else
-                       ERR(EAI_FAMILY);
-       }
-       
-       /* hostname as numeric name */
-       for (i = 0; afdl[i].a_af; i++) {
-               if (inet_pton(afdl[i].a_af, hostname, pton) == 1) {
-                       u_long v4a;
-                       u_char pfx;
-
-                       switch (afdl[i].a_af) {
-                       case AF_INET:
-                               v4a = ntohl(((struct in_addr *)pton)->s_addr);
-                               if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
-                                       pai->ai_flags &= ~AI_CANONNAME;
-                               v4a >>= IN_CLASSA_NSHIFT;
-                               if (v4a == 0 || v4a == IN_LOOPBACKNET)
-                                       pai->ai_flags &= ~AI_CANONNAME;
-                               break;
-#ifdef INET6
-                       case AF_INET6:
-                               pfx = ((struct in6_addr *)pton)->s6_addr[0];
-                               if (pfx == 0 || pfx == 0xfe || pfx == 0xff)
-                                       pai->ai_flags &= ~AI_CANONNAME;
-                               break;
-#endif
-                       }
-                       
-                       if (pai->ai_family == afdl[i].a_af ||
-                           pai->ai_family == PF_UNSPEC) {
-                               if (! (pai->ai_flags & AI_CANONNAME)) {
-                                       GET_AI(top, &afdl[i], pton, port);
-                                       goto good;
-                               }
-                               /*
-                                * if AI_CANONNAME and if reverse lookup
-                                * fail, return ai anyway to pacify
-                                * calling application.
-                                *
-                                * XXX getaddrinfo() is a name->address
-                                * translation function, and it looks strange
-                                * that we do addr->name translation here.
-                                */
-                               get_name(pton, &afdl[i], &top, pton, pai, port);
-                               goto good;
-                       } else 
-                               ERR(EAI_FAMILY);        /*xxx*/
-               }
-       }
-
-       if (pai->ai_flags & AI_NUMERICHOST)
-               ERR(EAI_NONAME);
-
-       /* hostname as alphabetical name */
-       error = get_addr(hostname, pai->ai_family, &top, pai, port);
-       if (error == 0) {
-               if (top) {
- good:
-                       *res = top;
-                       return SUCCESS;
-               } else
-                       error = EAI_FAIL;
-       }
- free:
-       if (top)
-               freeaddrinfo(top);
- bad:
-       *res = NULL;
-       return error;
-}
-
-static int
-get_name(addr, afd, res, numaddr, pai, port0)
-       const char *addr;
-       struct afd *afd;
-       struct addrinfo **res;
-       char *numaddr;
-       struct addrinfo *pai;
-       int port0;
-{
-       u_short port = port0 & 0xffff;
-       struct hostent *hp;
-       struct addrinfo *cur;
-       int error = 0;
-       hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af);
-       if (hp && hp->h_name && hp->h_name[0] && hp->h_addr_list[0]) {
-               GET_AI(cur, afd, hp->h_addr_list[0], port);
-               GET_CANONNAME(cur, hp->h_name);
-       } else
-               GET_AI(cur, afd, numaddr, port);
-       
-       *res = cur;
-       return SUCCESS;
- free:
-       if (cur)
-               freeaddrinfo(cur);
-
- /* bad: */
-       *res = NULL;
-       return error;
-}
-
-static int
-get_addr(hostname, af, res0, pai, port0)
-       const char *hostname;
-       int af;
-       struct addrinfo **res0;
-       struct addrinfo *pai;
-       int port0;
-{
-       int i, error, ekeep;
-       struct addrinfo *cur;
-       struct addrinfo **res;
-       int retry;
-       int s;
-
-       res = res0;
-       ekeep = 0;
-       error = 0;
-       for (i = 0; afdl[i].a_af; i++) {
-               retry = 0;
-               if (af == AF_UNSPEC) {
-                       /*
-                        * filter out AFs that are not supported by the kernel
-                        * XXX errno?
-                        */
-                       s = socket(afdl[i].a_af, SOCK_DGRAM, 0);
-                       if (s < 0)
-                               continue;
-                       close(s);
-               } else {
-                       if (af != afdl[i].a_af)
-                               continue;
-               }
-               /* It is WRONG, we need getipnodebyname(). */
-again:
-               error = get_addr0(hostname, afdl[i].a_af, res, pai, port0);
-               switch (error) {
-               case EAI_AGAIN:
-                       if (++retry < 3)
-                               goto again;
-                       /* FALL THROUGH*/
-               default:
-                       if (ekeep == 0)
-                               ekeep = error;
-                       break;
-               }
-               if (*res) {
-                       /* make chain of addrs */
-                       for (cur = *res;
-                            cur && cur->ai_next;
-                            cur = cur->ai_next)
-                               ;
-                       if (!cur)
-                               return EAI_FAIL;
-                       res = &cur->ai_next;
-               }
-       }
-
-       /* if we got something, it's okay */
-       if (*res0)
-               return 0;
-
-       return error ? error : ekeep;
-}
-
-static int
-get_addr0(hostname, af, res, pai, port0)
-       const char *hostname;
-       int af;
-       struct addrinfo **res;
-       struct addrinfo *pai;
-       int port0;
-{
-       u_short port = port0 & 0xffff;
-       struct addrinfo sentinel;
-       struct hostent *hp;
-       struct addrinfo *top, *cur;
-       struct afd *afd;
-       int i, error = 0, h_error;
-       char *ap;
-
-       top = NULL;
-       sentinel.ai_next = NULL;
-       cur = &sentinel;
-
-#ifdef HAVE_GETHOSTBYNAME2
-       if (af == AF_UNSPEC) {
-               error = EAI_FAIL;
-               goto bad;
-       }
-       hp = gethostbyname2(hostname, af);
-#else
-       if (af != AF_UNSPEC && af != AF_INET) {
-               error = EAI_FAIL;
-               goto bad;
-       }
-       hp = gethostbyname(hostname);
-#endif
-       h_error = h_errno;
-
-       if (hp == NULL) {
-               switch (h_error) {
-               case HOST_NOT_FOUND:
-               case NO_DATA:
-                       error = EAI_NODATA;
-                       break;
-               case TRY_AGAIN:
-                       error = EAI_AGAIN;
-                       break;
-               case NO_RECOVERY:
-               case NETDB_INTERNAL:
-               default:
-                       error = EAI_FAIL;
-                       break;
-               }
-               goto bad;
-       }
-
-       if ((hp->h_name == NULL) || (hp->h_name[0] == 0) ||
-           (hp->h_addr_list[0] == NULL))
-               ERR(EAI_FAIL);
-       
-       for (i = 0; (ap = hp->h_addr_list[i]) != NULL; i++) {
-               switch (af) {
-#ifdef INET6
-               case AF_INET6:
-                       afd = &afdl[N_INET6];
-                       break;
-#endif
-#ifndef INET6
-               default:        /* AF_UNSPEC */
-#endif
-               case AF_INET:
-                       afd = &afdl[N_INET];
-                       break;
-#ifdef INET6
-               default:        /* AF_UNSPEC */
-                       if (IN6_IS_ADDR_V4MAPPED((struct in6_addr *)ap)) {
-                               ap += sizeof(struct in6_addr) -
-                                       sizeof(struct in_addr);
-                               afd = &afdl[N_INET];
-                       } else
-                               afd = &afdl[N_INET6];
-                       break;
-#endif
-               }
-               GET_AI(cur->ai_next, afd, ap, port);
-               if (cur == &sentinel) {
-                       top = cur->ai_next;
-                       GET_CANONNAME(top, hp->h_name);
-               }
-               cur = cur->ai_next;
-       }
-       *res = top;
-       return SUCCESS;
- free:
-       if (top)
-               freeaddrinfo(top);
- bad:
-       *res = NULL;
-       return error;
-}
diff --git a/contrib/queryperf/missing/getnameinfo.c b/contrib/queryperf/missing/getnameinfo.c
deleted file mode 100644 (file)
index 6b1cbe1..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-/*
- * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
- * All rights reserved.
- * 
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- * 3. Neither the name of the project nor the names of its contributors
- *    may be used to endorse or promote products derived from this software
- *    without specific prior written permission.
- * 
- * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/*
- * Issues to be discussed:
- * - Thread safe-ness must be checked
- * - Return values.  There seems to be no standard for return value (RFC2553)
- *   but INRIA implementation returns EAI_xxx defined for getaddrinfo().
- */
-
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
-#include <arpa/inet.h>
-#include <arpa/nameser.h>
-#include <netdb.h>
-#include <resolv.h>
-#include <string.h>
-#include <stddef.h>
-
-#include "addrinfo.h"
-
-#define SUCCESS 0
-#define ANY 0
-#define YES 1
-#define NO  0
-
-static struct afd {
-       int a_af;
-       int a_addrlen;
-       int a_socklen;
-       int a_off;
-} afdl [] = {
-#ifdef INET6
-       {PF_INET6, sizeof(struct in6_addr), sizeof(struct sockaddr_in6),
-               offsetof(struct sockaddr_in6, sin6_addr)},
-#endif
-       {PF_INET, sizeof(struct in_addr), sizeof(struct sockaddr_in),
-               offsetof(struct sockaddr_in, sin_addr)},
-       {0, 0, 0},
-};
-
-struct sockinet {
-       u_char  si_len;
-       u_char  si_family;
-       u_short si_port;
-};
-
-#define ENI_NOSOCKET   0
-#define ENI_NOSERVNAME 1
-#define ENI_NOHOSTNAME 2
-#define ENI_MEMORY     3
-#define ENI_SYSTEM     4
-#define ENI_FAMILY     5
-#define ENI_SALEN      6
-
-int
-getnameinfo(sa, salen, host, hostlen, serv, servlen, flags)
-       const struct sockaddr *sa;
-       size_t salen;
-       char *host;
-       size_t hostlen;
-       char *serv;
-       size_t servlen;
-       int flags;
-{
-       struct afd *afd;
-       struct servent *sp;
-       struct hostent *hp;
-       u_short port;
-       int family, len, i;
-       char *addr, *p;
-       u_long v4a;
-       int h_error;
-       char numserv[512];
-       char numaddr[512];
-
-       if (sa == NULL)
-               return ENI_NOSOCKET;
-
-#ifdef HAVE_SA_LEN
-       len = sa->sa_len;
-       if (len != salen) return ENI_SALEN;
-#else
-       len = salen;
-#endif
-       
-       family = sa->sa_family;
-       for (i = 0; afdl[i].a_af; i++)
-               if (afdl[i].a_af == family) {
-                       afd = &afdl[i];
-                       goto found;
-               }
-       return ENI_FAMILY;
-       
- found:
-       if (len != afd->a_socklen) return ENI_SALEN;
-       
-       port = ((struct sockinet *)sa)->si_port; /* network byte order */
-       addr = (char *)sa + afd->a_off;
-
-       if (serv == NULL || servlen == 0) {
-               /* what we should do? */
-       } else if (flags & NI_NUMERICSERV) {
-               snprintf(numserv, sizeof(numserv), "%d", ntohs(port));
-               if (strlen(numserv) > servlen)
-                       return ENI_MEMORY;
-               strcpy(serv, numserv);
-       } else {
-               sp = getservbyport(port, (flags & NI_DGRAM) ? "udp" : "tcp");
-               if (sp) {
-                       if (strlen(sp->s_name) > servlen)
-                               return ENI_MEMORY;
-                       strcpy(serv, sp->s_name);
-               } else
-                       return ENI_NOSERVNAME;
-       }
-
-       switch (sa->sa_family) {
-       case AF_INET:
-               v4a = ntohl(((struct sockaddr_in *)sa)->sin_addr.s_addr);
-               if (IN_MULTICAST(v4a) || IN_EXPERIMENTAL(v4a))
-                       flags |= NI_NUMERICHOST;
-               v4a >>= IN_CLASSA_NSHIFT;
-               if (v4a == 0 || v4a == IN_LOOPBACKNET)
-                       flags |= NI_NUMERICHOST;                        
-               break;
-#ifdef INET6
-       case AF_INET6:
-           {
-               struct sockaddr_in6 *sin6;
-               sin6 = (struct sockaddr_in6 *)sa;
-               switch (sin6->sin6_addr.s6_addr[0]) {
-               case 0x00:
-                       if (IN6_IS_ADDR_V4MAPPED(&sin6->sin6_addr))
-                               ;
-                       else if (IN6_IS_ADDR_LOOPBACK(&sin6->sin6_addr))
-                               ;
-                       else
-                               flags |= NI_NUMERICHOST;
-                       break;
-               default:
-                       if (IN6_IS_ADDR_LINKLOCAL(&sin6->sin6_addr))
-                               flags |= NI_NUMERICHOST;
-                       else if (IN6_IS_ADDR_MULTICAST(&sin6->sin6_addr))
-                               flags |= NI_NUMERICHOST;
-                       break;
-               }
-           }
-               break;
-#endif
-       }
-       if (host == NULL || hostlen == 0) {
-               /* what should we do? */
-       } else if (flags & NI_NUMERICHOST) {
-               /* NUMERICHOST and NAMEREQD conflicts with each other */
-               if (flags & NI_NAMEREQD)
-                       return ENI_NOHOSTNAME;
-               if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
-                   == NULL)
-                       return ENI_SYSTEM;
-               if (strlen(numaddr) > hostlen)
-                       return ENI_MEMORY;
-               strcpy(host, numaddr);
-       } else {
-#ifdef USE_GETIPNODEBY
-               hp = getipnodebyaddr(addr, afd->a_addrlen, afd->a_af, &h_error);
-#else
-               hp = gethostbyaddr(addr, afd->a_addrlen, afd->a_af);
-               h_error = h_errno;
-#endif
-
-               if (hp) {
-                       if (flags & NI_NOFQDN) {
-                               p = strchr(hp->h_name, '.');
-                               if (p) *p = '\0';
-                       }
-                       if (strlen(hp->h_name) > hostlen) {
-#ifdef USE_GETIPNODEBY
-                               freehostent(hp);
-#endif
-                               return ENI_MEMORY;
-                       }
-                       strcpy(host, hp->h_name);
-#ifdef USE_GETIPNODEBY
-                       freehostent(hp);
-#endif
-               } else {
-                       if (flags & NI_NAMEREQD)
-                               return ENI_NOHOSTNAME;
-                       if (inet_ntop(afd->a_af, addr, numaddr, sizeof(numaddr))
-                           == NULL)
-                               return ENI_NOHOSTNAME;
-                       if (strlen(numaddr) > hostlen)
-                               return ENI_MEMORY;
-                       strcpy(host, numaddr);
-               }
-       }
-       return SUCCESS;
-}
index cd2feb2a1c5e9cc74754cd4f3dd462fdd86cdfb7..0dbffa95f6e3f939069cd05479e3d248bbfed142 100644 (file)
@@ -41,9 +41,6 @@
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
-#ifndef HAVE_GETADDRINFO
-#include "missing/addrinfo.h"
-#endif
 #endif
 
 /*
@@ -1387,7 +1384,7 @@ parse_query(char *input, char *qname, unsigned int qnlen, int *qtype) {
 
 /*
  * dispatch_query:
- *   Send the query packet for the entry 
+ *   Send the query packet for the entry
  *
  *   Return -1 on failure
  *   Return a non-negative integer otherwise
@@ -1422,7 +1419,7 @@ dispatch_query(unsigned short int id, char *dom, int qt, u_char **pktp,
                *p++ = 0;       /* root name */
                *p++ = 0;
                *p++ = 41;      /* OPT */
-               *p++ = 16;      
+               *p++ = 16;
                *p++ = 0;       /* UDP payload size (4K) */
                *p++ = 0;       /* extended rcode */
                *p++ = 0;       /* version */
@@ -1934,7 +1931,7 @@ print_statistics(int intermediate, unsigned int sent, unsigned int timed_out,
                 unsigned int roverflows, unsigned int *rarray)
 {
        unsigned int num_queries_completed;
-       double per_lost, per_completed, per_lost2, per_completed2; 
+       double per_lost, per_completed, per_lost2, per_completed2;
        double run_time, queries_per_sec, queries_per_sec2;
        double queries_per_sec_total;
        double rtt_average, rtt_stddev;
@@ -2074,7 +2071,7 @@ print_statistics(int intermediate, unsigned int sent, unsigned int timed_out,
        }
        if (target_qps > 0) {
                printf("  Total QPS/target:     %.6lf/%d qps\n",
-                      queries_per_sec_total, target_qps);              
+                      queries_per_sec_total, target_qps);
        }
 
        printf("\n");
index 5daf03e8b01d47dee893b80c06254ab6374d9029..c954b5f01d2d8aa651009b464c1b3788162edb52 100644 (file)
 
 #include <bind9/getaddresses.h>
 
-#ifdef HAVE_ADDRINFO
-#ifdef HAVE_GETADDRINFO
-#ifdef HAVE_GAISTRERROR
-#define USE_GETADDRINFO
-#endif
-#endif
-#endif
-
-#ifndef USE_GETADDRINFO
-#ifndef ISC_PLATFORM_NONSTDHERRNO
-extern int h_errno;
-#endif
-#endif
-
 isc_result_t
 bind9_getaddresses(const char *hostname, in_port_t port,
                   isc_sockaddr_t *addrs, int addrsize, int *addrcount)
@@ -51,12 +37,8 @@ bind9_getaddresses(const char *hostname, in_port_t port,
        bool have_ipv4, have_ipv6;
        int i;
 
-#ifdef USE_GETADDRINFO
        struct addrinfo *ai = NULL, *tmpai, hints;
        int result;
-#else
-       struct hostent *he;
-#endif
 
        REQUIRE(hostname != NULL);
        REQUIRE(addrs != NULL);
@@ -117,7 +99,6 @@ bind9_getaddresses(const char *hostname, in_port_t port,
                        return (ISC_R_SUCCESS);
                }
        }
-#ifdef USE_GETADDRINFO
        memset(&hints, 0, sizeof(hints));
        if (!have_ipv6)
                hints.ai_family = PF_INET;
@@ -175,41 +156,6 @@ bind9_getaddresses(const char *hostname, in_port_t port,
        }
        freeaddrinfo(ai);
        *addrcount = i;
-#else
-       he = gethostbyname(hostname);
-       if (he == NULL) {
-               switch (h_errno) {
-               case HOST_NOT_FOUND:
-#ifdef NO_DATA
-               case NO_DATA:
-#endif
-#if defined(NO_ADDRESS) && (!defined(NO_DATA) || (NO_DATA != NO_ADDRESS))
-               case NO_ADDRESS:
-#endif
-                       return (ISC_R_NOTFOUND);
-               default:
-                       return (ISC_R_FAILURE);
-               }
-       }
-       if (he->h_addrtype != AF_INET && he->h_addrtype != AF_INET6)
-               return (ISC_R_NOTFOUND);
-       for (i = 0; i < addrsize; i++) {
-               if (he->h_addrtype == AF_INET) {
-                       struct in_addr *inp;
-                       inp = (struct in_addr *)(he->h_addr_list[i]);
-                       if (inp == NULL)
-                               break;
-                       isc_sockaddr_fromin(&addrs[i], inp, port);
-               } else {
-                       struct in6_addr *in6p;
-                       in6p = (struct in6_addr *)(he->h_addr_list[i]);
-                       if (in6p == NULL)
-                               break;
-                       isc_sockaddr_fromin6(&addrs[i], in6p, port);
-               }
-       }
-       *addrcount = i;
-#endif
        if (*addrcount == 0)
                return (ISC_R_NOTFOUND);
        else
index 76a561eee10afac356ad51c70a73b4dd5dbcd1ff..144ed66ece72762915f25fb93923180f510173f1 100644 (file)
@@ -73,7 +73,7 @@ static const char *gai_messages[] = {
  * Returns an error message corresponding to an error code returned by
  * getaddrinfo() and getnameinfo()
  */
-IRS_GAISTRERROR_RETURN_T
+const char *
 gai_strerror(int ecode) {
        union {
                const char *const_ptr;
index c91e39ace986dfc6eae4bb4a53f61fd102624f5b..2af8aaee28e5f117337dd4044ab083921905dba3 100644 (file)
@@ -138,10 +138,10 @@ static struct afd {
        } while (0)
 
 int
-getnameinfo(const struct sockaddr *sa, IRS_GETNAMEINFO_SOCKLEN_T salen,
-           char *host, IRS_GETNAMEINFO_BUFLEN_T hostlen,
-           char *serv, IRS_GETNAMEINFO_BUFLEN_T servlen,
-           IRS_GETNAMEINFO_FLAGS_T flags)
+getnameinfo(const struct sockaddr *sa, socklen_t salen,
+           char *host, socklen_t hostlen,
+           char *serv, socklen_t servlen,
+           int flags)
 {
        struct afd *afd = NULL;
        struct servent *sp;
index 8806045ec26b99dbcb527ebe78a083e50fc9c7c3..4089f9e9169307ce0a7d0a149bf7786157555ac7 100644 (file)
 #include <stddef.h>    /* Required on FreeBSD (and  others?) for size_t. */
 #include <netdb.h>     /* Contractual provision. */
 
-/*
- * Define if <netdb.h> does not declare struct addrinfo.
- */
-@ISC_IRS_NEEDADDRINFO@
-
-#ifdef ISC_IRS_NEEDADDRINFO
-struct addrinfo {
-       int             ai_flags;      /* AI_PASSIVE, AI_CANONNAME */
-       int             ai_family;     /* PF_xxx */
-       int             ai_socktype;   /* SOCK_xxx */
-       int             ai_protocol;   /* 0 or IPPROTO_xxx for IPv4 and IPv6 */
-       size_t          ai_addrlen;    /* Length of ai_addr */
-       char            *ai_canonname; /* Canonical name for hostname */
-       struct sockaddr *ai_addr;      /* Binary address */
-       struct addrinfo *ai_next;      /* Next structure in linked list */
-};
-#endif
-
 /*
  * Undefine all #defines we are interested in as <netdb.h> may or may not have
  * defined them.
@@ -187,17 +169,17 @@ getaddrinfo(const char *hostname, const char *servname,
            const struct addrinfo *hints, struct addrinfo **res);
 
 int
-getnameinfo(const struct sockaddr *sa, IRS_GETNAMEINFO_SOCKLEN_T salen,
-           char *host, IRS_GETNAMEINFO_BUFLEN_T hostlen,
-           char *serv, IRS_GETNAMEINFO_BUFLEN_T servlen,
-           IRS_GETNAMEINFO_FLAGS_T flags);
+getnameinfo(const struct sockaddr *sa, socklen_t salen,
+           char *host, socklen_t hostlen,
+           char *serv, socklen_t servlen,
+           int flags);
 
 void freeaddrinfo (struct addrinfo *ai);
 
-IRS_GAISTRERROR_RETURN_T
+const char *
 gai_strerror(int ecode);
 
-#endif
+#endif /* IRS_NAMESPACE */
 
 /*
  * Tell Emacs to use C mode on this file.