Socket6

 view release on metacpan or  search on metacpan

ChangeLog  view on Meta::CPAN

	* Socket6.pm, Socket6.xs: Return an error message string if
	getaddrinfo() fails.

	Submitted by:   Jeff Okamoto <okamoto@best.com>

2001-03-27  Hajimu UMEMOTO  <ume@mahoroba.org>

	* Socket6.pm: Bump version number to 0.10.

	* Socket6.xs: Make compilable under OpenBSD.  Though OpenBSD has
	KAME, OpenBSD doesn't have netinet6/ipsec.h.
	Reported by:	Tim Ayers <cpantest@quaday.com>

2001-03-21  Hajimu UMEMOTO  <ume@mahoroba.org>

	* Socket6.pm: Bump version number to 0.09.

	* aclocal.m4 (IPv6_CHECK_FUNC): There is getaddrinfo(3) in
	libsocket under Solaris8.
	Reported by:	Tomohide Nagashima <tomohide@japan-telecom.co.jp>,
			TAKANO Yuji <takachan@running-dog.net>

Socket6.xs  view on Meta::CPAN

#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#ifdef __KAME__
# include <sys/param.h>
# include <net/route.h>
# if (defined(__FreeBSD__) && __FreeBSD_version >= 700048) || \
     (defined(__NetBSD__) && __NetBSD_Version__ >= 899002500)
#  include <netipsec/ipsec.h>
# elif !defined(__OpenBSD__) && !defined(__DragonFly__)
#  include <netinet6/ipsec.h>
# endif
#endif
#include <netdb.h>
#define	WSA_DECLARE
#define	WSA_STARTUP()
#define	WSA_CLEANUP()

#endif /* WIN32 */

#include "EXTERN.h"

aclocal.m4  view on Meta::CPAN

else
  ifelse([$2], , :, [$2])
fi
AC_MSG_RESULT($ipv6_cv_sa_len)])
dnl
dnl See whether we can use IPv6 related functions
AC_DEFUN([IPv6_CHECK_FUNC], [
AH_TEMPLATE(AS_TR_CPP(HAVE_$1), [Define to 1 if you have the `]$1[' function.])
AC_CHECK_FUNC($1, [dnl
  ac_cv_lib_socket_$1=no
  ac_cv_lib_inet6_$1=no
], [dnl
  AC_CHECK_LIB(socket, $1, [dnl
    LIBS="$LIBS -lsocket -lnsl"
    ac_cv_lib_inet6_$1=no
  ], [dnl
    AC_MSG_CHECKING([whether your system has IPv6 directory])
    AC_CACHE_VAL(ipv6_cv_dir, [dnl
      for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
	if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
	  break
	fi
      done])dnl
    AC_MSG_RESULT($ipv6_cv_dir)
    if test $ipv6_cv_dir = no; then
      ac_cv_lib_inet6_$1=no
    else
      if test x$ipv6_libinet6 = x; then
	ipv6_libinet6=no
	SAVELDFLAGS="$LDFLAGS"
	LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib"
      fi
      AC_CHECK_LIB(inet6, $1, [dnl
	if test $ipv6_libinet6 = no; then
	  ipv6_libinet6=yes
	  LIBS="$LIBS -linet6"
	fi],)dnl
      if test $ipv6_libinet6 = no; then
	LDFLAGS="$SAVELDFLAGS"
      fi
    fi])dnl
])dnl
ipv6_cv_$1=no
if test $ac_cv_func_$1 = yes -o $ac_cv_lib_socket_$1 = yes \
     -o $ac_cv_lib_inet6_$1 = yes
then
  ipv6_cv_$1=yes
fi
if test $ipv6_cv_$1 = no; then
  if test $1 = getaddrinfo; then
    for ipv6_cv_pfx in o n; do
      AC_EGREP_HEADER(${ipv6_cv_pfx}$1, netdb.h,
		      [AC_CHECK_FUNC(${ipv6_cv_pfx}$1)])
      if eval test X\$ac_cv_func_${ipv6_cv_pfx}$1 = Xyes; then
	ipv6_cv_$1=yes

configure  view on Meta::CPAN

{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
$as_echo "$ac_cv_path_EGREP" >&6; }
 EGREP="$ac_cv_path_EGREP"




ac_fn_c_check_func "$LINENO" "getaddrinfo" "ac_cv_func_getaddrinfo"
if test "x$ac_cv_func_getaddrinfo" = xyes; then :
    ac_cv_lib_socket_getaddrinfo=no
  ac_cv_lib_inet6_getaddrinfo=no

else
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo in -lsocket" >&5
$as_echo_n "checking for getaddrinfo in -lsocket... " >&6; }
if ${ac_cv_lib_socket_getaddrinfo+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-lsocket  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext

configure  view on Meta::CPAN

  ac_cv_lib_socket_getaddrinfo=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_getaddrinfo" >&5
$as_echo "$ac_cv_lib_socket_getaddrinfo" >&6; }
if test "x$ac_cv_lib_socket_getaddrinfo" = xyes; then :
      LIBS="$LIBS -lsocket -lnsl"
    ac_cv_lib_inet6_getaddrinfo=no

else
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether your system has IPv6 directory" >&5
$as_echo_n "checking whether your system has IPv6 directory... " >&6; }
    if ${ipv6_cv_dir+:} false; then :
  $as_echo_n "(cached) " >&6
else
        for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
	if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
	  break
	fi
      done
fi
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ipv6_cv_dir" >&5
$as_echo "$ipv6_cv_dir" >&6; }
    if test $ipv6_cv_dir = no; then
      ac_cv_lib_inet6_getaddrinfo=no
    else
      if test x$ipv6_libinet6 = x; then
	ipv6_libinet6=no
	SAVELDFLAGS="$LDFLAGS"
	LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib"
      fi
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getaddrinfo in -linet6" >&5
$as_echo_n "checking for getaddrinfo in -linet6... " >&6; }
if ${ac_cv_lib_inet6_getaddrinfo+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-linet6  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char getaddrinfo ();
int
main ()
{
return getaddrinfo ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_inet6_getaddrinfo=yes
else
  ac_cv_lib_inet6_getaddrinfo=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet6_getaddrinfo" >&5
$as_echo "$ac_cv_lib_inet6_getaddrinfo" >&6; }
if test "x$ac_cv_lib_inet6_getaddrinfo" = xyes; then :
  	if test $ipv6_libinet6 = no; then
	  ipv6_libinet6=yes
	  LIBS="$LIBS -linet6"
	fi
fi
      if test $ipv6_libinet6 = no; then
	LDFLAGS="$SAVELDFLAGS"
      fi
    fi
fi

fi
ipv6_cv_getaddrinfo=no
if test $ac_cv_func_getaddrinfo = yes -o $ac_cv_lib_socket_getaddrinfo = yes \
     -o $ac_cv_lib_inet6_getaddrinfo = yes
then
  ipv6_cv_getaddrinfo=yes
fi
if test $ipv6_cv_getaddrinfo = no; then
  if test getaddrinfo = getaddrinfo; then
    for ipv6_cv_pfx in o n; do
      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <netdb.h>

configure  view on Meta::CPAN


  :
else
  :
fi


ac_fn_c_check_func "$LINENO" "getnameinfo" "ac_cv_func_getnameinfo"
if test "x$ac_cv_func_getnameinfo" = xyes; then :
    ac_cv_lib_socket_getnameinfo=no
  ac_cv_lib_inet6_getnameinfo=no

else
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getnameinfo in -lsocket" >&5
$as_echo_n "checking for getnameinfo in -lsocket... " >&6; }
if ${ac_cv_lib_socket_getnameinfo+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-lsocket  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext

configure  view on Meta::CPAN

  ac_cv_lib_socket_getnameinfo=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_getnameinfo" >&5
$as_echo "$ac_cv_lib_socket_getnameinfo" >&6; }
if test "x$ac_cv_lib_socket_getnameinfo" = xyes; then :
      LIBS="$LIBS -lsocket -lnsl"
    ac_cv_lib_inet6_getnameinfo=no

else
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether your system has IPv6 directory" >&5
$as_echo_n "checking whether your system has IPv6 directory... " >&6; }
    if ${ipv6_cv_dir+:} false; then :
  $as_echo_n "(cached) " >&6
else
        for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
	if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
	  break
	fi
      done
fi
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ipv6_cv_dir" >&5
$as_echo "$ipv6_cv_dir" >&6; }
    if test $ipv6_cv_dir = no; then
      ac_cv_lib_inet6_getnameinfo=no
    else
      if test x$ipv6_libinet6 = x; then
	ipv6_libinet6=no
	SAVELDFLAGS="$LDFLAGS"
	LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib"
      fi
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getnameinfo in -linet6" >&5
$as_echo_n "checking for getnameinfo in -linet6... " >&6; }
if ${ac_cv_lib_inet6_getnameinfo+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-linet6  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char getnameinfo ();
int
main ()
{
return getnameinfo ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_inet6_getnameinfo=yes
else
  ac_cv_lib_inet6_getnameinfo=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet6_getnameinfo" >&5
$as_echo "$ac_cv_lib_inet6_getnameinfo" >&6; }
if test "x$ac_cv_lib_inet6_getnameinfo" = xyes; then :
  	if test $ipv6_libinet6 = no; then
	  ipv6_libinet6=yes
	  LIBS="$LIBS -linet6"
	fi
fi
      if test $ipv6_libinet6 = no; then
	LDFLAGS="$SAVELDFLAGS"
      fi
    fi
fi

fi
ipv6_cv_getnameinfo=no
if test $ac_cv_func_getnameinfo = yes -o $ac_cv_lib_socket_getnameinfo = yes \
     -o $ac_cv_lib_inet6_getnameinfo = yes
then
  ipv6_cv_getnameinfo=yes
fi
if test $ipv6_cv_getnameinfo = no; then
  if test getnameinfo = getaddrinfo; then
    for ipv6_cv_pfx in o n; do
      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <netdb.h>

configure  view on Meta::CPAN


  :
else
  :
fi


ac_fn_c_check_func "$LINENO" "gethostbyname2" "ac_cv_func_gethostbyname2"
if test "x$ac_cv_func_gethostbyname2" = xyes; then :
    ac_cv_lib_socket_gethostbyname2=no
  ac_cv_lib_inet6_gethostbyname2=no

else
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname2 in -lsocket" >&5
$as_echo_n "checking for gethostbyname2 in -lsocket... " >&6; }
if ${ac_cv_lib_socket_gethostbyname2+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-lsocket  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext

configure  view on Meta::CPAN

  ac_cv_lib_socket_gethostbyname2=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_gethostbyname2" >&5
$as_echo "$ac_cv_lib_socket_gethostbyname2" >&6; }
if test "x$ac_cv_lib_socket_gethostbyname2" = xyes; then :
      LIBS="$LIBS -lsocket -lnsl"
    ac_cv_lib_inet6_gethostbyname2=no

else
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether your system has IPv6 directory" >&5
$as_echo_n "checking whether your system has IPv6 directory... " >&6; }
    if ${ipv6_cv_dir+:} false; then :
  $as_echo_n "(cached) " >&6
else
        for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
	if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
	  break
	fi
      done
fi
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ipv6_cv_dir" >&5
$as_echo "$ipv6_cv_dir" >&6; }
    if test $ipv6_cv_dir = no; then
      ac_cv_lib_inet6_gethostbyname2=no
    else
      if test x$ipv6_libinet6 = x; then
	ipv6_libinet6=no
	SAVELDFLAGS="$LDFLAGS"
	LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib"
      fi
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gethostbyname2 in -linet6" >&5
$as_echo_n "checking for gethostbyname2 in -linet6... " >&6; }
if ${ac_cv_lib_inet6_gethostbyname2+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-linet6  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char gethostbyname2 ();
int
main ()
{
return gethostbyname2 ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_inet6_gethostbyname2=yes
else
  ac_cv_lib_inet6_gethostbyname2=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet6_gethostbyname2" >&5
$as_echo "$ac_cv_lib_inet6_gethostbyname2" >&6; }
if test "x$ac_cv_lib_inet6_gethostbyname2" = xyes; then :
  	if test $ipv6_libinet6 = no; then
	  ipv6_libinet6=yes
	  LIBS="$LIBS -linet6"
	fi
fi
      if test $ipv6_libinet6 = no; then
	LDFLAGS="$SAVELDFLAGS"
      fi
    fi
fi

fi
ipv6_cv_gethostbyname2=no
if test $ac_cv_func_gethostbyname2 = yes -o $ac_cv_lib_socket_gethostbyname2 = yes \
     -o $ac_cv_lib_inet6_gethostbyname2 = yes
then
  ipv6_cv_gethostbyname2=yes
fi
if test $ipv6_cv_gethostbyname2 = no; then
  if test gethostbyname2 = getaddrinfo; then
    for ipv6_cv_pfx in o n; do
      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <netdb.h>

configure  view on Meta::CPAN


  :
else
  :
fi


ac_fn_c_check_func "$LINENO" "getipnodebyname" "ac_cv_func_getipnodebyname"
if test "x$ac_cv_func_getipnodebyname" = xyes; then :
    ac_cv_lib_socket_getipnodebyname=no
  ac_cv_lib_inet6_getipnodebyname=no

else
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getipnodebyname in -lsocket" >&5
$as_echo_n "checking for getipnodebyname in -lsocket... " >&6; }
if ${ac_cv_lib_socket_getipnodebyname+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-lsocket  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext

configure  view on Meta::CPAN

  ac_cv_lib_socket_getipnodebyname=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_getipnodebyname" >&5
$as_echo "$ac_cv_lib_socket_getipnodebyname" >&6; }
if test "x$ac_cv_lib_socket_getipnodebyname" = xyes; then :
      LIBS="$LIBS -lsocket -lnsl"
    ac_cv_lib_inet6_getipnodebyname=no

else
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether your system has IPv6 directory" >&5
$as_echo_n "checking whether your system has IPv6 directory... " >&6; }
    if ${ipv6_cv_dir+:} false; then :
  $as_echo_n "(cached) " >&6
else
        for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
	if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
	  break
	fi
      done
fi
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ipv6_cv_dir" >&5
$as_echo "$ipv6_cv_dir" >&6; }
    if test $ipv6_cv_dir = no; then
      ac_cv_lib_inet6_getipnodebyname=no
    else
      if test x$ipv6_libinet6 = x; then
	ipv6_libinet6=no
	SAVELDFLAGS="$LDFLAGS"
	LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib"
      fi
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getipnodebyname in -linet6" >&5
$as_echo_n "checking for getipnodebyname in -linet6... " >&6; }
if ${ac_cv_lib_inet6_getipnodebyname+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-linet6  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char getipnodebyname ();
int
main ()
{
return getipnodebyname ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_inet6_getipnodebyname=yes
else
  ac_cv_lib_inet6_getipnodebyname=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet6_getipnodebyname" >&5
$as_echo "$ac_cv_lib_inet6_getipnodebyname" >&6; }
if test "x$ac_cv_lib_inet6_getipnodebyname" = xyes; then :
  	if test $ipv6_libinet6 = no; then
	  ipv6_libinet6=yes
	  LIBS="$LIBS -linet6"
	fi
fi
      if test $ipv6_libinet6 = no; then
	LDFLAGS="$SAVELDFLAGS"
      fi
    fi
fi

fi
ipv6_cv_getipnodebyname=no
if test $ac_cv_func_getipnodebyname = yes -o $ac_cv_lib_socket_getipnodebyname = yes \
     -o $ac_cv_lib_inet6_getipnodebyname = yes
then
  ipv6_cv_getipnodebyname=yes
fi
if test $ipv6_cv_getipnodebyname = no; then
  if test getipnodebyname = getaddrinfo; then
    for ipv6_cv_pfx in o n; do
      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <netdb.h>

configure  view on Meta::CPAN


  :
else
  :
fi


ac_fn_c_check_func "$LINENO" "getipnodebyaddr" "ac_cv_func_getipnodebyaddr"
if test "x$ac_cv_func_getipnodebyaddr" = xyes; then :
    ac_cv_lib_socket_getipnodebyaddr=no
  ac_cv_lib_inet6_getipnodebyaddr=no

else
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getipnodebyaddr in -lsocket" >&5
$as_echo_n "checking for getipnodebyaddr in -lsocket... " >&6; }
if ${ac_cv_lib_socket_getipnodebyaddr+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-lsocket  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext

configure  view on Meta::CPAN

  ac_cv_lib_socket_getipnodebyaddr=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_getipnodebyaddr" >&5
$as_echo "$ac_cv_lib_socket_getipnodebyaddr" >&6; }
if test "x$ac_cv_lib_socket_getipnodebyaddr" = xyes; then :
      LIBS="$LIBS -lsocket -lnsl"
    ac_cv_lib_inet6_getipnodebyaddr=no

else
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether your system has IPv6 directory" >&5
$as_echo_n "checking whether your system has IPv6 directory... " >&6; }
    if ${ipv6_cv_dir+:} false; then :
  $as_echo_n "(cached) " >&6
else
        for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
	if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
	  break
	fi
      done
fi
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ipv6_cv_dir" >&5
$as_echo "$ipv6_cv_dir" >&6; }
    if test $ipv6_cv_dir = no; then
      ac_cv_lib_inet6_getipnodebyaddr=no
    else
      if test x$ipv6_libinet6 = x; then
	ipv6_libinet6=no
	SAVELDFLAGS="$LDFLAGS"
	LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib"
      fi
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for getipnodebyaddr in -linet6" >&5
$as_echo_n "checking for getipnodebyaddr in -linet6... " >&6; }
if ${ac_cv_lib_inet6_getipnodebyaddr+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-linet6  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char getipnodebyaddr ();
int
main ()
{
return getipnodebyaddr ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_inet6_getipnodebyaddr=yes
else
  ac_cv_lib_inet6_getipnodebyaddr=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet6_getipnodebyaddr" >&5
$as_echo "$ac_cv_lib_inet6_getipnodebyaddr" >&6; }
if test "x$ac_cv_lib_inet6_getipnodebyaddr" = xyes; then :
  	if test $ipv6_libinet6 = no; then
	  ipv6_libinet6=yes
	  LIBS="$LIBS -linet6"
	fi
fi
      if test $ipv6_libinet6 = no; then
	LDFLAGS="$SAVELDFLAGS"
      fi
    fi
fi

fi
ipv6_cv_getipnodebyaddr=no
if test $ac_cv_func_getipnodebyaddr = yes -o $ac_cv_lib_socket_getipnodebyaddr = yes \
     -o $ac_cv_lib_inet6_getipnodebyaddr = yes
then
  ipv6_cv_getipnodebyaddr=yes
fi
if test $ipv6_cv_getipnodebyaddr = no; then
  if test getipnodebyaddr = getaddrinfo; then
    for ipv6_cv_pfx in o n; do
      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <netdb.h>

configure  view on Meta::CPAN


  :
else
  :
fi


ac_fn_c_check_func "$LINENO" "inet_pton" "ac_cv_func_inet_pton"
if test "x$ac_cv_func_inet_pton" = xyes; then :
    ac_cv_lib_socket_inet_pton=no
  ac_cv_lib_inet6_inet_pton=no

else
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_pton in -lsocket" >&5
$as_echo_n "checking for inet_pton in -lsocket... " >&6; }
if ${ac_cv_lib_socket_inet_pton+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-lsocket  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext

configure  view on Meta::CPAN

  ac_cv_lib_socket_inet_pton=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_inet_pton" >&5
$as_echo "$ac_cv_lib_socket_inet_pton" >&6; }
if test "x$ac_cv_lib_socket_inet_pton" = xyes; then :
      LIBS="$LIBS -lsocket -lnsl"
    ac_cv_lib_inet6_inet_pton=no

else
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether your system has IPv6 directory" >&5
$as_echo_n "checking whether your system has IPv6 directory... " >&6; }
    if ${ipv6_cv_dir+:} false; then :
  $as_echo_n "(cached) " >&6
else
        for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
	if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
	  break
	fi
      done
fi
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ipv6_cv_dir" >&5
$as_echo "$ipv6_cv_dir" >&6; }
    if test $ipv6_cv_dir = no; then
      ac_cv_lib_inet6_inet_pton=no
    else
      if test x$ipv6_libinet6 = x; then
	ipv6_libinet6=no
	SAVELDFLAGS="$LDFLAGS"
	LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib"
      fi
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_pton in -linet6" >&5
$as_echo_n "checking for inet_pton in -linet6... " >&6; }
if ${ac_cv_lib_inet6_inet_pton+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-linet6  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char inet_pton ();
int
main ()
{
return inet_pton ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_inet6_inet_pton=yes
else
  ac_cv_lib_inet6_inet_pton=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet6_inet_pton" >&5
$as_echo "$ac_cv_lib_inet6_inet_pton" >&6; }
if test "x$ac_cv_lib_inet6_inet_pton" = xyes; then :
  	if test $ipv6_libinet6 = no; then
	  ipv6_libinet6=yes
	  LIBS="$LIBS -linet6"
	fi
fi
      if test $ipv6_libinet6 = no; then
	LDFLAGS="$SAVELDFLAGS"
      fi
    fi
fi

fi
ipv6_cv_inet_pton=no
if test $ac_cv_func_inet_pton = yes -o $ac_cv_lib_socket_inet_pton = yes \
     -o $ac_cv_lib_inet6_inet_pton = yes
then
  ipv6_cv_inet_pton=yes
fi
if test $ipv6_cv_inet_pton = no; then
  if test inet_pton = getaddrinfo; then
    for ipv6_cv_pfx in o n; do
      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <netdb.h>

configure  view on Meta::CPAN


  :
else
  :
fi


ac_fn_c_check_func "$LINENO" "inet_ntop" "ac_cv_func_inet_ntop"
if test "x$ac_cv_func_inet_ntop" = xyes; then :
    ac_cv_lib_socket_inet_ntop=no
  ac_cv_lib_inet6_inet_ntop=no

else
    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_ntop in -lsocket" >&5
$as_echo_n "checking for inet_ntop in -lsocket... " >&6; }
if ${ac_cv_lib_socket_inet_ntop+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-lsocket  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext

configure  view on Meta::CPAN

  ac_cv_lib_socket_inet_ntop=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_socket_inet_ntop" >&5
$as_echo "$ac_cv_lib_socket_inet_ntop" >&6; }
if test "x$ac_cv_lib_socket_inet_ntop" = xyes; then :
      LIBS="$LIBS -lsocket -lnsl"
    ac_cv_lib_inet6_inet_ntop=no

else
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether your system has IPv6 directory" >&5
$as_echo_n "checking whether your system has IPv6 directory... " >&6; }
    if ${ipv6_cv_dir+:} false; then :
  $as_echo_n "(cached) " >&6
else
        for ipv6_cv_dir in /usr/local/v6 /usr/inet6 no; do
	if test $ipv6_cv_dir = no -o -d $ipv6_cv_dir; then
	  break
	fi
      done
fi
    { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ipv6_cv_dir" >&5
$as_echo "$ipv6_cv_dir" >&6; }
    if test $ipv6_cv_dir = no; then
      ac_cv_lib_inet6_inet_ntop=no
    else
      if test x$ipv6_libinet6 = x; then
	ipv6_libinet6=no
	SAVELDFLAGS="$LDFLAGS"
	LDFLAGS="$LDFLAGS -L$ipv6_cv_dir/lib"
      fi
      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for inet_ntop in -linet6" >&5
$as_echo_n "checking for inet_ntop in -linet6... " >&6; }
if ${ac_cv_lib_inet6_inet_ntop+:} false; then :
  $as_echo_n "(cached) " >&6
else
  ac_check_lib_save_LIBS=$LIBS
LIBS="-linet6  $LIBS"
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */

/* Override any GCC internal prototype to avoid an error.
   Use char because int might match the return type of a GCC
   builtin and then its argument prototype would still apply.  */
#ifdef __cplusplus
extern "C"
#endif
char inet_ntop ();
int
main ()
{
return inet_ntop ();
  ;
  return 0;
}
_ACEOF
if ac_fn_c_try_link "$LINENO"; then :
  ac_cv_lib_inet6_inet_ntop=yes
else
  ac_cv_lib_inet6_inet_ntop=no
fi
rm -f core conftest.err conftest.$ac_objext \
    conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_inet6_inet_ntop" >&5
$as_echo "$ac_cv_lib_inet6_inet_ntop" >&6; }
if test "x$ac_cv_lib_inet6_inet_ntop" = xyes; then :
  	if test $ipv6_libinet6 = no; then
	  ipv6_libinet6=yes
	  LIBS="$LIBS -linet6"
	fi
fi
      if test $ipv6_libinet6 = no; then
	LDFLAGS="$SAVELDFLAGS"
      fi
    fi
fi

fi
ipv6_cv_inet_ntop=no
if test $ac_cv_func_inet_ntop = yes -o $ac_cv_lib_socket_inet_ntop = yes \
     -o $ac_cv_lib_inet6_inet_ntop = yes
then
  ipv6_cv_inet_ntop=yes
fi
if test $ipv6_cv_inet_ntop = no; then
  if test inet_ntop = getaddrinfo; then
    for ipv6_cv_pfx in o n; do
      cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h.  */
#include <netdb.h>

configure  view on Meta::CPAN

if test $ipv6_cv_inet_ntop = yes; then
  cat >>confdefs.h <<_ACEOF
#define HAVE_INET_NTOP 1
_ACEOF

  :
else
  :
fi

if test $ac_cv_lib_inet6_getaddrinfo = yes; then
	INET6LIBS="-L$ipv6_cv_dir/lib -linet6"
fi


{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working inet_ntop" >&5
$as_echo_n "checking for working inet_ntop... " >&6; }
if ${ipv6_cv_can_inet_ntop+:} false; then :
  $as_echo_n "(cached) " >&6
else
  if test "$cross_compiling" = yes; then :
  { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5

configure.in  view on Meta::CPAN

SOCKET6_CHECK_PL_SV_UNDEF(AC_DEFINE(HAVE_PL_SV_UNDEF,[1],[Do we have a pl_sv_undef?]), , $ac_cv_path_perl)

IPv6_CHECK_FUNC(getaddrinfo)
IPv6_CHECK_FUNC(getnameinfo)
IPv6_CHECK_FUNC(gethostbyname2)
IPv6_CHECK_FUNC(getipnodebyname)
IPv6_CHECK_FUNC(getipnodebyaddr)
IPv6_CHECK_FUNC(inet_pton)
IPv6_CHECK_FUNC(inet_ntop)

if test $ac_cv_lib_inet6_getaddrinfo = yes; then
	INET6LIBS="-L$ipv6_cv_dir/lib -linet6"
fi

IPv6_CHECK_INET_NTOP()
IPv6_CHECK_SA_LEN()
IPv6_CHECK_SIN6_SCOPE_ID()
IPv6_CHECK_SOCKLEN_T()

AC_SUBST(DEFINES)
AC_SUBST(INET6LIBS)
AC_SUBST(PERLPATH)

gailookup.pl.in  view on Meta::CPAN

;# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
;# SUCH DAMAGE.

;# $Id: gailookup.pl.in 652 2015-12-05 04:40:07Z ume $

use Getopt::Std;
use Socket;
use Socket6;
use strict;

my $inet6 = defined(eval 'PF_INET6');

my %opt;
getopts(($inet6 ? 'aAchpsmnNP:qrS46' : 'AchpsmnNP:qrS4'), \%opt);

if ($opt{'h'}){
    print STDERR ("Usage: $0 [-h | [-a] [-A] [-c] [-m] [-n] [-N] [-p] [-P serv] [-q] [-r] [-s] [-S] [-4" .
		  ($inet6 && "|-6") . "] [host [serv]]]\n" .
		  "-h   : help\n" .
		  "-a   : AI_ADDRCONFIG flag\n" .
		  "-A   : AI_ALL flag\n" .
		  "-c   : AI_CANONNAME flag\n" .
		  "-m   : AI_V4MAPPED flag\n" .
		  "-n   : AI_NUMERICHOST flag\n" .
		  "-N   : AI_NUMERICSERV flag\n" .
		  "-p   : AI_PASSIVE flag\n" .
		  "-q   : only show IP address\n" .
		  "-r   : do reverse lookup\n" .
		  "-s   : NI_WITHSCOPEID flag\n" .
		  "-S   : suppress scopeid\n" .
		  ($inet6 ? "-4|-6: PF_INET | PF_INET6" : "-4   : PF_INET") .
		  "\n");
    exit(4);
}

my $host = shift(@ARGV) if (@ARGV);
my $serv = shift(@ARGV) if (@ARGV);
die("Too many arguments\n") if (@ARGV);
die("Either -4 or -6, not both should be specified\n") if ($opt{'4'} && $opt{'6'});

$serv = $opt{'P'} if ($opt{'P'});

my $af = PF_UNSPEC;
$af = PF_INET if ($opt{'4'});
$af = PF_INET6 if ($inet6 && $opt{'6'});

my $flags = 0;
eval('$flags |= AI_ADDRCONFIG') if ($opt{'a'});
eval('$flags |= AI_ALL') if ($opt{'A'});
eval('$flags |= AI_V4MAPPED') if ($opt{'m'});
$flags |= AI_PASSIVE if ($opt{'p'});
$flags |= AI_NUMERICHOST if ($opt{'n'});
$flags |= AI_NUMERICSERV if ($opt{'N'});
$flags |= AI_CANONNAME if ($opt{'c'});

im-140.diff  view on Meta::CPAN

-	@he_infos = im_getaddrinfo($s, $remoteport, AF_UNSPEC, SOCK_STREAM);
+	$0 = progname() . ": getaddrinfo($s)";
+	@he_infos = getaddrinfo($s, $remoteport, AF_UNSPEC, SOCK_STREAM);
 	if ($#he_infos < 1) {
 	    im_warn("address unknown for $s\n");
 	    @Response = ("address unknown for $s");
@@ -147,7 +150,7 @@
 		if ($family == AF_INET) {
 		    $port = (unpack_sockaddr_in($sin))[0];
 		} else {
-		    $port = (inet6_unpack_sockaddr_in6($sin))[0];
+		    $port = (unpack_sockaddr_in6($sin))[0];
 		}
 		*SOCK = \*{$name};
 		$SOCK = $port;
@@ -364,7 +367,9 @@
     my $count = shift;
 
     pool_priv_sock_af($count, AF_INET);
-    pool_priv_sock_af($count, inet6_family()) if (eval '&AF_INET6');
+    if (eval 'pack_sockaddr_in6(110, pack("N4", 0, 0, 0, 0))') {
+	pool_priv_sock_af($count, AF_INET6);
+    }
 }
 
 sub pool_priv_sock_af ($$) {
@@ -391,7 +396,7 @@
 		$psin = pack_sockaddr_in($privport, $ANYADDR);
 	    } else {
 		$ANYADDR = pack('N4', 0, 0, 0, 0);
-		$psin = inet6_pack_sockaddr_in6($privport, $ANYADDR);
+		$psin = pack_sockaddr_in6($privport, $ANYADDR);
 	    }
 	    last if (bind (*{$TcpSockName}, $psin));
 	    im_warn("privileged socket binding failed: $!.\n")
@@ -432,68 +437,6 @@
     im_die("connection error\n");
 }
 
-sub im_getaddrinfo ($$;$$$$) {
-    return getaddrinfo(@_) if (defined &getaddrinfo);

im-140.diff  view on Meta::CPAN

-	    $t = ':0:';
-	    while ($n--) {
-		$t .= '0:';
-	    }
-	    $node =~ s/::/$t/;
-	}
-	if ($node =~ /^([\da-f]*):([\da-f]*):([\da-f]*):([\da-f]*):([\da-f]*):([\da-f]*):([\da-f]*):([\da-f]*)$/i) {
-	    @he_addrs = (pack('n8',
-		    hex("0x$1"), hex("0x$2"), hex("0x$3"), hex("0x$4"),
-		    hex("0x$5"), hex("0x$6"), hex("0x$7"), hex("0x$8")));
-	    $family = inet6_family(); # AF_INET6
-	} else {
-	    im_err("bad server address in IPv6 format: $node\n");
-	    return;
-	}
-    } else {
-	alarm(dns_timeout()) unless win95p();
-	($he_name, $he_alias, $he_type, $he_len, @he_addrs)
-	  = gethostbyname($node);
-	alarm(0) unless win95p();
-	return unless ($he_name);
-	$family = $he_type;
-    }
-
-    my ($he_addr, @infos);
-    foreach $he_addr (@he_addrs) {
-	my $sin;
-	if ($family == AF_INET) {
-	    $sin = pack_sockaddr_in($se_port, $he_addr);
-	} else {
-	    $sin = inet6_pack_sockaddr_in6($se_port, $he_addr);
-	}
-	push(@infos, $family, $socktype, $pe_proto, $sin, $he_name);
-    }
-    @infos;
-}
-
 sub getserv($$) {
     my ($serv, $proto) = @_;
 
@@ -522,28 +465,6 @@
 	}
     }
     $se_port;
-}
-
-sub inet6_pack_sockaddr_in6 ($;$) {
-    return pack_sockaddr_in6(@_) if (defined &pack_sockaddr_in6);
-
-    my ($port, $he_addr) = @_;
-    pack('CCnN', 1+1+2+4+16+4, inet6_family(), $port, 0) . $he_addr .
-	pack('N', 0);
-}
-
-sub inet6_unpack_sockaddr_in6 ($) {
-    return unpack_sockaddr_in6(@_) if (defined &unpack_sockaddr_in6);
-
-    my $sock = shift;
-    my ($len, $family, $port, $flow, $a1, $a2, $a3, $a4)
-	= unpack('CCnNN4', $sock);
-    my $addr = pack('N4', $a1, $a2, $a3, $a4);
-    ($port, $addr);
-}
-
-sub inet6_family () {
-    return eval '&AF_INET6' || 24;
 }
 
 1;

t/use.t  view on Meta::CPAN

my @tmp = getaddrinfo("localhost", "", AF_INET, SOCK_STREAM, 0, 0);
if ($#tmp >= 1) {
    ok(2);
}
my($family, $socktype, $protocol, $sin, $canonname) = splice(@tmp, $[, 5);
my($addr, $port) = getnameinfo($sin, NI_NUMERICHOST | NI_NUMERICSERV);
if ($addr eq "127.0.0.1" && $port eq "0") {
    ok(3);
}

my $af_inet6 = eval('AF_INET6');
my $unless_inet6 = !defined($af_inet6) ? 'Skip if not defined AF_INET6' : '';

skip($unless_inet6,
     sub { inet_ntop($af_inet6, inet_pton($af_inet6, "::")), "::" });

# this fails under darwin
skip($unless_inet6,
     sub { inet_ntop($af_inet6, inet_pton($af_inet6, "::21")), "::21" })
    or print "# ", unpack("H*", inet_pton($af_inet6, "::21")), "\n";

skip($unless_inet6,
     sub { inet_ntop($af_inet6, inet_pton($af_inet6, "43::")), "43::" });
skip($unless_inet6,
     sub { inet_ntop($af_inet6, inet_pton($af_inet6, "1:2:3:4:5:6:7::")),
	   "1:2:3:4:5:6:7:0" });
skip($unless_inet6,
     sub { inet_ntop($af_inet6, inet_pton($af_inet6, "1::8")), "1::8" });
skip($unless_inet6,
     sub { inet_ntop($af_inet6, inet_pton($af_inet6, "FF00::FFFF")),
	   "ff00::ffff" });



( run in 1.135 second using v1.01-cache-2.11-cpan-87723dcf8b7 )