Commit e81cf378 authored by Sam Hocevar's avatar Sam Hocevar

  * ./configure.in, ./plugins/network/ipv6.c: support for the GNU glibc
    extension gethostbyname2(), thanks to Thomas Graf.
parent db25744a
......@@ -3270,7 +3270,7 @@ fi
save_CFLAGS="${save_CFLAGS} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"
for ac_func in gettimeofday select strerror strtod strtol isatty usleep vasprintf swab sigrelse getpwuid memalign posix_memalign
for ac_func in gettimeofday select strerror strtod strtol isatty usleep vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2
do
echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
echo "configure:3277: checking for $ac_func" >&5
......
......@@ -111,7 +111,7 @@ dnl The -DSYS_FOO flag
save_CFLAGS="${save_CFLAGS} -DSYS_`echo ${SYS} | sed -e 's/-.*//' | tr 'abcdefghijklmnopqrstuvwxyz.' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'`"
dnl Check for system libs needed
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty usleep vasprintf swab sigrelse getpwuid memalign posix_memalign)
AC_CHECK_FUNCS(gettimeofday select strerror strtod strtol isatty usleep vasprintf swab sigrelse getpwuid memalign posix_memalign gethostbyname2)
AC_CHECK_FUNC(connect,,[
AC_CHECK_LIB(socket,connect,
......
......@@ -76,6 +76,9 @@
/* Define if you have the getgid function. */
#undef HAVE_GETGID
/* Define if you have the gethostbyname2 function. */
#undef HAVE_GETHOSTBYNAME2
/* Define if you have the getpagesize function. */
#undef HAVE_GETPAGESIZE
......
......@@ -2,7 +2,7 @@
* ipv6.c: IPv6 network abstraction layer
*****************************************************************************
* Copyright (C) 2002 VideoLAN
* $Id: ipv6.c,v 1.3 2002/03/15 04:41:54 sam Exp $
* $Id: ipv6.c,v 1.4 2002/04/18 04:34:37 sam Exp $
*
* Authors: Alexis Guillard <alexis.guillard@bt.com>
* Christophe Massiot <massiot@via.ecp.fr>
......@@ -108,18 +108,34 @@ static int BuildAddr( struct sockaddr_in6 * p_socket,
{
p_socket->sin6_addr = in6addr_any;
}
else if( *psz_address != '['
|| psz_address[strlen(psz_address) - 1] != ']' )
{
intf_ErrMsg( "ipv6: IPv6 address is invalid, discarding" );
return( -1 );
}
else
else if( psz_address[0] == '['
&& psz_address[strlen(psz_address) - 1] == ']' )
{
psz_address++;
psz_address[strlen(psz_address) - 1] = '\0' ;
inet_pton(AF_INET6, psz_address, &p_socket->sin6_addr.s6_addr);
}
else
{
#ifdef HAVE_GETHOSTBYNAME2
struct hostent * p_hostent;
/* We have a fqdn, try to find its address */
if ( (p_hostent = gethostbyname2( psz_address, AF_INET6 )) == NULL )
{
intf_ErrMsg( "ipv6 error: unknown host %s", psz_address );
return( -1 );
}
/* Copy the first address of the host in the socket address */
memcpy( &p_socket->sin6_addr, p_hostent->h_addr_list[0],
p_hostent->h_length );
#else
intf_ErrMsg( "ipv6 error: IPv6 address %s is invalid", psz_address );
return( -1 );
#endif
}
return( 0 );
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment